public string GetClientStatusDescription(MOG_Command command) { MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); // Describe the current command of this connection string description = ""; // Check if we have a ProjectName specified? if (command.GetProject().Length > 0) { // Add on our ProjectName description += "PROJECT: " + command.GetProject(); } // Check if we have a ProjectName specified? if (command.GetBranch().Length > 0) { // Add on our ProjectName description += " BRANCH: " + command.GetBranch(); } // Check if we have a UserName specified? if (command.GetUserName().Length > 0) { // Add on our ProjectName description += " USER: "******" TAB: " + viewsCommand.GetTab(); } // Check if we have a Platform specified? if (viewsCommand.GetPlatform().Length > 0) { description += " PLATFORM: " + viewsCommand.GetPlatform(); } // Check if we have a Tab specified? if (viewsCommand.GetUserName().Length > 0) { description += " INBOX: " + viewsCommand.GetUserName(); } } return(description); }
internal bool IsJobPackaging(MOG_Command pCommand) { // Check if this job has already begun any packaging commands yet? if (mProcessedPackageCommands.Count > 0) { // Check if this package command is related to any already processed packaging commands within this job? foreach (MOG_Command command in mProcessedPackageCommands) { // Check if the CommandType matches? // Check if the AssetFilename matches? // Check if the Platforms matches? // Check if the Branch matches? if (command.GetCommandType() == pCommand.GetCommandType() && String.Compare(command.GetAssetFilename().GetOriginalFilename(), pCommand.GetAssetFilename().GetOriginalFilename(), true) == 0 && String.Compare(command.GetPlatform(), pCommand.GetPlatform(), true) == 0 && String.Compare(command.GetBranch(), pCommand.GetBranch(), true) == 0) { // Indicate that this job is packaging a similar network package command return(true); } } // In addition lets check all pending merge commands to make sure we don't have a deadlock situation coming down the road IDictionaryEnumerator enumerator = mPackageCommandList.GetEnumerator(); while (enumerator.MoveNext()) { MOG_Command command = (MOG_Command)(enumerator.Value); // Check if the CommandType matches? // Check if the AssetFilename matches? // Check if the Platforms matches? // Check if the Branch matches? if (command.GetCommandType() == pCommand.GetCommandType() && String.Compare(command.GetAssetFilename().GetOriginalFilename(), pCommand.GetAssetFilename().GetOriginalFilename(), true) == 0 && String.Compare(command.GetPlatform(), pCommand.GetPlatform(), true) == 0 && String.Compare(command.GetBranch(), pCommand.GetBranch(), true) == 0) { // Indicate that this job will soon be packaging a similar network package command return(true); } } } return(false); }
bool CheckExclusiveCommands(MOG_Command pCommand) { // Scan mActiveSlaves looking for one that matches this command for (int s = 0; s < mActiveSlaves.Count; s++) { // Make sure that this slave contains a valid command? MOG_Command pSlave = (MOG_Command)mActiveSlaves[s]; if (pSlave.GetCommand() != null) { // Check if the CommandType matches? // Check if the AssetFilename matches? // Check if the Platforms matches? // Check if the Branch matches? // Check if the JobLabel matches? if (pSlave.GetCommand().GetCommandType() == pCommand.GetCommandType() && String.Compare(pSlave.GetCommand().GetAssetFilename().GetOriginalFilename(), pCommand.GetAssetFilename().GetOriginalFilename(), true) == 0 && String.Compare(pSlave.GetCommand().GetPlatform(), pCommand.GetPlatform(), true) == 0 && String.Compare(pSlave.GetCommand().GetBranch(), pCommand.GetBranch(), true) == 0) // JohnRen - Checking the JobLabel breaks exclusivity because 2 users could have initiated the same item and could collide // String.Compare(pSlave.GetCommand().GetJobLabel(), pCommand.GetJobLabel(), true) == 0) { return(true); } } } // Check if this command is a network packaging command? if (pCommand.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge) { // Check if there was an earlier network package merge similar to this command? // Enumerate through all the jobs foreach (MOG_JobInfo job in mJobOrder) { // Make sure this is a valid job? and // Make sure this is another job unrelated to this command? if (job != null && string.Compare(job.GetJobLabel(), pCommand.GetJobLabel(), true) != 0) { // Ask this job if it is packaging a similar command? if (job.IsJobPackaging(pCommand)) { // We never want to allow a second network package merge to begin until the earlier one has finished posting return(true); } } } } return(false); }
bool IsDuplicateCommand(MOG_Command pCommand1, MOG_Command pCommand2) { // Check if the CommandType matches? // Check if the AssetFilename matches? // Check if the Platforms matches? // Check if the Branch matches? // Check if the JobLabel matches? // Check if the ValidSlaves matches? if (pCommand1.GetCommandType() == pCommand2.GetCommandType() && String.Compare(pCommand1.GetAssetFilename().GetOriginalFilename(), pCommand2.GetAssetFilename().GetOriginalFilename(), true) == 0 && String.Compare(pCommand1.GetPlatform(), pCommand2.GetPlatform(), true) == 0 && String.Compare(pCommand1.GetBranch(), pCommand2.GetBranch(), true) == 0 && String.Compare(pCommand1.GetJobLabel(), pCommand2.GetJobLabel(), true) == 0 && String.Compare(pCommand1.GetValidSlaves(), pCommand2.GetValidSlaves(), true) == 0) { return(true); } return(false); }
private ListViewItem LocateCommandItem(MOG_Command command) { foreach (ListViewItem item in mainForm.ConnectionManagerCommandsListView.Items) { if (item != null && item.SubItems != null) { MOG_Command existingCommand = item.Tag as MOG_Command; if (existingCommand != null) { if (existingCommand.GetCommandType() == command.GetCommandType() && string.Compare(existingCommand.GetAssetFilename().GetAssetFullName(), command.GetAssetFilename().GetAssetFullName(), true) == 0 && existingCommand.GetPlatform() == command.GetPlatform() && existingCommand.GetJobLabel() == command.GetJobLabel()) { return(item); } } } } return(null); }
public string GetDetailedCommandDescription(MOG_Command command) { MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); // Describe the current command of this connection string description = ""; // Check if this command is a MOG_COMMAND_RegisterClient? // Check if this command is a MOG_COMMAND_RegisterEditor? switch (command.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginProject: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginUser: case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews: // Indicate the LoginProject if (command.GetProject() != null && command.GetProject().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, command.GetProject()); } // Indicate the LoginUser if (command.GetUserName() != null && command.GetUserName().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, command.GetUserName()); } // Attempt to locate the current view settings for this client MOG_Command viewsCommand = commandServer.LocateActiveViewByID(command.GetNetworkID()); if (viewsCommand != null) { // Attempt to show the ActiveTab if (viewsCommand.GetTab() != null && viewsCommand.GetTab().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, viewsCommand.GetTab()); } // Attempt to show the ActivePlatform if (viewsCommand.GetPlatform() != null && viewsCommand.GetPlatform().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, viewsCommand.GetPlatform()); } // Attempt to show the ActiveUser if (viewsCommand.GetUserName() != null && viewsCommand.GetUserName().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, viewsCommand.GetUserName()); } } return(description); } description = command.ToString(); // If there is an Asset associated with the command?, show it as well if (command.GetAssetFilename().GetFilename().Length != 0) { if (command.GetAssetFilename().GetUserName().Length > 0) { description = String.Concat(description, " for ", command.GetAssetFilename().GetUserName()); if (command.GetAssetFilename().GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_SlaveTask) { string temp; int start, len; temp = command.GetAssetFilename().GetPath(); start = command.GetAssetFilename().GetBoxPath().Length + 1; len = temp.LastIndexOf("\\") - start; if (start > 0 && len != -1) { temp = temp.Substring(start, len); description = String.Concat(description, " - ", temp); } } else { description = String.Concat(description, " - ", command.GetAssetFilename().GetFilename()); } } } return(description); }
public void UpdateCommands(MOG_Command command) { ListViewItem item; MOG_Command action = command.GetCommand(); if (action != null) { bool bAdd = false; bool bRemove = false; switch (action.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_None: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew: case MOG_COMMAND_TYPE.MOG_COMMAND_InstantMessage: case MOG_COMMAND_TYPE.MOG_COMMAND_LaunchSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_LockCopy: case MOG_COMMAND_TYPE.MOG_COMMAND_LockMove: case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRelease: case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest: case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease: case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginProject: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginUser: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkBroadcast: case MOG_COMMAND_TYPE.MOG_COMMAND_NewBranch: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveCommand: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveConnection: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveLock: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveCommands: case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveConnections: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshApplication: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshTools: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshProject: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewConnection: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewLock: case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate: // Eat these commands, we don't need to show them in this window break; case MOG_COMMAND_TYPE.MOG_COMMAND_Complete: // Drill one more level into this Complete command action = action.GetCommand(); bRemove = true; break; // All other commands can simply be added default: bAdd = true; break; } // Check if we are removing the command? if (bRemove) { // Strip out any matching commands do { // Find it using specific information // item = LocateItem((int)CommandsColumns.COMMANDID, action.GetCommandID().ToString(), mainForm.ConnectionManagerCommandsListView); item = LocateCommandItem(action); if (item != null) { item.Remove(); } } while(item != null); } // Check if we are adding the command? if (bAdd) { // Find it using a generic approach item = LocateCommandItem(action); if (item != null) { // Check if this could replace an existing command? if (action.IsRemoveDuplicateCommands()) { // Remove the duplicate item.Remove(); item = null; } } // Check if the item already exists if (item == null) { //It doesn't already exist, so let's make a new one item = new ListViewItem(); MOG_Time time = new MOG_Time(); time.SetTimeStamp(command.GetCommandTimeStamp()); string assetFullName = "PROJECT: " + action.GetProject() + " ASSET: " + action.GetAssetFilename().GetAssetOriginalFullName(); if (string.Compare(action.GetProject(), MOG_ControllerProject.GetProjectName(), true) == 0) { assetFullName = action.GetAssetFilename().GetAssetFullName(); } item.Text = action.ToString(); item.SubItems.Add(assetFullName); item.SubItems.Add(action.GetPlatform()); item.SubItems.Add(action.IsCompleted() ? "Working" : ""); item.SubItems.Add(action.GetJobLabel()); item.SubItems.Add(action.GetComputerName().ToString()); item.SubItems.Add(action.GetComputerIP().ToString()); item.SubItems.Add(action.GetNetworkID().ToString()); item.SubItems.Add(action.GetCommandID().ToString()); item.Tag = action; item.ImageIndex = GetImageIndex(action.GetCommandType()); mainForm.ConnectionManagerCommandsListView.Items.Add(item); } } } }
public string GetClientStatusDescription(MOG_Command command) { // Describe the current command of this connection string description = ""; // Check if this was a registered slave reporting? switch (command.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: description = "Idle"; // Get the contained command this slave is working on MOG_Command slaveTask = command.GetCommand(); if (slaveTask != null) { // Check if we have a ProjectName specified? if (slaveTask.GetProject().Length > 0) { // Add on our ProjectName description = "PROJECT: " + slaveTask.GetProject(); } // Check if there is an encoded platform in this command? if (slaveTask.GetPlatform().Length > 0) { // Get the slave's active platform description += " PLATFORM: " + slaveTask.GetPlatform(); } // Check if we have a UserName specified? if (slaveTask.GetUserName().Length > 0) { // Add on our ProjectName description += " USER: "******" COMMAND: " + slaveTask.ToString(); // Make sure we are in the same project if (string.Compare(slaveTask.GetProject(), MOG_ControllerProject.GetProjectName(), true) == 0) { // Check if we have an asset specified? if (slaveTask.GetAssetFilename().GetAssetName().Length > 0) { // Build the slave's description description += " ASSET: " + slaveTask.GetAssetFilename().GetAssetName(); } } } break; default: // Check if we have a ProjectName specified? if (command.GetProject().Length > 0) { // Add on our ProjectName description += "PROJECT: " + command.GetProject(); } // Check if we have a ProjectName specified? if (command.GetBranch().Length > 0) { // Add on our ProjectName description += " BRANCH: " + command.GetBranch(); } // Check if we have a UserName specified? if (command.GetUserName().Length > 0) { // Add on our ProjectName description += " USER: "******" TAB: " + command.GetTab(); } // Check if we have a Platform specified? if (command.GetPlatform().Length > 0) { description += " PLATFORM: " + command.GetPlatform(); } // Check if we have a Tab specified? if (command.GetUserName().Length > 0) { description += " INBOX: " + command.GetUserName(); } break; } return(description); }