private void MogProcess() { // Loop until we shutdown while (!MOG_Main.IsShutdown()) { // Only process while we are not shutting down? if (!MOG_Main.IsShutdownInProgress()) { try { MOG_Main.Process(); } catch (Exception ex) { MOG_Report.ReportSilent("MogProcess", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } } Thread.Sleep(1); } // Inform our parent thread that we have exited mMogProcess = null; // Gracefully wait a while to see if our parent thread will terminate the application for us? Thread.Sleep(500); // At this point, let's take the inititive and shut ourselves down Application.Exit(); }
static public void MOGGlobalToolsPermisions(MogMainForm mainForm) { // Encapsulate everything in a try-catch try { if (MOG_ControllerProject.GetPrivileges() != null) { MogControl_PrivilegesForm privilegesForm = new MogControl_PrivilegesForm(MOG_ControllerProject.GetPrivileges()); privilegesForm.StartPosition = FormStartPosition.CenterParent; DialogResult result = privilegesForm.ShowDialog(mainForm); result.ToString(); } else { MOG_Prompt.PromptMessage("Permissions Error!", "Unable to open Permissions Form. " + "Please make sure a valid project is selected.\r\n\r\nYou may try clicking Projects |" + " (The Current Project) to resolve this error, and/or close and re-open MOG.", Environment.StackTrace); } } // Catch any .NET-explainable exceptions. catch (Exception ex) { MOG_Report.ReportMessage("Error in Privileges Change Form!", ex.Message, ex.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR); } }
static private int LoadIcon(string imageFileName, string assetClassName) { try { if (imageFileName != null && imageFileName.Length > 0) { // Load the icon specified by the Icon= key string iconName = imageFileName; // Make sure this is a full path, if not append the tools directory to it? iconName = MOG_ControllerSystem.LocateTool(imageFileName); // Make sure that the icon file exists if (iconName.Length > 0 && DosUtils.FileExist(iconName)) { // Get the image Image image = new Bitmap(iconName); return(InternalAddIconToLists(assetClassName, iconName, image)); } } } catch (Exception e) { MOG_Report.ReportSilent("Load Icon", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } return(0); }
private void AttachValidatedTagToNewObjectOrGroup(TreeNode package, TreeNode newNode, PackageNodeTypes nodeType) { // If this thing is a Group or Object, we need to do this algorithm string fullFilename = null; MOG_Filename assetFile = null; int imageIndex = 0; switch (nodeType) { case PackageNodeTypes.Group: imageIndex = MogUtil_AssetIcons.GetClassIconIndex(PackageGroup_ImageText); break; case PackageNodeTypes.Object: imageIndex = MogUtil_AssetIcons.GetClassIconIndex(PackageObject_ImageText); break; default: MOG_Report.ReportSilent("Got Unexpected PackageNodeTypes", "Unexpected PackageNodeTypes enum given for MOG_ControlsLibrary.Controls", Environment.StackTrace); break; } string groupPath = newNode.FullPath.Substring(package.FullPath.Length).Trim(PathSeparator.ToCharArray()).Replace(PathSeparator, "/"); fullFilename = package.FullPath + "/" + groupPath; assetFile = new MOG_Filename(((Mog_BaseTag)package.Tag).FullFilename); // Now that we've got our initial information, add our tag newNode.Tag = new Mog_BaseTag(newNode, assetFile.GetEncodedFilename(), this.FocusForAssetNodes, true); ((Mog_BaseTag)newNode.Tag).PackageNodeType = nodeType; ((Mog_BaseTag)newNode.Tag).PackageFullName = fullFilename; SetImageIndices(newNode, imageIndex); }
public static bool Init_Server(string configFilename, string name) { MOG_Main.SetName(name); // Make sure we have a valid config filename? if (configFilename.Length == 0) { configFilename = MOG_Main.BuildDefaultConfigFile(); } // Check our bootup precautions if (MOG_Main.CheckInitPrecautions(configFilename)) { // Initialize MOG_REPORT for the server MOG_Time time = new MOG_Time(); // MOG is really stable now so I am shutting off the log files so things will run faster // MOG_Prompt.SetMode(MOG_PROMPT_MODE_TYPE.MOG_PROMPT_FILE); MOG_Report.SetLogFileName(String.Concat(Application.StartupPath, "\\Logs\\Server\\Server.", time.FormatString(String.Concat("{Day.2}", "-", "{Month.2}", "-", "{Year.2}", " ", "{Hour.2}", ".", "{Minute.2}", "{ampm}")), ".log")); // Create a new system MOG_CommandServerCS server = new MOG_CommandServerCS(); return(MOG_ControllerSystemCS.InitializeServer(configFilename, server)); } return(false); }
//---------------------------------------------------------- // returns a list of available client versions public ArrayList GetCompatibleBuilds(ListViewItem server) { try { VersionNode serverVersion = (VersionNode)server.Tag; ArrayList compatibleBuilds = new ArrayList(); foreach (VersionNode version in mClientVersions) // go through client list { // major versions must match! if (version.MajorVersion == serverVersion.MajorVersion) { //if(version.MinorVersion >= serverVersion.MinorVersion) { compatibleBuilds.Add(version); } } } return(compatibleBuilds); } catch (Exception e) { MOG_Report.ReportMessage("Get Compatible Builds", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR); return(new ArrayList()); } }
public void KillCommand() { try { List <ListViewItem> killed = new List <ListViewItem>(); foreach (ListViewItem item in mainForm.CommandspendingListView.SelectedItems) { UInt32 commandID = Convert.ToUInt32(item.SubItems[(int)CommandsColumns.COMMANDID].Text); if (MOG_ControllerSystem.KillCommandFromServer(commandID)) { killed.Add(item); } } foreach (ListViewItem item in killed) { item.Remove(); } } catch (Exception e) { MOG_Report.ReportMessage("Kill Command Error", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR); } }
static private int LoadIcon(string imageFileName, string assetClassName) { try { // Load the icon specified by the Icon= key string iconName = imageFileName; // Make sure this is a full path, if not append the tools directory to it? iconName = MOG_ControllerSystem.LocateTool(imageFileName); lock (mAssetTypes) { // Make sure that the icon file exists if (iconName.Length > 0 && DosUtils.FileExist(iconName)) { // Get the image Image myImage = new Bitmap(iconName); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add(assetClassName, mAssetTypeImages.Images.Count - 1); return(mAssetTypeImages.Images.Count - 1); } } } catch (Exception e) { MOG_Report.ReportMessage("Load Icon", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } return(0); }
private void StartTimer_Tick(object sender, System.EventArgs e) { try { if (mainForm == null) { //StartTimer.Stop(); InitializeMainMogForm(mCommandLineArgs); //StartTimer.Start(); } else { if (mInitializationComplete) { Visible = false; this.Splash.Dispose(); if (bitmap != null) { bitmap.Dispose(); bitmap = null; } StartTimer.Stop(); mainForm.Show(); } } } catch (Exception ex) { MOG_Report.ReportMessage("Major Error", "MOG cannot start because of the following:\r\n\r\n" + ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL); this.Close(); this.Dispose(true); } }
public bool AddFile(string filename) { // We can only add to folder type objects if (mType == TYPE.Folder && mContents != null) { // Make sure it doesn't already exist if (!mContents.Contains(filename)) { // Add this file mContents.Add(filename, new DirectorySetInfo(filename, FolderName, DirectorySetInfo.TYPE.File)); //Debug.Write(filename, "\nAdded File to - " + FolderName); } else { // Warn the user they have a colliding asset string message = "Multiple assets are syncing to the same local filename.\n" + "FILENAME: " + Path.Combine(FolderName, filename) + "\n\n" + "The coliding assets can be seen from the project's Sync View tree.\n" + "Please remove the extra colliding assets from the project."; MOG_Report.ReportMessage("Colliding Assets Detected", message, "", MOG_ALERT_LEVEL.ERROR); return(false); } return(true); } return(false); }
private int LoadIcon(string imageFileName, ImageList imageList) { try { if (imageFileName != null && imageFileName.Length > 0) { // Load the icon specified by the Icon= key string iconName = imageFileName; // Make sure that the icon file exists if (DosUtils.FileExist(iconName)) { // Get the image Image myImage = new Bitmap(iconName); // Add the image and the type to the arrayLists imageList.Images.Add(myImage); return(imageList.Images.Count - 1); } } } catch (Exception e) { MOG_Report.ReportMessage("Load Icon", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } return(0); }
static public string Update(string project, string directory, string toolsPath) { string command = ""; string output = ""; string arguments = ""; // set current dir Environment.CurrentDirectory = directory; command = string.Concat(toolsPath, "\\cvs.bat"); arguments = string.Concat(directory, " update -d"); // 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); }
/// <summary> /// After rename, fixup the directory and update the MOG_ControllerSyncData /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GameDataTreeView_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e) { try { guiAssetTreeTag tag = (guiAssetTreeTag)e.Node.Tag; string targetDirectoryName = tag.FullFilename.Replace(e.Node.Text, e.Label); if (!Directory.Exists(targetDirectoryName)) { DirectoryInfo dir = new DirectoryInfo(tag.FullFilename); dir.MoveTo(targetDirectoryName); e.Node.Tag = new guiAssetTreeTag(targetDirectoryName, e.Node); GameDataTreeView.LabelEdit = false; } else { MOG_Report.ReportMessage("Rename Directory", "A name of that directory already exist", Environment.StackTrace, MOG_ALERT_LEVEL.ERROR); e.CancelEdit = true; return; } } catch { } }
static public int ShellExecute(string command, string arguments) { //string output = ""; int rc = 0; // 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); } try { p.WaitForExit(); } catch (Exception e) { MOG_Report.ReportMessage("SpawnDosCommand Error", String.Concat("Could not waitForExit (", e.Message, ")"), e.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } p.Close(); return(rc); }
public void CreateAssetConfigs() { RaiseAssetImport_Begin(); try { MOG_Project proj = MOG_ControllerProject.GetProject(); if (proj != null) { ProgressDialog progress = new ProgressDialog("Importing Assets", "Please wait while the Assets are imported into the Project's Repository.", CreateAssetConfigs_Worker, null, true); progress.ShowDialog(); // Post the projects new assets skipping the PostScanProcess MOG_ControllerProject.PostAssets(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName(), MOG_ControllerProject.GetProjectName(), true); } } catch (Exception e) { MOG_Report.ReportMessage("Unable to import asset", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL); } finally { RaiseAssetImport_Finish(); } }
/// <summary> /// Find a TreeNode, given its full path. NOTE: This does not expand down to the node, so if /// the TreeView is not expanded, you will receive the closest parent node. /// </summary> /// <returns>null, if no Node found</returns> public TreeNode FindNode(string fullPath) { //string[] pathParts = fullPath.Split(this.PathSeparator.ToCharArray()); TreeNode foundNode = null; try { TreeNodeCollection currentNodes = this.Nodes; // New fast search TreeNode [] foundNodes = currentNodes.Find(fullPath, true); if (foundNodes != null && foundNodes.Length > 0) { if (foundNodes.Length == 1) { return(foundNodes[0]); } } // KLK - Removed this old way of finding nodes because you can use the trees built in find if you set the name of each node = its fullpath. //else //{ // // Foreach part of our pathParts, look for a node that matches our currentPart... // foreach (string currentPart in pathParts) // { // // Foreach node in currentNodes, see if we match // foreach (TreeNode node in currentNodes) // { // // If we match, set foundNode to node, then exit out of this foreach // if (string.Compare(node.Text, currentPart, true) == 0) // //if (node.Text.ToLower() == currentPart.ToLower()) // { // foundNode = node; // break; // } // } // // If our foundNode.Nodes is not the same as our currentNodes collection, continue... // if (foundNode != null && foundNode.Nodes != currentNodes) // { // // Select our next set of Nodes // currentNodes = foundNode.Nodes; // } // // Else, we've found what we're looking for (or `null`), so terminate // else // { // break; // } // } //} } catch (Exception ex) { MOG_Report.ReportMessage("Error Finding Node", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.ERROR); } return(foundNode); }
/// <summary> /// Makes the selected assets the current version in the current branch /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MakeCurrentMenuItem_Click(object sender, System.EventArgs e) { try { ArrayList selectedItems = ControlGetSelectedItems(); ArrayList assetFilenames = new ArrayList(); // Scan the list and prepare it for delivery to the DLL string message = ""; foreach (guiAssetTreeTag tag in selectedItems) { if (tag.Execute) { MOG_Filename filename = new MOG_Filename(tag.FullFilename); if (filename.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset) { assetFilenames.Add(filename); } message = message + filename.GetAssetFullName() + "\n"; } } // Check if this request effects more than 1 asset?? if (selectedItems.Count > 1) { if (MOG_Prompt.PromptResponse("Are you sure you want to make all of these assets the current versions?", message, MOGPromptButtons.OKCancel) != MOGPromptResult.OK) { return; } } // Stamp all the specified assets if (MOG_ControllerProject.MakeAssetCurrentVersion(assetFilenames, "Made current by " + MOG_ControllerProject.GetUserName_DefaultAdmin())) { // Check if this request effects more than 1 asset?? if (selectedItems.Count > 1) { // Inform the user this may take a while MOG_Prompt.PromptResponse("Completed", "This change requires Slave processing.\n" + "The project will not reflect these changes until all slaves have finished processing the generated commands.\n" + "The progress of this task can be monitored in the Connections Tab."); } } else { MOG_Prompt.PromptMessage("Make Current Failed", "The system was unable to fully complete the task!", Environment.StackTrace); } } catch (Exception ex) { MOG_Report.ReportMessage("MakeCurrent Exception", ex.Message, ex.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL); } }
static public void MOGGlobalViewRefresh(MogMainForm mainForm, string tabName) { switch (tabName) { case "MainTabStartupTabPage": mainForm.MOGWelcomeWebBrowser.Refresh(); break; case "MainTabProjectManagerTabPage": mainForm.mProjectManager.BuildRepositoryTrees(true); //mainForm.ProjectManagerTaskWindow.InitializeForProject(); break; case "MainTabAssetManagerTabPage": mainForm.RefreshClientAssetWindow(); mainForm.mAssetManager.mLocal.RefreshWindow(); //mainForm.AssetManagerTaskWindow.InitializeForUser(); break; case "MainTabConnectionManagerTabPage": if (connectionRefreshTimer == null) //mainForm.AllowConnectionsRefresh) { mainForm.mConnectionManager.Refresh(); connectionRefreshTimer = new System.Windows.Forms.Timer(); connectionRefreshTimer.Interval = 1000; connectionRefreshTimer.Tick += new EventHandler(connectionRefreshTimer_Tick); connectionRefreshTimer.Start(); } break; case "MainTabLockManagerTabPage": if (mainForm.mLockManager != null) { mainForm.mLockManager.Initialize(); } break; case "MainTabLibraryTabPage": if (mainForm.mLibraryManager != null) { mainForm.mLibraryManager.Refresh(); } break; default: MOG_Report.ReportSilent("Error In MOG_Client.Client_Mog_Utilities.MainMenuViewClass.MOGGlobalViewRefresh", "Error finding tab page to refresh: \r\n\r\n" + mainForm.MOGTabControl.SelectedTab.Name, Environment.StackTrace); break; } }
private void InitializeMOG() { // Check to see if we can init the server if (!MOG_Main.Init_Client("", "Remote Server Manager")) { // Inform the user that we failed to connect and will continue in an offline mode string message = "Failed to connect to the MOG Server.\n" + "Please be advised that you will most likely experience limited functionality during this session."; MOG_Report.ReportMessage("Connection Failed", message, "", MOG_ALERT_LEVEL.ALERT); } RemoteServerSettings.Initialize(); }
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); } }
private System.Drawing.Bitmap SetIcon(string filename) { try { return(new System.Drawing.Bitmap(MOG_ControllerSystem.LocateTool("\\Images\\States", filename))); } catch (Exception e1) { MOG_Report.ReportSilent("Initialize state icon", "Icon:\n" + "\\Images\\States\\" + filename + "\nCould not be loaded\n\n" + e1.Message, e1.StackTrace, MOG_ALERT_LEVEL.ERROR); return(null); } }
/// <summary> /// Remove a Package from the PackageManagement Tree. /// Adapted from MogControl_AssetContextMenu.cs::MenuItemRemoveFromProject_Click() /// </summary> private void RemovePackage(MOG_Filename packageName) { try { if (!MOG_ControllerProject.RemoveAssetFromProject(packageName, "No longer needed", false)) { return; } } catch (Exception ex) { MOG_Report.ReportMessage("Remove From Project", ex.Message, ex.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL); } }
public guiLogs(FormMainSMOG parentForm) { defaultLogName = MOG_Report.GetLogFileName(); //TODO JKB: Function Request: MOG_REPORT.GetLogPath() logpath = MOG_Report.GetLogFileName().Substring(0, MOG_Report.GetLogFileName().LastIndexOf("\\")); defaultLogFullName = MOG_Report.GetLogFileName(); logLoaded = false; mainForm = parentForm; LogLogDisplayRichTextBox = new RichTextBox(); //mainForm.LogLogDisplayRichTextBox; LogLogFilenameLabel = new Label(); //mainForm.LogLogFilenameLabel; LogComboBox = new ComboBox(); }
static void Main(string[] args) { Control.CheckForIllegalCrossThreadCalls = false; SplashForm form = null; try { // Check for multiple instances Process mogProcess = RunningInstance(); if (mogProcess != null) { // we've got a duplicate process - ask the user if they want to continue anyway DialogResult res = MessageBox.Show("An instance of the MOG Server Manager is already running on this machine.\nIt is possible that this instance is the result of a crash or other problem,\nin which case you should contact your MOG or network administrator.\n\nWould you like to start the Manager anyway?", "Manager Already Running", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); // if not, shutdown if (res == DialogResult.No) { return; } // user wants to spawn a new instance } form = new SplashForm(args); form.Closing += new CancelEventHandler(form_Closing); form.Closed += new EventHandler(form_Closed); form.HandleDestroyed += new EventHandler(form_HandleDestroyed); Application.Run(form); } catch (Exception e) { MOG_Report.ReportMessage("Main", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL); // Write our problem out to our Output window in VS.NET System.Diagnostics.Debug.WriteLine(e.ToString() + "\n" + e.StackTrace); // Shutdown our process if (form != null) { form.Close(); if (form.mainForm.mMogProcess != null) { form.mainForm.mMogProcess.Abort(); } } // Exit our application so we can set a breakpoint here and try again MOG_Main.Shutdown(); Application.Exit(); } }
public static bool Process(string fullName) { try { MOG_ControllerInbox.RipAsset(new MOG_Filename(fullName)); } catch (Exception e) { MOG_Report.ReportMessage("Process", fullName + "\n\n" + e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR); return(false); } return(true); }
/// <summary> /// Delete directory /// </summary> private void LocalDirectoryDeleteMenuItem_Click(object sender, System.EventArgs e) { try { guiAssetTreeTag tag = (guiAssetTreeTag)GameDataTreeView.SelectedNode.Tag; if (MOG_Prompt.PromptResponse("Delete Directory", "Are you sure you wan to delete this directory with all its contents?\n\nDirectory:\n\n" + tag.FullFilename, MOGPromptButtons.YesNo) == MOGPromptResult.Yes) { if (tag.Object != null) { // Get our gameData handle from the item's tag MOG_ControllerSyncData gameDataHandle = (MOG_ControllerSyncData)tag.Object; if (gameDataHandle != null) { MOG_Report.ReportMessage("Delete Directory", "Cannot delete a directory that is a MOG Local Workspace! Remove this Workspace first then try again.", Environment.StackTrace, MOG_ALERT_LEVEL.ERROR); return; // // Remove the synced location // if (!MOG_DBSyncedDataAPI.RemoveSyncedLocation(MOG_ControllerSystem.GetComputerName(), gameDataHandle.GetProjectName(), gameDataHandle.GetPlatformName(), gameDataHandle.GetGameDataPath())) // { // throw new Exception("Database could not remove this synced location!"); // } // // // Remove all the updated records // string filter = gameDataHandle.GetGameDataPath() + "\\*"; // if (!MOG_DBInboxAPI.InboxRemoveAllAssets("Local", null, null, filter)) // { // throw new Exception("Database inbox could not remove this synced location!"); // } } } // Now, actually delete the directory ArrayList FilesToDelete = DosUtils.FileGetRecursiveList(tag.FullFilename, "*.*"); ProgressDialog progress = new ProgressDialog("Delete Directory", "Deleting...", LocalDirectoryDelete_Worker, FilesToDelete, true); if (progress.ShowDialog() == DialogResult.OK) { // Now delete all the files left behind Directory.Delete(tag.FullFilename, true); // Remove the node GameDataTreeView.SelectedNode.Remove(); } } } catch (Exception ex) { MOG_Report.ReportMessage("Delete Directory", "Could not delete this directory!\n\nMessage:" + ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } }
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 int AppendSummary(string section, string comment, Color nodeColor) { // Get all the file copies if (mSummary.SectionExist(section)) { string[] keys = mSummary.GetSectionKeys(section); foreach (string key in keys) { // Get the asset/file information from the summary file string assetName = mSummary.GetString(section, key); string fileName = key; // Trim any starting '\' if (fileName != null && fileName.Length > 0) { fileName = fileName.TrimStart("\\".ToCharArray()); } try { string fullfilename = MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory() + "\\" + fileName; ListViewItem item = new ListViewItem(); item.Text = Path.GetFileName(fileName); item.ForeColor = nodeColor; FileInfo file = new FileInfo(fullfilename); item.SubItems.Add(file.LastWriteTime.ToShortDateString() + " " + file.LastWriteTime.ToShortTimeString()); item.SubItems.Add(comment); item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(fullfilename); SummaryListView.Items.Add(item); } catch (Exception e) { MOG_Report.ReportMessage("Update Summary", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR); } } return(mSummary.CountKeys(section)); } return(0); }
/// <summary> /// Update populated tree node icons or status based on updated commands from the eventManager /// </summary> /// <param name="asset"></param> public void UpdateAsset(MOG_Command asset) { // Encapsulate this method in a try-catch try { // Update code for all persistent lock changes if (asset.GetCommand() != null && (asset.ToString().ToLower().IndexOf("lock") != -1)) { MOG_Command userLock = asset.GetCommand(); MOG_Filename assetName = userLock.GetAssetFilename(); string nodeKey = assetName.GetAssetFullName(); // Is this a class? if (assetName.GetFilenameType() != MOG_FILENAME_TYPE.MOG_FILENAME_Asset) { nodeKey = assetName.GetOriginalFilename().TrimEnd("*".ToCharArray()); } if (mainForm.ProjectManagerClassificationTreeView.IsInitialized) { FindAndUpdateNodeLockStatus(nodeKey, assetName, mainForm.ProjectManagerClassificationTreeView); } if (mainForm.ProjectManagerPackageTreeView.IsInitialized) { FindAndUpdateNodeLockStatus(nodeKey, assetName, mainForm.ProjectManagerPackageTreeView); } if (mainForm.ProjectManagerArchiveTreeView.IsInitialized) { FindAndUpdateNodeLockStatus(nodeKey, assetName, mainForm.ProjectManagerArchiveTreeView); } if (mainForm.ProjectManagerSyncTargetTreeView.IsInitialized) { FindAndUpdateNodeLockStatus(nodeKey, assetName, mainForm.ProjectManagerSyncTargetTreeView); } } } // Catch any .NET-standard errors catch (Exception ex) { // Add MOG_Report stuff here. MOG_Report.ReportSilent("UpdateAsset", ex.Message, ex.StackTrace); } }
internal bool ReleaseSlave(MOG_Command pCommand) { // Scan mActiveSlaves looking for one that matches this command // This way is safer just in case NetworkIDs get reset from a reconnect event for (int s = 0; s < mActiveSlaves.Count; s++) { MOG_Command pSlave = (MOG_Command)mActiveSlaves[s]; // Check if this slave is working on something? if (pSlave.GetCommand() != null) { // Check if the CommandID matches? if (pSlave.GetCommand().GetCommandID() == pCommand.GetCommandID()) { // Clear this slave's command pSlave.SetCommand(null); // Refresh the command's SetAssignedSlaveID pCommand.SetAssignedSlaveID(pSlave.GetNetworkID()); // Send out needed Notify command MOG_Command pNotify = MOG_CommandFactory.Setup_NotifyActiveConnection(pSlave); mServerCommandManager.SendToActiveTab("Connections", pNotify); pNotify = MOG_CommandFactory.Setup_NotifyActiveCommand(pCommand); mServerCommandManager.SendToActiveTab("Connections", pNotify); // Insert the slave at the top of mAvailableSlaves so it will be immeadiately reused mAvailableSlaves.Insert(0, pSlave); // Erase the slave from mActiveSlaves mActiveSlaves.RemoveAt(s); // Return the command that the slave was processing for reference return(true); } } } string message = String.Concat("Server could not release slave because it failed to locate the slave in mActiveSlaves\n", "Command:", pCommand.ToString(), " NetworkID:", pCommand.GetNetworkID(), " Asset:", pCommand.GetAssetFilename().GetOriginalFilename()); MOG_Report.ReportMessage("Server", message, Environment.StackTrace, MOG_ALERT_LEVEL.ERROR); return(false); }