예제 #1
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);
        }
        private MenuItem AddChangePropertiesToolsMenu(MOG_Ini specialMenuIni, string option, MogMenuItem_Click method)
        {
            MenuItem subItem = new MenuItem();

            subItem.Text = option;

            if (specialMenuIni.SectionExist(option))
            {
                for (int x = 0; x < specialMenuIni.CountKeys(option); x++)
                {
                    string   label = specialMenuIni.GetKeyNameByIndex(option, x);
                    MenuItem child = AddChangePropertiesToolsMenu(specialMenuIni, label, method);
                    if (child != null)
                    {
                        subItem.MenuItems.Add(child);
                    }
                }

                return(subItem);
            }
            else
            {
                subItem.Click += new EventHandler(method);
            }

            return(subItem);
        }
예제 #3
0
        /// <summary>
        /// Load saved ComboBoxItems from an Ini
        /// </summary>
        /// <param name="section">Section where to look for the items</param>
        /// <param name="ini">Ini in which to look for section</param>
        /// <returns>Array of MogTaggedStrings that can be placed directly into a ComboBox</returns>
        private MogTaggedString[] LoadComboBoxItems(string section, MOG_Ini ini)
        {
            int count = ini.CountKeys(section);

            MogTaggedString[] tbStrings = new MogTaggedString[count];

            // Determin the desired directory
            string directory = string.IsNullOrEmpty(this.FolderName) ? MOG_ControllerProject.GetWorkspaceDirectory() : this.FolderName;

            // Check if we are missing a root path?
            if (!Path.IsPathRooted(directory))
            {
                // Append on the current workspace directory
                directory = Path.Combine(MOG_ControllerProject.GetWorkspaceDirectory(), directory.Trim("\\".ToCharArray()));
            }

            // Load the items from the ini
            for (int i = 0; i < count; ++i)
            {
                string filename = ini.GetKeyByIndexSLOW(section, i);

                tbStrings[i] = new MogTaggedString(filename, filename, this.FilenameStyle, directory);
            }
            return(tbStrings);
        }
예제 #4
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();
                    }
                }
            }
        }
예제 #5
0
        public void InitializeItems(MenuItem menu)
        {
            string dir      = mCustomToolsInfo.Substring(0, mCustomToolsInfo.LastIndexOf("\\"));
            string wildcard = mCustomToolsInfo.Substring(mCustomToolsInfo.LastIndexOf("\\") + 1, (mCustomToolsInfo.Length - mCustomToolsInfo.LastIndexOf("\\")) - 1);

            foreach (FileInfo file in DosUtils.FileGetList(dir, wildcard))
            {
                MOG_Ini customTools = new MOG_Ini(file.FullName);

                // Remove the beginning of the info name
                string tmp  = wildcard.Substring(0, wildcard.IndexOf("*"));
                string name = file.Name.Replace(tmp, "");

                // Remove the .info
                name = name.Replace(".info", "");

                // Create the main Item
                MenuItem parent = new MenuItem(name);

                if (customTools.SectionExist("USER_TOOLS"))
                {
                    mClickHandlers = new ArrayList();
                    for (int i = 0; i < customTools.CountKeys("USER_TOOLS"); i++)
                    {
                        parent.MenuItems.Add(CreateItem(customTools.GetKeyNameByIndexSLOW("USER_TOOLS", i), new MogMenuItem_Click(CustomToolMenuItem_Click)));
                    }
                }

                menu.MenuItems.Add(parent);
            }
        }
예제 #6
0
        private void UpdateDriveMappings()
        {
            string output, command;

            MOG_Ini loader = new MOG_Ini(LoaderConfigFile);

            if (loader.KeyExist("LOADER", "updateDriveMappings"))
            {
                if (loader.GetString("LOADER", "updateDriveMappings") == "0")
                {
                    return;
                }
            }

            command = String.Concat("\\\\Gandalf\\Main FileServer - Advent\\S - System Drive\\", "MOG_Drive_Update.exe");

            // Run the batch file.
            Process p = new Process();

            p.StartInfo.FileName = command;

            p.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
            p.StartInfo.CreateNoWindow = true;

            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.UseShellExecute        = false;

            p.Start();
            p.WaitForExit();
            output = p.StandardOutput.ReadToEnd();

            p.Close();

            MapLogs.Text = output;
        }
