<commit_before>﻿using System;
using System.IO;

namespace Bounce.Framework
{
    public class ScheduledTask : Task
    {
        public Task<string> Machine;
        public Task<string> UserName;
        public Task<string> Password;
        public Task<string> Name;
        public Task<string> BinaryPath;
        public Task<string> SchTasksArguments;
        public Task<bool> ForceDelete;
        public Task<string> SchTasksCommandPath;

        public ScheduledTask()
        {
            SchTasksArguments = "";
            ForceDelete = false;
            SchTasksCommandPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "schtasks.exe");
        }

        public override void Build(IBounce bounce)
        {
            SchTasks(bounce, GetCreateSchTasksArguments());
        }

        public override void Clean(IBounce bounce)
        {
            SchTasks(bounce, GetDeleteSchTasksArguments());
        }

        private void SchTasks(IBounce bounce, string arguments)
        {
            bounce.ShellCommand.ExecuteAndExpectSuccess(SchTasksCommandPath.Value, arguments);
        }

        private string GetCreateSchTasksArguments()
        {
            return String.Format("/Create {0}", GetCreateSettings());
        }

        private string GetDeleteSchTasksArguments()
        {
            return String.Format("/Delete {0}", GetDeleteSettings());
        }

        private string GetCreateSettings() {
            return String.Join("", new []
                                       {
                                           GetSetting(Machine, "S"),
                                           GetSetting(UserName, "RU"),
                                           GetSetting(Password, "RP"),
                                           GetSetting(Name, "TN"),
                                           GetSetting(BinaryPath, "TR"),
                                           SchTasksArguments.Value,
                                       });
        }

        private string GetDeleteSettings() {
            return String.Join("", new []
                                       {
                                           GetSetting(Machine, "S"),<commit_msg>multiple issues with ScheduledTask now fixed<commit_after>﻿using System;
using System.IO;

namespace Bounce.Framework
{
    public class ScheduledTask : Task
    {
        [Dependency]
        public Task<string> Machine;
        [Dependency]
        public Task<string> UserName;
        [Dependency]
        public Task<string> Password;
        [Dependency]
        public Task<string> Name;
        [Dependency]
        public Task<string> BinaryPath;
        [Dependency]
        public Task<string> SchTasksArguments;
        [Dependency]
        public Task<bool> ForceDelete;
        [Dependency]
        public Task<string> SchTasksCommandPath;

        public ScheduledTask()
        {
            SchTasksArguments = "";
            ForceDelete = false;
            SchTasksCommandPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "schtasks.exe");
        }

        public override void Build(IBounce bounce)
        {
            SchTasks(bounce, GetCreateSchTasksArguments());
        }

        public override void Clean(IBounce bounce)
        {
            SchTasks(bounce, GetDeleteSchTasksArguments());
        }

        private void SchTasks(IBounce bounce, string arguments)
        {
            bounce.ShellCommand.ExecuteAndExpectSuccess(SchTasksCommandPath.Value, arguments);
        }

        private string GetCreateSchTasksArguments()
        {
            return String.Format("/Create {0}", GetCreateSettings());
        }

        private string GetDeleteSchTasksArguments()
        {
            return String.Format("/Delete {0}", GetDeleteSettings());
        }

        private string GetCreateSettings() {
            return String.Join(" ", new []
                                       {
                                           GetSetting(Machine, "S"),
                                           GetSetting(UserName, "RU"),
                                           GetSetting(Password, "RP"),
                                           GetSetting(Name, "TN"),
                                           GetSetting(BinaryPath, "TR"),
                                           SchTasksArguments.Value,
                                       });
        }

        private string GetDeleteSettings() {
            return String.Join(" ", new []
                                       {
                                           GetSetting(Machine, "S"),
{'fraction_non_alphanumeric': 0.08370895041854476, 'fraction_numerical': 0.0008585533376261, 'mean_word_length': 1.394655704008222, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1763737', 'n_tokens_mistral': 1004, 'n_tokens_neox': 965, 'n_words': 218}