private void PostFileList(string targetFolder, string executable, MOG_PropertiesIni files) { string fileListName = mSourceBinaries + "\\" + targetFolder + "\\" + mArchiveVersion + "\\FileList.ini"; StreamWriter fileList = new StreamWriter(fileListName); if (fileList != null) { fileList.WriteLine("[" + targetFolder + "]"); fileList.WriteLine("exe=" + executable); fileList.WriteLine(""); fileList.WriteLine("[FILES]"); if (files.SectionExist("FILES")) { for (int i = 0; i < files.CountKeys("FILES"); i++) { string file = files.GetKeyNameByIndexSLOW("FILES", i); fileList.WriteLine(file); } } fileList.Close(); } }
private void ConstructDefaultSkin(string filename) { mSkinDef = new MOG_PropertiesIni(filename); mSkinDef.PutString("Workspace", "{Inbox}Button.Rest", "Skin\\InboxButton(Rest).png"); mSkinDef.PutString("Workspace", "{Inbox}Button.Hover", "Skin\\InboxButton(Hover).png"); mSkinDef.PutString("Workspace", "{Inbox}Button.Pressed", "Skin\\InboxButton(Pressed).png"); mSkinDef.PutString("Workspace", "{Inbox}BackgroundBarMiddle", "Skin\\WideBar_Middle.png"); mSkinDef.PutString("Workspace", "{Inbox}BackgroundBarEnd", "Skin\\WideBar_End.png"); mSkinDef.PutString("Workspace", "{MyTasks}Button.Rest", "Skin\\TasksButton(Rest).png"); mSkinDef.PutString("Workspace", "{MyTasks}Button.Hover", "None"); mSkinDef.PutString("Workspace", "{MyTasks}Button.Pressed", "None"); mSkinDef.PutString("Workspace", "{MyTasks}BackgroundBarMiddle", "Skin\\ThinBar_Middle.png"); mSkinDef.PutString("Workspace", "{MyTasks}BackgroundBarEnd", "Skin\\ThinBar_End.png"); mSkinDef.PutString("Workspace", "{LocalExplorer}Button.Rest", "Skin\\LocalExplorerButton(Rest).png"); mSkinDef.PutString("Workspace", "{LocalExplorer}Button.Hover", "None"); mSkinDef.PutString("Workspace", "{LocalExplorer}Button.Pressed", "None"); mSkinDef.PutString("Workspace", "{LocalExplorer}BackgroundBarMiddle", "Skin\\ThinBar_Middle.png"); mSkinDef.PutString("Workspace", "{LocalExplorer}BackgroundBarEnd", "Skin\\ThinBar_End.png"); mSkinDef.PutString("Workspace", "{MyWorkspace}Button.Rest", "Skin\\WorkspaceButton(Rest).png"); mSkinDef.PutString("Workspace", "{MyWorkspace}Button.Hover", "Skin\\WorkspaceButton(Hover).png"); mSkinDef.PutString("Workspace", "{MyWorkspace}Button.Pressed", "Skin\\WorkspaceButton(Pressed).png"); mSkinDef.PutString("Workspace", "{MyWorkspace}BackgroundBarMiddle", "Skin\\ThinBar_Middle.png"); mSkinDef.PutString("Workspace", "{MyWorkspace}BackgroundBarEnd", "Skin\\ThinBar_End.png"); mSkinDef.PutString("Workspace", "{MyTools}Button.Rest", "Skin\\ToolBoxButton(Rest).png"); mSkinDef.PutString("Workspace", "{MyTools}Button.Hover", "Skin\\ToolBoxButton(Hover).png"); mSkinDef.PutString("Workspace", "{MyTools}Button.Pressed", "Skin\\ToolBoxButton(Pressed).png"); mSkinDef.PutString("Workspace", "{MyTools}BackgroundBarMiddle", "Skin\\ThinBar_Middle.png"); mSkinDef.PutString("Workspace", "{MyTools}BackgroundBarEnd", "Skin\\ThinBar_End.png"); mSkinDef.Save(); }
private void PropertyNameWizardPage_ShowFromNext(object sender, EventArgs e) { // Always reset our tree TreeNode root = PropertyContextMenuTreeView.Nodes[0]; root.Nodes.Clear(); // We need to initialize any previously existing menu if (mProperties.PropertyMenu.Length != 0) { string PropertyMenuFullName = MOG_Tokens.GetFormattedString(mProperties.PropertyMenu, MOG_Tokens.GetProjectTokenSeeds(MOG_ControllerProject.GetProject())); // Make sure we got a filename with a full path, if we didn't it is probably a relational path if (!Path.IsPathRooted(PropertyMenuFullName)) { PropertyMenuFullName = MOG_ControllerProject.GetProject().GetProjectToolsPath() + "\\" + PropertyMenuFullName; } // Find and open the menu if (DosUtils.FileExist(PropertyMenuFullName)) { MOG_PropertiesIni ripMenu = new MOG_PropertiesIni(PropertyMenuFullName); if (ripMenu.SectionExist("Property.Menu")) { string property = ""; // Create the sub menu CreateChangePropertiesSubMenu(property, PropertyContextMenuTreeView.Nodes[0], "Property.Menu", ripMenu); } } } }
private void removeToolStripMenuItem_Click(object sender, EventArgs e) { if (WebTabTabsListView.SelectedItems != null) { MOG_PropertiesIni project = MOG_ControllerProject.GetProject().GetConfigFile(); if (project != null) { foreach (ListViewItem item in WebTabTabsListView.SelectedItems) { project.RemoveString("WebTabs", item.Text); project.RemoveString("WebTab_" + item.Text, "Title"); project.RemoveString("WebTab_" + item.Text, "URL"); project.RemoveString("WebTab_" + item.Text, "Position"); // Only remove the section if it is now empty if (project.CountKeys("WebTab_" + item.Text) == 0) { project.RemoveSection("WebTab_" + item.Text); } item.Remove(); } SavePositionSettings(project); } } }
private string PostBridge() { MOG_PropertiesIni Files = new MOG_PropertiesIni(); Files.PutFile("bridge.info"); MOG_PropertiesIni files = Post("MOGBridge", Files); PostVersionFile("MOGBridge"); PostWhatsNew("MOGBridge"); PostFileList("MOGBridge", "MOG_Bridge.dll", files); return(mSourceBinaries + "\\" + "MOG_Bridge.dll" + "\\" + mArchiveVersion); }
private string PostServer() { MOG_PropertiesIni serverFiles = new MOG_PropertiesIni(); serverFiles.PutFile("server.info"); MOG_PropertiesIni sfiles = Post("Server", serverFiles); PostVersionFile("Server"); PostWhatsNew("Server"); PostFileList("Server", "MOG_Server.exe", sfiles); return(mSourceBinaries + "\\" + "Server" + "\\" + mArchiveVersion); }
public MogUtils_SkinManager(string skinDefinitionFile) { mSkins = new ArrayList(); mSkinNames = new ArrayList(); mSections = new ArrayList(); mSectionNames = new ArrayList(); if (DosUtils.FileExist(skinDefinitionFile)) { mSkinDef = new MOG_PropertiesIni(skinDefinitionFile); } else { ConstructDefaultSkin(skinDefinitionFile); } }
private string PostClient() { MOG_PropertiesIni clientFiles = new MOG_PropertiesIni(); clientFiles.PutFile("client.info"); clientFiles.PutFile("Slave.info"); clientFiles.PutFile("Commandline.info"); MOG_PropertiesIni files = Post("Client", clientFiles); PostVersionFile("Client"); PostWhatsNew("Client"); PostFileList("Client", "MOG_Client.exe", files); return(mSourceBinaries + "\\" + "Client" + "\\" + mArchiveVersion); }
public void Load(MOG_PropertiesIni ini, string section, string property, string key) { if (ini.PropertyExist(section, property, key + "_OpenWidth")) { mOpenWidth = Convert.ToInt32(ini.GetPropertyString(section, property, key + "_OpenWidth")); } if (ini.PropertyExist(section, property, key + "_CLoseWidth")) { mCloseWidth = Convert.ToInt32(ini.GetPropertyString(section, property, key + "_CLoseWidth")); } if (ini.PropertyExist(section, property, key + "_Open")) { Opened = Convert.ToBoolean(ini.GetPropertyString(section, property, key + "_Open")); } }
private void SaveOutMenus(MOG_PropertiesIni ripMenu, TreeNodeCollection nodes) { foreach (TreeNode node in nodes) { PropertyProperty property = node.Tag as PropertyProperty; if (property != null) { if (node.Parent.Text == "Root") { ripMenu.PutString("Property.Menu", "{MenuItem}" + property.MenuText, "[" + property.PropertyCategory + "]" + "{" + property.PropertySubCategory + "}" + property.PropertyName + "=" + property.PropertyValue); } else { ripMenu.PutString(node.Parent.Text, "{MenuItem}" + property.MenuText, "[" + property.PropertyCategory + "]" + "{" + property.PropertySubCategory + "}" + property.PropertyName + "=" + property.PropertyValue); } } else { PropertyMenu menu = node.Tag as PropertyMenu; if (menu != null) { if (node.Parent.Text == "Root") { ripMenu.PutString("Property.Menu", "{MenuItem}" + menu.MenuText, menu.MenuText); } else { ripMenu.PutString(node.Parent.Text, "{MenuItem}" + menu.MenuText, menu.MenuText); } // Menus ALWAYS require a section...even if it is blank! ripMenu.PutSection(menu.MenuText); } } if (node.Nodes.Count > 0) { SaveOutMenus(ripMenu, node.Nodes); } } }
private void PropertyFilenameWizardPage_CloseFromNext(object sender, MOG_ControlsLibrary.Utils.PageEventArgs e) { if (PropertyFilenameTextBox.Text.Length > 0) { string PropertyMenuFullName = MOG_Tokens.GetFormattedString(PropertyFilenameTextBox.Text, MOG_Tokens.GetProjectTokenSeeds(MOG_ControllerProject.GetProject())); string LocatedPropertyMenu = MOG_ControllerSystem.LocateTool(PropertyMenuFullName); if (LocatedPropertyMenu.Length == 0) { // Make sure we got a filename with a full path, if we didn't it is probably a relational path if (!Path.IsPathRooted(PropertyMenuFullName)) { PropertyMenuFullName = MOG_ControllerProject.GetProject().GetProjectToolsPath() + "\\Property.Menus\\" + PropertyMenuFullName; } } else { PropertyMenuFullName = LocatedPropertyMenu; } // Create or open the existing properties MOG_PropertiesIni ripMenu = new MOG_PropertiesIni(PropertyMenuFullName); // Reset our menu ripMenu.Empty(); // Add the properties ripMenu.PutSection("Property.Menu"); SaveOutMenus(ripMenu, PropertyContextMenuTreeView.Nodes[0].Nodes); // Save the properties ripMenu.Save(); // Save our new propertyMenu filename mPropertyMenu = PropertyMenuFullName; } // Skip to the end e.Page = PropertyEndWizardPage; }
private void SavePositionSettings(MOG_PropertiesIni project) { if (project == null) { project = MOG_ControllerProject.GetProject().GetConfigFile(); } int i = 0; if (project != null) { foreach (ListViewItem item in WebTabTabsListView.Items) { item.SubItems[2].Text = i.ToString(); project.PutString("WebTab_" + item.Text, "POSITION", item.SubItems[2].Text); i++; } project.Save(); } }
private void WebTabAddButton_Click(object sender, EventArgs e) { if (WebTabTitleTextBox.Text.Length != 0 && WebTabURLTextBox.Text.Length != 0) { MOG_PropertiesIni project = MOG_ControllerProject.GetProject().GetConfigFile(); if (project != null) { project.PutSectionString("WebTabs", WebTabTitleTextBox.Text); project.PutString("WebTab_" + WebTabTitleTextBox.Text, "Title", WebTabTitleTextBox.Text); project.PutString("WebTab_" + WebTabTitleTextBox.Text, "URL", WebTabURLTextBox.Text); project.PutString("WebTab_" + WebTabTitleTextBox.Text, "POSITION", "-1"); project.Save(); ListViewItem item = new ListViewItem(WebTabTitleTextBox.Text); item.SubItems.Add(WebTabURLTextBox.Text); item.SubItems.Add(""); WebTabTabsListView.Items.Add(item); SavePositionSettings(project); } } }
public ArrayList GetClassPropertiesListFromFiles(string classesPath) { ArrayList propList = new ArrayList(); if (!Directory.Exists(classesPath)) { return(propList); } foreach (string filename in Directory.GetFiles(classesPath, "{ProjectName}*.info")) { MOG_PropertiesIni classIni = new MOG_PropertiesIni(filename); if (classIni != null) { MOG_Properties props = MOG_Properties.OpenFileProperties(classIni); string pathFilename = Path.GetFileNameWithoutExtension(filename); string className = pathFilename.Replace("{ProjectName}", this.projectName); props.Classification = className; // extract just class name from filename propList.Add(props); } } return(propList); }
public void LoadTabs() { // Clear out any previous web tabs ClearWebTabs(); MOG_PropertiesIni project = MOG_ControllerProject.GetProject().GetConfigFile(); if (project.SectionExist("WebTabs")) { SortedList <int, webtab> list = new SortedList <int, webtab>(); for (int i = 0; i < project.CountKeys("WebTabs"); i++) { string section = "WebTab_" + project.GetKeyNameByIndexSLOW("WebTabs", i); // Upgrade old tabs to new format if (project.SectionExist(section) == false && project.SectionExist(project.GetKeyNameByIndexSLOW("WebTabs", i)) == true && string.Compare(project.GetKeyNameByIndexSLOW("WebTabs", i), "Project", true) != 0) { project.RenameSection(project.GetKeyNameByIndexSLOW("WebTabs", i), section); } // Load Tab information if (project.SectionExist(section)) { webtab tab = new webtab(); tab.title = "WebTab"; tab.url = "http://www.mogware.com"; tab.position = 0; // Get custom title if (project.KeyExist(section, "TITLE")) { tab.title = project.GetString(section, "TITLE"); } // Get custom url if (project.KeyExist(section, "URL")) { tab.url = project.GetString(section, "URL"); } // Get position if (project.KeyExist(section, "POSITION")) { tab.position = Convert.ToInt32(project.GetString(section, "POSITION")); } list.Add(tab.position, tab); } } foreach (webtab newtab in list.Values) { // Create the tab TabPage tab = CreateWebTab(newtab.title, newtab.url); // Add it to our main tab control mainForm.MOGTabControl.TabPages.Add(tab); } } }
static public void CreateSettings(string settingsLocation) { Settings = new MOG_PropertiesIni(settingsLocation); }
public void InitializeListView() { WebTabTabsListView.Items.Clear(); MOG_PropertiesIni project = MOG_ControllerProject.GetProject().GetConfigFile(); if (project.SectionExist("WebTabs")) { SortedList <int, webtab> list = new SortedList <int, webtab>(); for (int i = 0; i < project.CountKeys("WebTabs"); i++) { string section = "WebTab_" + project.GetKeyNameByIndexSLOW("WebTabs", i); // Upgrade old tabs to new format if (project.SectionExist(section) == false && project.SectionExist(project.GetKeyNameByIndexSLOW("WebTabs", i)) == true && string.Compare(project.GetKeyNameByIndexSLOW("WebTabs", i), "Project", true) != 0) { project.RenameSection(project.GetKeyNameByIndexSLOW("WebTabs", i), section); } // Load Tab information if (project.SectionExist(section)) { webtab tab = new webtab(); tab.title = "WebTab"; tab.url = "http://www.mogware.com"; tab.position = 0; // Get custom title if (project.KeyExist(section, "TITLE")) { tab.title = project.GetString(section, "TITLE"); } // Get custom url if (project.KeyExist(section, "URL")) { tab.url = project.GetString(section, "URL"); } // Get position if (project.KeyExist(section, "POSITION")) { tab.position = Convert.ToInt32(project.GetString(section, "POSITION")); } list.Add(tab.position, tab); } } foreach (webtab newtab in list.Values) { ListViewItem item = new ListViewItem(newtab.title); item.SubItems.Add(newtab.url); item.SubItems.Add(newtab.position.ToString()); WebTabTabsListView.Items.Add(item); } } }
private void CreateChangePropertiesMenuItem(string propertyPath, TreeNode parentNode, string section, string itemName, MOG_PropertiesIni ripMenu) { string command = ripMenu.GetPropertyString(section, "MenuItem", itemName); // Check to see if this command is another sub menu if (ripMenu.SectionExist(command)) { TreeNode propertyMenuItem = CreatePropertyMenuNode(parentNode, itemName); CreateChangePropertiesSubMenu(propertyPath, propertyMenuItem, command, ripMenu); } else { string globalSection, propertySection, key, val; string[] leftParts = command.Split("=".ToCharArray()); if (leftParts.Length < 2) { string title = "Change Properties Failed"; string message = "Invalid property format specified.\n" + "Specified Format: " + command + "\n" + " Proper Format: [Section]{PropertyGroup}PropertyName=PropertyValue"; MOG_Prompt.PromptMessage(title, message); return; } else { string[] testParts = leftParts[0].Split("[]{}".ToCharArray()); if (testParts.Length != 5) { string title = "Change Properties Failed"; string message = "Invalid property format specified.\n" + "Specified Format: " + command + "\n" + " Proper Format: [Section]{PropertyGroup}PropertyName=PropertyValue"; MOG_Prompt.PromptMessage(title, message); return; } else { try { globalSection = testParts[1]; propertySection = testParts[3]; key = testParts[4]; val = command.Substring(command.IndexOf("=") + 1); } catch { string title = "Change Properties Failed"; string message = "Invalid property format specified.\n" + "Specified Format: " + command + "\n" + " Proper Format: [Section]{PropertyGroup}PropertyName=PropertyValue"; MOG_Prompt.PromptMessage(title, message); return; } } CreatePropertyNode(parentNode, itemName, globalSection, propertySection, key, val); } } }
private MOG_PropertiesIni Post(string targetFolder, MOG_PropertiesIni fileList) { bool title = false; MOG_PropertiesIni copiedFiles = new MOG_PropertiesIni(); string fullTargetPath = mSourceBinaries + "\\" + targetFolder + "\\" + mArchiveVersion; Console.WriteLine("----------------------------------------"); Console.WriteLine("Create " + targetFolder + " VERSION: " + mArchiveVersion); // Make our target directory DosUtils.DirectoryCreate(fullTargetPath); Console.WriteLine("---------------------------"); Console.WriteLine("Posting new " + targetFolder + " version"); Console.WriteLine("---------------------------"); if (fileList.SectionExist("Files")) { for (int i = 0; i < fileList.CountKeys("Files"); i++) { string label = fileList.GetKeyByIndexSLOW("Files", i); string filename = fileList.GetKeyNameByIndexSLOW("Files", i); string path = MOG_Tokens.GetFormattedString(Path.GetDirectoryName(filename), "{BuildType}=" + mBuildType); string file = Path.GetFileName(filename); if (!title && mVerbose) { Console.WriteLine(label); title = true; } // Copy the files foreach (FileInfo fileHandle in DosUtils.FileGetList(path, file)) { if (!title && !mVerbose) { Console.WriteLine(label); title = true; } try { fileHandle.CopyTo(fullTargetPath + "\\" + fileHandle.Name, true); copiedFiles.PutSectionString("FILES", fullTargetPath + "\\" + fileHandle.Name); Console.WriteLine(" POSTED: " + "<" + fileHandle.LastWriteTime.ToShortDateString().ToString() + " " + fileHandle.LastWriteTime.ToShortTimeString().ToString() + ">\t" + fileHandle.Name); } catch (Exception e) { Console.WriteLine(" ERROR POSTING: " + fileHandle.Name); Console.WriteLine(" ERROR MESSAGE: "+ e.Message); } } title = false; Console.WriteLine(""); } } return(copiedFiles); }
public void Save(MOG_PropertiesIni ini, string section, string property, string key) { ini.PutPropertyString(section, property, key + "_OpenWidth", mOpenWidth.ToString()); ini.PutPropertyString(section, property, key + "_CLoseWidth", mCloseWidth.ToString()); ini.PutPropertyString(section, property, key + "_Open", Opened.ToString()); }
private void CreateChangePropertiesSubMenu(string propertyPath, TreeNode parentNode, string section, MOG_PropertiesIni ripMenu) { for (int i = 0; i < ripMenu.CountProperties(section, "MenuItem"); i++) { MOG_Property property = ripMenu.GetPropertyByIndex(section, "MenuItem", i); if (property != null) { string menuItem = property.mPropertyKey; if (propertyPath.Length == 0) { CreateChangePropertiesMenuItem(menuItem, parentNode, section, menuItem, ripMenu); } else { CreateChangePropertiesMenuItem(propertyPath + "/" + menuItem, parentNode, section, menuItem, ripMenu); } } } }