示例#1
0
        static public bool RequestPersistentLockWithRetry(string assetFullName, string description)
        {
            if (!guiAssetSourceLock.IsLockedWithRetry(assetFullName))
            {
SourceLockGet:
                MOG_Command sourceLock = MOG_ControllerProject.PersistentLock_Request(assetFullName, description);

                lockHolder = sourceLock.GetCommand();
                if (sourceLock.IsCompleted() &&
                    lockHolder != null)
                {
                    if (!sourceLock.IsCompleted() ||
                        lockHolder == null)
                    {
                        switch (LockMessage("Could not aquire this lock!", sourceLock, lockHolder))
                        {
                        case DialogResult.Retry:
                            goto SourceLockGet;
                        }
                    }
                }

                return(sourceLock.IsCompleted());
            }

            return(false);
        }
示例#2
0
        bool RemoveDuplicateCommands(MOG_Command pCommand)
        {
            bool bRemoved = false;

            // Get the appropriate command list for this command
            HybridDictionary commandList = GetJobCommandList(pCommand);

            if (commandList != null)
            {
                // Enumerate through the post commands
                IDictionaryEnumerator enumerator = commandList.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    MOG_Command thisCommand = (MOG_Command)(enumerator.Value);

                    // Check if this is a duplicate command?
                    if (IsDuplicateCommand(thisCommand, pCommand))
                    {
                        // Remove this command
                        bRemoved = RemoveCommand(thisCommand);
                        break;
                    }
                }
            }

            return(bRemoved);
        }
示例#3
0
        static public bool ReleasePersistentLockWithRetry(string assetFullName)
        {
SourceLockRelease:
            // Try to release the lock
            if (!MOG_ControllerProject.PersistentLock_Release(assetFullName))
            {
                // If we can't, tell us who has it
                MOG_Command sourceLock = MOG_ControllerProject.PersistentLock_Query(assetFullName);

                lockHolder = sourceLock.GetCommand();
                if (sourceLock.IsCompleted() &&
                    lockHolder != null)
                {
                    // Now check if someone had a lock on this asset
                    switch (LockMessage("This asset is currently locked by another user", sourceLock, lockHolder))
                    {
                    case DialogResult.Retry:
                        goto SourceLockRelease;
                    }

                    return(false);
                }
            }

            return(true);
        }
示例#4
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);
        }
        internal bool Command_RegisterSlave(MOG_Command pCommand)
        {
            // Remove this computer name from our requested slaves list
            RemoveRequestedSlaveName(pCommand.GetComputerName());

            return(true);
        }
示例#6
0
        public void ShellSpawnWithLock()
        {
            if (mBinary == null || mAsset == null)
            {
                MOG_Prompt.PromptMessage("Spawn Viewer Error!", "One of the following was not initialized: Viewer, Binary, Asset", Environment.StackTrace);
                return;
            }
            else
            {
                MOG_Command command = new MOG_Command();

                // Get Asset Lock
                command = MOG.COMMAND.MOG_CommandFactory.Setup_LockReadRequest(mAsset.GetOriginalFilename(), "Asset View - Open Asset");
                if (MOG_ControllerSystem.GetCommandManager().CommandProcess(command))
                {
                    string output = "";
                    if (mViewer != null && mViewer.Length == 0)
                    {
                        guiCommandLine.ShellExecute(mBinary);
                    }
                    else
                    {
                        guiCommandLine.ShellExecute(mViewer, mBinary, ProcessWindowStyle.Normal, ref output);
                    }

                    command = MOG.COMMAND.MOG_CommandFactory.Setup_LockReadRelease(mAsset.GetOriginalFilename());
                    MOG_ControllerSystem.GetCommandManager().CommandProcess(command);
                }
            }
        }
