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);
        }
        internal bool AddCommand(MOG_Command pCommand)
        {
            bool bAdded = false;

            MOG_JobInfo job = (MOG_JobInfo)mActiveJobs[pCommand.GetJobLabel()];

            if (job == null)
            {
                // Create a new job
                job = new MOG_JobInfo(this);
                mJobOrder.Add(job);
                mActiveJobs[pCommand.GetJobLabel()] = job;
            }

            // Make sure we have a valid job?
            if (job != null)
            {
                // Add this command to the identified job
                bAdded = job.AddCommand(pCommand);
            }

            return(bAdded);
        }
 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();
     }
 }
Example #4
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);
        }
Example #5
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);
        }
        internal ArrayList GetActiveSlaves(string jobLabel)
        {
            ArrayList activeSlaves = new ArrayList();

            // Scan mActiveSlaves looking for one that matches this command
            for (int s = 0; s < mActiveSlaves.Count; s++)
            {
                MOG_Command pSlave = (MOG_Command)mActiveSlaves[s];

                // Get the command this slave is working on
                MOG_Command pCommand = pSlave.GetCommand();
                if (pCommand != null)
                {
                    // Check if this slave is working on this jobLabel?
                    if (String.Compare(pCommand.GetJobLabel(), jobLabel, true) == 0)
                    {
                        // Include this slave
                        activeSlaves.Add(pSlave);
                    }
                }
            }

            return(activeSlaves);
        }
Example #7
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);
                    }
                }
            }
        }
Example #8
0
 private void btnRestart_Click(object sender, EventArgs e)
 {
     MOG_ControllerProject.StartJob(mCommand.GetJobLabel());
 }
Example #9
0
 internal string GetJobLabel()
 {
     return((IsJobStarted()) ? mStartJobCommand.GetJobLabel() : "");
 }