Exemple #1
0
        /// <summary>
        /// Add a MOG_Command to the NotifyEventForm
        /// </summary>
        /// <param name="command"></param>
        public void AddCommand(MOG_Command command)
        {
            string commandStr = "";

            switch (command.GetCommandType())
            {
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert:
                commandStr = "ALERT";
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError:
                commandStr = "ERROR";
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException:
                commandStr = "EXCEPTION";
                break;

            default:
                commandStr = command.ToString();
                break;
            }

            ListViewItem item = new ListViewItem(commandStr);

            item.SubItems.Add(command.GetDescription());
            item.SubItems.Add(MOG.TIME.MOG_Time.FormatTimestamp(command.GetCommandTimeStamp(), ""));
            this.listView1.Items.Add(item);
        }
Exemple #2
0
        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);
        }
Exemple #3
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);
        }
Exemple #5
0
        public string GetGenericCommandDescription(MOG_Command command)
        {
            // Describe this command by starting with the basics
            string description = "COMMAND: " + command.ToString();

            // Is there is an AssetName?
            if (command.GetAssetFilename().GetOriginalFilename().Length != 0)
            {
                description += "     ASSET: " + command.GetAssetFilename().GetOriginalFilename();

                // Is there a user within the asset's filename?
                if (command.GetAssetFilename().GetUserName().Length > 0)
                {
                    description += "     USER: "******"     SLAVETASK: " + command.GetAssetFilename().GetFilename();
                }
            }
            return(description);
        }
Exemple #6
0
        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 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;
                }
            }
        }
        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 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);
        }
Exemple #10
0
        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);
                    }
                }
            }
        }
Exemple #11
0
        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);
        }