コード例 #1
0
        public void GetCommandSnapShot()
        {
            // Clear our existing list
            mainForm.CommandspendingListView.Items.Clear();

            // Obtain the server
            MOG_CommandServerCS server = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager());

            if (server != null)
            {
                // Get all the pending commands
                ArrayList commands = server.GetAllPendingCommands();
                foreach (MOG_Command command in commands)
                {
                    ListViewItem item = new ListViewItem();

                    item.Text = command.ToString();
                    item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename());
                    item.SubItems.Add(command.GetComputerName());
                    item.SubItems.Add(command.GetComputerIP());
                    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.ForeColor  = Color.Black;
                    item.ImageIndex = GetImageIndex(command.GetCommandType());
                    item.Name       = command.GetCommandID().ToString();
                    // Add the new item
                    mainForm.CommandspendingListView.Items.Add(item);
                }
            }
        }
コード例 #2
0
ファイル: AssetView.cs プロジェクト: MOGwareSupport/MOG
        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);
                }
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public void Initialize()
        {
            MOG_CommandServerCS server = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager();

            mainForm.LocksListView.Items.Clear();

            ArrayList activeWriteLocks = new ArrayList(server.GetActiveWriteLocks());

            foreach (MOG_Command myLock in activeWriteLocks)
            {
                ListViewItem item = InitNewLockItem(myLock);

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

            ArrayList activeReadLocks = new ArrayList(server.GetActiveReadLocks());

            foreach (MOG_Command myLock in activeReadLocks)
            {
                ListViewItem item = InitNewLockItem(myLock);

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

            mainForm.LocksRequestLocksListView.Items.Clear();
        }
コード例 #5
0
ファイル: Monitor.cs プロジェクト: MOGwareSupport/MOG
        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";
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: PriviledgesForm.cs プロジェクト: MOGwareSupport/MOG
        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;
        }
コード例 #7
0
ファイル: FormMainSlave.cs プロジェクト: MOGwareSupport/MOG
        private void niconSystemTrayIcon_DoubleClick(object sender, System.EventArgs e)
        {
            MOG_CommandSlave manager = (MOG_CommandSlave)MOG_ControllerSystem.GetCommandManager();

            mLogWindow = new CommandLineLog(manager);
            mLogWindow.Show();
        }
コード例 #8
0
ファイル: FormMainSlave.cs プロジェクト: MOGwareSupport/MOG
        // Show the command line output
        private void mnuItmShowLog_Click(object sender, System.EventArgs e)
        {
            MOG_CommandSlave manager = (MOG_CommandSlave)MOG_ControllerSystem.GetCommandManager();

            mLogWindow = new CommandLineLog(manager);
            mLogWindow.Show();
        }
コード例 #9
0
ファイル: MOG_License.cs プロジェクト: MOGwareSupport/MOG
        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);
        }
コード例 #10
0
        public EventCallbacks(FormMainSlave main)
        {
            mainForm = main;

            MOG_Callbacks callbacks = new MOG_Callbacks();

            callbacks.mPreEventCallback = new MOG_CallbackCommandEvent(this.CommandPreEventCallBack);
            callbacks.mEventCallback    = new MOG_CallbackCommandEvent(this.CommandEventCallBack);
            MOG_ControllerSystem.GetCommandManager().SetCallbacks(callbacks);
        }
コード例 #11
0
ファイル: FormMainSlave.cs プロジェクト: MOGwareSupport/MOG
        private void InitSlaveInformationMenu()
        {
            // Initialize the Explorer context menu
            mnuItmInformation.MenuItems.Clear();

            mnuItmInformation.MenuItems.Add(String.Concat("Server:", MOG_ControllerSystem.GetServerComputerName()));
            mnuItmInformation.MenuItems.Add(String.Concat("ServerIp:", MOG_ControllerSystem.GetServerComputerIP()));
            mnuItmInformation.MenuItems.Add(String.Concat("NetworkID:", MOG_ControllerSystem.GetCommandManager().GetNetwork().GetID()));
            mnuItmInformation.MenuItems.Add(String.Concat("Commands:", Convert.ToString(MOG_ControllerSystem.GetCommandManager().GetCommandsList().Count)));
        }
コード例 #12
0
ファイル: MOG_License.cs プロジェクト: MOGwareSupport/MOG
        ArrayList GetAllCurrentLicenses()
        {
            // Check if we are a client?
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager());

            if (commandServer != null)
            {
                return(commandServer.GetRegisteredClients());
            }

            return(null);
        }
コード例 #13
0
ファイル: Monitor.cs プロジェクト: MOGwareSupport/MOG
        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);
        }
