private int AppendSummaryNonExistant(string section, string comment, Color nodeColor) { // Get all the file copies if (mSummary.SectionExist(section)) { for (int i = 0; i < mSummary.CountKeys(section); i++) { ListViewItem item = new ListViewItem(); // Get classification name string assetName = mSummary.GetKeyByIndexSLOW(section, i); // Get file name string fileName = mSummary.GetKeyNameByIndexSLOW(section, i); // Trim any starting '\' if (fileName != null && fileName.Length > 0) { fileName = fileName.TrimStart("\\".ToCharArray()); } item.Text = fileName; item.ForeColor = nodeColor; item.SubItems.Add(""); item.SubItems.Add(comment); SummaryListView.Items.Add(item); } return(mSummary.CountKeys(section)); } return(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); }
/// <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); }
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; } } } }
/// <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(); } }
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); }
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 }