Esempio n. 1
0
        public void Save()
        {
            if (File.Exists(this.configFilename))
            {
                MOG_Ini ini = new MOG_Ini(this.configFilename);
                if (ini != null)
                {
                    if (this.type == PurgeCommandType.INTERVAL)
                    {
                        ini.PutString("INTERVAL", "LastExecuted", this.lastExecuted.ToString());
                        ini.PutString("INTERVAL", "DayInterval", this.dayInterval.ToString());
                        ini.PutString("INTERVAL", "HourInterval", this.hourInterval.ToString());
                        ini.PutString("INTERVAL", "MinInterval", this.minInterval.ToString());

                        if (ini.KeyExist("TRASH", "Scope"))
                        {
                            if (this.scope.ToString().ToLower() != ini.GetString("TRASH", "Scope").ToLower())
                            {
                                ini.PutString("INTERVAL", "Scope", this.scope.ToString());
                            }
                        }

                        ini.Save();
                        ini.Close();
                    }
                }
            }
        }
Esempio n. 2
0
        private static bool CheckConfigurationForOutOfDate(string currentIniFilename)
        {
            MOG_Ini pIni = new MOG_Ini();

            if (pIni.Open(currentIniFilename, FileShare.Read))
            {
                foreach (string upgradeSection in pIni.GetSections(null))
                {
                    if (pIni.KeyExist(upgradeSection, VisisbleIndex_Key) == false ||
                        upgradeSection.StartsWith(CustomSectionIndicator_Text, StringComparison.CurrentCultureIgnoreCase))
                    {
                        // Only add the visisble key to ini's with a controlName defined
                        if (pIni.KeyExist(upgradeSection, ControlName_Key) && pIni.KeyExist(upgradeSection, VisisbleIndex_Key) == false)
                        {
                            return(true);
                        }

                        // Check for depricated section names
                        if (upgradeSection.StartsWith("CustomControl", StringComparison.CurrentCultureIgnoreCase))
                        {
                            return(true);
                        }
                    }
                }
                pIni.Close();
            }

            return(false);
        }
Esempio n. 3
0
        private bool Finish()
        {
            if (this.rbCreateNewRepository.Checked)
            {
                // create new mog repository
                string blankReposDir = Environment.CurrentDirectory + "\\setup\\Repository\\MOG";
                if (Directory.Exists(blankReposDir))
                {
                    if (!CopyDirectory(blankReposDir, this.tbNewRepositoryLocation.Text))
                    {
                        MessageBox.Show("Couldn't copy " + blankReposDir, "Copy Error");
                        return(false);
                    }
                }
                else
                {
                    MessageBox.Show("Couldn't find " + blankReposDir, "Missing Source Repository");
                    return(false);
                }

                // fixup the INI files within the new repository to point to the correct directories
                string mogIniFile = this.tbNewRepositoryLocation.Text + "\\Tools\\MOGConfig.ini";
                if (File.Exists(mogIniFile))
                {
                    MOG_Ini ini = new MOG_Ini(mogIniFile);
                    ini.PutString("MOG", "SystemRepositoryPath", this.tbNewRepositoryLocation.Text);
                    ini.PutString("MOG", "Tools", "{SystemRepositoryPath}\\Tools");
                    ini.PutString("MOG", "Projects", "{SystemRepositoryPath}\\Projects");

                    ini.Save();
                    ini.Close();
                }
                else
                {
                    MessageBox.Show(mogIniFile + " doesn't exist", "Missing INI File");
                }

                // create MogRepository.ini
                MOG_Ini repositoryIni = new MOG_Ini(this.tbNewRepositoryLocation.Text + "\\MogRepository.ini");
                repositoryIni.PutString("Mog_Repositories", this.RepositoryName, "");
                repositoryIni.PutString(this.RepositoryName, "SystemRepositoryPath", this.tbNewRepositoryLocation.Text);
                repositoryIni.PutString(this.RepositoryName, "SystemConfiguration", "{SystemRepositoryPath}\\Tools\\MOGConfig.ini");
                repositoryIni.Save();
                repositoryIni.Close();

                // copy it to the root if possible
                if (this.tbNewRepositoryLocation.Text.Length > 3)
                {
                    // if it's not already pointing to the root
                    string root = this.tbNewRepositoryLocation.Text.Substring(0, 3);
                    File.Copy(this.tbNewRepositoryLocation.Text + "\\MogRepository.ini", root + "MogRepository.ini", true);
                }
            }
            else if (this.rbSelectExistingRepository.Checked)
            {
            }

            return(true);
        }
