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
        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. 3
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. 4
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. 5
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);
        }