コード例 #14
0
        public void SlaveAdd()
        {
            MOG_CommandManager manager = MOG_ControllerSystem.GetCommandManager();

            if (manager != null)
            {
                MOG_Network network = manager.GetNetwork();
                if (network != null)
                {
                    // Add a slave
                    MOG_ControllerSystem.LaunchSlave(network.GetID());
                }
            }
        }
コード例 #15
0
ファイル: FormMainSlave.cs プロジェクト: MOGwareSupport/MOG
        private void mnuItmHideCommand_Click(object sender, System.EventArgs e)
        {
            MOG_CommandSlave manager = (MOG_CommandSlave)MOG_ControllerSystem.GetCommandManager();
            MenuItem         menu    = (MenuItem)sender;

            if (menu.Checked)
            {
                menu.Checked = false;
            }
            else
            {
                menu.Checked = true;
            }
            // Set the commanger to be the same
            manager.SetCommandLineHideWindow(menu.Checked);
        }
コード例 #16
0
        public static bool RebuildNetworkPackage(MOG_Filename packageFilename, string jobLabel)
        {
            // Make sure this represents the currently blessed revision of this package
            if (!packageFilename.IsWithinRepository())
            {
                // Obtain the current revision for this specified package
                packageFilename = MOG_ControllerProject.GetAssetCurrentBlessedVersionPath(packageFilename);
            }

            // Now we should be ensured a package located within the repository
            if (packageFilename.IsWithinRepository())
            {
                // Send our Rebuild package command to the server
                MOG_Command rebuildPackageCommand = MOG_CommandFactory.Setup_NetworkPackageRebuild(packageFilename.GetEncodedFilename(), packageFilename.GetAssetPlatform(), jobLabel);
                return(MOG_ControllerSystem.GetCommandManager().SendToServer(rebuildPackageCommand));
            }

            return(false);
        }
コード例 #17
0
        public guiEventCallbacks(MogMainForm main)
        {
            mainForm = main;

            // Initialize arraylist
            mDialogs = new ArrayList();
            windowId = 1;

            MOG_Callbacks callbacks = new MOG_Callbacks();

            callbacks.mPreEventCallback = new MOG_CallbackCommandEvent(this.CommandPreEventCallBack);
            callbacks.mEventCallback    = new MOG_CallbackCommandEvent(this.CommandEventCallBack);
            callbacks.mCommandCallback  = new MOG_CallbackCommandProcess(this.CommandProcessCallBack);

            if (!MOG_ControllerSystem.GetOffline() && MOG_ControllerSystem.IsCommandManager())
            {
                MOG_ControllerSystem.GetCommandManager().SetCallbacks(callbacks);
            }
        }
コード例 #18
0
        public int DialogInit(string title, string description, bool bCancelVisible)
        {
            this.Callbacks = MOG_ControllerSystem.GetCommandManager().GetCallbacks();

            if (this.Callbacks == null)
            {
                return(-1);
            }

            if (bCancelVisible)
            {
                this.Handle = this.Callbacks.mDialogInit(title, description, "Cancel");
            }
            else
            {
                this.Handle = this.Callbacks.mDialogInit(title, description, "");
            }

            this.description   = description;
            this.Title         = title;
            this.cancelVisible = bCancelVisible;

            return(this.Handle);
        }
コード例 #19
0
ファイル: MOG_JobInfo.cs プロジェクト: MOGwareSupport/MOG
        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);
        }
コード例 #20
0
ファイル: Monitor.cs プロジェクト: MOGwareSupport/MOG
        public void DisplayUpdateExistingConnections()
        {
            //first let's kill the existing ones.
            foreach (ListViewItem item in mainForm.lviewMonitor.Items)
            {
                mainForm.lviewMonitor.Items.Remove(item);
            }

            //this needs to walk the connections and add all the connected computers.
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager();

            if (commandServer == null)
            {
                return;
            }

            ArrayList slavesArray  = new ArrayList(commandServer.GetRegisteredSlaves());
            ArrayList clientsArray = new ArrayList(commandServer.GetRegisteredClients());
            ArrayList editorsArray = new ArrayList(commandServer.GetRegisteredEditors());

            //show the server first.
            DislayAddConnection(MOG_ControllerSystem.GetComputerName(), MOG_ControllerSystem.GetComputerIP(), 1, 0, "");

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

                // Describe the current command of this connection
                string description = FilterDesiredCommand(connection);
                if (description != null)
                {
                    DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient, description);
                }
            }

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

                // Describe the current command of this connection
                string description = FilterDesiredCommand(connection);
                if (description != null)
                {
                    DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor, description);
                }
            }

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

                // Check if this Slave is actively assigned anything?
                MOG_Command workingCommand = connection.GetCommand();
                if (workingCommand == null)
                {
                    // Describe the current command of this connection
                    description = FilterDesiredCommand(connection);
                }
                else
                {
                    // Describe the current command of this connection's command
                    description = FilterDesiredCommand(workingCommand);
                }

                if (description != null)
                {
                    DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave, description);
                }
            }
        }