Esempio n. 4
0
        public void SaveToIni(string iniFilename)
        {
            MOG_Ini ini = new MOG_Ini(iniFilename);

            ini.PutString("SQL", "ConnectionString", this.mConnectString);
            ini.Save();
            ini.Close();
        }
Esempio n. 5
0
        public bool GetTasksFromBox(string box, string section, Color textColor, System.Windows.Forms.ListView listViewToFill)
        {
            MOG_Ini contents = new MOG_Ini();

            // Get a handle to the inbox\contents.info
            FileInfo file = new FileInfo(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\Contents.info"));

            // If the .info file exists, open it
            if (file.Exists)
            {
                // Load the file
                contents.Load(file.FullName);

                // Find the items in the INBOX section
                if (contents.SectionExist(section))
                {
                    for (int i = 0; i < contents.CountKeys(section); i++)
                    {
                        ListViewItem node = new ListViewItem();

                        String assetName = contents.GetKeyNameByIndex(section, i);

                        // Set the due date
                        MOG_Time t = new MOG_Time();
                        t.SetTimeStamp(contents.GetString(assetName, "DUEDATE"));
                        DateTime dueDate = t.ToDateTime();

                        node.Text = (contents.GetString(assetName, "TITLE"));                                           // Name
                        node.SubItems.Add(dueDate.ToString());
                        node.SubItems.Add(contents.GetString(assetName, "TIME"));
                        node.SubItems.Add(contents.GetString(assetName, "CREATOR"));
                        node.SubItems.Add(contents.GetString(assetName, "PRIORITY"));
                        node.SubItems.Add(contents.GetString(assetName, "STATUS"));
                        node.SubItems.Add(contents.GetString(assetName, "ASSET"));
                        node.SubItems.Add(String.Concat(file.DirectoryName, "\\", assetName));                          // Fullname
                        node.SubItems.Add(box);                                                                         // Current box
                        node.ForeColor = textColor;

                        node.ImageIndex = 0;                        //SetAssetIcon(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\", assetName));
                        listViewToFill.Items.Add(node);
                    }
                }

                contents.Close();
            }

            return(true);
        }
Esempio n. 6
0
        //----------------------------------------------------------------
        // writes out settings to an ini file
        public void WriteSettingsToIni()
        {
            string projectDefaultButtonsFile = MOG_ControllerProject.GetProject().GetProjectToolsPath() + "\\ClientConfigs\\" + MOG_ControllerProject.GetProject().GetProjectName() + ".Client.Buttons." + mPlatformName + ".info";

            if (projectDefaultButtonsFile.Length == 0)
            {
                return;
            }

            MOG_Ini pIni = new MOG_Ini(projectDefaultButtonsFile);

            pIni.Empty();

            int i = 0;

            foreach (ControlDefinition def in mControlsList)
            {
                string section = "Button" + i;

                pIni.PutString(section, "Type", "" + def.mEType);
                pIni.PutString(section, "BUTTONNAME", def.mButton.Text);
                pIni.PutString(section, "Command", def.mCommand);
                pIni.PutString(section, "HideWindow", "" + def.mHiddenOutput);

                if ((ETYPE)def.mEType == ETYPE.STD_BUTTON)
                {
                    pIni.PutString(section, "ARGUMENTS", def.mArguments);
                }

                if ((ETYPE)def.mEType == ETYPE.STD_BUTTON_EDIT)
                {
                    pIni.PutString(section, "FIELDNAME", def.mTextBox.Name);
                    pIni.PutString(section, "ARGUMENTS", def.mEditText);
                }

                if ((ETYPE)def.mEType == ETYPE.STD_FILETYPE_LIST ||
                    (ETYPE)def.mEType == ETYPE.STD_FOLDERBROWSER)
                {
                    pIni.PutString(section, "Directory", def.mDirectory);
                    pIni.PutString(section, "Extension", def.mExtension);
                    pIni.PutString(section, "FIELDNAME", def.mComboBox.Name);
                }

                i++;
            }

            pIni.Close();
        }
        public void TargetXboxAdd()
        {
            // Get the user console ini
            string userPath       = mMog.GetUser().GetUserToolsPath();
            string consoleIniFile = string.Concat(userPath, "\\consoles.ini");

            MOG_Ini consoleIni = new MOG_Ini(consoleIniFile);

            consoleIni.PutSectionString("Xboxes", mTargetXbox);

            consoleIni.Save();
            consoleIni.Close();

            // Reset our xbox list
            InitializeXboxList();
        }
        public bool GetTasksFromBox(string box, string section, Color textColor, ListView listViewToFill)
        {
            MOG_Ini contents = new MOG_Ini();

            // Get a handle to the inbox\contents.info
            FileInfo file = new FileInfo(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\Contents.info"));

            // If the .info file exists, open it
            if (file.Exists)
            {
                // Load the file
                contents.Load(file.FullName);

                // Find the items in the INBOX section
                if (contents.SectionExist(section))
                {
                    for (int i = 0; i < contents.CountKeys(section); i++)
                    {
                        ListViewItem node = new ListViewItem();

                        String assetName = contents.GetKeyNameByIndex(section, i);

                        node.Text = (contents.GetString(assetName, "SUBJECT"));                                         // Name
                        node.SubItems.Add(contents.GetString(assetName, "TO"));
                        node.SubItems.Add(contents.GetString(assetName, "TIME"));
                        node.SubItems.Add(contents.GetString(assetName, "FROM"));
                        node.SubItems.Add(contents.GetString(assetName, "STATUS"));
                        node.SubItems.Add("");
                        node.SubItems.Add(String.Concat(file.DirectoryName, "\\", assetName));                          // Fullname
                        node.SubItems.Add(box);                                                                         // Current box
                        node.ForeColor = textColor;

                        if (string.Compare(contents.GetString(assetName, "STATUS"), "New", true) == 0)
                        {
                            node.Font = new Font(node.Font, FontStyle.Bold);
                        }

                        node.ImageIndex = 0;                        //SetAssetIcon(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\", assetName));
                        listViewToFill.Items.Add(node);
                    }
                }
                contents.Close();
            }

            return(true);
        }
Esempio n. 9
0
        private string ExtractRepositoryLocation(string iniFilename)
        {
            string  path     = this.mRepositoryPath;
            MOG_Ini reposIni = new MOG_Ini(iniFilename);

            if (reposIni.SectionExist("MOG_REPOSITORIES") && reposIni.CountKeys("MOG_REPOSITORIES") > 0)
            {
                string firstReposName = reposIni.GetKeyNameByIndexSLOW("MOG_REPOSITORIES", 0);
                if (reposIni.SectionExist(firstReposName))
                {
                    path = reposIni.GetString(firstReposName, "SystemRepositoryPath");
                }
            }
            reposIni.Close();

            return(path);
        }
Esempio n. 10
0
        private void Purge_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker      = sender as BackgroundWorker;
            List <string>    args        = e.Argument as List <string>;
            string           projName    = args[0];
            string           iniFilename = args[1];

            // open the ini file
            MOG_Ini ini = new MOG_Ini(iniFilename);

            if (ini != null)
            {
                bool bFailed = false;

                // Attempt to remove the project
                if (DosUtils.DirectoryExist(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName))
                {
                    if (!DosUtils.DirectoryDeleteFast(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName))
                    {
                        Utils.ShowMessageBoxExclamation("Can't purge " + projName + ", probably because of a sharing violation", "Project Removal Failure");
                        bFailed = true;
                    }
                }

                if (!bFailed)
                {
                    // make sure projName is a deleted project
                    if (ini.SectionExist(projName + ".Deleted"))
                    {
                        // Remove the project from the list of deleted projects
                        ini.RemoveString("Projects.Deleted", projName);
                        ini.RemoveSection(projName + ".Deleted");

                        BlankInfoBox();

                        ini.Save();
                    }
                }

                ini.Close();

                LoadIniFile(iniFilename);
            }
        }
Esempio n. 11
0
        private bool MOGIniValid()
        {
            // Is this a first run? (I.e Does MOG.Ini exist in the Current Directory?
            if (!File.Exists(Environment.CurrentDirectory + "\\" + LoaderTargetDirectory + "\\MOG.ini"))
            {
                return(false);
            }

            // make sure it's pointed to a valid MOG Repository
            MOG_Ini mogIni = new MOG_Ini(Environment.CurrentDirectory + "\\" + LoaderTargetDirectory + "\\MOG.ini");

            if (!mogIni.KeyExist("MOG", "ValidMogRepository"))
            {
                mogIni.Close();
                return(false);
            }

            return(true);
        }
Esempio n. 12
0
        /// <summary>
        /// Save our current listView items out to the target ini file
        /// </summary>
        /// <param name="filename"></param>
        private void SaveReportList(string filename)
        {
            ListOkButton.Enabled = false;

            MOG_Ini report = new MOG_Ini(filename);

            report.Empty();

            try
            {
                ProgressMax(ListListView.Items.Count);

                foreach (ListViewItem item in ListListView.Items)
                {
                    string extraInfo = "";

                    for (int i = 0; i < item.SubItems.Count; i++)
                    {
                        ProgressStep();

                        if (item.SubItems[i].Text.Length == 0)
                        {
                            extraInfo = extraInfo + " " + ",";
                        }
                        else
                        {
                            extraInfo = extraInfo + item.SubItems[i].Text + ",";
                        }
                    }
                    report.PutString("ASSETS", item.SubItems[FindColumn("Fullname")].Text, extraInfo);
                }
            }
            catch
            {
            }
            finally
            {
                report.Save();
                report.Close();
                ProgressReset();
                ListOkButton.Enabled = true;
            }
        }
Esempio n. 13
0
        public bool LoadRepositories(string iniFilename)
        {
            if (!Directory.Exists(Path.GetDirectoryName(iniFilename)))
            {
                return(false);
            }

            MOG_Ini ini = new MOG_Ini(iniFilename);

            if (ini == null)
            {
                return(false);
            }

            if (ini.SectionExist("REPOSITORIES"))
            {
                for (int i = 0; i < ini.CountKeys("REPOSITORIES"); i++)
                {
                    string key = ini.GetKeyNameByIndexSLOW("REPOSITORIES", i);
                    if (key.ToLower() == "default")
                    {
                        continue;
                    }

                    if (!ini.SectionExist("REPOSITORIES." + key))
                    {
                        continue;
                    }

                    string name = ini.GetString("REPOSITORIES." + key, "name");
                    string path = ini.GetString("REPOSITORIES." + key, "path");
                    AddRepository(name, path);
                }
            }

            ini.Close();
            return(true);
        }
Esempio n. 14
0
        public void AddShallowRepositories()
        {
            this.lvIniFile.Items.Clear();

            foreach (string drive in Directory.GetLogicalDrives())
            {
                int type = (int)GetDriveType(drive);
                if (type == DRIVE_TYPE_HD || type == DRIVE_TYPE_NETWORK)
                {
                    if (Directory.Exists(drive))
                    {
                        // look for a repository marker
                        if (File.Exists(drive + "MogRepository.ini"))
                        {
                            // repository exists, open it up
                            MOG_Ini ini = new MOG_Ini(drive + "MogRepository.ini");
                            if (!ini.SectionExist("MOG_REPOSITORIES"))
                            {
                                continue;
                            }

                            for (int sectionIndex = 0; sectionIndex < ini.CountKeys("MOG_REPOSITORIES"); sectionIndex++)
                            {
                                string sectionName = ini.GetKeyNameByIndexSLOW("MOG_REPOSITORIES", sectionIndex);
                                if (ini.SectionExist(sectionName) && ini.KeyExist(sectionName, "SystemRepositoryPath"))
                                {
                                    ListViewItem item = new ListViewItem(sectionName + " on " + drive.Trim("\\".ToCharArray()));
                                    item.SubItems.Add(ini.GetString(sectionName, "SystemRepositoryPath"));
                                    this.lvRepositories.Items.Add(item);
                                }
                            }

                            ini.Close();
                        }
                    }
                }
            }
        }
Esempio n. 15
0
        private void Restore_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker      = sender as BackgroundWorker;
            List <string>    args        = e.Argument as List <string>;
            string           projName    = args[0];
            string           iniFilename = args[1];

            // open the ini file
            MOG_Ini ini = new MOG_Ini(iniFilename);

            if (ini != null)
            {
                // make sure projName is a deleted project
                if (ini.SectionExist(projName + ".Deleted"))
                {
                    // Attempt to move the project's directory
                    if (DosUtils.DirectoryMoveFast(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName, MOG_ControllerSystem.GetSystemProjectsPath() + "\\" + projName, true))
                    {
                        // Restore the project to the active projects list
                        ini.PutString("Projects", projName, "");
                        ini.RemoveString("Projects.Deleted", projName);
                        ini.RenameSection(projName + ".Deleted", projName);

                        // Restore the project's database
                        MOG_ControllerSystem.GetDB().VerifyTables(projName);
                        MOG_Database.ImportProjectTables(projName, this.mogProjectsPath + "\\" + projName);
                    }

                    BlankInfoBox();

                    ini.Save();
                }

                ini.Close();

                LoadIniFile(iniFilename);
            }
        }