示例#7
0
 void CommandEventCallBack(MOG_Command command)
 {
     if (mainForm.IsHandleCreated)
     {
         mainForm.BeginInvoke(new MOG_CallbackCommandEvent(CommandEventCallBack_Invoked), new object[] { command });
     }
 }
        private void RefreshLists()
        {
            // get connection lists
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager();

            if (commandServer == null)
            {
                return;
            }

            this.slaveList  = commandServer.GetRegisteredSlaves();
            this.clientList = commandServer.GetRegisteredClients();
            this.editorList = commandServer.GetRegisteredEditors();
            this.serverList = new ArrayList();

            // build server's "command"
            MOG_Command command = new MOG_Command();

            command.SetComputerName(MOG_ControllerSystem.GetComputerName());
            command.SetComputerIP(MOG_ControllerSystem.GetComputerIP());
            command.SetNetworkID(1);
            command.SetCommandType(0);
            command.SetDescription("");
            this.serverList.Add(command);
        }
示例#9
0
        private void MogProcess()
        {
            while (!MOG_Main.isShutdown())
            {
                try
                {
                    MOG_Main.Process();
                }
                catch (Exception ex)
                {
                    MOG_Command pNotify = new MOG_Command();
                    pNotify.Setup_NotifySystemException("MogProcess:Exception Error durring Mog.Process" + "\n\nMessage: " + ex.ToString() + "\n\nStackTrace:" + ex.StackTrace.ToString());
                    MOG_ControllerSystem.GetCommandManager().CommandProcess(pNotify);

                    MOG_REPORT.LogError("MogProcess", "Exception Error durring Mog.Process");
                    MOG_REPORT.LogError("MogProcess", ex.ToString());
                    MOG_REPORT.LogError("MogProcess", ex.StackTrace.ToString());
                }

                Thread.Sleep(100);
            }

            Application.Exit();
            mMogProcess.Abort();
            mMogProcess = null;
        }
示例#10
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);
        }
示例#11
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;
            }
        }
示例#12
0
        internal bool ConfirmLicense(MOG_Command pCommand)
        {
            bool bLicense = false;

            // Check if we are a client?
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager());

            if (commandServer != null)
            {
                // Check if this client is already registered?
                if (commandServer.LocateClientByID(pCommand.GetNetworkID()) != null)
                {
                    // JohnRen - Bummer, we can't check this because they may have just expired and now be legitamately running on the 4 connections
                    //			// Now double check the date of this command to ensure it hasn't expired
                    //			DateTime commandDate = MOG_Time.GetDateTimeFromTimeStamp(pCommand.GetCommandTimeStamp());
                    //			if (!mTimeBomb.HasExpired(commandDate))
                    //			{
                    // Indicate this client is licensed
                    bLicense = true;
                    //			}
                }
                else
                {
                    // Let's try to obtain a license
                    if (CanObtainLicense(pCommand))
                    {
                        // Indicate this client got a license
                        bLicense = true;
                    }
                }
            }

            return(bLicense);
        }
示例#13
0
        internal bool Command_RequestActiveCommands(MOG_Command pCommand)
        {
            bool bFailed = false;

            // Loop through mActiveSlaves
            for (int c = 0; c < mActiveSlaves.Count; c++)
            {
                // Send off the Notify command for each one
                MOG_Command pNotify = MOG_CommandFactory.Setup_NotifyActiveCommand((MOG_Command)mActiveSlaves[c]);
                if (!mServerCommandManager.SendToConnection(pCommand.GetNetworkID(), pNotify))
                {
                    bFailed = true;
                }
            }

            // Enumerate through all the jobs
            foreach (MOG_JobInfo job in mJobOrder)
            {
                if (job != null)
                {
                    if (!job.Command_RequestActiveCommands(pCommand))
                    {
                        bFailed = true;
                    }
                }
            }

            // Check if we failed?
            if (!bFailed)
            {
                return(true);
            }
            return(false);
        }
