Пример #1
0
 private void InitFormOptions()
 {
     if (mOptions.SectionExist("Builds"))
     {
         for (int i = 0; i < mOptions.CountKeys("Builds"); i++)
         {
             string command = mOptions.GetKeyNameByIndexSLOW("Builds", i);
             BuildsListBox.Items.Add(command);
         }
     }
 }
Пример #2
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";
                }
            }
        }
Пример #3
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);
        }
Пример #4
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);
            }
        }
Пример #5
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);
        }
        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);
        }
Пример #7
0
        private int AppendSummary(string section, string comment, Color nodeColor)
        {
            // Get all the file copies
            if (mSummary.SectionExist(section))
            {
                string[] keys = mSummary.GetSectionKeys(section);
                foreach (string key in keys)
                {
                    // Get the asset/file information from the summary file
                    string assetName = mSummary.GetString(section, key);
                    string fileName  = key;

                    // Trim any starting '\'
                    if (fileName != null && fileName.Length > 0)
                    {
                        fileName = fileName.TrimStart("\\".ToCharArray());
                    }

                    try
                    {
                        string fullfilename = MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory() + "\\" + fileName;

                        ListViewItem item = new ListViewItem();
                        item.Text      = Path.GetFileName(fileName);
                        item.ForeColor = nodeColor;

                        FileInfo file = new FileInfo(fullfilename);
                        item.SubItems.Add(file.LastWriteTime.ToShortDateString() + " " + file.LastWriteTime.ToShortTimeString());
                        item.SubItems.Add(comment);

                        item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(fullfilename);

                        SummaryListView.Items.Add(item);
                    }
                    catch (Exception e)
                    {
                        MOG_Report.ReportMessage("Update Summary", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR);
                    }
                }

                return(mSummary.CountKeys(section));
            }

            return(0);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
0
        private int CreateComboControls(int startY, MOG_Ini dialogInfo, string section)
        {
            int x = 8;
            int y = startY;

            SuspendLayout();
            for (int i = 0; i < dialogInfo.CountKeys(section); i++)
            {
                string key        = dialogInfo.GetKeyNameByIndexSLOW(section, i);
                string keySection = section + "." + key;

                if (dialogInfo.SectionExist(keySection))
                {
                    if (dialogInfo.KeyExist(keySection, "Description"))
                    {
                        y = CreateLabelControl(x, y, dialogInfo.GetString(keySection, "Description"));
                    }
                    else
                    {
                        MOG_Prompt.PromptMessage("Custom Tool", "Cound not correctly create ComboControl due to missing (Description) field in info", Environment.StackTrace);
                    }

                    if (dialogInfo.KeyExist(keySection, "range"))
                    {
                        if (dialogInfo.KeyExist(keySection, "defaultValue"))
                        {
                            y = CreateComboBoxControl(x, y, dialogInfo.GetString(keySection, "range"), dialogInfo.GetString(keySection, "defaultValue"));
                        }
                        else
                        {
                            y = CreateComboBoxControl(x, y, dialogInfo.GetString(keySection, "range"), "0");
                        }
                    }
                    else
                    {
                        MOG_Prompt.PromptMessage("Custom Tool", "Cound not correctly create ComboControl due to missing (Range) field in info", Environment.StackTrace);
                    }
                }
            }

            ResumeLayout(false);

            return(y);
        }
Пример #13
0
        public void Update()
        {
            if (DosUtils.FileExist(string.Concat(mMog.GetProject().GetProjectPath(), "\\Surveys\\Contents.info")))
            {
                MOG_Ini contentsInfo = new MOG_Ini(string.Concat(mMog.GetProject().GetProjectPath(), "\\Surveys\\Contents.info"));
                mainForm.SurveyListView.Items.Clear();

                for (int i = 0; i < contentsInfo.CountKeys("SURVEYS"); i++)
                {
                    string       SurveyName = contentsInfo.GetKeyNameByIndex("SURVEYS", i);
                    ListViewItem item       = new ListViewItem(contentsInfo.GetString(SurveyName, "Title"));
                    item.SubItems.Add(contentsInfo.GetString(SurveyName, "Time"));
                    item.SubItems.Add(contentsInfo.GetString(SurveyName, "Category"));
                    item.SubItems.Add(contentsInfo.GetString(SurveyName, "Status"));
                    item.SubItems.Add(contentsInfo.GetString(SurveyName, "Priority"));

                    mainForm.SurveyListView.Items.Add(item);
                }
            }
        }
Пример #14
0
        private void InitializeDialog()
        {
            if (DosUtils.FileExist(mDialogInfoFilename))
            {
                MOG_Ini dialogInfo = new MOG_Ini(mDialogInfoFilename);

                // Init the controls
                if (dialogInfo.SectionExist("Controls"))
                {
                    int Y = 8;

                    for (int i = 0; i < dialogInfo.CountKeys("Controls"); i++)
                    {
                        string control        = dialogInfo.GetKeyNameByIndexSLOW("Controls", i);
                        string controlSection = dialogInfo.GetKeyByIndexSLOW("Controls", i);
                        switch (control.ToLower())
                        {
                        case "toggleoptions":
                            Y = CreateToggleCroupControl(Y, dialogInfo, controlSection);
                            break;

                        case "combooptions":
                            Y = CreateComboControls(Y, dialogInfo, controlSection);
                            break;

                        case "editoptions":
                            Y = CreateEditControls(Y, dialogInfo, controlSection);
                            break;
                        }
                    }

                    // Make sure our form is tall enough to handle the new controls
                    if (Height < Y)
                    {
                        Height = Y + 80;
                    }
                }
            }
        }
Пример #15
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);
        }
Пример #16
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();
                        }
                    }
                }
            }
        }
        private void InitializeXboxList()
        {
            if (mMog.IsUser())
            {
                // Get the project ini
                MOG_Ini configFile = new MOG_Ini(mMog.GetProject().GetProjectConfigFilename());

                // Clear our target combo box
                mainForm.AssetManagerLocalDataXboxTargetComboBox.Items.Clear();

                // Add each target to the combo box
                if (configFile.SectionExist("Xboxes"))
                {
                    for (int x = 0; x < configFile.CountKeys("Xboxes"); x++)
                    {
                        mainForm.AssetManagerLocalDataXboxTargetComboBox.Items.Add(configFile.GetKeyNameByIndex("Xboxes", x));
                    }
                }

                // Check for a user defined console list
                string userPath       = mMog.GetUser().GetUserToolsPath();
                string consoleIniFile = string.Concat(userPath, "\\consoles.ini");

                if (DosUtils.FileExist(consoleIniFile))
                {
                    MOG_Ini userConsoleIni = new MOG_Ini(consoleIniFile);

                    // Add each target to the combo box
                    if (userConsoleIni.SectionExist("Xboxes"))
                    {
                        for (int x = 0; x < userConsoleIni.CountKeys("Xboxes"); x++)
                        {
                            mainForm.AssetManagerLocalDataXboxTargetComboBox.Items.Add(userConsoleIni.GetKeyNameByIndex("Xboxes", x));
                        }
                    }
                }
            }
        }