Esempio n. 16
0
        private void LoadIniFile(string iniFilePath)
        {
            if (!File.Exists(iniFilePath))
            {
                return;
            }

            // setup list view and ini reader
            this.lvRemovedProjects.Items.Clear();
            MOG_Ini ini = new MOG_Ini(iniFilePath);

            // Make sure the section exists?
            if (ini.SectionExist("Projects.Deleted"))
            {
                // for each "deleted" project listed
                for (int i = 0; i < ini.CountKeys("Projects.Deleted"); i++)
                {
                    string projName = ini.GetKeyNameByIndexSLOW("Projects.Deleted", i);

                    // Check if the deleted project's directory is missing?
                    if (!DosUtils.DirectoryExistFast(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName))
                    {
                        // Auto clean this deleted project from the ini
                        ini.RemoveSection(projName + ".Deleted");
                        ini.RemoveString("projects.deleted", projName);
                        continue;
                    }

                    ListViewItem item = new ListViewItem();
                    item.Text = projName;
//					item.Tag = new RemovedProjectInfo( configFile );
                    this.lvRemovedProjects.Items.Add(item);
                }
            }

            ini.Close();
        }
        public void SaveMOGConfiguration()
        {
            string  configFilename = MOG_Main.FindInstalledConfigFile();
            MOG_Ini ini            = new MOG_Ini();

            if (ini.Load(configFilename))
            {
                // Save repository
                ini.PutString("MOG", "SystemRepositoryPath", mRepositoryPath);
                ini.PutString("MOG", "SystemConfiguration", mConfigFile);

                ini.Close();

                // If we are the installed MOG, update the loaders ini too
                if (DosUtils.FileExistFast(MOG_Main.GetExecutablePath() + "\\..\\Loader.ini"))
                {
                    MOG_Ini LoaderIni = new MOG_Ini(MOG_Main.GetExecutablePath() + "\\..\\Loader.ini");

                    LoaderIni.PutString("LOADER", "SystemRepositoryPath", mRepositoryPath);

                    LoaderIni.Save();
                }
            }
        }
