public void MarkCurrentVersion(ListView list, string type) { // Check our current versions version if (DosUtils.DirectoryExist(DeploymentDirectory + "\\" + type + "\\" + DeploymentTarget)) { VersionNode current = this.CreateVersionNode(DeploymentTarget, DeploymentDirectory + "\\" + type + "\\" + DeploymentTarget); if (current != null) { //this.bCheckOverride = true; // Walk all the items of this list and check or bold the items that match foreach (ListViewItem item in list.Items) { // Get our version node from this item VersionNode target = (VersionNode)item.Tag; if (string.Compare(target.Name, current.Name, true) == 0 && target.MajorVersion == current.MajorVersion && target.MinorVersion == current.MinorVersion) { item.ForeColor = Color.DarkGreen; item.Font = new Font(item.Font.FontFamily, item.Font.Size, FontStyle.Bold); item.Checked = true; } } //this.bCheckOverride = false; } } }
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; } } } }
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); }
private bool SyncDirectories(string fullFilename, string filePattern, string targetString) { // Copy Files // Make sure our target directory exists. CheckDirectory: if (!DosUtils.DirectoryExist(fullFilename)) { //Error switch (MOG_REPORT.ShowMessageBox("Platform Sync", "Attempted to sync (" + fullFilename + ") but could not find it! \n What should we do?", MessageBoxButtons.AbortRetryIgnore)) { case DialogResult.Ignore: break; case DialogResult.Retry: goto CheckDirectory; case DialogResult.Abort: return(false); } } // Walk all the directories DirectoryInfo[] dirs = DosUtils.DirectoryGetList(fullFilename, "*.*"); if (dirs != null && dirs.Length > 0) { foreach (DirectoryInfo dir in dirs) { string targetDirectory = dir.FullName.ToLower().Replace(mSourcePath, mSyncRoot); // Copy the files in this directory if (!SyncDirectories(dir.FullName, filePattern, targetDirectory)) { return(false); } } // Now do the files in this directory return(SyncFiles(fullFilename, filePattern)); } else { return(SyncFiles(fullFilename, filePattern)); } }
/// <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); } }
private void Purge_Worker(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; List <string> args = e.Argument as List <string>; string projName = args[0]; string iniFilename = args[1]; // open the ini file MOG_Ini ini = new MOG_Ini(iniFilename); if (ini != null) { bool bFailed = false; // Attempt to remove the project if (DosUtils.DirectoryExist(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName)) { if (!DosUtils.DirectoryDeleteFast(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName)) { Utils.ShowMessageBoxExclamation("Can't purge " + projName + ", probably because of a sharing violation", "Project Removal Failure"); bFailed = true; } } if (!bFailed) { // make sure projName is a deleted project if (ini.SectionExist(projName + ".Deleted")) { // Remove the project from the list of deleted projects ini.RemoveString("Projects.Deleted", projName); ini.RemoveSection(projName + ".Deleted"); BlankInfoBox(); ini.Save(); } } ini.Close(); LoadIniFile(iniFilename); } }
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); } } }
private void DeployCheckedItems_Worker(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; List <object> args = e.Argument as List <object>; List <VersionNode> versionNodes = args[0] as List <VersionNode>; string deploymentDirectory = args[1] as string; string deploymentTarget = args[2] as string; // We are going to attemp to copy all check clients to their respective deployment directories for (int i = 0; i < versionNodes.Count && !worker.CancellationPending; i++) { VersionNode target = versionNodes[i]; // Set our current directory in the subDirectory of this versions type string deployTarget = target.Type + "\\" + deploymentTarget; // Clear out any previous deployment if (DosUtils.DirectoryExist(deploymentDirectory + "\\" + deployTarget)) { worker.ReportProgress(i * 100 / versionNodes.Count, "Removing previous (" + target.Type + ") build"); if (!DosUtils.DirectoryDelete(deploymentDirectory + "\\" + deployTarget)) { throw new Exception(DosUtils.GetLastError()); } } worker.ReportProgress(i * 100 / versionNodes.Count, "Copying new(" + target.Type + ") build named:" + target.Name); // Copy our new deployment if (!DosUtils.DirectoryCopyFast(target.SourceDirectory, deploymentDirectory + "\\" + deployTarget, true)) { throw new Exception(DosUtils.GetLastError()); } worker.ReportProgress(i * 100 / versionNodes.Count, target.Type + " named:" + target.Name + " has been deployed!"); } }
/// <summary> InitializeAssetIcons /// Loads all the bmp's specified in the asset declarations /// in the Project.ini files. Each bmp is added to a /// list allong with its key added to a corresponding list /// for later searching. /// </summary> static public void AssetIconInitialize() { // Check to see if our project is loaded if (!MOG_ControllerProject.IsProject()) { return; } // Only allow population of the images array once if (mAssetTypes.Count > 0) { return; } // Add the active item icon first // Get the image if (DosUtils.FileExist(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\SelectIcon.bmp"))) { // Get the group image Image myImage = new Bitmap(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\SelectIcon.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("dot"); } // Open the project.ini MOG_Ini ini = new MOG_Ini(MOG_ControllerProject.GetProject().GetProjectConfigFilename()); // Walk through all the assets for (int x = 0; x < ini.CountKeys("Assets"); x++) { // Get the asset name string imageName = ini.GetString(ini.GetKeyNameByIndex("Assets", x), "Icon"); // Check if we have an image? if (imageName.Length > 0) { string assetKey = ini.GetKeyNameByIndex("Assets", x).ToLower(); LoadIcon(imageName, ini.GetKeyNameByIndex("Assets", x).ToLower()); // Check for a lock image string lockImageName = Path.GetFileNameWithoutExtension(imageName) + "_locked"; string lockFullImageName = imageName.Replace(Path.GetFileNameWithoutExtension(imageName), lockImageName); LoadIcon(lockFullImageName, assetKey + "_locked"); // Check for a ReadLock image lockImageName = Path.GetFileNameWithoutExtension(imageName) + "_readlocked"; lockFullImageName = imageName.Replace(Path.GetFileNameWithoutExtension(imageName), lockImageName); LoadIcon(lockFullImageName, assetKey + "_readlocked"); } } if (DosUtils.FileExist(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\Group.bmp"))) { // Get the group image Image myImage = new Bitmap(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\Group.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("group"); } mAssetTypeImages.TransparentColor = Color.Magenta; // Initialize state icons if (DosUtils.DirectoryExist(MOG_ControllerSystem.GetSystem().GetSystemToolsPath() + "\\Images\\States")) { FileInfo [] stateImages = DosUtils.FileGetList(MOG_ControllerSystem.GetSystem().GetSystemToolsPath() + "\\Images\\States", "*.bmp"); foreach (FileInfo stateImage in stateImages) { LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName, Path.GetFileNameWithoutExtension(stateImage.Name)); } } }
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; }