예제 #7
0
        /// <summary>
        /// Does this button exist in the project defined defaults and is it different?
        /// </summary>
        /// <param name="str"></param>
        /// <param name="platform"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        private bool CheckButtonMatch(string str, string platform, MOG_Ini config)
        {
            string projectName     = mainForm.gMog.GetProject().GetProjectName();
            string platformButtons = projectName + "." + platform + ".Buttons";

            if (config.SectionExist(platformButtons))
            {
                // Lets attempt to set up each button handle found in the handles array
                for (int k = 0; k < config.CountKeys(platformButtons); k++)
                {
                    string buttonKey = "Button" + k.ToString();
                    if (config.KeyExist(platformButtons, buttonKey))
                    {
                        // Get the command string
                        string buttonDefault = config.GetString(platformButtons, buttonKey);

                        // Now assign the name and tool if it was defined
                        if (string.Compare(buttonDefault, str, true) == 0)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
예제 #8
0
        private string InitializeSummaryMap()
        {
            // Summary filename
            string summaryFile = string.Concat(mSourcePath, "\\MOG\\platformSincSummary.", mMog.GetActivePlatform().mPlatformName, ".info");

            // Clear out the summary file if it exists
            if (DosUtils.FileExist(summaryFile))
            {
                if (!DosUtils.FileDelete(summaryFile))
                {
                    throw(new Exception("Could not delete summaryFile:" + summaryFile));
                }
            }

            string summaryPendingFile = summaryFile + "." + Path.GetFileNameWithoutExtension(mTargetConsole) + ".pending";

            if (DosUtils.FileExist(summaryPendingFile))
            {
                if (!DosUtils.FileDelete(summaryPendingFile))
                {
                    throw(new Exception("Could not delete summaryPendingFile:" + summaryPendingFile));
                }
            }

            mSummary     = new MOG_Ini(summaryFile);
            mPendingCopy = new MOG_Ini(summaryPendingFile);

            return(summaryFile);
        }
예제 #9
0
        private void MilestoneTargetTextBox_TextChanged(object sender, System.EventArgs e)
        {
            // Check if any other patches exist
            string patchInfo = string.Concat(MilestoneTargetTextBox.Text, "\\MOG\\Patches\\Patches.Info");

            if (DosUtils.FileExist(patchInfo))
            {
                PatchNameComboBox.Items.Clear();

                // Open it and add it to our patch list
                MOG_Ini patches = new MOG_Ini(patchInfo);

                // Add a key for our local build first.
                PatchNameComboBox.Items.Add("Local");

                if (patches.SectionExist("PATCHES"))
                {
                    for (int i = 0; i < patches.CountKeys("PATCHES"); i++)
                    {
                        PatchNameComboBox.Items.Add(patches.GetKeyNameByIndex("PATCHES", i));
                    }
                }

                if (patches.SectionExist("Local") && patches.KeyExist("Local", "Current"))
                {
                    PatchNameComboBox.Text = patches.GetString("Local", "Current");
                }
                else
                {
                    PatchNameComboBox.Text = "Unknown";
                }
            }
        }
예제 #10
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);
        }
예제 #11
0
        public void SaveToIni(string iniFilename)
        {
            MOG_Ini ini = new MOG_Ini(iniFilename);

            ini.PutString("SQL", "ConnectionString", this.mConnectString);
            ini.Save();
            ini.Close();
        }
예제 #12
0
        public bool Save(string filename)
        {
            MOG_Ini ini = new MOG_Ini(filename);

            ini.PutString("Sync", "Exclusions", GetExclusionString());
            ini.PutString("Sync", "Inclusions", GetInclusionString());
            return(ini.Save());
        }
예제 #13
0
        public SyncLatestSummaryForm(MOG_Ini summary)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            mSummary = summary;

            SummaryListView.SmallImageList = MogUtil_AssetIcons.Images;

            int totalCopied  = 0;
            int totalSkipped = 0;
            int totalDeleted = 0;

            SummaryListView.BeginUpdate();

            totalSkipped += AppendSummary("Files.Skipped", "Skipped", Color.Purple);

            totalCopied  += AppendSummary("Files.New", "New", Color.Green);
            totalCopied  += AppendSummary("Files.Copied", "Updated", Color.Green);
            totalCopied  += AppendSummary("Files.Restored", "Restored", Color.ForestGreen);
            totalCopied  += AppendSummary("Files.Reverted", "Reverted", Color.DarkGreen);
            totalDeleted += AppendSummaryNonExistant("Files.Removed", "Removed", Color.OrangeRed);
            totalCopied  += AppendSummary("Files.Up-to-date", "Up-to-date", Color.Black);
            totalCopied  += AppendSummary("Files.Restamped", "Restamped", Color.ForestGreen);

            totalCopied += AppendSummary("Assets.Canceled", "Canceled", Color.Firebrick);

            totalCopied += AppendSummary("Files.Missing", "Missing", Color.Firebrick);
            totalCopied += AppendSummary("Assets.Missing", "Missing", Color.Firebrick);
            totalCopied += AppendSummary("Files.RemoveError", "Remove Failed", Color.Firebrick);
            totalCopied += AppendSummary("Files.CopyError", "Copy Failed", Color.Firebrick);

            TotalCopiedLabel.Text  = TotalCopiedLabel.Text + " " + totalCopied.ToString();
            TotalSkippedLabel.Text = TotalSkippedLabel.Text + " " + totalSkipped.ToString();
            TotalDeletedLabel.Text = TotalDeletedLabel.Text + " " + totalDeleted.ToString();

            if (SummaryListView.Items.Count == 0)
            {
                // Check if the user canceled?
                if (mSummary.SectionExist("Assets.Canceled"))
                {
                    SummaryListView.Items.Add("User Canceled!");
                }
                else
                {
                    SummaryListView.Items.Add("All assets current!");
                }
            }

            SummaryListView.EndUpdate();

            // Initialize sorting columns
            mSortManager = new ListViewSortManager(SummaryListView, new Type[] { typeof(ListViewTextCaseInsensitiveSort),
                                                                                 typeof(ListViewDateSort),
                                                                                 typeof(ListViewTextCaseInsensitiveSort) });
        }
예제 #14
0
        private void UpdateAndRunCheckBox_Click(object sender, System.EventArgs e)
        {
            // Save this setting
            MOG_Ini loader = new MOG_Ini("MOG.ini");

            loader.PutString("LOADER", "UpdateRun", UpdateAndRunCheckBox.Checked.ToString());
            loader.Save();
            UserAbort = false;
        }
예제 #15
0
        /// <summary>
        /// Load our RadioButtons, given a section and a MOG_Ini
        /// </summary>
        /// <param name="section"></param>
        /// <param name="ini"></param>
        /// <returns></returns>
        private static SortedList LoadRadioButtons(string section, MOG_Ini ini)
        {
            ini.Load(ini.GetFilename());
            int        count        = ini.CountKeys(section);
            SortedList radioButtons = new SortedList();

            for (int i = 0; i < count; ++i)
            {
                radioButtons.Add(ini.GetKeyNameByIndexSLOW(section, i), ini.GetKeyByIndexSLOW(section, i));
            }
            return(radioButtons);
        }
예제 #16
0
        bool Initialize()
        {
            // Load the Network settings from the MOG_SYSTEM_CONFIGFILENAME
            MOG_Ini pConfigFile = MOG_ControllerSystem.GetSystem().GetConfigFile();

            // Check if this server has a managed slave setting?
            if (pConfigFile.KeyExist("Slaves", "ManagedSlavesMax"))
            {
                // Initialize the Server's ManagedSlavesMax
                mManagedSlavesMax = pConfigFile.GetValue("Slaves", "ManagedSlavesMax");
            }

            return(true);
        }
예제 #17
0
        private void LoadButtons(MOG_Ini config)
        {
            foreach (guiPlatformButtonHandles platformButton in PlatformButtonHandles)
            {
                string projectName     = mainForm.gMog.GetProject().GetProjectName();
                string platformButtons = projectName + "." + platformButton.mPlatform + ".Buttons";

                if (config.SectionExist(platformButtons))
                {
                    // Lets attempt to set up each button handle found in the handles array
                    for (int k = 0; k < platformButton.mButtonHandles.Count; k++)
                    {
                        string buttonKey = "Button" + k.ToString();
                        if (config.KeyExist(platformButtons, buttonKey))
                        {
                            string buttonName = "";
                            string buttonTool = "";

                            // Split the value of this key by the :
                            string [] parts = config.GetString(platformButtons, buttonKey).Split("@".ToCharArray());
                            if (parts.Length >= 2)
                            {
                                buttonName = parts[0];
                                buttonTool = parts[1];
                            }
                            else if (parts.Length == 1)
                            {
                                buttonName = parts[0];
                            }

                            // Now assign the name and tool if it was defined
                            if (buttonName.Length != 0 && buttonTool.Length != 0)
                            {
                                ((Button)platformButton.mButtonHandles[k]).Text    = buttonName;
                                ((Button)platformButton.mButtonHandles[k]).Tag     = buttonTool;
                                ((Button)platformButton.mButtonHandles[k]).Visible = true;
                            }
                            // Buttons with a name but no tool specified are to be set to inVisible
                            else if (buttonName.Length != 0)
                            {
                                ((Button)platformButton.mButtonHandles[k]).Text    = buttonName;
                                ((Button)platformButton.mButtonHandles[k]).Tag     = "";
                                ((Button)platformButton.mButtonHandles[k]).Visible = false;
                            }
                        }
                    }
                }
            }
        }
예제 #18
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();
        }
