Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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);
                    }
                }
            }
        }
Esempio n. 3
0
        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);
                }
            }
        }
Esempio n. 4
0
        public void Load(string section)
        {
            if (mSkinDef != null)
            {
                if (mSkinDef.SectionExist(section))
                {
                    ArrayList SkinNames = new ArrayList();
                    ArrayList Skins     = new ArrayList();

                    for (int i = 0; i < mSkinDef.CountKeys(section); i++)
                    {
                        string label        = mSkinDef.GetKeyNameByIndexSLOW(section, i);
                        string file         = mSkinDef.GetKeyByIndexSLOW(section, i);
                        string fullFilename = "";

                        if (Path.IsPathRooted(file))
                        {
                            fullFilename = file;
                        }
                        else
                        {
                            fullFilename = MOG.MOG_Main.GetExecutablePath() + "\\" + file;
                        }

LoadImage:

                        if (string.Compare(file, "none", true) != 0)
                        {
                            if (DosUtils.FileExist(fullFilename))
                            {
                                // Get the group image
                                Image myImage = new Bitmap(fullFilename);

                                // Add the image and the type to the arrayLists
                                Skins.Add(myImage);
                                SkinNames.Add(label);
                            }
                            else
                            {
                                switch (MOG_Prompt.PromptResponse("Custom skin", "Skin label:\n" + label + "\nSkin bitmap:\n" + fullFilename + "+\nCould not be found or is missing! This image will be nullified.", MOGPromptButtons.RetryCancel))
                                {
                                case MOGPromptResult.Retry:
                                    goto LoadImage;
                                }
                            }
                        }
                    }

                    mSections.Add(SkinNames);
                    mSectionNames.Add(section);
                    mSkins.Add(Skins);
                    mSkinNames.Add(SkinNames);
                }
            }
        }
Esempio n. 5
0
        public static bool SettingExist(string p, string p_2, string p_3)
        {
            bool exist = false;

            if (Settings != null)
            {
                exist = Settings.PropertyExist(p, p_2, p_3);

                if (!exist)
                {
                    if (Settings.SectionExist(p) == false)
                    {
                        Debug.WriteLine("Section(" + p + ") does not exist while looking up property(" + p_2 + ")", p_3);
                    }
                    else
                    {
                        Debug.WriteLine("Property(" + p_2 + ") does not exist within section(" + p + ")", p_3);
                    }
                }
            }

            return(exist);
        }
Esempio n. 6
0
        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);
                }
            }
        }
Esempio n. 7
0
        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);
                }
            }
        }
Esempio n. 8
0
        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);
        }