Ejemplo n.º 1
0
        internal bool AddCommand(MOG_Command pCommand)
        {
            bool bSuccess = false;

            // Check if this is the StartJob command?
            if (pCommand.GetCommandType() == MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_StartJob)
            {
                mStartJobCommand = pCommand;
                bSuccess         = true;
            }
            else
            {
                // Check if this command has requested to have duplicate commands removed?
                if (pCommand.IsRemoveDuplicateCommands())
                {
                    // Scan the Server's command queue looking for any other instance of this same command?
                    if (RemoveDuplicateCommands(pCommand))
                    {
                    }
                }

                // Check if this is a completed command?
                if (pCommand.GetCommandType() == MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_Complete)
                {
                    // Immediately process 'Complete' commands
                    if (ProcessCommand(pCommand))
                    {
                        // Remove the original command that is encapsulated within this 'Complete' command
                        RemoveCommand(pCommand.GetCommand());
                        bSuccess = true;
                    }
                }
                else
                {
                    // Get the appropriate command list for this command
                    HybridDictionary commandList = GetJobCommandList(pCommand);
                    if (commandList != null)
                    {
                        // Make sure we always clear the command's assigned slave or else it will never get processed
                        pCommand.SetAssignedSlaveID(0);

                        // Add this command to the appropriate list for later processing
                        commandList[pCommand.GetCommandID().ToString()] = pCommand;
                        bSuccess = true;
                    }
                }
            }

            return(bSuccess);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        HybridDictionary GetJobCommandList(MOG_Command pCommand)
        {
            HybridDictionary commandList = null;

            switch (pCommand.GetCommandType())
            {
            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_AssetRipRequest:
            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_SlaveTask:
            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_ReinstanceAssetRevision:
                commandList = mTaskCommandList;
                break;

            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_Bless:
            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_AssetProcessed:
            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject:
            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild:
                commandList = mPrimaryCommandList;
                break;

            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge:
                commandList = mPackageCommandList;
                break;

            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_Post:
                commandList = mPostCommandList;
                break;

            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_Archive:
            case MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_ScheduleArchive:
                commandList = mDeferredCommandList;
                break;
            }

            return(commandList);
        }
Ejemplo n.º 4
0
        void CommandPreEventCallBack_Invoked(MOG_Command command)
        {
            switch (command.GetCommandType())
            {
            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_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_Archive:
            case MOG_COMMAND_TYPE.MOG_COMMAND_ScheduleArchive:
                if (mainForm.SMOG_Main_TabControl.SelectedIndex == (int)FormMainSMOG.MAIN_PAGES.SMOG_COMMANDS)
                {
                    mainForm.mPendingCommands.RefreshWindow(command);
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 5
0
        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";
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 void CommandPreEventCallBack_Invoked(MOG_Command command)
 {
     switch (command.GetCommandType())
     {
     default:
         break;
     }
 }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        public void RefreshLockWindows(MOG_Command command)
        {
            MOG_Command lockCommand = command.GetCommand();

            //if (string.Compare(mainForm.SMOG_Main_TabControl.SelectedTab.Text, "Locks", true) == 0)
            if (lockCommand != null)
            {
                // If the command completed then it is a successful lock, if not then it is a request
                if (lockCommand.IsCompleted())
                {
                    switch (lockCommand.GetCommandType())
                    {
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
                        // Check if this is a lock that was waiting and now has succedded
                        ListViewItem oldReleaseLock = LocateListViewItem(mainForm.LockManagerPendingListView, lockCommand.GetAssetFilename().GetOriginalFilename());
                        if (oldReleaseLock != null)
                        {
                            oldReleaseLock.Remove();
                        }

                        //Put a new item in the list, but only if it doesn't exist in there already
                        if (LocateLockItem(lockCommand) == null)
                        {
                            // Create the new lock item
                            ListViewItem newLockItem = InitNewLockItem(lockCommand);
                            AddLockItem(newLockItem);
                        }

                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRelease:
                        ListViewItem releaseLock = LocateListViewItem(mainForm.LockManagerLocksListView, lockCommand.GetAssetFilename().GetOriginalFilename());
                        if (releaseLock != null)
                        {
                            releaseLock.Remove();
                        }
                        break;
                    }
                }
                else
                {
                    if (LocateListViewItem(mainForm.LockManagerPendingListView, lockCommand.GetAssetFilename().GetOriginalFilename()) == null)
                    {
                        ListViewItem item = InitNewLockItem(lockCommand);

                        if (item != null)
                        {
                            mainForm.LockManagerPendingListView.Items.Add(item);
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void RefreshLockWindows(MOG_Command command)
        {
            if (string.Compare(mainForm.SMOG_Main_TabControl.SelectedTab.Text, "Locks", true) == 0)
            {
                // If the command completed then it is a successful lock, if not then it is a request
                if (command.IsCompleted())
                {
                    switch (command.GetCommandType())
                    {
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:

                        // Check if this is a lock that was waiting and now has succedded
                        ListViewItem oldReleaseLock = LocateListViewItem(mainForm.LocksRequestLocksListView, command.GetAssetFilename().GetOriginalFilename(), command.GetComputerName());
                        if (oldReleaseLock != null)
                        {
                            oldReleaseLock.Remove();
                        }

                        // Create the new lock item
                        ListViewItem gotLock = InitNewLockItem(command);

                        if (gotLock != null)
                        {
                            mainForm.LocksListView.Items.Add(gotLock);
                        }
                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRelease:
                        ListViewItem releaseLock = LocateListViewItem(mainForm.LocksListView, command.GetAssetFilename().GetOriginalFilename(), command.GetComputerName());
                        if (releaseLock != null)
                        {
                            releaseLock.Remove();
                        }
                        break;
                    }
                }
                else
                {
                    if (LocateListViewItem(mainForm.LocksRequestLocksListView, command.GetAssetFilename().GetOriginalFilename(), command.GetComputerName()) == null)
                    {
                        ListViewItem item = InitNewRequestItem(command);

                        if (item != null)
                        {
                            mainForm.LocksRequestLocksListView.Items.Add(item);
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        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);
        }
 public void LoadCommand(MOG_Command command)
 {
     tbComputer.Text    = command.GetComputerName();
     tbDate.Text        = MogUtils_StringVersion.VersionToString(command.GetCommandTimeStamp());
     tbIp.Text          = command.GetComputerIP();
     tbID.Text          = command.GetCommandID().ToString();
     tbProject.Text     = command.GetProject();
     tbType.Text        = command.GetCommandType().ToString();
     tbUser.Text        = command.GetUserName();
     tbBranch.Text      = command.GetBranch();
     tbJobId.Text       = command.GetJobLabel();
     tbBlocking.Text    = command.IsBlocking().ToString();
     tbSlaveID.Text     = command.mAssignedSlaveID.ToString();
     tbCompleted.Text   = command.IsCompleted().ToString();
     tbValidSlaves.Text = command.GetValidSlaves();
     if (command.GetAssetFilename() != null)
     {
         tbAssetName.Text = command.GetAssetFilename().GetAssetFullName();
     }
 }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
        void CommandEventCallBack_Invoked(MOG_Command command)
        {
            switch (command.GetCommandType())
            {
            case MOG_COMMAND_TYPE.MOG_COMMAND_Complete:
                if (mainForm.mLogWindow != null)
                {
                    mainForm.mLogWindow.UpdateLog();
                }
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_SlaveTask:
                if (mainForm.mLogWindow != null)
                {
                    mainForm.mLogWindow.UpdateLog();
                }
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost:
                #region MOG_COMMAND_ConnectionLost
                // The server was shutdown
                Bitmap DisconnectedIcon = new Bitmap(mainForm.SlaveIconsImageList.Images[1]);
                mainForm.niconSystemTrayIcon.Icon = System.Drawing.Icon.FromHandle(DisconnectedIcon.GetHicon());
                mainForm.niconSystemTrayIcon.Text = "Server is disconnected!";
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew:
                #region MOG_COMMAND_ConnectionNew
                Bitmap ConnectedIcon = new Bitmap(mainForm.SlaveIconsImageList.Images[0]);
                mainForm.niconSystemTrayIcon.Icon = System.Drawing.Icon.FromHandle(ConnectedIcon.GetHicon());
                mainForm.niconSystemTrayIcon.Text = mainForm.RefreshConnectionToolText();
                #endregion
                break;
            }
            return;
        }
Ejemplo n.º 16
0
        internal bool ProcessCommand(MOG_Command pCommand)
        {
            bool bProcessed = false;

            // Make sure this command hasn't already been tasked out to a slave?
            if (pCommand.GetAssignedSlaveID() == 0)
            {
                // Attempt to process this command
                if (MOG_ControllerSystem.GetCommandManager().CommandProcess(pCommand))
                {
                    // Indicate the command was processed
                    bProcessed = true;

                    // Check if this command was a network package merge command?
                    if (pCommand.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge)
                    {
                        // Keep track of this command so we can watch exclusivity with other packaging commands in other jobs
                        mProcessedPackageCommands.Add(pCommand);
                    }
                }
            }

            return(bProcessed);
        }
Ejemplo n.º 17
0
        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;
                }
            }
        }
Ejemplo n.º 18
0
        void CommandEventCallBack_Invoked(MOG_Command command)
        {
            switch (command.GetCommandType())
            {
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert:
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError:
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException:
                #region MOG_COMMAND_NotifySystemException
                MOG_ALERT_LEVEL level = MOG_ALERT_LEVEL.ALERT;
                switch (command.GetCommandType())
                {
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert:
                    level = MOG_ALERT_LEVEL.ALERT;
                    break;

                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError:
                    level = MOG_ALERT_LEVEL.ERROR;
                    break;

                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException:
                    level = MOG_ALERT_LEVEL.CRITICAL;
                    break;
                }
                MOG_Prompt.PromptMessage(command.GetTitle(), command.GetDescription(), command.GetSource(), level);
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_LockPersistentNotify:
                #region MOG_COMMAND_LockPersistentNotify
                // Check if this is the same project?
                MOG_Command lockInfo = command.GetCommand();
                if (lockInfo != null)
                {
                    // Check if we are on the locks tab?
                    if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Locks", true) == 0)
                    {
                        if (mainForm.mLibraryManager != null)
                        {
                            mainForm.mLibraryManager.RefreshItem(command);
                        }
                    }

                    // Check if this lock is related to our project?
                    if (MOG_Filename.IsClassificationValidForProject(lockInfo.GetAssetFilename().GetOriginalFilename(), MOG_ControllerProject.GetProjectName()))
                    {
                        // Check if we are on the workspace tab?
                        if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Workspace", true) == 0)
                        {
                            if (mainForm.mAssetManager != null)
                            {
                                mainForm.mAssetManager.RefreshLockStatus(command);
// JohnRen - Removed because this is just too slow when the server sends us a ton of locks at startup
//								mainForm.LocalBranchMogControl_GameDataDestinationTreeView.RefreshFileLockStatus(command);
                                mainForm.mAssetManager.mLocal.RefreshLockStatus(command);
                            }
                        }
                        // Check if we are on the project tab?
                        else if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Project", true) == 0)
                        {
                            if (mainForm.mProjectManager != null)
                            {
                                mainForm.mProjectManager.UpdateAsset(command);
                            }
                        }
                        // Check if we are on the library tab?
                        else if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Library", true) == 0)
                        {
                            if (mainForm.mLibraryManager != null)
                            {
                                mainForm.mLibraryManager.RefreshItem(command);
                            }
                        }

                        // Check if this notify just got processed?
                        if (command.GetOptions().Contains("{Processed}"))
                        {
                            // Check if we have a local workspace defined?
                            MOG_ControllerSyncData workspace = MOG_ControllerProject.GetCurrentSyncDataController();
                            if (workspace != null)
                            {
                                // Time to check if this was our lock that just got released?
                                if (string.Compare(lockInfo.GetUserName(), MOG_ControllerProject.GetUserName(), true) == 0 &&
                                    string.Compare(lockInfo.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0)
                                {
                                    // Is this lockInfo for an asset?
                                    if (lockInfo.GetAssetFilename().GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
                                    {
                                        // Check the user's privilege
                                        MOG_Privileges privileges = MOG_ControllerProject.GetPrivileges();
                                        if (!privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.IgnoreSyncAsReadOnly))
                                        {
                                            MOG_Filename bestAssetFilename = lockInfo.GetAssetFilename();

                                            // Check if there is a better inbox asset that can be substituted?
                                            MOG_Filename inboxAssetFilename = MOG_ControllerInbox.LocateBestMatchingAsset(bestAssetFilename);
                                            if (inboxAssetFilename != null)
                                            {
                                                bestAssetFilename = inboxAssetFilename;
                                            }

                                            // Check if this asset has it's files synced as read only?
                                            MOG_Properties properties = new MOG_Properties(bestAssetFilename);
                                            if (properties.SyncAsReadOnly)
                                            {
                                                switch (lockInfo.GetCommandType())
                                                {
                                                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
                                                    workspace.SetLocalFileAttributes(lockInfo.GetAssetFilename(), FileAttributes.Normal);
                                                    break;

                                                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
                                                    workspace.SetLocalFileAttributes(lockInfo.GetAssetFilename(), FileAttributes.ReadOnly);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate:
                #region MOG_COMMAND_ViewUpdate

                // Make sure this is relevant to our active project?
                if (string.Compare(command.GetProject(), MOG_ControllerProject.GetProjectName(), true) != 0)
                {
                    break;
                }

                if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Project", true) == 0)
                {
                    // Process the auto process and package commands
                    switch (MOG_AssetStatus.GetType(command.GetDescription()))
                    {
                    case MOG_AssetStatusType.Modified:
                    case MOG_AssetStatusType.Unprocessed:
                        // Check to see if this command comes from us
                        if (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) != 0)
                        {
                            break;
                        }

                        // Check for Auto Process
                        if (mainForm.AssetManagerAutoProcessCheckBox.Checked &&
                            string.Compare(command.GetUserName(), MOG_ControllerProject.GetUser().GetUserName(), true) == 0)
                        {
                            guiAssetController.Process(command.GetDestination());
                        }
                        break;

                    //KLK - This may be overkill because we are on the Project tab and why do we want to change their local package button
                    case MOG_AssetStatusType.Packaged:
                        break;

                    case MOG_AssetStatusType.Unpackaged:
                    case MOG_AssetStatusType.Repackage:
                    case MOG_AssetStatusType.PackageError:
                    case MOG_AssetStatusType.Unpackage:
                        // We just got a new asset.  Make sure we inform the gui that a package is now required
                        if (mainForm.mAssetManager != null)
                        {
                            mainForm.mAssetManager.RefreshWindowsBoth(command);
                        }
                        break;
                    }
                }

                //if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Workspace", true) == 0)
                if (true)
                {
                    if (string.Compare(command.GetDescription(), "UnGrouped", true) == 0)
                    {
                        command.SetDestination("");
                    }

                    try
                    {
                        // Filter out updates to other computers that share our username and project
                        if ((string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) != 0) &&
                            (string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Copied), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Unpackaged), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Repackage), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Packaged), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.PackageError), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Unpackage), true) == 0))
                        {
                            return;
                        }
                        else
                        {
                            mainForm.mAssetManager.RefreshWindowsBoth(command);
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.Write(e.ToString());
                    }

                    // JohnRen - Changed...
                    // The ViewUpdate command contains the computer name of who generated the view command...not the computer name of the originator of the rip
                    // Because of this, AutoUpdate local would not work anytime somebody else's slave performed the rip.
                    // Changed the AutoUpdate events to respect the login user instead of the computer name because this will be 100% correct...
                    // However, multiple users will experience the event if they are logged in as the same user.
                    //					// Process the auto process and package commands
                    //					// only do this code if the command came from us
                    //					if (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0)
                    MOG_Filename destinationFilename = new MOG_Filename(command.GetDestination());
                    if (string.Compare(destinationFilename.GetUserName(), MOG_ControllerProject.GetUserName(), true) == 0)
                    {
                        switch (MOG_AssetStatus.GetType(command.GetDescription()))
                        {
                        case MOG_AssetStatusType.Modified:
                        case MOG_AssetStatusType.Unprocessed:
                            // Check for Auto Process
                            if (mainForm.AssetManagerAutoProcessCheckBox.Checked)
                            {
                                // Only auto-process this if it is in the drafts folder
                                if (destinationFilename.IsDrafts())
                                {
                                    // Make sure we are the ones that requested it
                                    if (string.Compare(command.GetUserName(), MOG_ControllerProject.GetUser().GetUserName(), true) == 0 &&
                                        (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0))
                                    {
                                        guiAssetController.Process(command.GetDestination());
                                    }
                                }
                            }
                            break;

                        case MOG_AssetStatusType.Imported:
                            // Only auto-process this if it is in the drafts folder
                            if (destinationFilename.IsDrafts())
                            {
                                // Make sure we are the ones that requested it
                                if (string.Compare(command.GetUserName(), MOG_ControllerProject.GetUser().GetUserName(), true) == 0 &&
                                    (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0))
                                {
                                    guiAssetController.UpdateLocal(command.GetDestination(), false);
                                }
                            }
                            break;

                        case MOG_AssetStatusType.Processed:
                        case MOG_AssetStatusType.Sent:
                            // Check if the MainForm's AutoUpdate button is checked?
                            if (mainForm.AssetManagerAutoUpdateLocalCheckBox.Checked)
                            {
                                // Only auto-process this if it is in the drafts folder
                                if (destinationFilename.IsDrafts())
                                {
                                    // Make sure we are the ones that requested it
                                    if (string.Compare(command.GetUserName(), MOG_ControllerProject.GetUser().GetUserName(), true) == 0 &&
                                        (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0))
                                    {
                                        // Check if we have a current workspace?
                                        if (MOG_ControllerProject.GetCurrentSyncDataController() != null)
                                        {
                                            guiAssetController.UpdateLocal(command.GetDestination(), false);
                                        }
                                    }
                                }
                            }
                            break;

                        case MOG_AssetStatusType.Rebuilt:
                            if (mainForm.mAssetManager != null)
                            {
                                mainForm.mAssetManager.RefreshActiveWindow();
                            }
                            break;

                        case MOG_AssetStatusType.Deleted:
                            MOG_Filename assetName = new MOG_Filename(command.GetSource());
                            if (assetName.IsTrash() && mainForm.mAssetManager != null && mainForm.mAssetManager.mTrash != null && mainForm.AssetManagerInboxTabControl.SelectedTab.Name == "AssetManagerTrashTabPage")
                            {
                                mainForm.mAssetManager.mTrash.RefreshRemove(command);
                            }
                            else if (assetName.IsLocal() && mainForm.mAssetManager != null)
                            {
                                MOG_Filename tempAssetName = new MOG_Filename(command.GetSource());
                            }
                            break;
                        }
                    }
                }

                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor:
                #region MOG_COMMAND_RegisterEditor
                // We just lost an Editor
                WorkspaceManager.RegisterEditor(command.GetWorkingDirectory());
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor:
                #region MOG_COMMAND_ShutdownEditor
                // We just lost an Editor
                WorkspaceManager.ShutdownEditor(command.GetWorkingDirectory());
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost:
                #region MOG_COMMAND_ConnectionLost
                // The server was shutdown
                Bitmap DisconnectedIcon = new Bitmap(mainForm.StatusBarImageList.Images[1]);
                mainForm.MOGStatusBarConnectionStatusBarPanel.Icon        = System.Drawing.Icon.FromHandle(DisconnectedIcon.GetHicon());
                mainForm.MOGStatusBarConnectionStatusBarPanel.Text        = "Disconnected";
                mainForm.MOGStatusBarConnectionStatusBarPanel.ToolTipText = "Server is disconnected!";
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew:
                #region MOG_COMMAND_ConnectionNew
                Bitmap ConnectedIcon = new Bitmap(mainForm.StatusBarImageList.Images[0]);
                mainForm.MOGStatusBarConnectionStatusBarPanel.Icon        = System.Drawing.Icon.FromHandle(ConnectedIcon.GetHicon());
                mainForm.MOGStatusBarConnectionStatusBarPanel.Text        = "Connected";
                mainForm.MOGStatusBarConnectionStatusBarPanel.ToolTipText = mainForm.RefreshConnectionToolText();
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_Complete:
                #region MOG_COMMAND_Complete
                // Make sure this contains an encapsulated command?
                if (command.GetCommand() != null)
                {
                    // Determin the type of encapsulated command
                    switch (command.GetCommand().GetCommandType())
                    {
                    case MOG_COMMAND_TYPE.MOG_COMMAND_Post:
                        #region MOG_COMMAND_PostComplete
                        if (mainForm != null)
                        {
                            // Check if we are on a tab that cares about this event?
                            if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Connections", true) == 0)
                            {
                                if (mainForm.mConnectionManager != null)
                                {
                                    // Only listen for the final Post w/o any assetFilename listed or else we would cause too many full refreshes
                                    if (command.GetCommand().GetAssetFilename().GetOriginalFilename().Length == 0)
                                    {
                                        // Refresh the pending package listview
                                        mainForm.mConnectionManager.RefreshMerging();
                                        // Refresh the pending post listview
                                        mainForm.mConnectionManager.RefreshPosting();
                                    }
                                }
                            }

                            // Check if this remove was successful?
                            if (command.GetCommand().IsCompleted())
                            {
// Someday this would be nice, but the library tab does refresh when it gets reselected so we need to process this event even though we are on another tab
//								// Check if we are on a tab that cares about this event?
//								if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Library", true) == 0)
//								{
                                if (command.GetCommand().GetAssetFilename().IsLibrary())
                                {
                                    if (mainForm.mLibraryManager != null)
                                    {
                                        mainForm.mLibraryManager.RefreshItem(command);
                                    }
                                }
//								}
                                // Check if we are on a tab that cares about this event?
                                if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Project", true) == 0)
                                {
                                    if (mainForm.mProjectManager != null)
                                    {
                                        mainForm.mProjectManager.MakeAssetCurrent(command.GetCommand().GetAssetFilename());
                                    }
                                }
                            }
                        }
                        #endregion
                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_ReinstanceAssetRevision:
                        #region MOG_COMMAND_ReinstanceAssetRevision
                        // Check if this remove was successful?
                        if (command.GetCommand().IsCompleted())
                        {
                            if (mainForm.mProjectManager != null)
                            {
                                mainForm.mProjectManager.RemoveAssetFromProject(new MOG_Filename(command.GetCommand().GetSource()));
                                mainForm.mProjectManager.MakeAssetCurrent(command.GetCommand().GetAssetFilename());
                            }
                            if (mainForm.LibraryExplorer != null)
                            {
                                mainForm.LibraryExplorer.LibraryListView.RefreshItem(command);
                            }
                        }
                        #endregion
                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject:
                        #region MOG_COMMAND_RemoveAssetFromProject
                        // Check if this remove was successful?
                        if (command.GetCommand().IsCompleted())
                        {
                            if (mainForm.mProjectManager != null)
                            {
                                mainForm.mProjectManager.RemoveAssetFromProject(command.GetCommand().GetAssetFilename());
                            }
                            if (mainForm.LibraryExplorer != null)
                            {
                                mainForm.LibraryExplorer.LibraryListView.RefreshItem(command);
                            }
                        }
                        #endregion
                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_EditorPackageMergeTask:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild:
                        WorkspaceManager.EndPackaging(command.GetCommand().GetWorkingDirectory());
                        break;
                    }
                }
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveConnection:
                #region MOG_COMMAND_NotifyActiveConnection
                if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Connections", true) == 0)
                {
                    if (mainForm.mConnectionManager != null)
                    {
                        mainForm.mConnectionManager.UpdateConnections(command);
                    }
                }
                #endregion
                break;

            // These are the all around locks requested commands from the server
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveLock:
                #region MOG_COMMAND_NotifyActiveLock
                switch (command.GetCommand().GetCommandType())
                {
                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:
                    if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Locks", true) == 0)
                    {
                        if (mainForm.mLockManager != null)
                        {
                            mainForm.mLockManager.RefreshLockWindows(command);
                        }
                    }
                    break;
                }
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshProject:
                #region MOG_COMMAND_RefreshProject
                MainMenuProjectsClass.MOGGlobalRefreshProject(mainForm);
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshApplication:
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshTools:
                break;

            // These are the all around general commands from the server
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveCommand:
                #region MOG_COMMAND_NotifyActiveCommand
                // The command manager needs to know about all commands
                if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Connections", true) == 0)
                {
                    if (mainForm.mConnectionManager != null)
                    {
                        mainForm.mConnectionManager.UpdateCommands(command);
                    }
                }
                #endregion
                break;
            }
        }
Ejemplo n.º 19
0
        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;
                    }
                }
            }
        }
Ejemplo n.º 20
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);
        }
Ejemplo n.º 21
0
        public void RefreshItem(MOG_Command command)
        {
            // No reason to bother if they have no library working directory
            if (MOG_ControllerLibrary.GetWorkingDirectory().Length == 0)
            {
                return;
            }

            // Make sure this contains an encapsulated command?
            MOG_Command encapsulatedCommand = command.GetCommand();

            if (encapsulatedCommand != null)
            {
                // No reason to bother if they are in a different project
                if (string.Compare(MOG_ControllerProject.GetProjectName(), encapsulatedCommand.GetProject(), true) != 0)
                {
                    return;
                }

                // Check if this encapsulatedCommand contains a valid assetFilename?
                if (encapsulatedCommand.GetAssetFilename().GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
                {
                    // No reason to bother if this asset's classification doesn't match their mCurrentClassification
                    if (string.Compare(CurrentClassification, encapsulatedCommand.GetAssetFilename().GetAssetClassification(), true) != 0)
                    {
                        return;
                    }
                }

                // Can we find the asset node of this file?
                int itemid = FindListItem(encapsulatedCommand.GetAssetFilename().GetAssetFullName());
                if (itemid == -1)
                {
                    // Check if this was a post command?
                    if (encapsulatedCommand.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_Post)
                    {
                        // Create a new item
                        ListViewItem item = CreateListViewItemForAsset(encapsulatedCommand.GetAssetFilename());
                        if (item != null)
                        {
                            LibraryListView.Items.Add(item);
                            itemid = FindListItem(encapsulatedCommand.GetAssetFilename().GetAssetFullName());
                        }
                    }
                }

                // Now check if we finally found our itemid?
                if (itemid != -1)
                {
                    ListViewItem item = LibraryListView.Items[itemid];
                    if (item != null)
                    {
                        int classificationIdx  = FindColumn("Classification");
                        int nameIdx            = FindColumn("Name");
                        int statusIdx          = FindColumn("Status");
                        int userIdx            = FindColumn("User");
                        int commentIdx         = FindColumn("Comment");
                        int localFileIdx       = FindColumn("LocalFile");
                        int repositoryFileIdx  = FindColumn("RepositoryFile");
                        int localTimestampIdx  = FindColumn("Local Timestamp");
                        int serverTimestampIdx = FindColumn("Server Timestamp");
                        int fullname           = FindColumn("Fullname");
                        int extensionIdx       = FindColumn("Extension");

                        // Determin the type of encapsulated command
                        switch (encapsulatedCommand.GetCommandType())
                        {
                        case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
                        case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRelease:
                            UpdateItem(item);
                            break;

                        case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
                        case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest:
                            string status   = "";
                            string comment  = encapsulatedCommand.GetDescription();
                            string username = encapsulatedCommand.GetUserName();
                            if (String.Compare(MOG_ControllerProject.GetUserName(), encapsulatedCommand.GetUserName(), true) == 0)
                            {
                                status = "CheckedOut";
                            }
                            else
                            {
                                status = "Locked";
                            }

                            item.ImageIndex = MogUtil_AssetIcons.GetLockedBinaryIcon(item.SubItems[repositoryFileIdx].Text);
                            item.SubItems[commentIdx].Text = comment;
                            item.SubItems[userIdx].Text    = username;
                            item.SubItems[statusIdx].Text  = status;

                            UpdateListViewItemColors(item, status);
                            break;

                        case MOG_COMMAND_TYPE.MOG_COMMAND_Post:
                            item.SubItems[repositoryFileIdx].Text = MOG_ControllerLibrary.ConstructBlessedFilenameFromAssetName(encapsulatedCommand.GetAssetFilename());
                            UpdateItem(item);
                            break;

                        case MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject:
                            // Make sure to remove this file just incase it had been previously synced
                            MOG_ControllerLibrary.Unsync(encapsulatedCommand.GetAssetFilename());
                            // Proceed to delete this item
                            RemoveItem(itemid);
                            break;
                        }

                        // Update the item's colors
                        UpdateListViewItemColors(item, item.SubItems[statusIdx].Text);
                    }
                }
            }
        }
        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);
        }
Ejemplo n.º 23
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);
                    }
                }
            }
        }
