コード例 #1
0
        private void GameDataCreateMenuItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                // Create a directory as a child directory of a node
                if (GameDataTreeView.SelectedNode != null)
                {
                    guiAssetTreeTag tag = GameDataTreeView.SelectedNode.Tag as guiAssetTreeTag;

                    string   directoryPath = tag.FullFilename + "\\NewDirectory";
                    TreeNode directory     = CreateDirectoryNode(tag.FullFilename + "\\NewDirectory", null);

                    // Now create the folder
                    if (!DosUtils.DirectoryCreate(directoryPath))
                    {
                        MOG_Prompt.PromptResponse("Create Directory", DosUtils.GetLastError(), MOGPromptButtons.OK);
                    }
                    else
                    {
                        // Now edit the name of this node
                        GameDataTreeView.LabelEdit = true;
                        GameDataTreeView.SelectedNode.Nodes.Add(directory);
                        GameDataTreeView.SelectedNode = directory;
                        GameDataTreeView.SelectedNode.BeginEdit();
                    }
                }
                else
                {
                    // Create a directory at the root of the project
                    string   directoryPath = MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory() + "\\NewDirectory";
                    TreeNode directory     = CreateDirectoryNode(directoryPath, null);

                    // Now create the folder
                    if (!DosUtils.DirectoryCreate(directoryPath))
                    {
                        MOG_Prompt.PromptResponse("Create Directory", DosUtils.GetLastError(), MOGPromptButtons.OK);
                    }
                    else
                    {
                        // Now edit the name of this node
                        GameDataTreeView.LabelEdit    = true;
                        GameDataTreeView.SelectedNode = directory;
                        directory.BeginEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                MOG_Report.ReportMessage("Create Directory", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
            }
        }
コード例 #2
0
 private void BrowseWorkspaceDirectory_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (this.DialogResult == DialogResult.OK)
     {
         if (!DosUtils.DirectoryExist(this.BrowseTargetTextBox.Text))
         {
             if (!DosUtils.DirectoryCreate(this.BrowseTargetTextBox.Text))
             {
                 MOG_Prompt.PromptMessage("Create local Workspace", "Could not create target directory(" + this.BrowseTargetTextBox.Text + ")!");
                 e.Cancel = true;
             }
         }
     }
 }
コード例 #3
0
        static public string Checkout(string project, string directory, string toolsPath)
        {
            string command   = "";
            string target    = "";
            string output    = "";
            string arguments = "";

            target = string.Concat(directory, "\\", project);

            // Check if the target directory exists
            if (DosUtils.DirectoryExist(target))
            {
                if (MessageBox.Show("Target directory already exists!  Checkout will delete current data!  Do you want to continue?", "Checkout", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return("");
                }
                else
                {
                    DosUtils.DirectoryDelete(target);
                }
            }

            // Create dir
            DosUtils.DirectoryCreate(directory);
            Environment.CurrentDirectory = directory;

            command   = string.Concat(toolsPath, "\\cvs.bat");
            arguments = string.Concat(directory, " checkout ", project);

            // Run the command
            Process p = new Process();

            p.StartInfo.FileName  = command;
            p.StartInfo.Arguments = arguments;

            try
            {
                p.Start();
            }
            catch (Exception e)
            {
                MOG_Report.ReportMessage("SpawnDosCommand Error", String.Concat("Could not waitForExit (", e.Message, ")"), e.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
            }


            p.Close();

            return(output);
        }
コード例 #4
0
ファイル: ListForm.cs プロジェクト: MOGwareSupport/MOG
        /// <summary>
        /// Save out this report
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListSaveButton_Click(object sender, System.EventArgs e)
        {
            string ReportDir = MOG_ControllerProject.GetUser().GetUserPath() + "\\Reports";
            string FileName  = CreateUniqueFilename(ReportDir, "Untitled.rep");

            if (!DosUtils.DirectoryExist(ReportDir))
            {
                DosUtils.DirectoryCreate(ReportDir);
            }

            ListSaveFileDialog.InitialDirectory = ReportDir;
            ListSaveFileDialog.FileName         = FileName;

            if (ListSaveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                SaveReportList(ListSaveFileDialog.FileName);
            }
        }
コード例 #5
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);
                }
            }
        }
コード例 #6
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);
        }
コード例 #7
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;
        }