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); }
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"; } } }
public bool GetTasksFromBox(string box, string section, Color textColor, System.Windows.Forms.ListView listViewToFill) { MOG_Ini contents = new MOG_Ini(); // Get a handle to the inbox\contents.info FileInfo file = new FileInfo(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\Contents.info")); // If the .info file exists, open it if (file.Exists) { // Load the file contents.Load(file.FullName); // Find the items in the INBOX section if (contents.SectionExist(section)) { for (int i = 0; i < contents.CountKeys(section); i++) { ListViewItem node = new ListViewItem(); String assetName = contents.GetKeyNameByIndex(section, i); // Set the due date MOG_Time t = new MOG_Time(); t.SetTimeStamp(contents.GetString(assetName, "DUEDATE")); DateTime dueDate = t.ToDateTime(); node.Text = (contents.GetString(assetName, "TITLE")); // Name node.SubItems.Add(dueDate.ToString()); node.SubItems.Add(contents.GetString(assetName, "TIME")); node.SubItems.Add(contents.GetString(assetName, "CREATOR")); node.SubItems.Add(contents.GetString(assetName, "PRIORITY")); node.SubItems.Add(contents.GetString(assetName, "STATUS")); node.SubItems.Add(contents.GetString(assetName, "ASSET")); node.SubItems.Add(String.Concat(file.DirectoryName, "\\", assetName)); // Fullname node.SubItems.Add(box); // Current box node.ForeColor = textColor; node.ImageIndex = 0; //SetAssetIcon(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\", assetName)); listViewToFill.Items.Add(node); } } contents.Close(); } return(true); }
public 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); }
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); } } }
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)); } } } } }
/// <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)); } } }
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; } }
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] }
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); } }