示例#14
0
        private ListViewItem LocateLockItem(MOG_Command command)
        {
            ListViewItem commandItem = InitNewLockItem(command);

            if (commandItem != null)
            {
                foreach (ListViewItem item in mainForm.LockManagerLocksListView.Items)
                {
                    if (item.SubItems.Count == commandItem.SubItems.Count)
                    {
                        bool match = true;
                        for (int i = 0; i < item.SubItems.Count; i++)
                        {
                            if (String.Compare(commandItem.SubItems[i].Text, item.SubItems[i].Text, true) != 0)
                            {
                                //We have encountered at least one item where the text doesn't match the command, so this is not a match
                                match = false;
                                break;
                            }
                        }

                        if (match)
                        {
                            //We went through all the subitems in this item and it totally matches the command, so return it
                            return(item);
                        }
                    }
                }
            }

            return(null);
        }
示例#15
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";
                        }
                    }
                }
            }
        }
示例#16
0
        public void DisplayUpdateExistingConnections()
        {
            //first let's kill the existing ones.
            foreach (ListViewItem item in mForm.lviewMonitor.Items)
            {
                mForm.lviewMonitor.Items.Remove(item);
            }

            //this needs to walk the connections and add all the connected computers.
            MOG_CommandServer commandServer = (MOG_CommandServer)mForm.gMog.GetCommandManager();

            ArrayList slavesArray  = commandServer.GetRegisteredSlaves();
            ArrayList clientsArray = commandServer.GetRegisteredClients();

            //show the server first.
            DislayAddConnection(mForm.gMog.GetComputerName(), mForm.gMog.GetComputerIP(), 1, 0);

            foreach (Object item in clientsArray)
            {
                MOG_Command connection = (MOG_Command)item;

                DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient);
            }

            foreach (Object item in slavesArray)
            {
                MOG_Command connection = (MOG_Command)item;

                DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave);
            }
        }
示例#17
0
 void CommandPreEventCallBack_Invoked(MOG_Command command)
 {
     switch (command.GetCommandType())
     {
     default:
         break;
     }
 }
示例#18
0
 private void OnNewLock(MOG_Command lockCommand)
 {
     if (this.NewLock != null)
     {
         MOG_NewLockEventArgs e = new MOG_NewLockEventArgs();
         e.lockCommand = lockCommand;
         this.NewLock(this, e);
     }
 }
示例#19
0
 private void OnNewConnection(MOG_Command connectionCommand)
 {
     if (this.NewConnection != null)
     {
         MOG_NewConnectionEventArgs e = new MOG_NewConnectionEventArgs();
         e.connectionCommand = connectionCommand;
         this.NewConnection(this, e);
     }
 }
示例#20
0
 private void OnNewCommand(MOG_Command command)
 {
     if (this.NewCommand != null)
     {
         MOG_NewCommandEventArgs e = new MOG_NewCommandEventArgs();
         e.command = command;
         this.NewCommand(this, e);
     }
 }
示例#21
0
 private void OnNewSystemException(MOG_Command exceptionCommand)
 {
     if (this.NewSystemException != null)
     {
         MOG_NewSystemExceptionEventArgs e = new MOG_NewSystemExceptionEventArgs();
         e.exceptionCommand = exceptionCommand;
         this.NewSystemException(this, e);
     }
 }
示例#22
0
        void CommandPreEventCallBack_Invoked(MOG_Command command)
        {
//			switch (command.GetCommandType())
//			{
//			case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge:
//				mainForm.mAssetManager.UpdatePackageButton();
//				break;
//			}
        }
示例#23
0
        private ListViewItem LocateItem(MOG_Command command, ListView view)
        {
            // This is a much faster way to check if the command already exists in our list
            if (view.Items.ContainsKey(command.GetCommandID().ToString()))
            {
                return(view.Items[mainForm.CommandspendingListView.Items.IndexOfKey(command.GetCommandID().ToString())]);
            }

            return(null);
        }
示例#24
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);
                        }
                    }
                }
            }
        }
