Exemple #1
0
 private void SetDefaultFromConfig()
 {
     cmbRampUp.SelectedItem     = ConfigRepository.Instance()["ddc_rampup"];
     cmbConfigFile.SelectedItem = ConfigRepository.Instance()["ddc_config"];
     cmbPhraseLen.Value         = ConfigRepository.Instance().GetDecimal("ddc_phraselength");
     chkRemoveSustains.Checked  = ConfigRepository.Instance().GetBoolean("ddc_removesustain");
 }
Exemple #2
0
        private void inlayGenerateButton_Click(object sender, EventArgs e)
        {
            // dlcSavePath = Path.Combine(workDir, "cgm");
            using (var ofd = new SaveFileDialog())
            {
                ofd.FileName         = InlayName.GetValidName(true, false, true, Frets24).ToLower();
                ofd.Filter           = "Custom Inlay DLC (*.*)|*.*";
                ofd.InitialDirectory = ConfigRepository.Instance()["general_rs2014path"];
                // ofd.InitialDirectory = dlcSavePath;

                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                dlcSavePath = ofd.FileName;
            }
            DLCPackageData packageData = new DLCPackageData();

            packageData.Inlay            = new InlayData();
            packageData.Inlay.InlayPath  = InlayFile;
            packageData.Inlay.IconPath   = IconFile;
            packageData.Inlay.Frets24    = Frets24;
            packageData.Inlay.Colored    = Colored;
            packageData.Inlay.DLCSixName = GeneralExtensions.RandomName(6);

            // CRITICAL - 24 fret inlays have naming dependencies
            if (Frets24)
            {
                packageData.Inlay.DLCSixName = String.Format("24fret_{0}", packageData.Inlay.DLCSixName);
            }

            packageData.Name  = InlayName;
            packageData.AppId = appIdCombo.SelectedValue.ToString();

            // Saving for later
            ConfigRepository.Instance()["cgm_inlayname"]    = InlayName;
            ConfigRepository.Instance()["cgm_24frets"]      = Frets24.ToString();
            ConfigRepository.Instance()["cgm_coloredinlay"] = Colored.ToString();

            // Generate
            if (Path.GetFileName(dlcSavePath).Contains(" ") && platformPS3.Checked)
            {
                if (!ConfigRepository.Instance().GetBoolean("creator_ps3pkgnamewarn"))
                {
                    MessageBox.Show(String.Format("PS3 package name can't support space character due to encryption limitation. {0} Spaces will be automatic removed for your PS3 package name.", Environment.NewLine), MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    ConfigRepository.Instance()["creator_ps3pkgnamewarn"] = true.ToString();
                }
            }

            if (!bwGenerate.IsBusy && packageData != null)
            {
                updateProgress.Visible        = true;
                currentOperationLabel.Visible = true;
                inlayGenerateButton.Enabled   = false;
                bwGenerate.RunWorkerAsync(packageData);
            }
        }
        private void DefaultResourceToFile()
        {
            Author    = ConfigRepository.Instance()["general_defaultauthor"];
            InlayName = ConfigRepository.Instance()["cgm_inlayname"];
            Frets24   = ConfigRepository.Instance().GetBoolean("cgm_24frets");
            Colored   = ConfigRepository.Instance().GetBoolean("cgm_coloredinlay");

            defaultDir = Path.Combine(Path.GetTempPath(), InlayName);
            IconFile   = Path.Combine(defaultDir, "icon.png");
            InlayFile  = Path.Combine(defaultDir, "inlay.png");

            if (!Directory.Exists(defaultDir))
            {
                Directory.CreateDirectory(defaultDir);

                // Icon Resource
                using (var iconStream = new MemoryStream(RocksmithToolkitLib.Properties.Resources.cgm_default_icon))
                {
                    iconStream.WriteFile(IconFile);
                }

                // Inlay Resource
                using (var inlayStream = new MemoryStream(RocksmithToolkitLib.Properties.Resources.cgm_default_inlay))
                {
                    inlayStream.WriteFile(InlayFile);
                }
            }

            picIcon.ImageLocation  = IconFile;
            picInlay.ImageLocation = InlayFile;
        }
Exemple #4
0
        private void MainForm_Splash(object sender, EventArgs e)
        {
            bool showRevNote = ConfigRepository.Instance().GetBoolean("general_showrevnote");

            if (showRevNote)
            {
                ShowHelpForm();
                ConfigRepository.Instance()["general_showrevnote"] = "false";
            }

            this.Refresh();

            // don't bug the Developers when in debug mode ;)
#if !DEBUG
            // check for first run //Check if author set at least, then it's not a first run tho, but let it show msg anyways...
            bool firstRun = ConfigRepository.Instance().GetBoolean("general_firstrun");
            if (!firstRun)
            {
                return;
            }
            MessageBox.Show(new Form {
                TopMost = true
            },
                            "    Welcome to the Song Creator Toolkit for Rocksmith." + Environment.NewLine +
                            "          Commonly known as, 'the toolkit'." + Environment.NewLine + Environment.NewLine +
                            "It looks like this may be your first time running the toolkit.  " + Environment.NewLine +
                            "  Please fill in the Configuration menu with your selections.", "Song Creator Toolkit for Rocksmith ... First Run",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);

            ShowConfigScreen();
            BringToFront();
#endif
        }
Exemple #5
0
        public DLCPackerUnpacker()
        {
            InitializeComponent();
            try
            {
                var gameVersionList = Enum.GetNames(typeof(GameVersion)).ToList <string>();
                gameVersionList.Remove("None");
                gameVersionCombo.DataSource   = gameVersionList;
                gameVersionCombo.SelectedItem = ConfigRepository.Instance()["general_defaultgameversion"];
                GameVersion gameVersion = (GameVersion)Enum.Parse(typeof(GameVersion), gameVersionCombo.SelectedItem.ToString());
                PopulateAppIdCombo(gameVersion);
            }
            catch { /*For mono compatibility*/ }

            // App ID updater worker
            bwRepack.DoWork               += new DoWorkEventHandler(UpdateAppId);
            bwRepack.ProgressChanged      += new ProgressChangedEventHandler(ProgressChanged);
            bwRepack.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(ProcessCompleted);
            bwRepack.WorkerReportsProgress = true;

            // Upack worker
            bwUnpack.DoWork               += new DoWorkEventHandler(Unpack);
            bwUnpack.ProgressChanged      += new ProgressChangedEventHandler(ProgressChanged);
            bwUnpack.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(ProcessCompleted);
            bwUnpack.WorkerReportsProgress = true;
        }
        public GeneralConfig()
        {
            InitializeComponent();
            general_defaultauthor.Validating += ValidateSortName;

            loading = true;
            try
            {
                PopulateAppIdCombo(general_defaultappid_RS2012, GameVersion.RS2012);
                PopulateAppIdCombo(general_defaultappid_RS2014, GameVersion.RS2014);
                PopulateEnumCombo(general_defaultgameversion, typeof(GameVersion));
                PopulateEnumCombo(general_defaultplatform, typeof(GamePlatform));
                PopulateEnumCombo(converter_source, typeof(GamePlatform));
                PopulateEnumCombo(converter_target, typeof(GamePlatform));
                PopulateRampUp();
                PopulateConfigDDC();
                LoadAndSetupConfiguration(this.Controls);
                // hide First Run
                if (ConfigRepository.Instance()["general_firstrun"] == "false")
                {
                    lblFirstRun.Visible = false;
                }
            }
            catch { /*For mono compatibility*/ }
            loading = false;
        }
Exemple #7
0
        public void Init(ToolkitVersionOnline onlineVersion)
        {
            // DELETE OLD UPDATER APP IF EXISTS
            var updatingAppPath = Path.Combine(localToolkitDir, APP_UPDATING);

            if (File.Exists(updatingAppPath))
            {
                File.Delete(updatingAppPath);
            }

            var useBeta = ConfigRepository.Instance().GetBoolean("general_usebeta");

            lblCurrentVersion.Text = ToolkitVersion.RSTKGuiVersion;
            lblNewVersion.Text     = String.Format("{0}-{1} {2}", onlineVersion.Version, onlineVersion.Revision, useBeta ? "BETA" : "");
            lblNewVersionDate.Text = onlineVersion.Date.ToShortDateString();

            if (onlineVersion.CommitMessages != null)
            {
                dgvCommitMessage.Visible = true;
                dgvCommitMessage.Rows.Clear();
                for (var i = 0; i < onlineVersion.CommitMessages.Length; i++)
                {
                    dgvCommitMessage.Rows.Add();
                    dgvCommitMessage.Rows[i].Cells["Message"].Value = onlineVersion.CommitMessages[i];
                }
            }
        }
        private void ConfigurationChanged(object sender, EventArgs e)
        {
            if (!loading)
            {
                Control control = (Control)sender;
                var     key     = control.Name;
                var     value   = control.Text;

                if (control is ComboBox)
                {
                    var combo = ((ComboBox)control);
                    if (!String.IsNullOrEmpty(combo.ValueMember))
                    {
                        value = combo.SelectedValue.ToString();
                    }
                    else
                    {
                        value = combo.SelectedItem.ToString();
                    }
                }
                else if (control is CheckBox)
                {
                    value = ((CheckBox)control).Checked.ToString();
                }
                else if (control is NumericUpDown)
                {
                    value = ((NumericUpDown)control).Value.ToString(CultureInfo.InvariantCulture);
                }

                if (ConfigRepository.Instance().ValueChanged(key, value) && !String.IsNullOrEmpty(value))
                {
                    ConfigRepository.Instance()[key] = value;
                }
            }
        }
Exemple #9
0
 private void SetDefaultFromConfig()
 {
     ramUpMdlsCbox.SelectedItem  = ConfigRepository.Instance()["ddc_rampup"];
     ConfigFilesCbx.SelectedItem = ConfigRepository.Instance()["ddc_config"];
     phaseLenNum.Value           = ConfigRepository.Instance().GetDecimal("ddc_phraselength");
     delsustainsBT.Checked       = ConfigRepository.Instance().GetBoolean("ddc_removesustain");
 }
        private void InitMainForm()
        {
            this.Text = String.Format("Song Creator Toolkit for Rocksmith (v{0})", ToolkitVersion.RSTKGuiVersion);

            btnUpdate.FlatStyle = FlatStyle.Flat;
            btnUpdate.BackColor = SystemColors.Control;
            btnUpdate.Text      = "Updates are disabled";
            btnUpdate.Enabled   = false;

            try
            {
                // updates are disabled on real Mac platform, or according to general_autoupdate setting
                if (Environment.OSVersion.Platform != PlatformID.MacOSX &&
                    ConfigRepository.Instance().GetBoolean("general_autoupdate"))
                {
                    bWorker                     = new BackgroundWorker();
                    bWorker.DoWork             += CheckForUpdate;
                    bWorker.RunWorkerCompleted += EnableUpdate;
                    bWorker.RunWorkerAsync();
                }

                // update current VersionInfo.txt file based on what's running
                ToolkitVersion.UpdateVersionInfoFile();
            }
            catch { /* DO NOTHING */ }
        }
        private void MainForm_Shown(object sender, EventArgs e)
        {
            // check for first run
            bool firstRun = ConfigRepository.Instance().GetBoolean("general_firstrun");

            // confirm and log App.config was properly loaded at runtime
            var appConfigStatus = "<ERROR> Load Failed";

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["key"]))
            {
                appConfigStatus = "Load Successful";
            }

            // validate and log runtime display setting
            var displaySettings = String.Empty;

            if (!GeneralExtension.ValidateDisplaySettings(this, this, false, firstRun))
            {
                displaySettings = "\r\n  - Adjusted AutoScaleDimensions, AutoScaleMode, and AutoSize";
            }

            GlobalsConfig.Log.Info(
                String.Format(" - App.config Status ({0})\r\n ", appConfigStatus) +
                String.Format(" - System Display DPI Setting ({0})\r\n ", GeneralExtension.GetDisplayDpi(this)) + // validate and log runtime display setting
                String.Format(" - System Display Screen Scale Factor ({0}%) ", GeneralExtension.GetDisplayScalingFactor(this) * 100) +
                String.Format(displaySettings)
                );

            // don't bug the Developers when in design mode ;)
            bool showRevNote = ConfigRepository.Instance().GetBoolean("general_showrevnote");

            if (showRevNote && !GeneralExtension.IsInDesignMode)
            {
                ShowHelpForm();
                ConfigRepository.Instance()["general_showrevnote"] = "false";
            }

            // don't bug the Developers when in design mode ;)
            if (!firstRun || GeneralExtension.IsInDesignMode)
            {
                return;
            }

            this.Refresh();
            MessageBox.Show(new Form {
                TopMost = true
            },
                            "Welcome to the Song Creator Toolkit for Rocksmith ..." + Environment.NewLine +
                            "Commonly known as, 'the toolkit'." + Environment.NewLine + Environment.NewLine +
                            "It looks like this may be your first time running the toolkit.  " + Environment.NewLine +
                            "Please fill in the Configuration menu with your selections.",
                            "Song Creator Toolkit for Rocksmith - FIRST RUN", MessageBoxButtons.OK, MessageBoxIcon.Information);

            ShowConfigScreen();
            BringToFront();
        }
        public static string GetWwisePath()
        {
            string wwisePath;

            // Audiokinetic Wwise might not be installed in the default location ;<
            // added custom Wwise install path to toolkit configuration menu
            if (!String.IsNullOrEmpty(ConfigRepository.Instance()["general_wwisepath"]))
            {
                wwisePath = ConfigRepository.Instance()["general_wwisepath"];
            }
            else
            {
                wwisePath = Environment.GetEnvironmentVariable("WWISEROOT");
            }

            if (String.IsNullOrEmpty(wwisePath))
            {
                throw new FileNotFoundException("Could not find Audiokinetic Wwise installation." + Environment.NewLine + "Please confirm that Wwise v2013.2.x v2014.1.x or 2015.1.x series is installed.");
            }

            Selected = OggFile.WwiseVersion.None;
            var pathWwiseCli = Directory.EnumerateFiles(wwisePath, "WwiseCLI.exe", SearchOption.AllDirectories).FirstOrDefault();

            if (pathWwiseCli == null)
            {
                throw new FileNotFoundException("Could not find WwiseCLI.exe in " + wwisePath + Environment.NewLine + "Please confirm that Wwise v2013.2.x v2014.1.x or 2015.1.x series is installed.");
            }

            var wwiseVersion = FileVersionInfo.GetVersionInfo(pathWwiseCli).ProductVersion;

            if (wwiseVersion.StartsWith("2013.2"))
            {
                Selected = OggFile.WwiseVersion.Wwise2013;
            }
            if (wwiseVersion.StartsWith("2014.1"))
            {
                Selected = OggFile.WwiseVersion.Wwise2014;
            }
            if (wwiseVersion.StartsWith("2015.1"))
            {
                Selected = OggFile.WwiseVersion.Wwise2015;
            }
            // add support for new versions here, code is expandable
            //if (wwiseVersion.StartsWith("201x.x"))
            //    Selected = OggFile.WwiseVersion.Wwise201x;
            if (Selected == OggFile.WwiseVersion.None)
            {
                throw new FileNotFoundException("You have no compatible version of Audiokinetic Wwise installed." +
                                                Environment.NewLine + "Install Wwise v2013.2.x or v2014.1.x or even v2015.1.x series if you would like to use" +
                                                Environment.NewLine + " the toolkit OGG/WAV audio to Wwise WEM audio auto convert features.");
            }

            return(pathWwiseCli);
        }
Exemple #13
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            using (var u = new UpdateForm())
            {
                u.Init(onlineVersion);
                u.ShowDialog();
            }

            // reset to display the revision note
            ConfigRepository.Instance()["general_showrevnote"] = "true";
        }
        private void PopulateAppIdCombo()
        {
            var appIdList = SongAppIdRepository.Instance().Select(GameVersion.RS2014).ToArray();

            appIdCombo.DataSource    = appIdList;
            appIdCombo.DisplayMember = "DisplayName";
            appIdCombo.ValueMember   = "AppId";

            var songAppId = SongAppIdRepository.Instance().Select(ConfigRepository.Instance()["general_defaultappid_RS2014"], GameVersion.RS2014);

            appIdCombo.SelectedValue = songAppId.AppId;
        }
 private void InitOutputDir()
 {
     // set initial outputDir location
     if (Directory.Exists(ConfigRepository.Instance()["general_rs2014path"]))
     {
         outputDir = Path.Combine(ConfigRepository.Instance()["general_rs2014path"], "dlc");
     }
     else
     {
         outputDir = Path.GetDirectoryName(Application.ExecutablePath);
     }
 }
Exemple #16
0
 private void rs2014PathButton_Click(object sender, EventArgs e)
 {
     using (var fbd = new VistaFolderBrowserDialog())
     {
         if (fbd.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         var rs2014Path = fbd.SelectedPath;
         general_rs2014path.Text = rs2014Path;
         ConfigRepository.Instance()[general_rs2014path.Name] = rs2014Path;
     }
 }
Exemple #17
0
        private void PopulateGameVersionCombo()
        {
            var gameVersionList = Enum.GetNames(typeof(GameVersion)).ToList <string>();

            gameVersionList.Remove("None");
            cmbGameVersion.Items.Clear();
            foreach (var version in gameVersionList)
            {
                cmbGameVersion.Items.Add(version);
            }

            cmbGameVersion.SelectedItem = ConfigRepository.Instance()["general_defaultgameversion"];
        }
Exemple #18
0
        private void PopulateAppIdCombo(GameVersion gameVersion)
        {
            appIdCombo.Items.Clear();
            foreach (var song in SongAppIdRepository.Instance().Select(gameVersion))
            {
                appIdCombo.Items.Add(song);
            }

            var songAppId = SongAppIdRepository.Instance().Select(ConfigRepository.Instance()["general_defaultappid_RS2014"], gameVersion);

            appIdCombo.SelectedItem = songAppId;
            AppId = songAppId.AppId;
        }
        private void btnProjectDir_Click(object sender, EventArgs e)
        {
            using (var fbd = new VistaFolderBrowserDialog())
            {
                fbd.SelectedPath = creator_defaultproject.Text;
                fbd.Description  = "Select Default Project Folder for the CDLC Creator";
                if (fbd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var projectDir = fbd.SelectedPath;
                creator_defaultproject.Text = projectDir;
                ConfigRepository.Instance()["creator_defaultproject"] = projectDir;
            }
        }
Exemple #20
0
        private void WwisePathButton_Click(object sender, EventArgs e)
        {
            using (var ofd = new OpenFileDialog())
            {
                ofd.Title  = "Select Wwise CLI File";
                ofd.Filter = "WwiseCLI.exe File (*.exe)|*.exe";

                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var wwisePath = ofd.FileName;
                general_wwisepath.Text = wwisePath;
                ConfigRepository.Instance()[general_wwisepath.Name] = wwisePath;
            }
        }
Exemple #21
0
        // only gets called one time
        public GeneralConfig()
        {
            InitializeComponent();


            // fix readonly textbox/cuebox background colors
            general_rs1path.BackColor        = SystemColors.Window;
            general_rs2014path.BackColor     = SystemColors.Window;
            general_wwisepath.BackColor      = SystemColors.Window;
            creator_defaulttone.BackColor    = SystemColors.Window;
            creator_defaultproject.BackColor = SystemColors.Window;

            general_defaultauthor.Validating += ValidateSortName;
            loading = true;

            try
            {
                PopulateAppIdCombo(general_defaultappid_RS2012, GameVersion.RS2012);
                PopulateAppIdCombo(general_defaultappid_RS2014, GameVersion.RS2014);
                PopulateEnumCombo(general_defaultgameversion, typeof(GameVersion));
                PopulateEnumCombo(general_defaultplatform, typeof(GamePlatform));
                PopulateEnumCombo(converter_source, typeof(GamePlatform));
                PopulateEnumCombo(converter_target, typeof(GamePlatform));
                PopulateRampUp();
                PopulateConfigDDC();

                // CRITICAL - force static Wwise path and settings for Mac Mono/Wine packages on first run
                if ((Environment.OSVersion.Platform == PlatformID.MacOSX || GeneralExtension.IsWine()) && ConfigRepository.Instance().GetBoolean("general_firstrun"))
                {
                    ConfigRepository.Instance()["general_autoupdate"]      = "false";
                    ConfigRepository.Instance()["general_replacerepo"]     = "true";
                    ConfigRepository.Instance()["general_defaultauthor"]   = "CST_Mac";
                    ConfigRepository.Instance()["general_wwisepath"]       = "C:\\Program Files (x86)\\Audiokinetic\\Wwise\\Authoring"; // interestingly the full path is not needed here
                    ConfigRepository.Instance()["general_replacerepo"]     = "false";
                    ConfigRepository.Instance()["general_defaultplatform"] = "Mac";
                    // TODO: identify these Mac paths if static (they are not static)
                    ConfigRepository.Instance()["general_rs2014path"] = "";
                    ConfigRepository.Instance()["general_rs1path"]    = "";
                }

                LoadAndSetupConfiguration(this.Controls);
            }
            catch { /*For mono compatibility*/ }

            loading = false;
        }
 private void PopulateRampUp()
 {
     if (Directory.Exists(@".\ddc\"))
     {
         ddc_rampup.Items.Clear();
         foreach (var xml in Directory.EnumerateFiles(@".\ddc\", "*.xml", SearchOption.AllDirectories))
         {
             var name = Path.GetFileNameWithoutExtension(xml);
             if (name.StartsWith("user_"))
             {
                 name = name.Remove(0, 5);
             }
             ddc_rampup.Items.Add(name);
             ddc_rampup.SelectedItem = ConfigRepository.Instance()[ddc_rampup.Name];
         }
     }
 }
        private void btnWwisePath_Click(object sender, EventArgs e)
        {
            using (var fbd = new VistaFolderBrowserDialog())
            {
                fbd.SelectedPath = general_wwisepath.Text;
                fbd.Description  = "Select Wwise CLI (*.exe) installation folder.";

                if (fbd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var wwisePath = fbd.SelectedPath;
                general_wwisepath.Text = wwisePath;
                ConfigRepository.Instance()["general_wwisepath"] = wwisePath;
            }
        }
        private void btnRs2014Path_Click(object sender, EventArgs e)
        {
            using (var fbd = new VistaFolderBrowserDialog())
            {
                fbd.SelectedPath = general_rs2014path.Text;
                fbd.Description  = "Select Rocksmith 2014 executable root installation folder.";

                if (fbd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var rs2014Path = fbd.SelectedPath;
                general_rs2014path.Text = rs2014Path;
                ConfigRepository.Instance()["general_rs2014path"] = rs2014Path;
            }
        }
        public void LoadConfigXml()
        {
            var configFile = ConfigRepository.Instance()["ddc_config"] + ".cfg";
            var rampupFile = ConfigRepository.Instance()["ddc_rampup"] + ".xml";

            PhraseLen = (int)ConfigRepository.Instance().GetDecimal("ddc_phraselength");
            RemoveSus = ConfigRepository.Instance().GetBoolean("ddc_removesustain");
            RampPath  = Path.Combine(ExternalApps.TOOLKIT_ROOT, ExternalApps.DDC_DIR, rampupFile);
            CfgPath   = Path.Combine(ExternalApps.TOOLKIT_ROOT, ExternalApps.DDC_DIR, configFile);

            if (!File.Exists(RampPath) || !File.Exists(CfgPath))
            {
                throw new FileNotFoundException("DDC support files are missing");
            }

            //    // -m "D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\rocksmith-custom-song-toolkit\RocksmithTookitGUI\bin\Debug\ddc\ddc_default.xml"
            //    // -c "D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\rocksmith-custom-song-toolkit\RocksmithTookitGUI\bin\Debug\ddc\ddc_default.cfg"
        }
Exemple #26
0
        public void LoadIntroScreens()
        {
            txtAuthor.DoubleClick  += txtAuthor_DoubleClick;
            txtSeqName.DoubleClick += txtSeqName_DoubleClick;
            txtSeqName.Leave       += txtSeqName_Leave;

            if (Directory.Exists(ConfigRepository.Instance()["general_rs2014path"]))
            {
                rsDir = ConfigRepository.Instance()["general_rs2014path"];
            }
            else
            {
                rsDir = Path.Combine(workDir, "cgm");
            }

            txtAuthor.Text = ConfigRepository.Instance()["general_defaultauthor"];
            LoadImages(Path.Combine(workDir, "cgm", "current.cis"));
        }
        private void btnTonePath_Click(object sender, EventArgs e)
        {
            using (var ofd = new OpenFileDialog())
            {
                ofd.InitialDirectory = creator_defaulttone.Text;
                ofd.Title            = "Select Default Tone for the CDLC Creator";
                ofd.Filter           = CurrentOFDFilter;

                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var tonePath = ofd.FileName;
                creator_defaulttone.Text = tonePath;
                ConfigRepository.Instance()["creator_defaulttone"] = tonePath;
            }
        }
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            // autosave the dlc.xml template on closing
            if (dlcPackageCreator1.IsDirty && ConfigRepository.Instance().GetBoolean("creator_autosavetemplate"))
            {
                dlcPackageCreator1.SaveTemplateFile(dlcPackageCreator1.UnpackedDir, false);
            }

            // leave temp folder contents for developer debugging
            if (GeneralExtension.IsInDesignMode)
            {
                return;
            }

            // cleanup temp folder garbage carefully
            // confirm this is the 'Local Settings\Temp' directory
            var di = new DirectoryInfo(Path.GetTempPath());

            if (di.Parent != null)
            {
                return;
            }

            if (di.Parent.Name == "Local Settings" && di.Name == "Temp")
            {
                foreach (FileInfo file in di.GetFiles())
                {
                    try
                    {
                        file.Delete();
                    }
                    catch { /*Don't worry just skip locked file*/ }
                }

                foreach (DirectoryInfo dir in di.GetDirectories())
                {
                    try
                    {
                        dir.Delete(true);
                    }
                    catch { /*Don't worry just skip locked directory*/ }
                }
            }
        }
        private void LoadAndSetupConfiguration(ControlCollection controls)
        {
            foreach (var control in controls)
            {
                if (control is TextBox || control is CueTextBox)
                {
                    var tb = (TextBox)control;
                    tb.Text = (string)ConfigRepository.Instance()[tb.Name];
                }
                else if (control is ComboBox)
                {
                    var cb    = (ComboBox)control;
                    var value = ConfigRepository.Instance()[cb.Name];
                    if (!String.IsNullOrEmpty(cb.ValueMember))
                    {
                        cb.SelectedValue = value;
                    }
                    else
                    {
                        cb.SelectedItem = value;
                    }
                }
                else if (control is CheckBox)
                {
                    var ch = (CheckBox)control;
                    ch.Checked = ConfigRepository.Instance().GetBoolean(ch.Name);
                }
                else if (control is NumericUpDown)
                {
                    var nud = (NumericUpDown)control;
                    nud.Value = ConfigRepository.Instance().GetDecimal(nud.Name);
                }
                else if (control is GroupBox)
                {
                    LoadAndSetupConfiguration(((GroupBox)control).Controls);
                }
            }

            // hide First Run
            if (ConfigRepository.Instance()["general_firstrun"] == "false")
            {
                lblFirstRun.Visible = false;
            }
        }
        private void PopulateConfigDDC()
        {
            var ddcpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "ddc");

            if (Directory.Exists(ddcpath))
            {
                ddc_config.Items.Clear();
                foreach (var xml in Directory.EnumerateFiles(ddcpath, "*.cfg", SearchOption.AllDirectories))
                {
                    var name = Path.GetFileNameWithoutExtension(xml);
                    if (name.StartsWith("user_", StringComparison.Ordinal))
                    {
                        name = name.Remove(0, 5);
                    }
                    ddc_config.Items.Add(name);
                    ddc_config.SelectedItem = ConfigRepository.Instance()[ddc_config.Name];
                }
            }
        }