Пример #18
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();
        }
Пример #19
0
        private void PopulatePermissions()
        {
            // Clear the file info tree
            PriviledgesTreeView.Nodes.Clear();
            PriviledgesTreeView.Sorted = true;

            string     groupSection  = MOG_Priviledges.MainSections.Group.ToString();
            SortedList groupNodeList = new SortedList();

            if (mPriviledgesIni.SectionExist(groupSection))
            {
                int groupsCount = mPriviledgesIni.CountKeys(groupSection);
                for (int i = 0; i < groupsCount; ++i)
                {
                    string   groupName = mPriviledgesIni.GetKeyNameByIndex(groupSection, i);
                    TreeNode groupNode = new TreeNode(groupName);
                    groupNodeList.Add(groupName, groupNode);
                    PriviledgesTreeView.Nodes.Add(groupNode);
                }
            }

            string userSection = MOG_Priviledges.MainSections.Users.ToString();

            // If [Users] exists...
            if (mPriviledgesIni.SectionExist(userSection))
            {
                int      usersCount = mPriviledgesIni.CountKeys(userSection);
                string[] users      = new string[usersCount];
                string[] groups     = new string[usersCount];

                // Foreach user...
                for (int i = 0; i < usersCount; ++i)
                {
                    // Get user's name and group
                    string userName  = mPriviledgesIni.GetKeyNameByIndex(userSection, i);
                    string userGroup = mPriviledgesIni.GetKeyByIndex(userSection, i);

                    // Create our use's node
                    TreeNode userNode = new TreeNode(userName);

                    SortedList availablePermissions = new SortedList();

                    // If the userGroup exists...
                    if (mPriviledgesIni.SectionExist(userGroup))
                    {
                        int    permissionsCount = mPriviledgesIni.CountKeys(userGroup);
                        string key, value;

                        // Foreach permission in userGroup...
                        for (int j = 0; j < permissionsCount; ++j)
                        {
                            key   = mPriviledgesIni.GetKeyNameByIndex(userGroup, j);
                            value = mPriviledgesIni.GetKeyByIndex(userGroup, j);

                            // Populate the permissions sorted list
                            availablePermissions.Add(key, value);
                        }                         // end for on permissions

                        if (mPriviledgesIni.SectionExist(userName))
                        {
                            int userPermissionsCount = mPriviledgesIni.CountKeys(userName);

                            // Foreach userPermission...
                            for (int k = 0; k < userPermissionsCount; ++k)
                            {
                                key   = mPriviledgesIni.GetKeyNameByIndex(userName, k);
                                value = mPriviledgesIni.GetKeyByIndex(userName, k);

                                string currentValue = (string)availablePermissions.GetByIndex(availablePermissions.IndexOfKey(key));

                                if (availablePermissions.ContainsKey(key) &&
                                    currentValue != value)
                                {
                                    string   newPermissionEntry = key + "=" + value;
                                    TreeNode overrideNode       = new TreeNode(newPermissionEntry);
                                    overrideNode.ForeColor = Color.Red;
                                    userNode.Nodes.Add(overrideNode);
                                    availablePermissions.Remove(key);
                                }
                            }
                        }
                    }

                    // Foreach permission for this user...
                    foreach (DictionaryEntry userPermission in availablePermissions)
                    {
                        string   permissionEntry = userPermission.Key.ToString() + "=" + userPermission.Value.ToString();
                        TreeNode permissionNode  = new TreeNode(permissionEntry);
                        if (userPermission.Value.ToString().ToLower() == "true")
                        {
                            permissionNode.Checked = true;
                        }
                        else
                        {
                            permissionNode.Checked = false;
                        }
                        userNode.Nodes.Add(permissionNode);
                    }

                    TreeNode groupNode = (TreeNode)groupNodeList.GetByIndex(groupNodeList.IndexOfKey(userGroup));
                    groupNode.Nodes.Add(userNode);
                }         // end for on users
            }             // end if on [Users]
        }