示例#25
0
        static private DialogResult LockMessage(string message, MOG_Command desiredLockInfo, MOG_Command currentLockHolderInfo)
        {
            MOG_Time desiredLockTime = new MOG_Time();

            desiredLockTime.SetTimeStamp(desiredLockInfo.GetCommand().GetCommandTimeStamp());

            string desiredLockName = desiredLockInfo.GetAssetFilename().GetAssetFullName();

            // Check if this asset is a classification
            if (desiredLockName.Length == 0)
            {
                desiredLockName = desiredLockInfo.GetAssetFilename().GetOriginalFilename();
            }

            string desiredUser        = desiredLockInfo.GetCommand().GetUserName().Length != 0 ? desiredLockInfo.GetCommand().GetUserName() : desiredLockInfo.GetCommand().GetComputerName();
            string desiredMachine     = desiredLockInfo.GetCommand().GetComputerName();
            string desiredDescription = desiredLockInfo.GetCommand().GetDescription().Trim();

            // Current lock holder
            MOG_Time currentLockTime = new MOG_Time();

            currentLockTime.SetTimeStamp(currentLockHolderInfo.GetCommandTimeStamp());

            string currentLockName = currentLockHolderInfo.GetAssetFilename().GetAssetFullName();

            // Check if this asset is a classification
            if (currentLockName.Length == 0)
            {
                currentLockName = currentLockHolderInfo.GetAssetFilename().GetOriginalFilename();
            }

            string currentLockUser        = currentLockHolderInfo.GetUserName().Length != 0 ? currentLockHolderInfo.GetUserName() : currentLockHolderInfo.GetComputerName();
            string currentLockMachine     = currentLockHolderInfo.GetComputerName();
            string currentLockDescription = currentLockHolderInfo.GetDescription().Trim();


            return(MessageBox.Show(message + "\n\n" +
                                   desiredLockName + "\n" +
                                   "    USER: "******"\n" +
                                   "    MACHINE: " + desiredMachine + "\n" +
                                   "    DESCRIPTION: " + desiredDescription + "\n" +
                                   "    TIME: " + desiredLockTime.FormatString("") +

                                   "\n\n Colliding Lock:\n\n" +

                                   currentLockName + "\n" +
                                   "    USER: "******"\n" +
                                   "    MACHINE: " + currentLockMachine + "\n" +
                                   "    DESCRIPTION: " + currentLockDescription + "\n" +
                                   "    TIME: " + currentLockTime.FormatString(""),

                                   "Asset Locked!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question));
        }
示例#26
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);
                        }
                    }
                }
            }
        }
示例#27
0
        public string GetClientStatusDescription(MOG_Command command)
        {
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager();

            // Describe the current command of this connection
            string description = "";

            // Check if we have a ProjectName specified?
            if (command.GetProject().Length > 0)
            {
                // Add on our ProjectName
                description += "PROJECT: " + command.GetProject();
            }

            // Check if we have a ProjectName specified?
            if (command.GetBranch().Length > 0)
            {
                // Add on our ProjectName
                description += "     BRANCH: " + command.GetBranch();
            }

            // Check if we have a UserName specified?
            if (command.GetUserName().Length > 0)
            {
                // Add on our ProjectName
                description += "     USER: "******"     TAB: " + viewsCommand.GetTab();
                }
                // Check if we have a Platform specified?
                if (viewsCommand.GetPlatform().Length > 0)
                {
                    description += "     PLATFORM: " + viewsCommand.GetPlatform();
                }
                // Check if we have a Tab specified?
                if (viewsCommand.GetUserName().Length > 0)
                {
                    description += "     INBOX: " + viewsCommand.GetUserName();
                }
            }

            return(description);
        }
示例#28
0
        public void RefreshRemove(MOG_Command command)
        {
            // Find the asset
            int index = ListViewItemFindFullItem(command.GetDestination(), mAssetManager.mainForm.AssetManagerTrashListView);

            if (index != -1)
            {
                mAssetManager.mainForm.AssetManagerTrashListView.Items.RemoveAt(index);
            }

            // Update global size
            mAssetManager.mainForm.AssetManagerTrashTotalSizeLabel.Text = "Total Size:" + FormatSize(mSize);
        }
示例#29
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);
        }
示例#30
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);
        }