public void DisplayRefreshSlaveStatus() { //this needs to walk the connections and add all the connected computers. MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); if (commandServer == null) { return; } ArrayList slavesArray = commandServer.GetRegisteredSlaves(); foreach (Object item in slavesArray) { MOG_Command connection = (MOG_Command)item; if (connection.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_None) { // Find item ListViewItem lItem = LocateListViewItem(mainForm.lviewMonitor, connection.GetNetworkID()); if (lItem != null) { if (string.Compare(lItem.SubItems[(int)MONITOR_TABS.INFORMATION].Text, "Idle") != 0) { lItem.SubItems[(int)MONITOR_TABS.INFORMATION].Text = "Idle"; } } } } }
internal bool ConfirmLicense(MOG_Command pCommand) { bool bLicense = false; // Check if we are a client? MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager()); if (commandServer != null) { // Check if this client is already registered? if (commandServer.LocateClientByID(pCommand.GetNetworkID()) != null) { // JohnRen - Bummer, we can't check this because they may have just expired and now be legitamately running on the 4 connections // // Now double check the date of this command to ensure it hasn't expired // DateTime commandDate = MOG_Time.GetDateTimeFromTimeStamp(pCommand.GetCommandTimeStamp()); // if (!mTimeBomb.HasExpired(commandDate)) // { // Indicate this client is licensed bLicense = true; // } } else { // Let's try to obtain a license if (CanObtainLicense(pCommand)) { // Indicate this client got a license bLicense = true; } } } return(bLicense); }
internal bool Command_RequestActiveCommands(MOG_Command pCommand) { bool bFailed = false; // Loop through mActiveSlaves for (int c = 0; c < mActiveSlaves.Count; c++) { // Send off the Notify command for each one MOG_Command pNotify = MOG_CommandFactory.Setup_NotifyActiveCommand((MOG_Command)mActiveSlaves[c]); if (!mServerCommandManager.SendToConnection(pCommand.GetNetworkID(), pNotify)) { bFailed = true; } } // Enumerate through all the jobs foreach (MOG_JobInfo job in mJobOrder) { if (job != null) { if (!job.Command_RequestActiveCommands(pCommand)) { bFailed = true; } } } // Check if we failed? if (!bFailed) { return(true); } return(false); }
internal bool RemoveSlave(MOG_Command pSlave) { // Remove this computer name from our requested slaves list RemoveRequestedSlaveName(pSlave.GetComputerName()); // Remove this slave from our list of automatically launched slaves RemoveAutoLaunchedSlaveName(pSlave.GetComputerName()); // Scan all the available slaves looking for this one for (int s = 0; s < mAvailableSlaves.Count; s++) { MOG_Command availableSlave = (MOG_Command)mAvailableSlaves[s]; // Check if this is the slave we are looking for? if (pSlave.GetNetworkID() == availableSlave.GetNetworkID()) { // Remove it from mAvailableSlaves mAvailableSlaves.RemoveAt(s); break; } } // Scan all the active slaves looking for this one for (int s = 0; s < mActiveSlaves.Count; s++) { MOG_Command activeSlave = (MOG_Command)mActiveSlaves[s]; // Check if this is the slave we are looking for? if (pSlave.GetNetworkID() == activeSlave.GetNetworkID()) { // Remove the slave from mActiveSlaves mActiveSlaves.RemoveAt(s); // Recover the command this slave was actively working on RecoverActiveSlaveCommand(pSlave); break; } } return(true); }
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); }
MOG_Command LocateActiveSlaveByID(int networkID) { // Scan mActiveSlaves looking for one that matches this command for (int s = 0; s < mActiveSlaves.Count; s++) { MOG_Command pSlave = (MOG_Command)mActiveSlaves[s]; // Check if this is the slave we are looking for? if (pSlave.GetNetworkID() == networkID) { return(pSlave); } } return(null); }
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); }
private ListViewItem InitNewRequestItem(MOG_Command command) { if ((command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest) || (command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest)) { ListViewItem item = new ListViewItem(); MOG_Time time = new MOG_Time(); time.SetTimeStamp(command.GetCommandTimeStamp()); item.Text = command.ToString(); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.SubItems.Add(command.GetComputerIP()); item.SubItems.Add(time.FormatString("")); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetUserName()); item.SubItems.Add(Convert.ToString(command.GetNetworkID())); item.SubItems.Add(command.GetDescription()); item.SubItems.Add(command.ToString()); switch (command.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest: item.Text = "Read Lock"; item.ForeColor = Color.Green; item.ImageIndex = 0; break; case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest: item.Text = "Write Lock"; item.ForeColor = Color.Red; item.ImageIndex = 0; break; } return(item); } return(null); }
internal bool Command_KillCommand(MOG_Command pCommand) { // Enumerate through all the jobs foreach (MOG_JobInfo job in mJobOrder) { if (job != null) { // Attempt to remove the command from this job job.KillCommand(pCommand.GetCommandID()); } } // Check the active slaves to see if it is being processed? // Just in case the command we want to kill has already been tasked out to a slave for (int c = 0; c < mActiveSlaves.Count; c++) { // Check this slave's assigned command? MOG_Command activeSlave = (MOG_Command)mActiveSlaves[c]; MOG_Command pActiveCommand = activeSlave.GetCommand(); if (pActiveCommand != null) { // Checkif the CommandID matches? if (pActiveCommand.GetCommandID() == pCommand.GetCommandID()) { // Clear the command this slave is working on activeSlave.SetCommand(null); // Always kill the connection to this slave just in case it was hung by the command MOG_ControllerSystem.ShutdownSlave(activeSlave.GetNetworkID()); break; } } } // Always eat this command return(true); }
internal bool AssignToSlave(MOG_Command pCommand) { MOG_Command pSlave = null; // Always make sure that the AssignedSlaveID is cleared just in case we fail pCommand.SetAssignedSlaveID(0); // Check if this is an exclusive command? if (pCommand.IsExclusiveCommand()) { // Check if this exclusive command is already actively getting processed? if (CheckExclusiveCommands(pCommand)) { // Don't assign this exclusive command because there is already another one being processed return(false); } } // Identify a valid slave based on the mValidSlaves? if (pCommand.GetValidSlaves().Length > 0) { // Look for a valid slave by scanning mAvailableSlaves for (int s = 0; s < mAvailableSlaves.Count; s++) { // Is this slave's name specified in mValidSlaves? pSlave = (MOG_Command)mAvailableSlaves[s]; if (pSlave != null) { if (IsSlaveListed(pSlave.GetComputerName(), pCommand.GetValidSlaves())) { break; } } // Indicate that this slave wasn't listed in mValidSlaves pSlave = null; } // No available valid slave found? if (pSlave == null) { // Request a new slave respecting this command's valid slaves RequestNewSlave(pCommand); // Bail out since we need to wait for a slave to become available return(false); } } else { // Check if we have run out of available slaves? if (mAvailableSlaves.Count == 0) { // Request a new slave? RequestNewSlave(pCommand); // Bail out here because there were no slaves and it can take some time before any requested slaves will be launched return(false); } // Since mValidSlaves was blank, get the first slave in the list pSlave = (MOG_Command)mAvailableSlaves[0]; } // Did we actually locate a valid available slave? if (pSlave != null) { // Send the command to the available slave if (mServerCommandManager.SendToConnection(pSlave.GetNetworkID(), pCommand)) { // Assign the Slave's NetworkID within the command so we will know who is working on this command pCommand.SetAssignedSlaveID(pSlave.GetNetworkID()); // Stick this command into the RegisteredSlave's command pSlave.SetCommand(pCommand); // Add the slave to mActiveSlaves mActiveSlaves.Add(pSlave); // Remove the top slave from mAvailableSlaves mAvailableSlaves.Remove(pSlave); // 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); return(true); } } return(false); }
bool RequestNewSlave(MOG_Command pCommand) { MOG_Command pClient = null; bool bAutoLaunchedSlave = false; bool bThisSpecificSlaveBeingRequested = false; // Check if we should wait a bit longer before we request a slave? if (DateTime.Now < mNextSlaveRequstTime) { // Ignore this request return(false); } // Check for a 'SlaveMachine' section in the System's config file? MOG_Ini pConfigFile = MOG_ControllerSystem.GetSystem().GetConfigFile(); string[] validSlaveMachines = null; if (pConfigFile.SectionExist("SlaveMachines")) { validSlaveMachines = pConfigFile.GetSectionKeys("SlaveMachines"); } // Check if we obtained a list of validSlaveMachines? if (validSlaveMachines != null && validSlaveMachines.Length > 0) { // Scan all the slaves specifically listed in our config file first // Walk list of specified SlaveMachines? foreach (string machineName in validSlaveMachines) { // Get the SlaveMachine info string machinePriority = pConfigFile.GetString("SlaveMachines", machineName); bThisSpecificSlaveBeingRequested = false; // Check if we have already requested this slave? if (IsAlreadyRequestedSlave(machineName)) { // We can skip this machine because we have already issued a request for a slave continue; } // Check if we had a specific list of validSlaves specified? if (pCommand.GetValidSlaves().Length != 0) { // Check if this machineName isn't listed in the command's validSlaves? if (IsSlaveListed(machineName, pCommand.GetValidSlaves())) { bThisSpecificSlaveBeingRequested = true; } else { // We can skip this machine because it isn't listed as a validSlave continue; } } // Check if there is already a slave running on this machine? if (mServerCommandManager.LocateRegisteredSlaveByComputerName(machineName) != null) { continue; } // Make sure there is a client running on this machine? pClient = mServerCommandManager.LocateClientByComputerName(machineName); if (pClient != null) { // Check if this Slave should be considered an AutoLaunchedSlave? if (String.Compare(machinePriority, "Always", true) != 0 && String.Compare(machinePriority, "Yes", true) != 0 && String.Compare(machinePriority, "True", true) != 0) { // Indicate this slave should be terminated when it is no longer needed bAutoLaunchedSlave = true; } break; } } } // Check if we are still missing a client to launch a slave on? if (pClient == null) { // Scan all the registered clients looking for one that we can send this request to? ArrayList registeredClients = this.mServerCommandManager.GetRegisteredClients(); for (int c = 0; c < registeredClients.Count; c++) { MOG_Command pRegisteredClient = (MOG_Command)registeredClients[c]; string machineName = pRegisteredClient.GetComputerName(); bThisSpecificSlaveBeingRequested = false; // Check if we have already requested this slave? if (IsAlreadyRequestedSlave(machineName)) { // We can skip this machine because we have already issued a request for a slave continue; } // Check if there is already a slave running on this machine? if (mServerCommandManager.LocateRegisteredSlaveByComputerName(machineName) != null) { continue; } // Check if we had a specific list of validSlaves specified? if (pCommand.GetValidSlaves().Length != 0) { // Check if this machineName isn't listed in the specified validSlaves? if (IsSlaveListed(machineName, pCommand.GetValidSlaves())) { bThisSpecificSlaveBeingRequested = true; } else { // We can skip this machine because it isn't listed as a validSlave continue; } } else { // Check if there was a list of validSlaveMachines specified? if (validSlaveMachines != null) { // Check if this computer was listed? if (pConfigFile.KeyExist("SlaveMachines", machineName)) { // Make sure this isn't listed as an exclusion? string machinePriority = pConfigFile.GetString("SlaveMachines", machineName); if (String.Compare(machinePriority, "Never", true) != 0 || String.Compare(machinePriority, "No", true) != 0 || String.Compare(machinePriority, "Exempt", true) != 0 || String.Compare(machinePriority, "Ignore", true) != 0 || String.Compare(machinePriority, "Skip", true) != 0) { continue; } } } } // Looks like we can use this client pClient = pRegisteredClient; // Indicate this slave should be terminated when it is no longer needed bAutoLaunchedSlave = true; break; } } // Check if this is just a generic slave request? if (!bThisSpecificSlaveBeingRequested) { // Check if we have a maximum number of slaves to auto launch? and // Check if we are over our maximum number of slaves? if (mManagedSlavesMax != 0 && mManagedSlavesMax < mAutoLaunchedSlaveNames.Count) { // No need to launch this slave because we have exceeded our max return(false); } } // Check if we found a client that we can request a new slave from? if (pClient != null) { // Instruct this client to launch a slave MOG_ControllerSystem.LaunchSlave(pClient.GetNetworkID()); // Track when this last request was made mNextSlaveRequstTime = DateTime.Now.AddSeconds(5); // Add this slave to our list of requested slave names AddRequestedSlave(pClient.GetComputerName()); // Check if we should add this slave as an AutoLaunchedSlave? if (bAutoLaunchedSlave) { AddAutoLaunchedSlaveName(pClient.GetComputerName()); } // Indicate we launched a new slave return(true); } // Check if it is time to report a missing slave error? if (DateTime.Now > mNextNoSlaveReportTime) { // Check if there was a specific validslaves listed? if (pCommand.GetValidSlaves().Length > 0) { bool bWarnUser = true; // Split up the specified ValidSlaves String delimStr = ",;"; Char[] delimiter = delimStr.ToCharArray(); String[] SlaveNames = pCommand.GetValidSlaves().Trim().Split(delimiter); // Check the registered slaves to see if a valid slave is running for (int n = 0; n < SlaveNames.Length; n++) { // Check if we found our matching slave name? if (mServerCommandManager.LocateRegisteredSlaveByComputerName(SlaveNames[n]) != null) { // We found a match...this command will eventually get processed bWarnUser = false; break; } } // Check if we decided to warn the user? if (bWarnUser) { // Setup the Broadcast message indicating that there are no valid slaves running string message = String.Concat("MOG Server is trying to process a command containing a 'ValidSlaves' property and has been unable to launch the needed Slave.\n", "VALIDSLAVES=", pCommand.GetValidSlaves(), "\n\n", "Please check this machine to ensure it is connected to the MOG Server."); MOG_ControllerSystem.NetworkBroadcast(pCommand.GetUserName(), message); // Record the time when this report was sent mNextNoSlaveReportTime = DateTime.Now.AddMinutes(5); } } } // Indicate that we failed to find a qualified slave return(false); }
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 void DisplayUpdateExistingConnections() { //first let's kill the existing ones. foreach (ListViewItem item in mainForm.lviewMonitor.Items) { mainForm.lviewMonitor.Items.Remove(item); } //this needs to walk the connections and add all the connected computers. MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); if (commandServer == null) { return; } ArrayList slavesArray = new ArrayList(commandServer.GetRegisteredSlaves()); ArrayList clientsArray = new ArrayList(commandServer.GetRegisteredClients()); ArrayList editorsArray = new ArrayList(commandServer.GetRegisteredEditors()); //show the server first. DislayAddConnection(MOG_ControllerSystem.GetComputerName(), MOG_ControllerSystem.GetComputerIP(), 1, 0, ""); foreach (Object item in clientsArray) { MOG_Command connection = (MOG_Command)item; // Describe the current command of this connection string description = FilterDesiredCommand(connection); if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient, description); } } foreach (Object item in editorsArray) { MOG_Command connection = (MOG_Command)item; // Describe the current command of this connection string description = FilterDesiredCommand(connection); if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor, description); } } foreach (Object item in slavesArray) { MOG_Command connection = (MOG_Command)item; string description; // Check if this Slave is actively assigned anything? MOG_Command workingCommand = connection.GetCommand(); if (workingCommand == null) { // Describe the current command of this connection description = FilterDesiredCommand(connection); } else { // Describe the current command of this connection's command description = FilterDesiredCommand(workingCommand); } if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave, description); } } }
public string FilterDesiredCommand(MOG_Command command) { MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); bool match = false; // Describe the current command of this connection string description = ""; // Since we haven't found our match yet, keep looking... if (!match) { MOG_Command slave; // Check if this command was assigned to a slave? if (command.GetAssignedSlaveID() != 0) { // Attempt to find the registered slave associated with this command? slave = commandServer.LocateRegisteredSlaveByID(command.GetAssignedSlaveID()); } else { // Attempt to find the registered slave associated with this command? slave = commandServer.LocateRegisteredSlaveByID(command.GetNetworkID()); } // Check if we found a matching slave? if (slave != null) { switch (command.GetCommandType()) { // Only allow the Following commands to build a unique description case MOG_COMMAND_TYPE.MOG_COMMAND_AssetRipRequest: case MOG_COMMAND_TYPE.MOG_COMMAND_AssetProcessed: case MOG_COMMAND_TYPE.MOG_COMMAND_SlaveTask: case MOG_COMMAND_TYPE.MOG_COMMAND_ReinstanceAssetRevision: case MOG_COMMAND_TYPE.MOG_COMMAND_Bless: case MOG_COMMAND_TYPE.MOG_COMMAND_Post: case MOG_COMMAND_TYPE.MOG_COMMAND_Archive: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject: case MOG_COMMAND_TYPE.MOG_COMMAND_BuildFull: case MOG_COMMAND_TYPE.MOG_COMMAND_Build: match = true; break; case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate: case MOG_COMMAND_TYPE.MOG_COMMAND_Complete: // Always revert the slave into "Idle"... description = "Idle"; return(description); default: // Don't change the existing description... description = "Unknown - " + command.ToString(); return(description); } } } // Since we haven't found our match yet, keep looking... if (!match) { // Attempt to find the registered slave associated with this command? MOG_Command editor = commandServer.LocateAssociatedEditorByClientID(command.GetNetworkID()); if (editor != null) { switch (command.GetCommandType()) { // Only allow the Following commands to build a unique description case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageRebuild: match = true; break; default: // Use the RegisteredClient as the command so we get the standard description... description = GetDetailedCommandDescription(editor); return(description); } } } // Since we haven't found our match yet, keep looking... if (!match) { // Attempt to find the registered client associated with this command? MOG_Command client = commandServer.LocateClientByID(command.GetNetworkID()); if (client != null) { switch (command.GetCommandType()) { // Only allow the Following commands to build a unique description case MOG_COMMAND_TYPE.MOG_COMMAND_AssetRipRequest: case MOG_COMMAND_TYPE.MOG_COMMAND_AssetProcessed: case MOG_COMMAND_TYPE.MOG_COMMAND_SlaveTask: case MOG_COMMAND_TYPE.MOG_COMMAND_ReinstanceAssetRevision: case MOG_COMMAND_TYPE.MOG_COMMAND_Bless: case MOG_COMMAND_TYPE.MOG_COMMAND_Post: case MOG_COMMAND_TYPE.MOG_COMMAND_Archive: case MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_BuildFull: //case MOG_COMMAND_TYPE.MOG_COMMAND_Build: break; default: // Use the RegisteredClient as the command so we get the standard description... description = GetDetailedCommandDescription(client); return(description); } } } // Use the RegisteredClient as the command so we get the standard description... description = GetDetailedCommandDescription(command); return(description); }
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 UpdateConnections(MOG_Command command) { if (mainForm.ConnectionsListView != null) { MOG_Command action = command.GetCommand(); if (action != null) { // Check if this item already exist in our list? ListViewItem item = LocateItem((int)ConnectionsColumns.ID, action.GetNetworkID().ToString(), mainForm.ConnectionsListView); if (item == null) { // Create a new item item = new ListViewItem(); item.Text = action.GetComputerName(); item.SubItems.Add(action.GetComputerIP()); item.SubItems.Add(action.GetNetworkID().ToString()); item.SubItems.Add(action.GetDescription()); item.SubItems.Add("N/A"); item.SubItems.Add(action.GetNetworkID().ToString()); // Add the new item to our list mainForm.ConnectionsListView.Items.Add(item); mGroups.UpdateGroupItem(mainForm.ConnectionsListView, item, "Type"); } // Make sure we have a valid item if (item != null) { // Update the item's information item.SubItems[(int)ConnectionsColumns.INFO].Text = GetClientStatusDescription(action); } // Identify the desired icon & colors switch (action.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: item.ImageIndex = (int)MOGImagesImages.EDITOR; item.ForeColor = Color.SlateGray; break; case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: item.ImageIndex = (int)MOGImagesImages.SLAVE; item.ForeColor = Color.BlueViolet; break; case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews: // Check what kind of client? if (action.GetDescription().Contains("Client")) { item.ImageIndex = (int)MOGImagesImages.CLIENT; item.ForeColor = Color.DarkBlue; } else if (action.GetDescription().Contains("Server Manager")) { item.ImageIndex = (int)MOGImagesImages.SERVER; item.ForeColor = Color.Firebrick; } else { item.ImageIndex = (int)MOGImagesImages.CLIENT; item.ForeColor = Color.SteelBlue; } break; case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine: item.ImageIndex = (int)MOGImagesImages.COMMANDLINE; item.ForeColor = Color.Black; break; case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost: item.Remove(); break; } } } }
public void DisplayUpdateExistingConnections() { //first let's kill the existing ones. foreach (ListViewItem item in mForm.lviewMonitor.Items) { mForm.lviewMonitor.Items.Remove(item); } //this needs to walk the connections and add all the connected computers. MOG_CommandServer commandServer = (MOG_CommandServer)mForm.gMog.GetCommandManager(); ArrayList slavesArray = commandServer.GetRegisteredSlaves(); ArrayList clientsArray = commandServer.GetRegisteredClients(); //show the server first. DislayAddConnection(mForm.gMog.GetComputerName(), mForm.gMog.GetComputerIP(), 1, 0); foreach (Object item in clientsArray) { MOG_Command connection = (MOG_Command)item; DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient); } foreach (Object item in slavesArray) { MOG_Command connection = (MOG_Command)item; DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave); } }
public void RefreshWindow(MOG_Command command) { if (command == null) { GetCommandSnapShot(); } else { ListViewItem item = null; switch (command.GetCommandType()) { // Eat these commands, we don't need to show them in this window 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_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_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_RemoveAssetFromProject: 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: case MOG_COMMAND_TYPE.MOG_COMMAND_AssetProcessed: break; default: string commandString = command.ToString(); if (command.IsCompleted()) { item = LocateItem(command, mainForm.CommandspendingListView); while (item != null) { item.Remove(); item = LocateItem(command, mainForm.CommandspendingListView); } } else { // See if it already exists if (LocateItem(command, mainForm.CommandspendingListView) == null) { item = new ListViewItem(); item.Text = command.ToString(); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.SubItems.Add(command.GetComputerName().ToString()); item.SubItems.Add(command.GetComputerIP().ToString()); item.SubItems.Add(command.GetNetworkID().ToString()); item.SubItems.Add(command.GetCommandID().ToString()); item.SubItems.Add(command.GetCommandTimeStamp()); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.ImageIndex = GetImageIndex(command.GetCommandType()); // Assign the Key for this listViewItem item.Name = command.GetCommandID().ToString(); mainForm.CommandspendingListView.Items.Add(item); } } break; } } }
bool CanObtainLicense(MOG_Command pCommand) { bool bLicense = false; // Get our server command manager? MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager()); if (commandServer != null) { // This client is not accounted for, check the license file to see if he can fit into the current situation if (EnsureValidLicense()) { // We have a license file if (!mTimeBomb.IsValidMacAddress()) { //The Mac address is bad String message = String.Concat("This MOG Server's machine hasn't been properly licensed.\n", "You will be limited to 2 client connections.\n", "Contact Mogware to transfer this license."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } else { // Since the Mac address is ok, what about the expiration? DateTime commandDate = MOG_Time.GetDateTimeFromTimeStamp(pCommand.GetCommandTimeStamp()); if (mTimeBomb.HasExpired() || mTimeBomb.HasExpired(commandDate)) { //Oh man this license file is expired String message = String.Concat("The MOG Server has been unable to renew the MOG License.\n", "You will be limited to 2 client connections.\n", "Please make sure the MOG Server machine has internet access."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } // Check if we are going to expire soon? else if (mTimeBomb.WillExpireSoon()) { // Inform the user of our impending doom String message = String.Concat("The MOG Server has been unable to renew the MOG License.\n", "EXPIRATION DATE: ", mTimeBomb.GetExpireDate().ToString(), "\n", "Please make sure the MOG Server machine has internet access."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } } } else { // There is no license file at all String message = String.Concat("You're using an unlicensed server.\n", "You will be limited to 2 client connections.\n", "Licensing can be performed in the ServerManager."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } // Call this to see if any more clients can be licensed if (IsLicenseAvailable()) { bLicense = true; } else { // Notify client of failed command request string message = String.Concat("No more available licenses on the server.\n\n", "This client cannot be launched until another client is closed.\n", "Additional seats can be licensed in the ServerManager."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } } return(bLicense); }
public void DisplayUpdateExistingConnections(MOG_Command command) { ListViewItem item; // Construct the command description string description = FilterDesiredCommand(command); if (description == null) { return; } // Check if this command was assigned to a slave? if (command.GetAssignedSlaveID() != 0) { // Find the connection by the assigned slave's network id item = LocateListViewItem(mainForm.lviewMonitor, command.GetAssignedSlaveID()); } else { // Find the connection by network id item = LocateListViewItem(mainForm.lviewMonitor, command.GetNetworkID()); } switch (command.GetCommandType()) { // Delete connection? case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine: if (item != null) { item.Remove(); } break; // Add connection? case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine: if (item == null) { // This is a new connection, add it item = new ListViewItem(); // Construct the new item item.Text = command.GetComputerName(); item.SubItems.Add(command.GetComputerIP()); item.SubItems.Add(command.GetNetworkID().ToString()); item.SubItems.Add(command.GetDescription()); item.SubItems.Add(command.ToString()); item.SubItems[(int)MONITOR_TABS.INFORMATION].Text = description; item.ForeColor = Color.Black; // Add the new item mainForm.lviewMonitor.Items.Add(item); } break; default: // Always update the command desription if (item != null && item.SubItems.Count >= (int)MONITOR_TABS.INFORMATION) { item.SubItems[(int)MONITOR_TABS.INFORMATION].Text = description; } break; } }
public string FilterDesiredCommand(MOG_Command command) { MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); // Describe the current command of this connection string description = ""; // Check if this command was assigned to a slave? MOG_Command slave; if (command.GetAssignedSlaveID() != 0) { // Attempt to find the registered slave associated with this command? slave = commandServer.LocateRegisteredSlaveByID(command.GetAssignedSlaveID()); } else { // Attempt to find the registered slave associated with this command? slave = commandServer.LocateRegisteredSlaveByID(command.GetNetworkID()); } // Check if we found a matching slave? if (slave != null) { // Update the status of this slave based on the command info switch (command.GetCommandType()) { // Reset the description to Idle? case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate: case MOG_COMMAND_TYPE.MOG_COMMAND_Complete: case MOG_COMMAND_TYPE.MOG_COMMAND_Postpone: case MOG_COMMAND_TYPE.MOG_COMMAND_Failed: // Always revert the slave into "Idle"... description = "Idle"; break; default: // Build the generic command description description = GetGenericCommandDescription(command); break; } // Since we know this was assigned to a slave, return what ever description we generated return(description); } // Attempt to find the registered editor by this command's computer name? MOG_Command editor = commandServer.LocateAssociatedEditorByClientID(command.GetNetworkID()); if (editor != null) { switch (command.GetCommandType()) { // Only allow the Following commands to build a unique description case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageRebuild: // Build the generic command description description = GetGenericCommandDescription(command); break; default: // Always revert the editor into "Idle"... description = "Idle"; break; } // Since we know this was assigned to ab editor, return what ever description we generated return(description); } // Attempt to find the registered client associated with this command? MOG_Command client = commandServer.LocateClientByID(command.GetNetworkID()); if (client != null) { // Use the RegisteredClient as the command so we get the standard description... description = GetClientStatusDescription(client); return(description); } // Always default everything to "Idle"... description = "Idle"; return(description); }
private ListViewItem InitNewLockItem(MOG_Command command) { if (command != null) { if ((command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest) || (command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest)) { ListViewItem item = new ListViewItem(); MOG_Time time = new MOG_Time(); time.SetTimeStamp(command.GetCommandTimeStamp()); // Gather appropriate lock info from the command's MOG_Filename string label = ""; string classification = ""; // Check if this is an asset? if (command.GetAssetFilename().GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset) { // Get the label and classifciation of the asset label = command.GetAssetFilename().GetAssetLabel(); classification = command.GetAssetFilename().GetAssetClassification(); // Obtain the proper icon item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(command.GetAssetFilename().GetOriginalFilename()); } // Check if this is a classification-level by seeing if it ends with a '*'? else if (command.GetAssetFilename().GetOriginalFilename().EndsWith("*")) { // Do our best to illustrate a classification-level lock label = "*"; classification = command.GetAssetFilename().GetOriginalFilename().Trim("*".ToCharArray()); // Obtain the proper icon item.ImageIndex = MogUtil_AssetIcons.GetClassIconIndex(classification); } //LOCK_COLUMNS {LABEL, CLASSIFICATION, USER, DESCRIPTION, MACHINE, IP, ID, TIME, FULLNAME, TYPE}; item.Text = label; item.SubItems.Add(classification); item.SubItems.Add(command.GetUserName()); item.SubItems.Add(command.GetDescription()); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetComputerIP()); item.SubItems.Add(Convert.ToString(command.GetNetworkID())); item.SubItems.Add(time.FormatString("")); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); switch (command.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest: item.SubItems.Add("Read Lock"); item.ForeColor = Color.Green; break; case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest: item.SubItems.Add("Write Lock"); item.ForeColor = Color.Red; break; } return(item); } } return(null); }
internal bool Command_RetaskCommand(MOG_Command pCommand) { // Shutdown this slave and its command will be automatically recycled return(MOG_ControllerSystem.ShutdownSlave(pCommand.GetNetworkID())); }
internal bool Command_RequestActiveCommands(MOG_Command pCommand) { bool bFailed = false; // Send off the Notify commands for this commands list IDictionaryEnumerator enumerator = mTaskCommandList.GetEnumerator(); while (enumerator.MoveNext()) { MOG_Command pActiveCommand = (MOG_Command)(enumerator.Value); MOG_Command pNotify = MOG_CommandFactory.Setup_NotifyActiveCommand(pActiveCommand); if (!mServerJobManager.GetServerCommandManager().SendToConnection(pCommand.GetNetworkID(), pNotify)) { bFailed = true; } } // Send off the Notify commands for this commands list enumerator = mPrimaryCommandList.GetEnumerator(); while (enumerator.MoveNext()) { MOG_Command pActiveCommand = (MOG_Command)(enumerator.Value); MOG_Command pNotify = MOG_CommandFactory.Setup_NotifyActiveCommand(pActiveCommand); if (!mServerJobManager.GetServerCommandManager().SendToConnection(pCommand.GetNetworkID(), pNotify)) { bFailed = true; } } // Send off the Notify commands for this commands list enumerator = mPackageCommandList.GetEnumerator(); while (enumerator.MoveNext()) { MOG_Command pActiveCommand = (MOG_Command)(enumerator.Value); MOG_Command pNotify = MOG_CommandFactory.Setup_NotifyActiveCommand(pActiveCommand); if (!mServerJobManager.GetServerCommandManager().SendToConnection(pCommand.GetNetworkID(), pNotify)) { bFailed = true; } } // Send off the Notify commands for this commands list enumerator = mPostCommandList.GetEnumerator(); while (enumerator.MoveNext()) { MOG_Command pActiveCommand = (MOG_Command)(enumerator.Value); MOG_Command pNotify = MOG_CommandFactory.Setup_NotifyActiveCommand(pActiveCommand); if (!mServerJobManager.GetServerCommandManager().SendToConnection(pCommand.GetNetworkID(), pNotify)) { bFailed = true; } } // Send off the Notify commands for this commands list enumerator = mDeferredCommandList.GetEnumerator(); while (enumerator.MoveNext()) { MOG_Command pActiveCommand = (MOG_Command)(enumerator.Value); MOG_Command pNotify = MOG_CommandFactory.Setup_NotifyActiveCommand(pActiveCommand); if (!mServerJobManager.GetServerCommandManager().SendToConnection(pCommand.GetNetworkID(), pNotify)) { bFailed = true; } } // Check if we failed? if (!bFailed) { return(true); } return(false); }