Пример #20
0
        /// <summary> InitializeAssetIcons
        /// Loads all the bmp's specified in the asset declarations
        /// in the Project.ini files.  Each bmp is added to a
        /// list allong with its key added to a corresponding list
        /// for later searching.
        /// </summary>
        static public void AssetIconInitialize()
        {
            // Check to see if our project is loaded
            if (!MOG_ControllerProject.IsProject())
            {
                return;
            }

            // Only allow population of the images array once
            if (mAssetTypes.Count > 0)
            {
                return;
            }

            // Add the active item icon first
            // Get the image
            if (DosUtils.FileExist(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\SelectIcon.bmp")))
            {
                // Get the group image
                Image myImage = new Bitmap(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\SelectIcon.bmp"));

                // Add the image and the type to the arrayLists
                mAssetTypeImages.Images.Add(myImage);
                mAssetTypes.Add("dot");
            }

            // Open the project.ini
            MOG_Ini ini = new MOG_Ini(MOG_ControllerProject.GetProject().GetProjectConfigFilename());

            // Walk through all the assets
            for (int x = 0; x < ini.CountKeys("Assets"); x++)
            {
                // Get the asset name
                string imageName = ini.GetString(ini.GetKeyNameByIndex("Assets", x), "Icon");
                // Check if we have an image?
                if (imageName.Length > 0)
                {
                    string assetKey = ini.GetKeyNameByIndex("Assets", x).ToLower();
                    LoadIcon(imageName, ini.GetKeyNameByIndex("Assets", x).ToLower());

                    // Check for a lock image
                    string lockImageName     = Path.GetFileNameWithoutExtension(imageName) + "_locked";
                    string lockFullImageName = imageName.Replace(Path.GetFileNameWithoutExtension(imageName), lockImageName);
                    LoadIcon(lockFullImageName, assetKey + "_locked");

                    // Check for a ReadLock image
                    lockImageName     = Path.GetFileNameWithoutExtension(imageName) + "_readlocked";
                    lockFullImageName = imageName.Replace(Path.GetFileNameWithoutExtension(imageName), lockImageName);
                    LoadIcon(lockFullImageName, assetKey + "_readlocked");
                }
            }

            if (DosUtils.FileExist(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\Group.bmp")))
            {
                // Get the group image
                Image myImage = new Bitmap(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\Group.bmp"));

                // Add the image and the type to the arrayLists
                mAssetTypeImages.Images.Add(myImage);
                mAssetTypes.Add("group");
            }

            mAssetTypeImages.TransparentColor = Color.Magenta;

            // Initialize state icons
            if (DosUtils.DirectoryExist(MOG_ControllerSystem.GetSystem().GetSystemToolsPath() + "\\Images\\States"))
            {
                FileInfo [] stateImages = DosUtils.FileGetList(MOG_ControllerSystem.GetSystem().GetSystemToolsPath() + "\\Images\\States", "*.bmp");

                foreach (FileInfo stateImage in stateImages)
                {
                    LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName, Path.GetFileNameWithoutExtension(stateImage.Name));
                }
            }
        }
        private void CloseButton_Click(object sender, System.EventArgs e)
        {
LocateRepository:

            try
            {
                // Determine if the path selected is valid
                if (!File.Exists(MOGSelectedRepository + "\\MogRepository.ini"))
                {
                    MessageBox.Show(this, "The selected path is not a valid MOG repository.", "Invalid repository");
                    this.DialogResult = DialogResult.Retry;
                    return;
                }
                else
                {
                    // Load the MogRepository.ini file found at the location specified by the user
                    MOG_Ini repository = new MOG_Ini(MOGSelectedRepository + "\\MogRepository.ini");

                    // Does this MogRepository have at least one valid repository path
                    if (repository.SectionExist("Mog_Repositories"))
                    {
                        // If there is only one specified repository, choose that one
                        if (repository.CountKeys("Mog_Repositories") == 1)
                        {
                            // Get the section
                            string section = repository.GetKeyNameByIndexSLOW("Mog_Repositories", 0);

                            // Get the path from that section
                            if (repository.SectionExist(section) && repository.KeyExist(section, "SystemRepositoryPath"))
                            {
                                mRepositoryPath = repository.GetString(section, "SystemRepositoryPath");

                                // Now set the config
                                if (repository.SectionExist(section) && repository.KeyExist(section, "SystemConfiguration"))
                                {
                                    mConfigFile = repository.GetString(section, "SystemConfiguration");
                                }
                                else
                                {
                                    MessageBox.Show(this, "The selected path does not have or is missing a System Configuration file.", "Invalid repository");
                                    goto LocateRepository;
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "The selected path does not have or is missing a repository path.", "Invalid repository");
                                goto LocateRepository;
                            }
                        }
                        else if (repository.CountKeys("Mog_Repositories") > 1)
                        {
                            // The user must now choose which repository to use
                            MogForm_MultiRepository multiRep = new MogForm_MultiRepository();
                            for (int i = 0; i < repository.CountKeys("Mog_Repositories"); i++)
                            {
                                multiRep.RepositoryComboBox.Items.Add(repository.GetKeyNameByIndexSLOW("Mog_Repositories", i));
                            }
                            multiRep.RepositoryComboBox.SelectedIndex = 0;

                            // Show the form to the user and have him select between the repository sections found
                            if (multiRep.ShowDialog() == DialogResult.OK)
                            {
                                // Get the section
                                string userSection = multiRep.RepositoryComboBox.Text;

                                // Get the path from that section
                                if (repository.SectionExist(userSection) && repository.KeyExist(userSection, "SystemRepositoryPath"))
                                {
                                    mRepositoryPath = repository.GetString(userSection, "SystemRepositoryPath");

                                    // Now set the config
                                    if (repository.SectionExist(userSection) && repository.KeyExist(userSection, "SystemConfiguration"))
                                    {
                                        mConfigFile = repository.GetString(userSection, "SystemConfiguration");
                                    }
                                    else
                                    {
                                        MessageBox.Show(this, "The selected path does not have or is missing a System Configuration file.", "Invalid repository");
                                        goto LocateRepository;
                                    }
                                }
                                else
                                {
                                    MessageBox.Show(this, "The selected path does not have or is missing a repository path.", "Invalid repository");
                                    goto LocateRepository;
                                }
                            }
                            else
                            {
                                goto LocateRepository;
                            }
                        }
                        else
                        {
                            MessageBox.Show(this, "The selected path does not have or is missing a repository path.", "Invalid repository");
                            goto LocateRepository;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Invalid repository");
                goto LocateRepository;
            }


            // Double check that we got a valid mog repository path
            if (mRepositoryPath.Length == 0)
            {
                goto LocateRepository;
            }
            else
            {
                // Save out our MOG.ini
                SaveMOGConfiguration();

                if (mForceRestart)
                {
                    // Close our application
                    MessageBox.Show(this, "Changing of the MOG repository requires MOG to restart.  We are now shutting down the client. When complete, restart MOG for changes to be effective.", "Shutting down MOG", MessageBoxButtons.OK);
                }
            }
        }
Пример #22
0
        private void PopulateSyncTree(MOG_Ini ProjectPlatfromSinc, MOG_Ini userPlatfromSinc)
        {
            // Clear our list
            XboxSincTreeView.Nodes.Clear();

            #region Project platform defaults
            // Load the project platform defaults
            TreeNode parentPlatform = new TreeNode(MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName());
            if ((ProjectPlatfromSinc != null) && (ProjectPlatfromSinc.SectionExist("xbox")))
            {
                for (int x = 0; x < ProjectPlatfromSinc.CountKeys("Xbox"); x++)
                {
                    TreeNode node  = new TreeNode(FormatString(ProjectPlatfromSinc.GetKeyNameByIndexSLOW("Xbox", x)));
                    TreeNode child = new TreeNode(FormatString(ProjectPlatfromSinc.GetKeyByIndexSLOW("Xbox", x)));
                    node.Checked = true;
                    node.Nodes.Add(child);

                    parentPlatform.Nodes.Add(node);
                }
            }

            // Add user nodes
            if (userPlatfromSinc != null)
            {
                if (userPlatfromSinc.SectionExist("xbox"))
                {
                    for (int x = 0; x < userPlatfromSinc.CountKeys("Xbox"); x++)
                    {
                        TreeNode node  = new TreeNode(FormatString(userPlatfromSinc.GetKeyNameByIndexSLOW("Xbox", x)));
                        TreeNode child = new TreeNode(FormatString(userPlatfromSinc.GetKeyByIndexSLOW("Xbox", x)));
                        node.Checked   = true;
                        node.ForeColor = Color.Blue;
                        node.Nodes.Add(child);

                        parentPlatform.Nodes.Add(node);
                    }
                }
            }
            XboxSincTreeView.Nodes.Add(parentPlatform);
            #endregion

            #region Filemaps
            // Load project Filemaps
            TreeNode parentFileMaps = new TreeNode("FileMap");
            if ((ProjectPlatfromSinc != null) && (ProjectPlatfromSinc.SectionExist("FileMap")))
            {
                for (int x = 0; x < ProjectPlatfromSinc.CountKeys("FileMap"); x++)
                {
                    TreeNode node  = new TreeNode(FormatString(ProjectPlatfromSinc.GetKeyNameByIndexSLOW("FileMap", x)));
                    TreeNode child = new TreeNode(FormatString(ProjectPlatfromSinc.GetKeyByIndexSLOW("FileMap", x)));
                    node.Checked = true;
                    node.Nodes.Add(child);

                    parentFileMaps.Nodes.Add(node);
                }
            }

            // Add user nodes
            if (userPlatfromSinc != null)
            {
                if (userPlatfromSinc.SectionExist("FileMap"))
                {
                    for (int x = 0; x < userPlatfromSinc.CountKeys("FileMap"); x++)
                    {
                        TreeNode node = new TreeNode(FormatString(userPlatfromSinc.GetKeyNameByIndexSLOW("FileMap", x)));
                        node.ForeColor = Color.Blue;
                        node.Checked   = true;

                        TreeNode child = new TreeNode(FormatString(userPlatfromSinc.GetKeyByIndexSLOW("FileMap", x)));
                        node.ForeColor = Color.Blue;
                        node.Nodes.Add(child);

                        parentFileMaps.Nodes.Add(node);
                    }
                }
            }

            XboxSincTreeView.Nodes.Add(parentFileMaps);
            #endregion

            #region Remaps
            // Load Remaps
            TreeNode parentRemaps = new TreeNode("ReMap");
            if ((ProjectPlatfromSinc != null) && (ProjectPlatfromSinc.SectionExist("ReMap")))
            {
                for (int x = 0; x < ProjectPlatfromSinc.CountKeys("ReMap"); x++)
                {
                    TreeNode node = new TreeNode(FormatString(ProjectPlatfromSinc.GetKeyNameByIndexSLOW("ReMap", x)));
                    node.Checked = true;
                    node.Nodes.Add(FormatString(ProjectPlatfromSinc.GetKeyByIndexSLOW("ReMap", x)));

                    parentRemaps.Nodes.Add(node);
                }
            }

            if ((userPlatfromSinc != null) && (userPlatfromSinc.SectionExist("ReMap")))
            {
                for (int x = 0; x < userPlatfromSinc.CountKeys("ReMap"); x++)
                {
                    TreeNode node = new TreeNode(FormatString(userPlatfromSinc.GetKeyNameByIndexSLOW("ReMap", x)));
                    node.Checked   = true;
                    node.ForeColor = Color.Blue;
                    node.Nodes.Add(FormatString(userPlatfromSinc.GetKeyByIndexSLOW("ReMap", x)));

                    parentRemaps.Nodes.Add(node);
                }
            }

            XboxSincTreeView.Nodes.Add(parentRemaps);
            #endregion

            #region Exclusions
            // Load Exclusions
            TreeNode parentExclusions = new TreeNode("Exclusion");

            if ((ProjectPlatfromSinc != null) && (ProjectPlatfromSinc.SectionExist("Exclusion")))
            {
                for (int x = 0; x < ProjectPlatfromSinc.CountKeys("Exclusion"); x++)
                {
                    TreeNode node = new TreeNode(FormatString(ProjectPlatfromSinc.GetKeyNameByIndexSLOW("Exclusion", x)));
                    node.Checked = true;
                    node.Nodes.Add(FormatString(ProjectPlatfromSinc.GetKeyByIndexSLOW("Exclusion", x)));

                    parentExclusions.Nodes.Add(node);
                }
            }

            // Add user nodes
            if (userPlatfromSinc != null)
            {
                if (userPlatfromSinc.SectionExist("Exclusion"))
                {
                    for (int x = 0; x < userPlatfromSinc.CountKeys("Exclusion"); x++)
                    {
                        TreeNode node = new TreeNode(FormatString(userPlatfromSinc.GetKeyNameByIndexSLOW("Exclusion", x)));
                        node.ForeColor = Color.Blue;
                        node.Checked   = true;

                        TreeNode child = new TreeNode(FormatString(userPlatfromSinc.GetKeyByIndexSLOW("Exclusion", x)));
                        node.ForeColor = Color.Blue;
                        node.Nodes.Add(child);

                        parentExclusions.Nodes.Add(node);
                    }
                }
            }

            XboxSincTreeView.Nodes.Add(parentExclusions);
            #endregion
        }
Пример #23
0
        /// <summary>
        /// Load a report form from a file and populate it
        /// </summary>
        /// <param name="filename"></param>
        public void LoadReportList(string filename)
        {
            MOG_Ini report = new MOG_Ini(filename);

            // Set the form title
            Text = Path.GetFileName(filename);

            if (report.SectionExist("ASSETS"))
            {
                ListListView.Items.Clear();

                ListListView.BeginUpdate();

                ProgressMax(report.CountKeys("ASSETS"));

                for (int x = 0; x < report.CountKeys("ASSETS"); x++)
                {
                    MOG_Filename mogAsset  = new MOG_Filename(report.GetKeyNameByIndexSLOW("ASSETS", x));
                    string       extraInfo = report.GetKeyByIndexSLOW("ASSETS", x);

                    MOG_Properties pProperties = new MOG_Properties(mogAsset);

                    string version        = mogAsset.GetVersionTimeStamp();
                    string currentVersion = MOG_DBAssetAPI.GetAssetVersion(mogAsset);                    //mCurrentInfo.GetString("ASSETS", mogAsset.GetAssetName());

                    MOG_Time assetTime        = new MOG_Time(version);
                    MOG_Time currentAssetTime = new MOG_Time(currentVersion);

                    ListViewItem item = new ListViewItem();

                    // We have support for the old lists as well as the new ones that have extra information stored.
                    if (string.Compare(extraInfo, "ReportList", true) != 0)
                    {
                        string [] extraItems = extraInfo.Split(",".ToCharArray());
                        foreach (string extra in extraItems)
                        {
                            if (item.Text.Length == 0)
                            {
                                item.Text = extra;
                            }
                            else
                            {
                                item.SubItems.Add(extra);
                            }
                        }

                        // Update the version
                        if (assetTime.Compare(currentAssetTime) != 0)
                        {
                            item.SubItems[FindColumn("Version")].Text      = currentAssetTime.FormatString("");
                            item.SubItems[FindColumn("Version")].ForeColor = Color.Red;
                        }
                    }
                    else
                    {
                        item = AddItemToListView(mogAsset, pProperties, MOG_ControllerRepository.GetAssetBlessedVersionPath(mogAsset, version).GetEncodedFilename());

                        // Get version
                        if (assetTime.Compare(currentAssetTime) != 0)                                                                                           // Version
                        {
                            item.SubItems[FindColumn("Version")].Text      = currentAssetTime.FormatString("");
                            item.SubItems[FindColumn("Version")].ForeColor = Color.Red;
                            version = currentVersion;
                        }
                        else
                        {
                            item.SubItems[FindColumn("Version")].Text = assetTime.FormatString("");
                        }
                    }

                    // Icon
                    item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(mogAsset.GetAssetFullName());

                    ListListView.Items.Add(item);

                    ProgressStep();
                }

                UpdateAssetTotals();
                ListListView.EndUpdate();
                ProgressReset();
            }
        }
Пример #24
0
        public void RefreshTab()
        {
            int     newItems = 0;
            MOG_Ini contents = new MOG_Ini();

            // Determine which boxes we are looking at, Inbox or outBox
            string  boxName     = "Unknown";
            TabPage pagePointer = null;

            if (string.Compare(mParent.mainForm.AssetManagerBoxesTabControl.SelectedTab.Name, "AssetManagerInboxTabPage") == 0)
            {
                boxName     = "Inbox";
                pagePointer = mParent.mainForm.AssetManagerInboxTabControl.TabPages[(int)guiAssetManager.InboxTabOrder.MESSAGES];
            }
            else if (string.Compare(mParent.mainForm.AssetManagerBoxesTabControl.SelectedTab.Name, "AssetManagerOutboxTabPage") == 0)
            {
                boxName     = "Outbox";
                pagePointer = mParent.mainForm.AssetManagerOutboxTabControl.TabPages[(int)guiAssetManager.OutboxTabOrder.MESSAGES];
            }
            else
            {
                MOG_REPORT.ShowMessageBox("ERROR", "No valid box selected in mAssetManager.Messages.RefreshTab", MessageBoxButtons.OK);
                return;
            }

            // Check all tasks for the new status
            FileInfo file = new FileInfo(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", boxName, "\\Contents.info"));

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

                // Find the items in the TASKS section
                if (contents.SectionExist("Messages"))
                {
                    for (int i = 0; i < contents.CountKeys("Messages"); i++)
                    {
                        string messageName   = contents.GetKeyNameByIndex("Messages", i);
                        string messageStatus = contents.GetString(messageName, "Status");
                        if (string.Compare(messageStatus, "New", true) == 0)
                        {
                            newItems++;
                        }
                    }
                }
            }

            // If we have new items, update the tab
            string tabName;

            if (newItems > 0)
            {
                tabName = string.Concat("Messages ", boxName, "(", newItems.ToString(), ") New");
            }
            else
            {
                tabName = string.Concat("Messages ", boxName);
            }

            // Store this count
            mNewMessageCount = newItems;

            // Set the tab name
            if (pagePointer != null)
            {
                pagePointer.Text = tabName;
            }
        }
Пример #25
0
        private void SyncSaveButton_Click(object sender, System.EventArgs e)
        {
            SyncSaveFileDialog.InitialDirectory = MOG_ControllerProject.GetUser().GetUserToolsPath();

            // Save this custom sync file
            if (SyncSaveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string  syncFilename = SyncSaveFileDialog.FileName;
                MOG_Ini syncFile     = new MOG_Ini(syncFilename);

                foreach (TreeNode sectionNode in XboxSincTreeView.Nodes)
                {
                    string section = sectionNode.Text;

                    foreach (TreeNode keyNode in sectionNode.Nodes)
                    {
                        string key = keyNode.Text;

                        if (keyNode.Nodes.Count > 0)
                        {
                            foreach (TreeNode valNode in keyNode.Nodes)
                            {
                                string val = valNode.Text;

                                syncFile.PutString(section, key, val);
                            }
                        }
                        else
                        {
                            syncFile.PutSectionString(section, key);
                        }
                    }
                }

                // Verify that the newly created sync file has the correct number amount of sections
                if (syncFile.SectionExist("Filemap"))
                {
                    if (syncFile.CountKeys("Filemap") > 0 && string.Compare(SyncProjectMapComboBox.Text, "None") == 0)
                    {
                        MOG_Prompt.PromptMessage("Missing syncfile data", "The required 'FILEMAP' section was not found in this custom sync file.  Aborting...");
                        syncFile.CloseNoSave();
                        return;
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Missing syncfile data", "The required 'FILEMAP' section was not found in this custom sync file.  Aborting...");
                    syncFile.CloseNoSave();
                    return;
                }

                // Make sure we have a valid root definition
                if (syncFile.SectionExist(MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName()))
                {
                    if (syncFile.CountKeys(MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName()) > 0 && string.Compare(SyncProjectMapComboBox.Text, "None") == 0)
                    {
                        MOG_Prompt.PromptMessage("Missing syncfile data", "The required '" + MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName() + "' section was not found in this custom sync file.  Aborting...");
                        syncFile.CloseNoSave();
                        return;
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Missing syncfile data", "The required '" + MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName() + "' section was not found in this custom sync file.  Aborting...");
                    syncFile.CloseNoSave();
                    return;
                }

                // Save out our new syncFile
                syncFile.Save();
                SyncSaveButton.Enabled = false;

                mUserMap = syncFile.GetFilename();
            }
        }
Пример #26
0
        public guiSound(MogMainForm handle, SplashForm SplashScreen, string configFilename, string soundClass)
        {
            mTheme          = soundClass;
            mHandle         = handle;
            mSoundAvailable = true;

            InitializeSoundEngine();

            // Load the sound ini
            string iniPath    = Application.StartupPath;
            string configFile = string.Concat(iniPath, "\\", configFilename);

            if (DosUtils.FileExist(configFile))
            {
                mConfig    = new MOG_Ini(configFile);
                mSoundPath = string.Concat(iniPath, "\\ClientSounds");

                // Update the sound menu with the scheme choices
                if (mConfig.SectionExist("Themes"))
                {
                    // Add a menuItem for each them found in the ini
                    for (int i = 0; i < mConfig.CountKeys("Themes"); i++)
                    {
                        // Assign the click event to each menu item
                        ToolStripMenuItem item = new ToolStripMenuItem(mConfig.GetKeyNameByIndexSLOW("Themes", i));
                        item.Click += new System.EventHandler(this.SoundMenu_OnClick);

                        // Set the check mark on the theme that pass passed in to the constructor
                        if (string.Compare(item.Text, mTheme, true) == 0)
                        {
                            item.Checked = true;
                        }

                        // Add th menu item
                        mHandle.themeToolStripMenuItem.DropDownItems.Add(item);
                    }

                    // Setup default theme
                    if (mTheme == null)
                    {
                        if (mHandle.themeToolStripMenuItem.DropDownItems.Count > 0)
                        {
                            mTheme = mHandle.themeToolStripMenuItem.DropDownItems[0].Text;
                            ToolStripMenuItem defaultTheme = mHandle.themeToolStripMenuItem.DropDownItems[0] as ToolStripMenuItem;
                            defaultTheme.Checked = true;
                        }
                    }
                }

                // Get our current sounds version
                if (mConfig.SectionExist("Version"))
                {
                    mVersion = Convert.ToInt32(mConfig.GetString("SoundsVersion", "Version"));
                }
                else
                {
                    mVersion = 0;
                }

                // Get all default sounds
                if (mConfig.SectionExist("SOUNDS"))
                {
                    string SourceSoundPath = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\" + mConfig.GetString("Sounds", "Root");
                    // Make sure we have a current sound directory
                    if (!DosUtils.DirectoryExist(mSoundPath))
                    {
                        DosUtils.DirectoryCreate(mSoundPath);
                    }

                    // Make sure we have all the needed sounds
                    if (DosUtils.FileExist(string.Concat(SourceSoundPath, "\\version.ini")))
                    {
                        MOG_Ini soundVersion = new MOG_Ini(string.Concat(SourceSoundPath, "\\version.ini"));

                        int sourceVersion = Convert.ToInt32(soundVersion.GetString("SoundsVersion", "Version"));

                        if (sourceVersion > mVersion)
                        {
                            // Update all our sounds
                            foreach (FileInfo file in DosUtils.FileGetList(SourceSoundPath, "*.wav"))
                            {
                                string target = string.Concat(mSoundPath, "\\", file.Name);
                                if (DosUtils.FileCopyModified(file.FullName, target))
                                {
                                    SplashScreen.updateSplashNoStep("UPDATING: " + file.Name, 0);
                                }
                            }

                            // Update our version number
                            mConfig.PutString("SoundsVersion", "Version", sourceVersion.ToString());
                            mConfig.Save();
                        }
                    }
                }
            }

            // Set the main theme to be the same as this private version
            mHandle.mSoundScheme = mTheme;
        }
Пример #27
0
        private int CreateToggleCroupControl(int startY, MOG_Ini dialogInfo, string section)
        {
            SuspendLayout();

            GroupBox groupBox = new System.Windows.Forms.GroupBox();

            groupBox.Location = new System.Drawing.Point(8, startY);
            groupBox.Name     = section;
            groupBox.TabIndex = 2;
            groupBox.TabStop  = false;
            groupBox.Text     = section;
            groupBox.Visible  = true;
            groupBox.Parent   = ControlsPanel;

            groupBox.SuspendLayout();

            int X = 5;
            int Y = 12;

            //Graphics Gdi = Graphics.FromImage(pictureBox1.Image);

            for (int i = 0; i < dialogInfo.CountKeys(section); i++)
            {
                RadioButton radioButton = new System.Windows.Forms.RadioButton();

                string option  = dialogInfo.GetKeyNameByIndexSLOW(section, i);
                string command = dialogInfo.GetKeyByIndexSLOW(section, i);

                radioButton.Location  = new System.Drawing.Point(X, Y);
                radioButton.Name      = command;
                radioButton.TabIndex  = 0;
                radioButton.FlatStyle = FlatStyle.System;
                radioButton.Text      = option;
                radioButton.Visible   = true;
                radioButton.Parent    = groupBox;

                // Measure string.
                radioButton.Width = MeasureString(option, radioButton.Font);
                if (radioButton.Width > groupBox.Width)
                {
                    groupBox.Width = radioButton.Width + 10;
                }

                if (groupBox.Width > Width)
                {
                    Width = groupBox.Width + 10;
                }

                groupBox.Controls.Add(radioButton);
                mDynamicControls.Add(radioButton);

                Y += radioButton.Height;
            }

            groupBox.Height = Y + 5;
            groupBox.ResumeLayout(false);
            ResumeLayout(false);
            mDynamicControls.Add(groupBox);

            return(startY + groupBox.Height);
        }
Пример #28
0
        public bool InitializeMogRepository()
        {
            // First we are going to attempt to load our loader.ini and check if a Repository path was saved froma previous load
            // Load system Ini
            MOG_Ini loader = new MOG_Ini(LoaderConfigFile);

            if (loader != null && loader.CountSections() > 0)
            {
                if (loader.SectionExist("Loader"))
                {
                    if (loader.KeyExist("Loader", "SystemRepositoryPath"))
                    {
                        // Now double check that the path specified actually has a Repository.ini at that location
                        // Lets verify if the repository that was saved is really still a repository?
                        if (Directory.Exists(loader.GetString("Loader", "SystemRepositoryPath") + "\\Tools") &&
                            Directory.Exists(loader.GetString("Loader", "SystemRepositoryPath") + "\\Updates"))
                        {
                            mRepositoryPath = loader.GetString("Loader", "SystemRepositoryPath");

                            // SECOND make sure that we have the mog.ini saved correctly in the current directory
                            if (File.Exists(Environment.CurrentDirectory + "\\" + LoaderTargetDirectory + "\\MOG.ini"))
                            {
                                // Also make sure it has a valid repository
                                MOG_Ini targetLoader = new MOG_Ini(Environment.CurrentDirectory + "\\" + LoaderTargetDirectory + "\\MOG.ini");
                                if (targetLoader != null && targetLoader.CountSections() > 0)
                                {
                                    if (targetLoader.SectionExist("MOG"))
                                    {
                                        if (targetLoader.KeyExist("MOG", "SystemRepositoryPath"))
                                        {
                                            // Lets verify if the repository that was saved is really still a repository?
                                            if (Directory.Exists(targetLoader.GetString("MOG", "SystemRepositoryPath") + "\\Tools") &&
                                                Directory.Exists(targetLoader.GetString("MOG", "SystemRepositoryPath") + "\\Updates"))
                                            {
                                                return(true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            // If any of the above conditions fail, have the user locate our repository path for us
            MogForm_RepositoryBrowser_ServerLoader form = new MogForm_RepositoryBrowser_ServerLoader();

            form.ForceRepositorySelection = true;
            form.RepositoryViewVisible    = false;
            form.RepositoryViewVisible    = false;

LocateRepository:

            try
            {
                mSplash.Opacity  = 0;
                this.WindowState = FormWindowState.Minimized;
                if (form.ShowDialog() == DialogResult.OK)
                {
                    // Determine if the path selected is valid
                    if (!File.Exists(form.SelectedPath + "\\MogRepository.ini"))
                    {
                        MessageBox.Show(this, "The selected path is not a valid MOG repository.", "Invalid repository");
                        goto LocateRepository;
                    }
                    else
                    {
                        // Load the MogRepository.ini file found at the location specified by the user
                        MOG_Ini repository = new MOG_Ini(form.SelectedPath + "\\MogRepository.ini");

                        // Does this MogRepository have at least one valid repository path
                        if (repository.SectionExist("Mog_Repositories"))
                        {
                            // If there is only one specified repository, choose that one
                            if (repository.CountKeys("Mog_Repositories") == 1)
                            {
                                // Get the section
                                string section = repository.GetKeyNameByIndexSLOW("Mog_Repositories", 0);

                                // Get the path from that section
                                if (repository.SectionExist(section) && repository.KeyExist(section, "SystemRepositoryPath"))
                                {
                                    mRepositoryPath = repository.GetString(section, "SystemRepositoryPath");
                                }
                                else
                                {
                                    MessageBox.Show(this, "The selected path does not have or is missing a repository path.", "Invalid repository");
                                    goto LocateRepository;
                                }
                            }
                            else if (repository.CountKeys("Mog_Repositories") > 1)
                            {
                                // The user must now choose which repository to use
                                MogForm_MultiRepository multiRep = new MogForm_MultiRepository();
                                for (int i = 0; i < repository.CountKeys("Mog_Repositories"); i++)
                                {
                                    multiRep.RepositoryComboBox.Items.Add(repository.GetKeyNameByIndexSLOW("Mog_Repositories", i));
                                }
                                multiRep.RepositoryComboBox.SelectedIndex = 0;

                                // Show the form to the user and have him select between the repository sections found
                                if (multiRep.ShowDialog() == DialogResult.OK)
                                {
                                    // Get the section
                                    string userSection = multiRep.RepositoryComboBox.Text;

                                    // Get the path from that section
                                    if (repository.SectionExist(userSection) && repository.KeyExist(userSection, "SystemRepositoryPath"))
                                    {
                                        mRepositoryPath = repository.GetString(userSection, "SystemRepositoryPath");
                                    }
                                    else
                                    {
                                        MessageBox.Show(this, "The selected path does not have or is missing a repository path.", "Invalid repository");
                                        goto LocateRepository;
                                    }
                                }
                                else
                                {
                                    goto LocateRepository;
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "The selected path does not have or is missing a repository path.", "Invalid repository");
                                goto LocateRepository;
                            }
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message, "Invalid repository");
                goto LocateRepository;
            }


            // Double check that we got a valid mog repository path
            if (mRepositoryPath.Length == 0)
            {
                goto LocateRepository;
            }
            else
            {
                //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)
                    {
                        goto LocateRepository;
                    }
                }

                // Yup, all is well save it out
                loader.PutString("Loader", "SystemRepositoryPath", mRepositoryPath);
                loader.Save();

                // Save out our MOG.ini
                SaveMOGConfiguration();

                this.Opacity     = 0;
                mSplash.Opacity  = 1;
                this.WindowState = FormWindowState.Normal;
                return(true);
            }
        }
Пример #29
0
        public void LoadSysIni()
        {
            try
            {
                // Start the progressBar
                ZipProgressBar(10);

                // Load system Ini
                MOG_Ini loader = new MOG_Ini(LoaderConfigFile);

                // Clear our box
                CheckListBox.Items.Clear();

                // Locate the Master Archive drive
                for (int i = 0; i < loader.CountKeys("UPDATE"); i++)
                {
                    string SectionToBeUpdated = loader.GetKeyNameByIndexSLOW("UPDATE", i);

                    // Get bin locations
                    string gSourceLocation = mRepositoryPath + "\\" + loader.GetString(SectionToBeUpdated, "BINLOCATION");
                    string TargetLocation  = loader.GetString("LOADER", "BINLOCATION");

                    if (TargetLocation.CompareTo("NONE") == 0)
                    {
                        TargetLocation = String.Concat(Environment.CurrentDirectory, "\\" + LoaderTargetDirectory);

                        DirectoryInfo dir = new DirectoryInfo(TargetLocation);
                        if (dir.Exists != true)
                        {
                            dir.Create();
                        }
                    }


                    // Make sure we have a valid fileList in the target drive
                    if (!File.Exists(gSourceLocation + "\\FileList.ini"))
                    {
                        throw new Exception("Current version of (" + SectionToBeUpdated + ") does not exist at:\n\n " + gSourceLocation + "\n\n Aborting...");
                    }

                    // Load the filelist associated with this section
                    MOG_Ini files = new MOG_Ini(String.Concat(gSourceLocation, "\\FileList.ini"));


                    // Either update the directory box or the ini
                    if (TargetDir.Text == "")
                    {
                        if (gSourceLocation.CompareTo("") == 0)
                        {
                            TargetDir.Text = String.Concat(Environment.CurrentDirectory, "\\" + LoaderTargetDirectory);
                            gBinLocation   = TargetDir.Text;
                            loader.PutString("LOADER", "BINLOCATION", TargetDir.Text);
                            loader.Save();
                        }
                        else
                        {
                            TargetDir.Text = TargetLocation;
                            gBinLocation   = TargetLocation;
                            loader.PutString("LOADER", "BINLOCATION", TargetDir.Text);
                            loader.Save();
                        }
                    }
                    else
                    {
                        gBinLocation = TargetDir.Text;
                        loader.PutString("LOADER", "BINLOCATION", TargetDir.Text);
                        loader.Save();
                    }

                    // Get the executable to launch with the run button
                    string exeFile = files.GetString(SectionToBeUpdated, "EXE");

                    // Make sure the exe is not NONE
                    if (String.Compare(exeFile, "NONE", true) != 0)
                    {
                        gExeFile = exeFile;
                    }

                    // Walk thru all files
                    for (int x = 0; x < files.CountKeys("FILES"); x++)
                    {
                        ListViewItem item    = new ListViewItem();
                        string       curFile = String.Concat(TargetLocation, "\\", files.GetKeyNameByIndexSLOW("FILES", x));
                        string       newFile = String.Concat(gSourceLocation, "\\", files.GetKeyNameByIndexSLOW("FILES", x));

                        // Check current version against new version
                        FileInfo CurrentBin, NewBin;

                        // Check for special folders
                        if (curFile.IndexOf("<WIN_SYSTEM>") != -1)
                        {
                            // Fix path to reflect new dir
                            curFile = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.System), curFile.Substring(curFile.IndexOf(">") + 1));
                            newFile = string.Concat(newFile.Substring(0, newFile.IndexOf("<")), newFile.Substring(newFile.IndexOf(">") + 1));
                        }

                        CurrentBin = new FileInfo(curFile);
                        NewBin     = new FileInfo(newFile);

                        // Add file to the menu
                        item.Text = files.GetKeyNameByIndexSLOW("FILES", x);
                        item.SubItems.Add(newFile);
                        item.SubItems.Add(gSourceLocation);                          // Source directory

                        if ((CurrentBin.LastWriteTime.CompareTo(NewBin.LastWriteTime) != 0) || !(CurrentBin.Exists))
                        {
                            Debug.Write("Copy - " + curFile + " \tCurrent:" + CurrentBin.LastWriteTime.ToString() + " New:" + NewBin.LastWriteTime.ToString(), "\nNew Check");
                        }
                        else
                        {
                            Debug.Write("Skip - " + curFile + " \tCurrent:" + CurrentBin.LastWriteTime.ToString() + " New:" + NewBin.LastWriteTime.ToString(), "\nNew Check");
                        }

                        if ((CurrentBin.LastWriteTime.CompareTo(NewBin.LastWriteTime) != 0) || !(CurrentBin.Exists))
                        {
                            if (NewBin.Exists)
                            {
                                // Enable buttons
                                UpdateButton.Enabled    = true;
                                UpdateRunButton.Enabled = true;
                                RunButton.Enabled       = true;
                                allUpToDate             = false;

                                // Check the old file
                                item.Checked = true;
                            }
                            else
                            {
                                item.Remove();
                            }
                        }

                        // Make sure we don't add an asset twice to the list
                        bool alreadyExists = false;
                        foreach (ListViewItem lItem in CheckListBox.Items)
                        {
                            if (String.Compare(lItem.Text, item.Text) == 0)
                            {
                                alreadyExists = true;
                            }
                        }

                        if (alreadyExists == false)
                        {
                            CheckListBox.Items.Add(item);
                        }
                    }
                }

                if (loader.KeyExist("LOADER", "UpdateRun") && !allUpToDate)
                {
                    if (string.Compare(loader.GetString("LOADER", "UpdateRun"), "true", true) == 0)
                    {
                        mSplash.updateSplash("Auto Updating to current version...", 500);

                        if (!UserAbort)
                        {
                            if (UpdateBinary())
                            {
                                allUpToDate   = true;
                                DisableEvents = false;
                                RunBinary();
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message, "Error updating to latest version");
                allUpToDate = false;
                Application.Exit();
            }
        }
Пример #30
0
        public void TargetConsoleRemoveSync()
        {
            // Build a list of exactly what should be on the xbox
            mGetFileCount     = true;
            mTotalFilesToCopy = 0;
            bool success = true;

            string CopyFileMap = mSourcePath + "\\MOG\\platformSincMap." + mMog.GetActivePlatform().mPlatformName + ".info";

            if (DosUtils.FileExist(CopyFileMap))
            {
                if (!DosUtils.FileDelete(CopyFileMap))
                {
                    return;
                }
            }

            // Create the new map
            mPendingCopy = new MOG_Ini(CopyFileMap);

            InitializeFileMap();
            mFileMapCreate = true;

            // Initialize our progress dialog
            mProgress = new CallbackDialogForm();
            string message = "Preforming platform remove data Sync: \n" +
                             "   Project Sync file map:" + mProjectSyncFile + "\n" +
                             "   User Sync file map:" + mUserSyncFile + "\n";

            mProgress.DialogInitialize("(" + mTargetConsole + ")Platform Remove Data Sync", message, "");
            Application.DoEvents();

            for (int i = 0; i < mPlatformSync.CountKeys("FileMap"); i++)
            {
                string sourcePath  = FormatString(mPlatformSync.GetKeyNameByIndex("FileMap", i).ToLower());
                string targetPath  = sourcePath.Replace(mSourcePath, mSyncRoot);
                string filePattern = mPlatformSync.GetKeyByIndex("FileMap", i).ToLower();
                success = SyncDirectories(sourcePath, filePattern, mSyncRoot);

                mProgress.DialogUpdate((i * 100) / mPlatformSync.CountKeys("FileMap"), sourcePath + "\n" + targetPath);
                Application.DoEvents();

                // Create the needed directory on the xbox
                string newDirName = RemapDirectoryString(targetPath);
                if (mConsoleCopy)
                {
                    if (!XboxUtils.FileExist(newDirName))
                    {
                        mPendingCopy.PutSectionString("CREATE_DIR", newDirName);
                        mPendingCopy.Save();
                    }
                }
                else
                {
                    if (!DosUtils.FileExist(newDirName))
                    {
                        mPendingCopy.PutSectionString("CREATE_DIR", newDirName);
                        mPendingCopy.Save();
                    }
                }
            }

            if (mConsoleCopy)
            {
                // Logon to correct xbox
                XboxUtils.SetXboxName(mTargetConsole, false);
            }

            mProgress.DialogInitialize("Sync Remove", "Scanning console for non-needed assets", "");

            ArrayList deletableAssets = new ArrayList();

            // Verify the xbox for each of these files
            for (int j = 0; j < mPlatformSync.CountKeys("FileMap"); j++)
            {
                string sourcePath = FormatString(mPlatformSync.GetKeyNameByIndex("FileMap", j).ToLower());
                string targetPath = sourcePath.Replace(mSourcePath, mSyncRoot);
                string walkFiles  = XboxUtils.GetFiles(targetPath + "\\");

                mProgress.DialogUpdate((j * 100) / mPlatformSync.CountKeys("FileMap"), sourcePath + "\n" + targetPath);
                Application.DoEvents();

                if (walkFiles.Length != 0 && walkFiles.IndexOf(",") != -1)
                {
                    string [] files = walkFiles.Split(",".ToCharArray());
                    for (int k = 0; k < files.Length; k++)
                    {
                        string targetFile = files[k];

                        if (Path.GetExtension(targetFile) != "")
                        {
                            // Check to see if this file exists in the map
                            if (!mPendingCopy.KeyExist("MAP", targetFile))
                            {
                                // Get the list of deletable assets
                                deletableAssets.Add(targetFile);
                            }
                        }
                    }
                }
            }

            mProgress.DialogKill();
            mProgress = null;

            if (deletableAssets.Count != 0)
            {
                if (guiConfirmDialog.MessageBoxDialog("Console Remove Sync", "Is is OK to Delete the Following Assets?", deletableAssets, MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    // Delete the assets in the list from off the xbox
                    foreach (string str in guiConfirmDialog.SelectedItems)
                    {
                        string [] parts = str.Split(",;".ToCharArray());
                        if (parts != null && parts.Length >= 2)
                        {
                            string assetDeleteName = parts[0];
                            XboxUtils.FileDelete(assetDeleteName);
                        }
                    }
                }
            }
            else
            {
                MOG_REPORT.ShowMessageBox("Sync Remove", "This target does not have any files that need to be deleted", MessageBoxButtons.OK);
            }
        }