Ejemplo n.º 24
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;
            }
        }
Ejemplo n.º 25
0
        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);
        }
        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);
        }
Ejemplo n.º 27
0
        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);
        }
Ejemplo n.º 28
0
        void CommandEventCallBack_Invoked(MOG_Command command)
        {
            if (mainForm.WindowState == FormWindowState.Minimized)
            {
                return;
            }

            switch (command.GetCommandType())
            {
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert:
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError:
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException:
                // notify anyone who cares
                OnNewSystemException(command);
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRelease:
            case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
            case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
            case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest:
                if (mainForm.mLocks != null)
                {
                    mainForm.mLocks.RefreshLockWindows(command);
                }

                // notify anyone who cares
                OnNewLock(command);
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill:
            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_RegisterSlave:
            case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient:
            case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor:
            case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine:
            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_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_Archive:
            case MOG_COMMAND_TYPE.MOG_COMMAND_ScheduleArchive:
            case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews:
                OnNewConnection(command);

                if (mainForm.SMOG_Main_TabControl.SelectedIndex == (int)FormMainSMOG.MAIN_PAGES.SMOG_CONNECTIONS)
                {
                    mainForm.mMonitor.DisplayUpdateExistingConnections(command);
                }
                if (mainForm.SMOG_Main_TabControl.SelectedIndex == (int)FormMainSMOG.MAIN_PAGES.SMOG_COMMANDS)
                {
                    mainForm.mPendingCommands.RefreshWindow(command);
                }
                break;
            }
            return;
        }