예제 #19
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);
        }
        public void TargetXboxReset()
        {
            string  output         = "";
            string  sourceDir      = mainForm.mAssetManager.GetTargetPath();
            MOG_Ini buttonDefaults = null;

            if (mMog.IsProject())
            {
                // Get the project defaults
                string projectDefaultButtonsFile = mMog.GetProject().GetProjectToolsPath() + "\\" + mMog.GetProject().GetProjectName() + ".Client.Buttons.Default.info";
                if (DosUtils.FileExist(projectDefaultButtonsFile))
                {
                    buttonDefaults = new MOG_Ini(projectDefaultButtonsFile);
                }
            }

            // Get the tool listed on the startup page
            string command = "";

            if (buttonDefaults != null)
            {
                if (buttonDefaults.SectionExist(mMog.GetProject().GetProjectName() + ".Buttons"))
                {
                    if (buttonDefaults.KeyExist(mMog.GetProject().GetProjectName() + ".Buttons", "Reboot"))
                    {
                        command = buttonDefaults.GetString(mMog.GetProject().GetProjectName() + ".Buttons", "Reboot");
                    }
                }
            }

            if (command.IndexOf("[ProjectPath]") != -1)
            {
                command = string.Concat(command.Substring(0, command.IndexOf("[")), mainForm.mAssetManager.GetTargetPath(), command.Substring(command.IndexOf("]") + 1));
            }

            // Make sure the tool we need exits
            if (DosUtils.FileExist(command))
            {
                if (guiCommandLine.ShellExecute(command, string.Concat("/x ", mTargetXbox, " ", sourceDir), ProcessWindowStyle.Hidden, ref output) != 0)
                {
                    MOG_REPORT.ShowMessageBox("XBox Tools", string.Concat(output), MessageBoxButtons.OK);
                }
            }
            else
            {
                MOG_REPORT.ShowMessageBox("XBox Tools", string.Concat("This tool is missing, have you updated to the latest version?"), MessageBoxButtons.OK);
            }
        }
