Exemple #1
0
 static void menuItem5_Click(object sender, EventArgs e)
 {
     Setup setupWizard = new Setup(config);
     if (setupWizard.ShowDialog() == DialogResult.OK)
     {
         config = setupWizard.config;
         writeConfigIni();
     }
 }
Exemple #2
0
        public Setup(Config _config)
        {
            InitializeComponent();

            config = _config;
            //Read or initialize variables
            if (config.watchPath == null)
            {
                config.format = "Normal";
                config.copyReplay = false;
                config.moveReplay = false;
                config.copyToGametypeFolder = false;
                config.playSound = false;
                config.autoPosition = false;
                config.typeOfSort = "Player";
                config.playerName = "NA";
                textBox1.Text = "NA";
                config.position = "Front";
                comboBox1.Text = "Front";
                config.race = "Zerg";
                comboBox2.Text = "Zerg";
                config.dynamicParamString = "|Matchup|.|Players|.|on|.|Map|[|ID|]";
                string[] dynamicParams = config.dynamicParamString.Split('|');
                label15.Text = previewDynamic(dynamicParams);
                config.debugWaitSeconds = 0;
                config.filters = new bool[6];
                config.filters[0] = false; //other
                config.filters[1] = true; //1v1
                config.filters[2] = true; //2v2
                config.filters[3] = true; //3v3
                config.filters[4] = true; //4v4
                config.filters[5] = true; //FFA

            }
            else
            {
                textBox2.Text = config.watchPath;
                textBox3.Text = config.outputPath;
                checkBox1.Checked = config.copyReplay;
                checkBox2.Checked = config.moveReplay;
                checkBox3.Checked = config.autoPosition;
                checkBox11.Checked = config.copyToGametypeFolder;
                checkBox10.Checked = config.playSound;
                textBox1.Text = config.playerName;
                comboBox1.Text = config.position;
                comboBox2.Text = config.race;

                if (config.autoPosition)
                {
                    if (config.typeOfSort.Equals("Player"))
                    {
                        radioButton12.Checked = true;
                    }
                    else if (config.typeOfSort.Equals("Race"))
                    {
                        radioButton13.Checked = true;
                    }
                }
                if (config.position.Equals("Front"))
                {
                    //radioButton1.Checked = true;
                    comboBox1.Text = "Front";
                }
                else if (config.position.Equals("Back"))
                {
                    //radioButton2.Checked = true;
                    comboBox2.Text = "Back";
                }

                if (config.format.Equals("Normal"))
                {
                    radioButton11.Checked = true;
                }
                else if (config.format.Equals("Normal."))
                {
                    radioButton10.Checked = true;
                }
                else if (config.format.Equals("Matchup"))
                {
                    radioButton3.Checked = true;
                }
                else if (config.format.Equals("Matchup."))
                {
                    radioButton4.Checked = true;
                }
                else if (config.format.Equals("Map"))
                {
                    radioButton5.Checked = true;
                }
                else if (config.format.Equals("Map."))
                {
                    radioButton6.Checked = true;
                }
                else if (config.format.Equals("Date"))
                {
                    radioButton7.Checked = true;
                }
                else if (config.format.Equals("DateMatchup"))
                {
                    radioButton8.Checked = true;
                }
                else if (config.format.Equals("Dynamic"))
                {
                    radioButton9.Checked = true;
                }
                textBox4.Text = config.dynamicParamString;
                string[] dynamicParams = config.dynamicParamString.Split('|');
                label15.Text = previewDynamic(dynamicParams);

                //filters
                checkBox9.Checked = config.filters[0];
                checkBox4.Checked = config.filters[1];
                checkBox5.Checked = config.filters[2];
                checkBox6.Checked = config.filters[3];
                checkBox7.Checked = config.filters[4];
                checkBox8.Checked = config.filters[5];
            }

            this.Icon = new Icon(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("SC2RAR.sc2rari.ico"));
            tabControl1.SelectedIndexChanged += new EventHandler(tabControl1_SelectedIndexChanged);
        }
Exemple #3
0
        static void initialize()
        {
            StreamReader read = new StreamReader("config.ini");
            config.watchPath = @read.ReadLine();
            read.Close();
            if (config.watchPath == null)
            {
                Setup setupWizard = new Setup(config);
                if (setupWizard.ShowDialog() == DialogResult.OK)
                {
                    config = setupWizard.config;
                    writeConfigIni();
                }
            }
            else
            {
                read = new StreamReader("config.ini");
                config.watchPath = read.ReadLine();
                string parameters = read.ReadLine();
                optionParams = parameters.Split(' ');
                config.format = optionParams[0];
                bool didItWork;

                didItWork = bool.TryParse(optionParams[1], out config.autoPosition);
                config.typeOfSort = optionParams[2];
                config.playerName = optionParams[3];
                config.position = optionParams[4];
                config.race = optionParams[5];

                didItWork = bool.TryParse(optionParams[6], out config.copyReplay);
                didItWork = bool.TryParse(optionParams[7], out config.moveReplay);
                didItWork = bool.TryParse(optionParams[8], out config.playSound);
                didItWork = bool.TryParse(optionParams[9], out config.copyToGametypeFolder);
                config.debugWaitSeconds = Int32.Parse(optionParams[10]);
                //filters
                string filterparameters = read.ReadLine();
                filterParams = filterparameters.Split(' ');
                config.filters = new bool[6];
                didItWork = bool.TryParse(filterParams[0], out config.filters[0]);
                didItWork = bool.TryParse(filterParams[1], out config.filters[1]);
                didItWork = bool.TryParse(filterParams[2], out config.filters[2]);
                didItWork = bool.TryParse(filterParams[3], out config.filters[3]);
                didItWork = bool.TryParse(filterParams[4], out config.filters[4]);
                didItWork = bool.TryParse(filterParams[5], out config.filters[5]);

                //dynamic
                config.dynamicParamString = read.ReadLine();
                config.dynamicParams = config.dynamicParamString.Split('|');
                config.outputPath = read.ReadLine();
                read.Close();
            }

            watch = new System.IO.FileSystemWatcher(config.watchPath, "*.SC2Replay");
            watch.IncludeSubdirectories = true;
            watch.Created += new System.IO.FileSystemEventHandler(watch_Created);
            watch.EnableRaisingEvents = true;
        }