Exemplo n.º 1
0
        private void registerGenConfigBtn_Click(object sender, EventArgs e)
        {
            bool isStatOne = stationChkBox.Checked;

            if (!ErrorCheckingService.SingleRegErrorChecker(RegTextBoxes(), isStatOne))
            {
                return;
            }
            if (!FolderSelection())
            {
                return;
            }

            // Creates Root Dir
            if (!Directory.Exists(_topDir))
            {
                Directory.CreateDirectory(_topDir);
            }
            var    stationSubdir   = "Station " + registerNumberTxt.Text;
            String stationFullPath = Path.Combine(_topDir, stationSubdir);

            // Creates Station Dir
            if (!Directory.Exists(stationFullPath))
            {
                Directory.CreateDirectory(stationFullPath);
            }

            if (registerNumberTxt.Text == "1")
            {
                stationFullPath = _topDir + "\\Station 1";
                XMLModificationService.RegisterOneXMLModifier(RegTextBoxes(), stationFullPath, "\\Register.cfg", 0);
            }
            else
            {
                stationFullPath = _topDir + "\\Station " + registerNumberTxt.Text;
                int statNum = int.Parse(registerNumberTxt.Text);
                XMLModificationService.RegisterTwoPlusXMLModifier(RegTextBoxes(), stationFullPath, "\\Register.cfg", 1, statNum);
            }

            OpenFolder(_topDir);
        }
Exemplo n.º 2
0
        private void GenConfigBtn_Click(object sender, EventArgs e)
        {
            String stationFullPath = "";
            String videoFullPath   = "";
            int    videoCount      = 0;

            List <int> enabledVideos = new List <int>();

            for (int i = 0; i < _videos.Length; i++)
            {
                if (_videos[i].Enabled == true)
                {
                    enabledVideos.Add(i);
                }
            }
            int[] comboIndex = new int[]
            {
                stationCmbo.SelectedIndex,
                videoCmbo.SelectedIndex
            };
            bool enabled = videoCmbo.Enabled;

            if (!ErrorCheckingService.RegAndVidErrorChecker(comboIndex, enabled, RegAndVidTextBoxes(), VideosTextBoxes(), enabledVideos))
            {
                return;
            }
            if (!FolderSelection())
            {
                return;
            }

            if (!Directory.Exists(_topDir))
            {
                Directory.CreateDirectory(_topDir);
            }

            int stationCount = int.Parse(stationCmbo.SelectedItem.ToString());

            for (int i = 1; i <= stationCount; i++)
            {
                var stationSubdir = "Station " + i;
                stationFullPath = Path.Combine(_topDir, stationSubdir);
                if (!Directory.Exists(stationFullPath))
                {
                    Directory.CreateDirectory(stationFullPath);
                }
            }

            if (videoChkBox.Checked)
            {
                videoCount = int.Parse(videoCmbo.SelectedItem.ToString());
                for (int i = 1; i <= videoCount; i++)
                {
                    var videoSubdir = "Video " + _videos[i - 1].Text;
                    videoFullPath = Path.Combine(_topDir, videoSubdir);
                    if (!Directory.Exists(videoFullPath))
                    {
                        Directory.CreateDirectory(videoFullPath);
                    }
                }
            }

            for (int i = 1; i <= stationCount; i++)
            {
                if (i == 1)
                {
                    stationFullPath = _topDir + "\\Station 1";
                    XMLModificationService.RegisterOneXMLModifier(RegAndVidTextBoxes(), stationFullPath, "\\Register.cfg", 0);
                }
                if (i != 1)
                {
                    stationFullPath = _topDir + "\\Station " + i;
                    XMLModificationService.RegisterTwoPlusXMLModifier(RegAndVidTextBoxes(), stationFullPath, "\\Register.cfg", 1, i);
                }
            }

            List <String> videoNums = new List <String>();

            for (int i = 0; i < _videos.Length; i++)
            {
                if (_videos[i].Enabled == true)
                {
                    videoNums.Add(_videos[i].Text);
                }
            }

            for (int i = 0; i < videoNums.Count; i++)
            {
                videoFullPath = _topDir + "\\Video " + videoNums[i];
                XMLModificationService.KitchenXMLModifier(RegAndVidTextBoxes(), videoFullPath, "\\Kitchen.cfg", 2, videoNums[i]);
            }

            OpenFolder(_topDir);
        }