コード例 #21
0
        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);
        }
コード例 #22
0
        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);
        }
コード例 #23
0
ファイル: Monitor.cs プロジェクト: MOGwareSupport/MOG
        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);
        }
コード例 #24
0
        public void Initialize()
        {
            mainForm.LockManagerLocksListView.Items.Clear();
            mainForm.LockManagerPendingListView.Items.Clear();
            mainForm.LockManagerLocksListView.SmallImageList   = MogUtil_AssetIcons.Images;
            mainForm.LockManagerPendingListView.SmallImageList = MogUtil_AssetIcons.Images;

            // Locks
            mListViewSort_Manager.Add(new ListViewSortManager(mainForm.LockManagerLocksListView, new Type[] {
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewInt32Sort),
                typeof(ListViewDateSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
            }));
            // RequestLocks
            mListViewSort_Manager.Add(new ListViewSortManager(mainForm.LockManagerPendingListView, new Type[] {
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewInt32Sort),
                typeof(ListViewDateSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
                typeof(ListViewTextCaseInsensitiveSort),
            }));

            // Populate our list of locks
            MOG_CommandClient client = MOG_ControllerSystem.GetCommandManager() as MOG_CommandClient;

            if (client != null)
            {
                // Check if we already have the locks from the server?
                ArrayList locks = client.GetLocks();
                if (locks.Count > 0)
                {
                    ArrayList lockItems = new ArrayList();

                    // Create the new lock items for each lock
                    foreach (MOG_Command lockCommand in locks)
                    {
                        ListViewItem newLockItem = InitNewLockItem(lockCommand);
                        if (newLockItem != null)
                        {
                            lockItems.Add(newLockItem);
                        }
                    }

                    // Add them all at once because it is much faster
                    AddLockItems(lockItems);
                }
                else
                {
                    // Looks like we need to request the locks from the server (this is much slower)
                    MOG_ControllerSystem.RequestActiveLocks();
                }
            }
        }
コード例 #25
0
ファイル: MOG_License.cs プロジェクト: MOGwareSupport/MOG
        bool CanObtainLicense(MOG_Command pCommand)
        {
            bool bLicense = false;

            // Get our server command manager?
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager());

            if (commandServer != null)
            {
                // This client is not accounted for, check the license file to see if he can fit into the current situation
                if (EnsureValidLicense())
                {
                    // We have a license file
                    if (!mTimeBomb.IsValidMacAddress())
                    {
                        //The Mac address is bad
                        String message = String.Concat("This MOG Server's machine hasn't been properly licensed.\n",
                                                       "You will be limited to 2 client connections.\n",
                                                       "Contact Mogware to transfer this license.");

                        MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                        commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                    }
                    else
                    {
                        // Since the Mac address is ok, what about the expiration?
                        DateTime commandDate = MOG_Time.GetDateTimeFromTimeStamp(pCommand.GetCommandTimeStamp());
                        if (mTimeBomb.HasExpired() ||
                            mTimeBomb.HasExpired(commandDate))
                        {
                            //Oh man this license file is expired
                            String message = String.Concat("The MOG Server has been unable to renew the MOG License.\n",
                                                           "You will be limited to 2 client connections.\n",
                                                           "Please make sure the MOG Server machine has internet access.");

                            MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                            commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                        }
                        // Check if we are going to expire soon?
                        else if (mTimeBomb.WillExpireSoon())
                        {
                            // Inform the user of our impending doom
                            String message = String.Concat("The MOG Server has been unable to renew the MOG License.\n",
                                                           "EXPIRATION DATE: ", mTimeBomb.GetExpireDate().ToString(), "\n",
                                                           "Please make sure the MOG Server machine has internet access.");
                            MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                            commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                        }
                    }
                }
                else
                {
                    // There is no license file at all
                    String message = String.Concat("You're using an unlicensed server.\n",
                                                   "You will be limited to 2 client connections.\n",
                                                   "Licensing can be performed in the ServerManager.");

                    MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                    commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                }

                // Call this to see if any more clients can be licensed
                if (IsLicenseAvailable())
                {
                    bLicense = true;
                }
                else
                {
                    // Notify client of failed command request
                    string message = String.Concat("No more available licenses on the server.\n\n",
                                                   "This client cannot be launched until another client is closed.\n",
                                                   "Additional seats can be licensed in the ServerManager.");
                    MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                    commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                }
            }

            return(bLicense);
        }