Esempio n. 18
0
        public bool SaveRepositories(string iniFilename)
        {
            if (!Directory.Exists(Path.GetDirectoryName(iniFilename)))
            {
                return(false);
            }

            MOG_Ini ini = new MOG_Ini(iniFilename);

            if (ini == null)
            {
                return(false);
            }

            // remove all old repository data
            int i;

            if (ini.SectionExist("REPOSITORIES"))
            {
                for (i = 0; i < ini.CountKeys("REPOSITORIES"); i++)
                {
                    // skip default
                    if (ini.GetKeyNameByIndexSLOW("REPOSITORIES", i).ToLower() == "default")
                    {
                        continue;
                    }

                    ini.RemoveSection("REPOSITORIES." + ini.GetKeyNameByIndexSLOW("REPOSITORIES", i));
                }
                ini.RemoveSection("REPOSITORIES");
            }

            // and save the new data
            i = 0;
            foreach (ListViewItem item in this.lvRepositories.Items)
            {
                string mrString = "mr" + i.ToString();
                ini.PutString("REPOSITORIES", mrString, "");
                ini.PutString("REPOSITORIES." + mrString, "name", item.Text);
                ini.PutString("REPOSITORIES." + mrString, "path", item.SubItems[1].Text);

                if (item == this.lvRepositories.SelectedItems[0])
                {
                    // this one's the default
                    ini.PutString("REPOSITORIES", "default", mrString);

                    // is there an INI selected in lvIniFiles?
                    if (this.lvIniFile.SelectedItems.Count > 0)
                    {
                        ini.PutString("REPOSITORIES." + mrString, "ini", item.SubItems[1].Text + "\\Tools\\" + this.lvIniFile.SelectedItems[0].Text);
                    }
                    else
                    {
                        ini.PutString("REPOSITORIES." + mrString, "ini", item.SubItems[1].Text + "\\" + MOG_Main.GetDefaultSystemRelativeConfigFileDefine());
                    }
                }
                else
                {
                    ini.PutString("REPOSITORIES." + "mr" + i.ToString(), "ini", item.SubItems[1].Text + "\\" + MOG_Main.GetDefaultSystemRelativeConfigFileDefine());
                }

                ++i;
            }

            ini.Save();
            ini.Close();
            return(true);
        }
