Esempio n. 1
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. 2
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);
        }