コード例 #1
0
        public void DownloadSkins()
        {
            if (DosUtils.DirectoryExist(MOG.MOG_Main.GetExecutablePath() + "\\Skin") == false)
            {
                DosUtils.DirectoryCreate(MOG.MOG_Main.GetExecutablePath() + "\\Skin");
            }

            string sourcePath = MOG.CONTROLLER.CONTROLLERSYSTEM.MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Updates\\Skins";
            string targetPath = MOG.MOG_Main.GetExecutablePath() + "\\Skin";

            if (DosUtils.DirectoryExist(sourcePath))
            {
                // Copy all the files down
                FileInfo [] files = DosUtils.FileGetList(sourcePath, "*.*");
                foreach (FileInfo file in files)
                {
                    DosUtils.FileCopyModified(file.FullName, targetPath + "\\" + file.Name);
                }
            }
        }
コード例 #2
0
        public guiSound(MogMainForm handle, SplashForm SplashScreen, string configFilename, string soundClass)
        {
            mTheme          = soundClass;
            mHandle         = handle;
            mSoundAvailable = true;

            InitializeSoundEngine();

            // Load the sound ini
            string iniPath    = Application.StartupPath;
            string configFile = string.Concat(iniPath, "\\", configFilename);

            if (DosUtils.FileExist(configFile))
            {
                mConfig    = new MOG_Ini(configFile);
                mSoundPath = string.Concat(iniPath, "\\ClientSounds");

                // Update the sound menu with the scheme choices
                if (mConfig.SectionExist("Themes"))
                {
                    // Add a menuItem for each them found in the ini
                    for (int i = 0; i < mConfig.CountKeys("Themes"); i++)
                    {
                        // Assign the click event to each menu item
                        ToolStripMenuItem item = new ToolStripMenuItem(mConfig.GetKeyNameByIndexSLOW("Themes", i));
                        item.Click += new System.EventHandler(this.SoundMenu_OnClick);

                        // Set the check mark on the theme that pass passed in to the constructor
                        if (string.Compare(item.Text, mTheme, true) == 0)
                        {
                            item.Checked = true;
                        }

                        // Add th menu item
                        mHandle.themeToolStripMenuItem.DropDownItems.Add(item);
                    }

                    // Setup default theme
                    if (mTheme == null)
                    {
                        if (mHandle.themeToolStripMenuItem.DropDownItems.Count > 0)
                        {
                            mTheme = mHandle.themeToolStripMenuItem.DropDownItems[0].Text;
                            ToolStripMenuItem defaultTheme = mHandle.themeToolStripMenuItem.DropDownItems[0] as ToolStripMenuItem;
                            defaultTheme.Checked = true;
                        }
                    }
                }

                // Get our current sounds version
                if (mConfig.SectionExist("Version"))
                {
                    mVersion = Convert.ToInt32(mConfig.GetString("SoundsVersion", "Version"));
                }
                else
                {
                    mVersion = 0;
                }

                // Get all default sounds
                if (mConfig.SectionExist("SOUNDS"))
                {
                    string SourceSoundPath = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\" + mConfig.GetString("Sounds", "Root");
                    // Make sure we have a current sound directory
                    if (!DosUtils.DirectoryExist(mSoundPath))
                    {
                        DosUtils.DirectoryCreate(mSoundPath);
                    }

                    // Make sure we have all the needed sounds
                    if (DosUtils.FileExist(string.Concat(SourceSoundPath, "\\version.ini")))
                    {
                        MOG_Ini soundVersion = new MOG_Ini(string.Concat(SourceSoundPath, "\\version.ini"));

                        int sourceVersion = Convert.ToInt32(soundVersion.GetString("SoundsVersion", "Version"));

                        if (sourceVersion > mVersion)
                        {
                            // Update all our sounds
                            foreach (FileInfo file in DosUtils.FileGetList(SourceSoundPath, "*.wav"))
                            {
                                string target = string.Concat(mSoundPath, "\\", file.Name);
                                if (DosUtils.FileCopyModified(file.FullName, target))
                                {
                                    SplashScreen.updateSplashNoStep("UPDATING: " + file.Name, 0);
                                }
                            }

                            // Update our version number
                            mConfig.PutString("SoundsVersion", "Version", sourceVersion.ToString());
                            mConfig.Save();
                        }
                    }
                }
            }

            // Set the main theme to be the same as this private version
            mHandle.mSoundScheme = mTheme;
        }