Esempio n. 19
0
        internal void Remove(ToolBox toolbox)
        {
            // Write out our change
            string  currentIniFilename = toolbox.GetCurrentIniFilenameFromLocation(Location);
            MOG_Ini pIni = new MOG_Ini();

OpenConfigIni:
            if (pIni.Open(currentIniFilename, FileShare.Write))
            {
                // Remove this control from the siblings
                mSiblings.Remove(VisibleIndex);

                // Go thru all of this controls siblings and move their visual index up one so that there is not a break in the chain
                foreach (KeyValuePair <int, ControlDefinition> sibling in mSiblings)
                {
                    // Is this guy visually after the one we are deleting?
                    if (sibling.Value.VisibleIndex > VisibleIndex)
                    {
                        // Then move it up one
                        sibling.Value.VisibleIndex = sibling.Value.VisibleIndex - 1;

                        // Make sure this section actually exists
                        if (pIni.SectionExist(sibling.Value.ControlGuid))
                        {
                            pIni.PutString(sibling.Value.ControlGuid, VisisbleIndex_Key, sibling.Value.VisibleIndex.ToString());
                        }
                    }
                }

                pIni.RemoveSection(ControlGuid);

                // Scan all the sections looking for any related subsections
                ArrayList relatedSubSections = new ArrayList();
                string    subControlGuid     = ControlGuid + SubSectionIndicator_Text;
                foreach (string section in pIni.GetSections(null))
                {
                    if (section.StartsWith(subControlGuid, StringComparison.CurrentCultureIgnoreCase))
                    {
                        // Schedule this subsection for removal
                        relatedSubSections.Add(section);
                    }
                }
                // Remove any subsections related to this control
                foreach (string section in relatedSubSections)
                {
                    pIni.RemoveSection(section);
                }

                pIni.Save();
                pIni.Close();
            }
            else
            {
                if (
                    MOG_Prompt.PromptResponse("Configuration locked!",
                                              "Configuration file for this control is currently in use by another user",
                                              MOGPromptButtons.RetryCancel) == MOGPromptResult.Retry)
                {
                    goto OpenConfigIni;
                }
            }
        }
