private void PackageNewClassificationMenuItem_Click(object sender, EventArgs e)
        {
            MOG_Privileges privs = MOG_ControllerProject.GetPrivileges();

            if (privs.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.AddClassification))
            {
                ToolStripMenuItem item = sender as ToolStripMenuItem;
                if (item != null)
                {
                    ContextMenuStrip contextMenu = item.Owner as ContextMenuStrip;
                    if (contextMenu != null)
                    {
                        MogControl_BaseTreeView treeview = contextMenu.SourceControl as MogControl_BaseTreeView;
                        if (treeview != null)
                        {
                            TreeNode node = treeview.SelectedNode;
                            if (node != null)
                            {
                                ClassificationCreateForm form = new ClassificationCreateForm(node.FullPath);
                                if (form.ShowDialog(treeview.TopLevelControl) == DialogResult.OK)
                                {
                                    treeview.DeInitialize();
                                    treeview.LastNodePath = form.FullClassificationName;
                                    treeview.Initialize();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to add classifications to the project.");
            }
        }
Esempio n. 2
0
        private void SyncConfigureButton_Click(object sender, EventArgs e)
        {
            MOG_Privileges privileges = MOG_ControllerProject.GetPrivileges();

            if (privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.ConfigureUpdateFilterPromotions))
            {
                if (SyncConfigureButton.Visible)
                {
                    SyncFilterLabel.Visible        = true;
                    SyncAddButton.Visible          = true;
                    SyncDelButton.Visible          = true;
                    SyncSaveButton.Visible         = true;
                    SyncPromoteButton.Visible      = true;
                    SyncConfigureButton.Visible    = false;
                    ClassificationTreeView.Visible = true;
                    SyncShowAssetsCheckBox.Visible = true;
                    SyncFilterComboBox.Enabled     = true;
                    CloseButton.Visible            = true;
                    SyncFilterComboBox.Width      -= (SyncAddButton.Width * 3) + 6;

                    ClassificationTreeView.Initialize();

                    if (ConfigureFilter != null)
                    {
                        ConfigureFilter(sender, true);
                    }
                }
            }
            else
            {
                MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to configure sync filters.");
            }
        }
Esempio n. 3
0
        static private void ProjectRefresh()
        {
            string projectName = MOG_ControllerProject.GetProjectName();
            string branchName  = MOG_ControllerProject.GetBranchName();
            string userName    = MOG_ControllerProject.GetUserName();

            // Refresh all my user list controls
            if (guiProject.SetLoginProject(projectName, branchName))
            {
                // Set the login user
                guiUser guiUsers = new guiUser(mainForm);

                if (!guiUsers.SetLoginUser(userName))
                {
                    // Error
                    MOG_Prompt.PromptResponse("Refresh Project", "Unable to refresh user!  Try re-logging in to your project");
                }
            }
            else
            {
                // Error
                MOG_Prompt.PromptResponse("Refresh Project", "No local workspace or login to project failed!, Try re-logging in to your project");
            }

            // Refresh all my project lists
        }
Esempio n. 4
0
        private void UpdatePromoteButton()
        {
            MOG_Privileges privileges = MOG_ControllerProject.GetPrivileges();

            if (privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.ConfigureUpdateFilterPromotions))
            {
                SyncPromoteButton.Enabled = true;
            }
            else
            {
                SyncPromoteButton.Enabled = false;
            }

            ComboBoxItem filter = SyncFilterComboBox.SelectedItem as ComboBoxItem;

            if (filter != null)
            {
                string filterFileName = filter.FullPath;
                if (filterFileName.Contains(MOG_ControllerProject.GetUserPath()))
                {
                    // This is a user tool and can be promoted
                    SyncPromoteButton.Image = Properties.Resources.Up;
                    SyncToolTips.SetToolTip(SyncPromoteButton, "Promote this filter to the team");
                }
                else
                {
                    // This is a project tool and can be demoted
                    SyncPromoteButton.Image = Properties.Resources.Down;
                    SyncToolTips.SetToolTip(SyncPromoteButton, "Demote this filter");
                }
            }
        }
Esempio n. 5
0
        private void AddBranch()
        {
            MOG_Privileges privs = MOG_ControllerProject.GetPrivileges();

            if (privs.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.CreateBranch))
            {
                CreateBranchForm newBranch = new CreateBranchForm();
                newBranch.BranchSourceTextBox.Text = MOG_ControllerProject.GetBranchName();

                if (newBranch.ShowDialog() == DialogResult.OK)
                {
                    // Create the branch
                    if (MOG_ControllerProject.BranchCreate(MOG_ControllerProject.GetBranchName(), newBranch.BranchNameTextBox.Text))
                    {
                        MOG_DBBranchInfo branch = MOG_DBProjectAPI.GetBranch(newBranch.BranchNameTextBox.Text);

                        AddBranchListViewItem(branch);

                        MOG_Prompt.PromptMessage("Create Branch", "New branch successfully created.\n" +
                                                 "BRANCH: " + newBranch.BranchNameTextBox.Text);
                    }
                }
            }
            else
            {
                MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to create branches.");
            }
        }
Esempio n. 6
0
        public void SetUserInbox(string name)
        {
            if (MOG_ControllerProject.GetProject() != null)
            {
                // Is this user valid?
                if (MOG_ControllerProject.GetProject().GetUser(name) != null)
                {
                    // Is this user different from the current user?
                    if (string.Compare(name, mCurrentUsersBox, true) != 0)
                    {
                        MOG_Privileges privs = MOG_ControllerProject.GetPrivileges();

                        if (privs.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.ViewOtherUsersInbox) ||
                            String.Compare(MOG_ControllerProject.GetUserName(), name, true) == 0)
                        {
                            mInboxAssetsDirectory  = "";
                            mOutboxAssetsDirectory = "";
                            mCurrentUsersBox       = name;

                            // Set the active user
                            guiUser user = new guiUser(mainForm);
                            user.SetActiveUser(name);

                            // Are we in our inbox or another teammate
                            Color formBackColor = SystemColors.Window;
                            if (string.Compare(name, MOG_ControllerProject.GetUserName(), true) != 0)
                            {
                                // We are not in our boxes, so lets color them
                                formBackColor = Color.LavenderBlush;
                            }

                            mainForm.AssetManagerInboxListView.BackColor  = formBackColor;
                            mainForm.AssetManagerSentListView.BackColor   = formBackColor;
                            mainForm.AssetManagerTrashListView.BackColor  = formBackColor;
                            mainForm.AssetManagerDraftsListView.BackColor = formBackColor;

                            RefreshAllWindows();
                        }
                        else
                        {
                            MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to view other users' inboxes.");
                        }
                    }
                    else
                    {
                        // User is the same, so just update our gui to show correct department and user
                        SetActiveUser(mCurrentUsersBox);
                    }
                }
            }
        }
Esempio n. 7
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;
            }
        }
Esempio n. 8
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);
                    }
                }
            }
        }
Esempio n. 9
0
        private void UpdateItem(ListViewItem item)
        {
            string status         = "";
            string username       = "";
            string comment        = "";
            string localTimestamp = "";

            // Find our desired columns
            int statusIdx          = FindColumn("Status");
            int userIdx            = FindColumn("User");
            int commentIdx         = FindColumn("Comment");
            int localTimestampIdx  = FindColumn("Local Timestamp");
            int serverTimestampIdx = FindColumn("Server Timestamp");
            int localFileIdx       = FindColumn("LocalFile");
            int repositoryFileIdx  = FindColumn("RepositoryFile");

            string       repositoryFile          = item.SubItems[repositoryFileIdx].Text;
            MOG_Filename repositoryAssetFilename = new MOG_Filename(repositoryFile);

            // Check if this file exist locally?
            string localFile = item.SubItems[localFileIdx].Text;

            if (localFile.Length != 0)
            {
                // Obtain the localFile info
                FileInfo fileInfo = new FileInfo(localFile);
                // Does this local file exist?
                if (fileInfo != null && fileInfo.Exists)
                {
                    // Compare our local file's timestamp to the server's revision
                    localTimestamp = MOG_Time.GetVersionTimestamp(fileInfo.LastWriteTime);
                    if (localTimestamp == repositoryAssetFilename.GetVersionTimeStamp())
                    {
                        // Indicate this item is synced and up-to-date
                        status = "Up-to-date";
                    }
                    else
                    {
                        // Indicate this item is synced
                        status = "Out-of-date";
                    }
                }
                else
                {
                    // Indicate this item is not synced
                    status = "unSynced";
                }
            }
            else
            {
                // Indicate this item is not synced
                status = "unSynced";
            }

            // Check if this file exists in the repository?
            if (repositoryFile.Length != 0)
            {
                // Check the lock statusIdx of the asset
                MOG_Command sourceLock = MOG_ControllerProject.PersistentLock_Query(repositoryAssetFilename.GetAssetFullName());
                if (sourceLock.IsCompleted() && sourceLock.GetCommand() != null)
                {
                    MOG_Command lockHolder = sourceLock.GetCommand();

                    // Obtain the lock info
                    item.ImageIndex = MogUtil_AssetIcons.GetLockedBinaryIcon(repositoryFile);
                    username        = lockHolder.GetUserName();
                    comment         = lockHolder.GetDescription();

                    // Check if this is locked by me?
                    if (username == MOG_ControllerProject.GetUserName())
                    {
                        status = "CheckedOut";
                    }
                    else
                    {
                        status = "Locked";
                    }
                }
                else
                {
                    // Update this file's icon
                    item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(repositoryFile);
                }
            }

            // Update the item with the new information
            item.SubItems[statusIdx].Text          = status;
            item.SubItems[userIdx].Text            = username;
            item.SubItems[commentIdx].Text         = comment;
            item.SubItems[localTimestampIdx].Text  = MogUtils_StringVersion.VersionToString(localTimestamp);
            item.SubItems[serverTimestampIdx].Text = MogUtils_StringVersion.VersionToString(repositoryAssetFilename.GetVersionTimeStamp());

            // Update the color for this locked item
            UpdateListViewItemColors(item, status);
        }
        /// <summary>
        /// We need to make sure the users does not create a new group under an object
        /// </summary>
        private void PackageTreeContextMenu_Popup(object sender, CancelEventArgs e)
        {
            ContextMenuStrip contextMenu = sender as ContextMenuStrip;

            // Get our tree, then get our selected node, so we can then get our NodeType (which is defaulted to Class)
            MogControl_PackageTreeView tree = contextMenu.SourceControl as MogControl_PackageTreeView;

            if (tree != null)
            {
                TreeNode node = tree.SelectedNode;
                // If we actually have a node selected...
                if (node != null && node.Tag != null)
                {
                    PackageNodeTypes nodeType = ((Mog_BaseTag)node.Tag).PackageNodeType;

                    // Enable all our MenuItems
                    foreach (ToolStripItem item in contextMenu.Items)
                    {
                        item.Enabled = true;
                    }

                    // Depending on our NodeType, decide which MenuItems will be available to the user
                    switch (nodeType)
                    {
                    // For package and group, we should not be able to create a sub-package
                    case PackageNodeTypes.Asset:
                    case PackageNodeTypes.Package:
                        this.PackageNewClassificationMenuItem.Enabled = false;
                        this.PackageNewPackageMenuItem.Enabled        = false;
                        this.PackageNewPackageSubMenu.Enabled         = false;
                        this.PackageRemoveMenuItem.Enabled            = true;
                        break;

                    case PackageNodeTypes.Group:
                        this.PackageNewClassificationMenuItem.Enabled = false;
                        this.PackageNewPackageMenuItem.Enabled        = false;
                        this.PackageNewPackageSubMenu.Enabled         = false;
                        this.PackageRemoveMenuItem.Enabled            = true;
                        break;

                    // For object, we should not be able to create a package or a sub-group
                    case PackageNodeTypes.Object:
                        this.PackageNewClassificationMenuItem.Enabled = false;
                        this.PackageNewPackageMenuItem.Enabled        = false;
                        this.PackageNewPackageSubMenu.Enabled         = false;
                        this.PackageNewGroupMenuItem.Enabled          = false;
                        this.PackageRemoveMenuItem.Enabled            = true;
                        break;

                    // For class, we should only be able to add a package or remove a package
                    default:                     // PackageNodeTypes.Class:
                        this.PackageNewClassificationMenuItem.Enabled = true;
                        this.PackageNewPackageMenuItem.Enabled        = true;
                        this.PackageNewPackageSubMenu.Enabled         = true;
                        this.PackageNewGroupMenuItem.Enabled          = false;
                        this.PackageNewObjectMenuItem.Enabled         = false;
                        this.PackageRemoveMenuItem.Enabled            = false;
                        break;
                    }

                    // Disable menu items we don't have privileges for
                    MOG_Privileges privileges            = MOG_ControllerProject.GetPrivileges();
                    bool           bCanAddClassification = privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.AddClassification);
                    if (!bCanAddClassification)
                    {
                        PackageNewClassificationMenuItem.Enabled = false;
                    }
                    bool bCanCreatePackage = privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.CreatePackage);
                    if (!bCanCreatePackage)
                    {
                        PackageNewPackageMenuItem.Enabled = false;
                        PackageNewPackageSubMenu.Enabled  = false;
                        PackageRemoveMenuItem.Enabled     = false;
                    }
                    bool bCanCreatePackageGroup = privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.AddPackageGroup);
                    if (!bCanCreatePackageGroup)
                    {
                        PackageNewObjectMenuItem.Enabled = false;
                        PackageNewGroupMenuItem.Enabled  = false;
                        PackageRemoveMenuItem.Enabled    = false;
                    }

                    // Substitute the create package submenu in the place of the create package option depending on the ShowPlatformSpecific option
                    PackageNewPackageMenuItem.Visible = !tree.ShowPlatformSpecific;
                    PackageNewPackageSubMenu.Visible  = tree.ShowPlatformSpecific;
                }
                else
                {
                    foreach (ToolStripItem item in contextMenu.Items)
                    {
                        item.Enabled = false;
                    }
                }
                // Now the ContextMenu will display properly
            }
        }
Esempio n. 11
0
        public void BuildMerge(bool ShowSyncWindow, bool silent, string tag, string filter, bool updateModifiedMissing, bool cleanUnknownFiles)
        {
            //get the sync data controller
            MOG_ControllerSyncData gameDataHandle = MOG_ControllerProject.GetCurrentSyncDataController();

            //if we don't have one infom the user that we need one
            if (gameDataHandle == null)
            {
                MOG_Prompt.PromptMessage("Update Build", "Cannot update a build without a valid local Workspace and Workspace tab created.  Create a local Workspace first then try again.", Environment.StackTrace);
                return;
            }

            SyncLatestForm update = new SyncLatestForm(mainForm, mainForm.mAdministratorMode, tag, filter, mDefaultUpdateBuildType, gameDataHandle.GetSyncDirectory(), mCurrentVersion, mHidePlatforms, updateModifiedMissing, cleanUnknownFiles);

            try
            {
                //if we are expected to show the SyncWindow
                if (ShowSyncWindow)
                {
                    if (update.ShowDialog(mainForm) == DialogResult.OK)
                    {
                        // Make sure we update our local variables that could get changed within the dialog
                        tag = update.SyncTag;
                        updateModifiedMissing = update.UpdateBuildCheckMissingCheckBox.Checked;
                        cleanUnknownFiles     = update.UpdateBuildCleanUnknownFilesCheckBox.Checked;
                    }
                    else
                    {
                        //the result is not ok, so do not proceed with the sync
                        return;
                    }
                }

                //get the sync directory from the SyncDataController
                string targetProjectPath = gameDataHandle.GetSyncDirectory();

                // Get the current SyncData controller
                MOG_ControllerSyncData sync = MOG_ControllerProject.GetCurrentSyncDataController();
                if (sync != null)
                {
                    // Check if the user has specified a cleaning?
                    if (cleanUnknownFiles)
                    {
                        // Check if we need to clean the workspace?
                        string startingPath = sync.GetSyncDirectory();
                        try
                        {
                            MogUtil_WorkspaceCleaner cleaner = new MogUtil_WorkspaceCleaner();
                            cleaner.Clean(startingPath);
                        }
                        catch (Exception ex)
                        {
                            MOG_Prompt.PromptMessage("Clean", "The cleaner exited with the following error (" + ex.Message + ")");
                        }
                    }

                    // Attempt to use the dialog's MOG_LocalSyncInfo
                    MOG_LocalSyncInfo localSyncInfo = update.mLocalSyncInfo;
                    if (localSyncInfo == null)
                    {
                        // Looks like we need to build our own MOG_LocalSyncInfo
                        string computerName   = MOG_ControllerSystem.GetComputerName();
                        string projectName    = MOG_ControllerProject.GetProjectName();
                        string platformName   = MOG_ControllerProject.GetPlatformName();
                        string syncDirectory  = MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory();
                        string userName       = MOG_ControllerProject.GetUserName();
                        string classification = MOG_ControllerProject.GetProjectName();
                        localSyncInfo = new MOG_LocalSyncInfo(computerName, projectName, platformName, syncDirectory, tag, userName, classification, "");
                    }

                    // Check if we want to update missing
                    sync.SyncRepositoryData(MOG_ControllerProject.GetProjectName(), update.Exclusions, update.Inclusions, updateModifiedMissing, localSyncInfo);

                    // Show the summary file
                    SyncLatestSummaryForm summary = new SyncLatestSummaryForm(sync.GetSyncLog());
                    if (silent)
                    {
                        summary.Show(mainForm);
                    }
                    else
                    {
                        summary.ShowDialog(mainForm);
                    }
                }

                guiUserPrefs.SaveDynamic_LayoutPrefs("AssetManager", mainForm);

                update.Dispose();
            }
            catch (Exception e)
            {
                MOG_Report.ReportMessage("Update", "Could not perform update due to error:\n\n" + e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR);
            }
        }
Esempio n. 12
0
        static public bool AddAssetToWorkspaces(MOG_Filename assetFilename, bool userInitiated, BackgroundWorker worker)
        {
            bool bFailed = false;

            // Open the asset now to save time later so it doesn't need to be opened for each workspace
            MOG_ControllerAsset asset = MOG_ControllerAsset.OpenAsset(assetFilename);

            if (asset != null)
            {
                try
                {
                    // Walk through all of our workspaces
                    foreach (MOG_ControllerSyncData workspace in mWorkspaces.Values)
                    {
                        bool bAddAsset = false;

                        // Check if this workspace is active?
                        if (workspace.IsAlwaysActive())
                        {
                            bAddAsset = true;
                        }
                        // Imported asset has special logic
                        else if (asset.GetProperties().Status == MOG_AssetStatus.GetText(MOG_AssetStatusType.Imported))
                        {
                            // Check if this asset originated from within this workspace?  (special case added for SmartBomb so editor will always update the workspace of an object sent from the editor)
                            if (DosUtils.PathIsWithinPath(workspace.GetSyncDirectory(), asset.GetProperties().SourcePath))
                            {
                                bAddAsset = true;
                            }
                            // Check if the user actually initiated this event?
                            else if (userInitiated &&
                                     workspace == MOG_ControllerProject.GetCurrentSyncDataController())
                            {
                                bAddAsset = true;
                            }
                        }
                        // All other assets should simply go into the current
                        else if (workspace == MOG_ControllerProject.GetCurrentSyncDataController())
                        {
                            bAddAsset = true;
                        }

                        // Should this asset be added?
                        if (bAddAsset)
                        {
                            // Decide if the user wants to be notified about the asset's update
                            bool bInformUser = userInitiated;
                            // Check if no worker was specified?  or
                            // Check if this isn't the active workspace?
                            if (worker == null ||
                                workspace != MOG_ControllerProject.GetCurrentSyncDataController())
                            {
                                // Don't bother the user about any problems
                                bInformUser = false;
                            }

                            // Check if we can add this asset to the local workspace?
                            if (workspace.CanAddAssetToLocalWorkspace(asset, bInformUser))
                            {
                                // Check if this asset comming from an inbox?   and
                                // Check if this asset comming from our inbox?   and
                                // Check if this asset's current state is 'Imported'  and
                                // Check if this asset originated from this workspace?
                                // Finally, Make sure this wasn't user initiated?
                                if (assetFilename.IsWithinInboxes() &&
                                    string.Compare(assetFilename.GetUserName(), MOG_ControllerProject.GetUserName(), true) == 0 &&
                                    string.Compare(asset.GetProperties().Status, MOG_AssetStatus.GetText(MOG_AssetStatusType.Imported), true) == 0 &&
                                    MOG_Filename.IsWithinPath(workspace.GetSyncDirectory(), asset.GetProperties().SourcePath) &&
                                    !userInitiated)
                                {
                                    // Looks like we can proceed to import
                                    if (!workspace.AddAssetToLocalUpdatedTray(asset, worker))
                                    {
                                        bFailed = true;
                                    }

                                    // Continue on to the next asset
                                    continue;
                                }

                                // Proceed to add the asset to this workspace
                                if (!workspace.AddAssetToLocalWorkspace(asset, worker))
                                {
                                    bFailed = true;
                                }
                            }
                        }
                    }
                }
                finally
                {
                    asset.Close();
                }
            }
            else
            {
                bFailed = true;
            }

            if (!bFailed)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 13
0
        public void UpdateControl(MOG_Ini pIni, ToolBox toolBox)
        {
            try
            {
                // Do we need to load this file?
                if (pIni == null)
                {
                    string currentIniFilename = toolBox.GetCurrentIniFilenameFromLocation(Location);
                    pIni = new MOG_Ini(currentIniFilename);
                }

                string type = "";
                // If we can, get the ToolBoxControlType of this control...
                if (pIni.KeyExist(ControlGuid, Type_Key))
                {
                    type = pIni.GetString(ControlGuid, Type_Key);
                }
                // Get the ToolBoxControlType from the ini
                ControlType = (ToolBoxControlType)Enum.Parse(ToolBoxControlType.Button.GetType(), type, true);

                // If we can, get our ToolBoxControlLocation for this control...
                if (pIni.KeyExist(ControlGuid, Location_Key))
                {
                    // Get the location from the ini
                    Location = (ToolBoxControlLocation)Enum.Parse(ToolBoxControlLocation.Project.GetType(), pIni.GetString(ControlGuid, Location_Key), true);
                }

                // If we can, get the HideWindow value...
                if (pIni.KeyExist(ControlGuid, HideWindow_Key))
                {
                    HideOutput = pIni.GetBool(ControlGuid, HideWindow_Key);
                }

                // Get all of our default values: (see ControlDefinition for what these identifiers mean)
                // If we can, get the ControlName...
                if (pIni.KeyExist(ControlGuid, ControlName_Key))
                {
                    ControlName = pIni.GetString(ControlGuid, ControlName_Key);

                    // Should this control have it's text updated?
                    bool bUpdateControlText = false;
                    switch (this.ControlType)
                    {
                    case ToolBoxControlType.Button:                         bUpdateControlText = true;                      break;

                    case ToolBoxControlType.ParameterButton:        bUpdateControlText = true;                      break;

                    case ToolBoxControlType.Label:                          bUpdateControlText = true;                      break;

                    case ToolBoxControlType.LinkLabel:                      bUpdateControlText = true;                      break;

                    case ToolBoxControlType.IniCombo:                       bUpdateControlText = false;                     break;

                    case ToolBoxControlType.FileCombo:                      bUpdateControlText = false;                     break;

                    case ToolBoxControlType.CheckBox:                       bUpdateControlText = true;                      break;

                    case ToolBoxControlType.RadioButton:            bUpdateControlText = true;                      break;
                    }

                    if (bUpdateControlText)
                    {
                        DefButton.Text = ControlName;
                    }
                }
                // If we can, get the Command...
                if (pIni.KeyExist(ControlGuid, Command_Key))
                {
                    Command = pIni.GetString(ControlGuid, Command_Key);
                }
                // If we can, get the Arguments...
                if (pIni.KeyExist(ControlGuid, Arguments_Key))
                {
                    Arguments = pIni.GetString(ControlGuid, Arguments_Key);
                }
                // If we can, get the ArgumentTrue...
                if (pIni.KeyExist(ControlGuid, ArgumentsTrue_Key))
                {
                    ArgumentTrue = pIni.GetString(ControlGuid, ArgumentsTrue_Key);
                }
                // If we can, get the ArgumentFalse...
                if (pIni.KeyExist(ControlGuid, ArgumentsFalse_Key))
                {
                    ArgumentFalse = pIni.GetString(ControlGuid, ArgumentsFalse_Key);
                }

                // If we can, get the TagName...
                if (pIni.KeyExist(ControlGuid, TagName_Key))
                {
                    TagName = pIni.GetString(ControlGuid, TagName_Key);
                }
                // If we can, get the ToolTipString...
                if (pIni.KeyExist(ControlGuid, ToolTip_Key))
                {
                    ToolTipString = pIni.GetString(ControlGuid, ToolTip_Key);
                }
                // If we can, get the FolderName...
                if (pIni.KeyExist(ControlGuid, FolderName_Key))
                {
                    FolderName = pIni.GetString(ControlGuid, FolderName_Key);
                }
                // If we can, get the ComboBoxDepth...
                if (pIni.KeyExist(ControlGuid, ComboBoxDepth_Key))
                {
                    ComboBoxDepth = int.Parse(pIni.GetString(ControlGuid, ComboBoxDepth_Key));
                }
                // If we can, get our Pattern
                if (pIni.KeyExist(ControlGuid, Pattern_Key))
                {
                    Pattern = pIni.GetString(ControlGuid, Pattern_Key);
                }
                // If we can, get our ini filename path
                if (pIni.KeyExist(ControlGuid, IniFilename_Key))
                {
                    IniFilename = pIni.GetString(ControlGuid, IniFilename_Key);
                }
                // If we can, get our ini section name
                if (pIni.KeyExist(ControlGuid, IniSection_Key))
                {
                    IniSectionName = pIni.GetString(ControlGuid, IniSection_Key);
                }
                // If we can, get our DialogStartPath
                if (pIni.KeyExist(ControlGuid, DialogStartPath_Key))
                {
                    DialogStartPath = pIni.GetString(ControlGuid, DialogStartPath_Key);
                }
                // If we can, set our LastSelectedIndex
                // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team
                string usersLastIndex_Key = MOG_ControllerProject.IsUser() ? LastIndex_Key + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): LastIndex_Key;
                if (pIni.KeyExist(ControlGuid, usersLastIndex_Key))
                {
                    LastSelectedIndex = int.Parse(pIni.GetString(ControlGuid, usersLastIndex_Key));
                }

                if (pIni.KeyExist(ControlGuid, ShowFullPaths_Key))
                {
                    ShowFullPaths = Convert.ToBoolean(pIni.GetString(ControlGuid, ShowFullPaths_Key));
                }
                if (pIni.KeyExist(ControlGuid, ShowWorkspaceRelativePaths_Key))
                {
                    ShowWorkspaceRelativePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, ShowWorkspaceRelativePaths_Key));
                }
                if (pIni.KeyExist(ControlGuid, ShowFolderRelativePaths_Key))
                {
                    ShowFolderRelativePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, ShowFolderRelativePaths_Key));
                }
                if (pIni.KeyExist(ControlGuid, ShowBasePaths_Key))
                {
                    ShowBasePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, ShowBasePaths_Key));
                }

                if (pIni.KeyExist(ControlGuid, VisisbleIndex_Key))
                {
                    VisibleIndex = Convert.ToInt32(pIni.GetString(ControlGuid, VisisbleIndex_Key));
                }

                if (pIni.KeyExist(ControlGuid, FullPaths_Key))
                {
                    TagFullPaths = Convert.ToBoolean(pIni.GetString(ControlGuid, FullPaths_Key));
                }

                if (pIni.KeyExist(ControlGuid, WorkspaceRelativePaths_Key))
                {
                    TagWorkspaceRelativePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, WorkspaceRelativePaths_Key));
                }

                if (pIni.KeyExist(ControlGuid, FolderRelativePaths_Key))
                {
                    TagFolderRelativePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, FolderRelativePaths_Key));
                }

                if (pIni.KeyExist(ControlGuid, BasePaths_Key))
                {
                    TagBasePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, BasePaths_Key));
                }

                if (pIni.KeyExist(ControlGuid, RecurseFolders_Key))
                {
                    RecurseFolders = Convert.ToBoolean(pIni.GetString(ControlGuid, RecurseFolders_Key));
                }

                // If we can, get the ComboBoxItems
                // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team
                string usersSection = MOG_ControllerProject.IsUser() ? ControlGuid + ComboItems_Section + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): ControlGuid + ComboItems_Section;
                if (pIni.SectionExist(usersSection))
                {
                    ComboBoxItems = LoadComboBoxItems(usersSection, pIni);
                }

                // If we can, get our RadioButtons
                if (pIni.SectionExist(ControlGuid + RadioButton_Section))
                {
                    RadioButtons = LoadRadioButtons(ControlGuid + RadioButton_Section, pIni);
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }
        }
Esempio n. 14
0
        public void Save(MOG_Ini pIni, string section)
        {
            // Write the type out to the INI
            pIni.PutString(section, Type_Key, ControlType.ToString());

            // Write our location out to the INI
            pIni.PutString(section, Location_Key, Location.ToString());

            // Write the name of the control out to our INI
            pIni.PutString(section, ControlName_Key, ControlName);
            // Write our TagName
            pIni.PutString(section, TagName_Key, TagName);

            // Write our Command
            pIni.PutString(section, Command_Key, Command);
            // Write whether or not we will be hiding output window
            pIni.PutBool(section, HideWindow_Key, HideOutput);

            // (ADD_HERE):  Any new Controls must be added here...

            pIni.PutString(section, VisisbleIndex_Key, VisibleIndex.ToString());

            // Write our arguments
            pIni.PutString(section, Arguments_Key, Arguments);
            pIni.PutString(section, ArgumentsTrue_Key, ArgumentTrue);
            pIni.PutString(section, ArgumentsFalse_Key, ArgumentFalse);

            // Write our ToolTipString
            pIni.PutString(section, ToolTip_Key, ToolTipString);

            // Write the folder path we will start at for dialogs
            pIni.PutString(section, FolderName_Key, FolderName);

            // Write out the depth we will support for this def's ComboBox
            pIni.PutString(section, ComboBoxDepth_Key, ComboBoxDepth.ToString());

            // Write out the show full paths bool
            pIni.PutString(section, ShowFullPaths_Key, ShowFullPaths.ToString());
            pIni.PutString(section, ShowWorkspaceRelativePaths_Key, ShowWorkspaceRelativePaths.ToString());
            pIni.PutString(section, ShowFolderRelativePaths_Key, ShowFolderRelativePaths.ToString());
            pIni.PutString(section, ShowBasePaths_Key, ShowBasePaths.ToString());

            // Write out the relative paths bool
            pIni.PutString(section, FullPaths_Key, TagFullPaths.ToString());
            pIni.PutString(section, WorkspaceRelativePaths_Key, TagWorkspaceRelativePaths.ToString());
            pIni.PutString(section, FolderRelativePaths_Key, TagFolderRelativePaths.ToString());
            pIni.PutString(section, BasePaths_Key, TagBasePaths.ToString());

            pIni.PutString(section, RecurseFolders_Key, RecurseFolders.ToString());

            // Write our IniSectionName
            pIni.PutString(section, IniSection_Key, IniSectionName);
            // Write out our IniFilename
            pIni.PutString(section, IniFilename_Key, IniFilename);
            // Write out our GUID
            pIni.PutString(section, GUID_Key, section);

            // Write out our ComboBoxDepth
            pIni.PutString(section, ComboBoxDepth_Key, ComboBoxDepth.ToString());

            // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team
            string usersLastIndex_Key = MOG_ControllerProject.IsUser() ? LastIndex_Key + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): LastIndex_Key;

            pIni.PutString(section, usersLastIndex_Key, LastSelectedIndex.ToString());

            // If we are a fileComboBox write out our items
            if (ControlType == ToolBoxControlType.FileCombo)
            {
                // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team
                string usersSection = MOG_ControllerProject.IsUser() ? section + ComboItems_Section + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): section + ComboItems_Section;

                int count = 0;
                foreach (MogTaggedString item in DefComboBox.Items)
                {
                    pIni.PutString(usersSection, ComboItems_Key + count++, (string)item.AttachedItem);
                }
            }

            // Write out the fileComboBox patterns
            pIni.PutString(section, Pattern_Key, Pattern);

            // If we are a ToolBoxGroupBox, write out our radio buttons
            if (ControlType == ToolBoxControlType.RadioButton)
            {
                foreach (DictionaryEntry button in RadioButtons)
                {
                    pIni.PutString(section + RadioButton_Section, (string)button.Key, (string)button.Value);
                }
            }
        }