예제 #21
0
        public void ProjectRemove()
        {
            // TODO JKB move some of this into the dll?


            if (mainForm.ConfigProjectsListView.SelectedItems.Count <= 0)
            {
                return;
            }

            string projectName = mainForm.ConfigProjectsListView.SelectedItems[0].Text;

            // remove project called 'projectName' from MOG
            if (MessageBox.Show(string.Concat("Are you sure you want to remove project '", projectName, "'?"), "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

//			MOG_ControllerSystem.GetSystem().ProjectRemove(projectName);

            // TODO: Put this in MOG_System.cpp
            // mark it as deleted in the INI file
            MOG_Ini ini = MOG_ControllerSystem.GetSystem().GetConfigFile();

            ini.RemoveString("projects", projectName);
            ini.PutString("projects.deleted", projectName, "");
            string configFile = ini.GetString(projectName, "ConfigFile");
            string projPath   = MOG_ControllerProject.GetProject().GetProjectPath();

            configFile = configFile.Replace(projPath, string.Concat(projPath, ".deleted"));
            ini.RemoveSection(projectName);
            ini.PutString(string.Concat(projectName, ".deleted"), "ConfigFile", configFile);
            MOG_ControllerSystem.GetSystem().GetProjectNames().Remove(projectName);

            ini.Save();

            // rename directory
            string dirName = MOG_ControllerProject.GetProject().GetProjectPath();

            if (Directory.Exists(dirName) && !Directory.Exists(string.Concat(dirName, ".deleted")))
            {
                Directory.Move(dirName, string.Concat(dirName, ".deleted"));
            }

            // Refresh the MOG system
            MOG_ControllerSystem.GetSystem().GetConfigFile().Load();
            InitializeConfigurations();
        }
예제 #22
0
        /// <summary>
        /// Load the project defined custom buttons list
        /// </summary>
        public void Load()
        {
            if (mainForm.gMog.IsProject())
            {
                // Get the project defaults
                string projectDefaultButtonsFile = mainForm.gMog.GetProject().GetProjectToolsPath() + "\\" + mainForm.gMog.GetProject().GetProjectName() + ".Client.Buttons.Default.info";
                if (DosUtils.FileExist(projectDefaultButtonsFile))
                {
                    MOG_Ini defaults = new MOG_Ini(projectDefaultButtonsFile);
                    LoadButtons(defaults);
                }

                // Load the custom button configs
                LoadButtons(guiUserPrefs.ini);
            }
        }
        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();
        }
예제 #24
0
        public bool Load(string filename)
        {
            if (DosUtils.ExistFast(filename))
            {
                MOG_Ini ini = new MOG_Ini(filename);
                if (ini != null)
                {
                    Clear();
                    AddExclusions(ini.GetString("Sync", "Exclusions"));
                    AddInclusions(ini.GetString("Sync", "Inclusions"));
                    return(true);
                }
            }

            return(false);
        }
예제 #25
0
        public SQLConnectForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            packetSize      = "4096";
            security        = "SSPI";
            persistSecurity = "False";
            dataSource      = "";
            initialCatalog  = "MOG";

            MOG_Ini config = new MOG_Ini(MOG_Main.GetExecutablePath() + "\\MOG.ini");

            if (config.KeyExist("SQL", "ConnectionString"))
            {
                string    connectionString = config.GetString("SQL", "ConnectionString");
                string [] tokens;
                tokens = connectionString.Split(";".ToCharArray());
                foreach (string token in tokens)
                {
                    string [] values = token.Split("=".ToCharArray());
                    if (values != null && values.Length >= 2)
                    {
                        switch (values[0].ToLower())
                        {
                        case "data source":
                            dataSource = values[1];
                            break;

                        case "initial catalog":
                            initialCatalog = values[1];
                            break;
                        }
                    }
                }
            }

            // packet size=4096;integrated security=SSPI;data source="NEMESIS";persist security info=False;initial catalog=mog

            SQLServerComboBox.Text   = dataSource;
            SQLDatabaseComboBox.Text = initialCatalog;

            mConnectString = "";
        }
예제 #26
0
        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);
        }
예제 #27
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);
        }
예제 #28
0
        public void SaveMOGConfiguration()
        {
            // Save out our MOG.ini
            MOG_Ini repositoryIni = new MOG_Ini(Environment.CurrentDirectory + "\\" + LoaderTargetDirectory + "\\MOG.ini");

            // Save repository
            repositoryIni.PutString("MOG", "SystemRepositoryPath", mRepositoryPath);
            repositoryIni.PutString("MOG", "SystemConfiguration", "{SystemRepositoryPath}\\Tools\\" + SystemConfigFile);

            // Only save the connection string if we built one in this loader
            if (mConnectionString.Length > 0)
            {
                repositoryIni.PutString("SQL", "ConnectionString", mConnectionString);
            }

            // Save the ini
            repositoryIni.Save();
        }
예제 #29
0
        public FormLoader(SplashForm splash)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            mSplash   = splash;
            UserAbort = false;
            bRunning  = false;

            MOG_Ini loader = new MOG_Ini(LoaderConfigFile);

            if (loader.KeyExist("LOADER", "UpdateRun"))
            {
                UpdateAndRunCheckBox.Checked = Convert.ToBoolean(loader.GetString("LOADER", "UpdateRun"));
            }
        }
예제 #30
0
        public RequestBuildForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            string buildTool = MOG_ControllerSystem.LocateTool("Configs", "Build.Options.Info");

            if (DosUtils.FileExist(buildTool))
            {
                mOptions = new MOG_Ini(buildTool);
                InitFormOptions();
            }

            // Load prefs
            PreloadLastSettings();
        }