Esempio n. 20
0
        public bool Initialize()
        {
            DisableEvents = true;
            allUpToDate   = true;

            // Is this a first run? (I.e Does MOG.Ini exist in the Current Directory?
            if (!MOGIniValid())
            {
                MogForm_RepositoryBrowser_ServerLoader reposBrowser = new MogForm_RepositoryBrowser_ServerLoader();
                reposBrowser.ForceRepositorySelection = true;
                reposBrowser.CancelButtonText         = "Exit";
                reposBrowser.RepositoryViewVisible    = false;

                bool bRepositorySelected = false;

                while (!bRepositorySelected)
                {
                    if (reposBrowser.ShowDialog() == DialogResult.OK)
                    {
                        bRepositorySelected  = true;
                        this.mRepositoryPath = reposBrowser.SelectedPath.Trim("\\".ToCharArray());

                        // extract more exact path if possible
                        if (File.Exists(this.mRepositoryPath + "\\MogRepository.ini"))
                        {
                            this.mRepositoryPath = ExtractRepositoryLocation(this.mRepositoryPath + "\\MogRepository.ini");
                        }

                        //Warn the user if the repository was on a local drive
                        string drive = Path.GetPathRoot(mRepositoryPath);
                        int    type  = (int)GetDriveType(drive);
                        if (type != DRIVE_TYPE_NETWORK)
                        {
                            if (MessageBox.Show(this, "It is not recommended to place a MOG Repository on a local drive because it will not be accessible to other users on the network.", "Local Drive Warning", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                            {
                                //Go back and try again
                                bRepositorySelected = false;
                            }
                        }

                        if (bRepositorySelected)
                        {
                            SQLConnectForm sqlForm = new SQLConnectForm();
                            this.mConnectionString = "";
                            DialogResult result = sqlForm.ShowDialog();
                            if (result == DialogResult.OK)
                            {
                                this.mConnectionString = sqlForm.ConnectionString;
                            }

                            // Save this MOG.ini
                            SaveMOGConfiguration();

                            // write to loader.ini
                            MOG_Ini loaderIni = new MOG_Ini(Environment.CurrentDirectory + "\\Loader.ini");
                            loaderIni.PutString("LOADER", "SystemRepositoryPath", this.mRepositoryPath);
                            loaderIni.Save();
                            loaderIni.Close();
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (InitializeMogRepository())
            {
                // Load up the target ini
                LoadSysIni();

                DisableEvents = false;

                if (!allUpToDate)
                {
                    mSplash.Visible = false;
                }

                if (!bRunning)
                {
                    RunBinary();
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }