Exemplo n.º 1
0
        /// <summary>
        /// Keeps user from renaming multiple asset labels.
        /// </summary>
        private void RenameNewLabelTextBox_TextChanged(object sender, System.EventArgs e)
        {
            try
            {
                // Check for invalid characters in the new name
                if (MOG_ControllerSystem.InvalidMOGCharactersCheck(RenameNewLabelTextBox.Text, true))
                {
                    RenameNewLabelTextBox.Text = MOG_ControllerSystem.ReplaceInvalidCharacters(RenameNewLabelTextBox.Text);
                }

                // For Rename Label, we only need to worry about one asset...
                if (mFullFilename != null)
                {
                    MOG_Filename currentFilename = new MOG_Filename(this.mFullFilename);
                    string       targetName      = GetTargetName(currentFilename, RenameNewClassNameTextBox.Text,
                                                                 RenameNewPlatformComboBox.Text, RenameNewLabelTextBox.Text);

                    ChangeAssetFilenameInListView(targetName);

                    // Update the imported files column
                    if (RenameFiles.Checked && bInitialized)
                    {
                        ChangeAssetImportnameInListView(RenameNewLabelTextBox.Text);
                    }
                }
            }
            // Eat any errors we get
            catch (Exception ex)
            {
                MOG_Prompt.PromptMessage("Error With Value", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.ALERT);
            }
        }
Exemplo n.º 2
0
        public void ShellSpawnWithLock()
        {
            if (mBinary == null || mAsset == null)
            {
                MOG_Prompt.PromptMessage("Spawn Viewer Error!", "One of the following was not initialized: Viewer, Binary, Asset", Environment.StackTrace);
                return;
            }
            else
            {
                MOG_Command command = new MOG_Command();

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

                    command = MOG.COMMAND.MOG_CommandFactory.Setup_LockReadRelease(mAsset.GetOriginalFilename());
                    MOG_ControllerSystem.GetCommandManager().CommandProcess(command);
                }
            }
        }
Exemplo n.º 3
0
        private void LibraryListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.Label != null)
            {
                // Rename the asset
                ListViewItem renamedAsset = LibraryListView.Items[e.Item];
                string       fullName     = GetItemFullName(renamedAsset);
                string       label        = renamedAsset.SubItems[FindColumn("Name")].Text;
                string       extension    = DosUtils.PathGetExtension(fullName);

                string rename = fullName.Replace(label, e.Label);

                if (DosUtils.FileExistFast(rename))
                {
                    MOG_Prompt.PromptMessage("Rename Error", "Cannot rename (" + label + ") to (" + e.Label + ") because this asset already exists!");
                    e.CancelEdit = true;
                }
                else
                {
                    if (!DosUtils.RenameFast(fullName, rename, false))
                    {
                        MOG_Prompt.PromptMessage("Rename Error", DosUtils.GetLastError());
                        e.CancelEdit = true;
                    }
                    else
                    {
                        // Update the full filename
                        renamedAsset.SubItems[FindColumn("Fullname")].Text  = rename;
                        renamedAsset.SubItems[FindColumn("Extension")].Text = extension;
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Post the build in the users data directory to their inbox
        /// <summary>
        public void BuildPost()
        {
            MOG_ControllerSyncData gameDataHandle = MOG_ControllerProject.GetCurrentSyncDataController();

            try
            {
                string ProjectName     = gameDataHandle.GetProjectName();
                string ProjectDir      = gameDataHandle.GetSyncDirectory();
                string ProjectPlatform = gameDataHandle.GetPlatformName();
                string ImportName      = string.Concat(MOG_ControllerProject.GetProjectName(), ".Build.Release.", ProjectName, ".", ProjectPlatform);
                string command         = string.Concat(MOG_ControllerProject.GetProject().GetProjectToolsPath(), "\\MOG_UserBless.bat");
                string output          = "";

                // Make sure the tool we need exits
                if (DosUtils.FileExist(command))
                {
                    guiCommandLine.ShellSpawn(command, string.Concat(ProjectName, " ", ProjectDir, " ", ProjectPlatform, " ", ImportName), ProcessWindowStyle.Normal, ref output);
                }
                else
                {
                    MOG_Prompt.PromptMessage("Tool", string.Concat("This tool(", command, ") is missing."), Environment.StackTrace);
                }
            }
            catch (Exception e)
            {
                MOG_Prompt.PromptMessage("Build Post", "Could not perform post due to error:\n\n" + e.Message, e.StackTrace);
            }
        }
Exemplo n.º 5
0
 static public void MOGGlobalToolsPermisions(MogMainForm mainForm)
 {
     // Encapsulate everything in a try-catch
     try
     {
         if (MOG_ControllerProject.GetPrivileges() != null)
         {
             MogControl_PrivilegesForm privilegesForm = new MogControl_PrivilegesForm(MOG_ControllerProject.GetPrivileges());
             privilegesForm.StartPosition = FormStartPosition.CenterParent;
             DialogResult result = privilegesForm.ShowDialog(mainForm);
             result.ToString();
         }
         else
         {
             MOG_Prompt.PromptMessage("Permissions Error!", "Unable to open Permissions Form.  "
                                      + "Please make sure a valid project is selected.\r\n\r\nYou may try clicking Projects |"
                                      + " (The Current Project) to resolve this error, and/or close and re-open MOG.", Environment.StackTrace);
         }
     }
     // Catch any .NET-explainable exceptions.
     catch (Exception ex)
     {
         MOG_Report.ReportMessage("Error in Privileges Change Form!", ex.Message,
                                  ex.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR);
     }
 }
Exemplo n.º 6
0
        private void Restore(string projName, string iniFilename)
        {
            // make sure iniFilename points to valid file
            if (File.Exists(iniFilename))
            {
                // make sure directory exists
                if (Directory.Exists(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName))
                {
                    if (DosUtils.DirectoryExistFast(MOG_ControllerSystem.GetSystemProjectsPath() + "\\" + projName))
                    {
                        // A project of this name already exists
                        MOG_Prompt.PromptMessage("Project Name Conflict", "Projects cannot be restored over the top of another active project.");
                        return;
                    }

                    List <string> args = new List <string>();
                    args.Add(projName);
                    args.Add(iniFilename);

                    string message = "Please wait while MOG restores deleted project.\n" +
                                     "   PROJECT: " + projName;
                    ProgressDialog progress = new ProgressDialog("Restoring project", message, Restore_Worker, args, false);
                    progress.ShowDialog();
                }
            }
        }
Exemplo n.º 7
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.");
            }
        }
Exemplo n.º 8
0
        public bool CheckImportAssetNames(List <ImportFile> sourceFullNames, ref List <string> newAssetNames, ref List <ArrayList> newAssetProperties)
        {
            foreach (ImportFile SourceFile in sourceFullNames)
            {
                // Strip sourceFullNames[f] down to only the name
                string assetName = Path.GetFileName(SourceFile.mImportFilename);
                try
                {
                    ArrayList MogPropertyArray = new ArrayList();
                    string    targetName       = FixName(assetName, SourceFile, ref MogPropertyArray);
                    if (targetName != null)
                    {
                        newAssetNames.Add(targetName);
                        newAssetProperties.Add(MogPropertyArray);
                    }
                    else
                    {
                        //if FixName returns null that means the user cancelled
                        return(false);
                    }
                }
                catch (Exception e)
                {
                    MOG_Prompt.PromptMessage("Import FixName failed!", SourceFile + "\n\n" + e.Message, e.StackTrace);

                    // Let our caller know that we didn't get a successful import on this asset
                    SourceFile.mImportFilename = "";
                    newAssetNames.Add("");
                    newAssetProperties.Add(new ArrayList());
                }
            }

            return(true);
        }
Exemplo n.º 9
0
        private void CreateChangePropertiesMenuItem(string propertyPath, TreeNode parentNode, string section, string itemName, MOG_PropertiesIni ripMenu)
        {
            string command = ripMenu.GetPropertyString(section, "MenuItem", itemName);

            // Check to see if this command is another sub menu
            if (ripMenu.SectionExist(command))
            {
                TreeNode propertyMenuItem = CreatePropertyMenuNode(parentNode, itemName);
                CreateChangePropertiesSubMenu(propertyPath, propertyMenuItem, command, ripMenu);
            }
            else
            {
                string   globalSection, propertySection, key, val;
                string[] leftParts = command.Split("=".ToCharArray());
                if (leftParts.Length < 2)
                {
                    string title   = "Change Properties Failed";
                    string message = "Invalid property format specified.\n" +
                                     "Specified Format: " + command + "\n" +
                                     "   Proper Format: [Section]{PropertyGroup}PropertyName=PropertyValue";
                    MOG_Prompt.PromptMessage(title, message);
                    return;
                }
                else
                {
                    string[] testParts = leftParts[0].Split("[]{}".ToCharArray());
                    if (testParts.Length != 5)
                    {
                        string title   = "Change Properties Failed";
                        string message = "Invalid property format specified.\n" +
                                         "Specified Format: " + command + "\n" +
                                         "   Proper Format: [Section]{PropertyGroup}PropertyName=PropertyValue";
                        MOG_Prompt.PromptMessage(title, message);
                        return;
                    }
                    else
                    {
                        try
                        {
                            globalSection   = testParts[1];
                            propertySection = testParts[3];
                            key             = testParts[4];
                            val             = command.Substring(command.IndexOf("=") + 1);
                        }
                        catch
                        {
                            string title   = "Change Properties Failed";
                            string message = "Invalid property format specified.\n" +
                                             "Specified Format: " + command + "\n" +
                                             "   Proper Format: [Section]{PropertyGroup}PropertyName=PropertyValue";
                            MOG_Prompt.PromptMessage(title, message);
                            return;
                        }
                    }

                    CreatePropertyNode(parentNode, itemName, globalSection, propertySection, key, val);
                }
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Edit the ripper in notepad
        /// </summary>
        private void EditRipper()
        {
            if (this.PropertiesList.Length > 0)
            {
                MOG_Properties properties = PropertiesList[0] as MOG_Properties;

                // Get the assigned ripper information
                string ripper = properties.AssetRipper;
                string tool   = DosUtils.FileStripArguments(properties.AssetRipper);
                string args   = DosUtils.FileGetArguments(properties.AssetRipper);

                // Do we have a ripper to edit?
                if (ripper.Length > 0)
                {
                    // Locate the ripper
                    ripper = MOG_ControllerSystem.LocateTool("", tool);
                    if (ripper.Length > 0)
                    {
                        // Edit the ripper
                        guiCommandLine.ShellSpawn("Notepad.exe", ripper);
                    }
                    else
                    {
                        // If not, do we want to create one?
                        if (MOG_Prompt.PromptResponse("No Ripper Found", "This appears to be a new ripper.\n" +
                                                      "RIPPER: " + tool + "\n\n" +
                                                      "Would you like to create a new one for editing?", MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                        {
                            // Create a new one using the user's specified name
                            string defaultRipperName = tool;
                            ripper = Path.Combine(MOG_ControllerProject.GetProject().GetProjectToolsPath(), defaultRipperName);

                            // Do we want to start from the template?
                            if (MOG_Prompt.PromptResponse("Use Ripper Template", "Would you like to base the new ripper from MOG's ripper template?", MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                            {
                                // If so, copy the template to this new ripper
                                string template = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Tools\\Rippers\\TemplateComplex_ripper.bat";

                                DosUtils.CopyFast(template, ripper, false);
                            }

                            // Launch the editor
                            string output = "";
                            guiCommandLine.ShellExecute("Notepad.exe", ripper, System.Diagnostics.ProcessWindowStyle.Normal, ref output);

                            // Now, set this new ripper as the ripper assigned to this asset restoring the users args
                            properties.AssetRipper = ripper + " " + args;
                            this.PropertiesRippingRipperComboBox.Text = properties.AssetRipper;
                        }
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Edit Ripper", "There is no ripper to edit.");
                }
            }
        }
Exemplo n.º 11
0
        private void SQLTestButton_Click(object sender, System.EventArgs e)
        {
            // Test the connection string
            // Attempt to open a connection to make sure we will work?
            BuildConnectionString();

            SqlConnection myConnection = new SqlConnection(mConnectString);

            MOG_Prompt.PromptMessage("SQL Connection", "Successfully connected to SQL database " + SQLServerComboBox.Text + "!");
        }
Exemplo n.º 12
0
        /// <summary>
        /// Makes the selected assets the current version in the current branch
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MakeCurrentMenuItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                ArrayList selectedItems  = ControlGetSelectedItems();
                ArrayList assetFilenames = new ArrayList();

                // Scan the list and prepare it for delivery to the DLL
                string message = "";
                foreach (guiAssetTreeTag tag in selectedItems)
                {
                    if (tag.Execute)
                    {
                        MOG_Filename filename = new MOG_Filename(tag.FullFilename);
                        if (filename.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
                        {
                            assetFilenames.Add(filename);
                        }

                        message = message + filename.GetAssetFullName() + "\n";
                    }
                }

                // Check if this request effects more than 1 asset??
                if (selectedItems.Count > 1)
                {
                    if (MOG_Prompt.PromptResponse("Are you sure you want to make all of these assets the current versions?", message, MOGPromptButtons.OKCancel) != MOGPromptResult.OK)
                    {
                        return;
                    }
                }

                // Stamp all the specified assets
                if (MOG_ControllerProject.MakeAssetCurrentVersion(assetFilenames, "Made current by " + MOG_ControllerProject.GetUserName_DefaultAdmin()))
                {
                    // Check if this request effects more than 1 asset??
                    if (selectedItems.Count > 1)
                    {
                        // Inform the user this may take a while
                        MOG_Prompt.PromptResponse("Completed",
                                                  "This change requires Slave processing.\n" +
                                                  "The project will not reflect these changes until all slaves have finished processing the generated commands.\n" +
                                                  "The progress of this task can be monitored in the Connections Tab.");
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Make Current Failed", "The system was unable to fully complete the task!", Environment.StackTrace);
                }
            }
            catch (Exception ex)
            {
                MOG_Report.ReportMessage("MakeCurrent Exception", ex.Message, ex.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL);
            }
        }
Exemplo n.º 13
0
 private void EditLibraryAsset(string librarySource)
 {
     if (File.Exists(librarySource))
     {
         guiCommandLine.ShellSpawn(librarySource);
     }
     else
     {
         MOG_Prompt.PromptMessage("Edit Error", "This asset does not exist or is missing.  CheckOut and try again...");
     }
 }
Exemplo n.º 14
0
        private void SQLOkButton_Click(object sender, System.EventArgs e)
        {
            // Test the connection string
            // Attempt to open a connection to make sure we will work?
            BuildConnectionStringNoCatalog();
            string databaseName = this.SQLDatabaseComboBox.Text;

            // Is this a 'Create new' database
            if (this.SQLCreateDatabaseRadioButton.Checked)
            {
                try
                {
                    if (MOG.DATABASE.MOG_DBAPI.DatabaseExists(mConnectString, this.SQLDatabaseTextBox.Text) == false)
                    {
                        if (MOG_Prompt.PromptResponse("Create new Database?", "We will need to create this database to test this connection.\n\n\tDATABASE NAME: " + this.SQLDatabaseTextBox.Text + "\n\nIs it ok to proceed?", MOGPromptButtons.OKCancel) == MOGPromptResult.OK)
                        {
                            if (MOG.DATABASE.MOG_DBAPI.CreateDatabase(mConnectString, this.SQLDatabaseTextBox.Text))
                            {
                                databaseName = SQLDatabaseTextBox.Text;
                            }
                            else
                            {
                                if (MOG_Prompt.PromptResponse("Create Database", "Unable to create database! \n\nDo you want to continue and save these new settings?", MOGPromptButtons.YesNo) == MOGPromptResult.No)
                                {
                                    return;
                                }
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MOG_Prompt.PromptMessage("Create Database", "Unable to check or create database with the following message:\n\n" + ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.ERROR);
                    return;
                }
            }

            BuildConnectionString();

            if (!MOG_ControllerSystem.InitializeDatabase(mConnectString, "", ""))
            {
                MOG_Prompt.PromptResponse("Connection Failure", "Couldn't connect to SQL database " + databaseName + " on server " + SQLServerComboBox.Text);
                return;
            }

            // notify others that we clicked the OK button
            OnOKClicked();
        }
Exemplo n.º 15
0
 private void TagOkButton_Click(object sender, EventArgs e)
 {
     if (TagNameTextBox.Text.Length != 0)
     {
         if (MOG_ControllerProject.TagCreate(MOG_ControllerProject.GetCurrentSyncDataController(), TagNameTextBox.Text))
         {
             Close();
         }
         else
         {
             MOG_Prompt.PromptMessage("Create Tag", "Error in creating the tag");
         }
     }
 }
        /// <summary>
        /// Prepare a drag object to recieve any driped items from the package tree
        /// </summary>
        private DataObject PrepareDragObject(TreeView tree, TreeNode node)
        {
            // failsafe for unpopulated package lists
            if (tree.Nodes.Count <= 0)
            {
                return(null);
            }

            // Create our list holders
            ArrayList    packages = new ArrayList();
            MOG_Filename package  = new MOG_Filename(node.Text);

            // Get the package names
            if (package.GetAssetPlatform().Length == 0)
            {
                // We need to make a new MOG_Filename with a valid platform
                // To do this we need to get to the class, label and desired platform
                string classification = FindClassification(node);
                string packgePath     = IsolatePackagePath(node.FullPath, classification);

                if (packgePath.Length > 0)
                {
                    package = MOG_Filename.CreateAssetName(classification, "All", packgePath);

                    // Add the platforms
                    foreach (MOG_Platform platform in MOG_ControllerProject.GetProject().GetPlatforms())
                    {
                        package = MOG_Filename.CreateAssetName(classification, platform.mPlatformName, packgePath);
                        packages.Add(package.GetAssetFullName());
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Create package name", "Could not locate pachage path in package(" + node.FullPath + ")");
                    return(null);
                }
            }
            else
            {
                packages.Add(package.GetAssetFullName());
            }

            if (packages.Count > 0)
            {
                // Create a new Data object for the send
                return(new DataObject("Package", packages));
            }

            return(null);
        }
Exemplo n.º 17
0
 private void BrowseWorkspaceDirectory_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (this.DialogResult == DialogResult.OK)
     {
         if (!DosUtils.DirectoryExist(this.BrowseTargetTextBox.Text))
         {
             if (!DosUtils.DirectoryCreate(this.BrowseTargetTextBox.Text))
             {
                 MOG_Prompt.PromptMessage("Create local Workspace", "Could not create target directory(" + this.BrowseTargetTextBox.Text + ")!");
                 e.Cancel = true;
             }
         }
     }
 }
Exemplo n.º 18
0
 private void GameDataDeleteMenuItem_Click(object sender, System.EventArgs e)
 {
     try
     {
         guiAssetTreeTag tag = (guiAssetTreeTag)GameDataTreeView.SelectedNode.Tag;
         if (MOG_Prompt.PromptResponse("Delete Directory", "Are you sure you wan to delete this directory with all its contents?\n\nDirectory:\n\n" + tag.FullFilename, MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
         {
             // Remove the node
             GameDataTreeView.SelectedNode.Remove();
         }
     }
     catch (Exception ex)
     {
         MOG_Prompt.PromptMessage("Delete Directory", "Could not delete this directory!\n\nMessage:" + ex.Message);
     }
 }
Exemplo n.º 19
0
        public bool IsValid(bool showMessages)
        {
            // Check for more than one platform
            if (this.lvPlatforms.Items.Count <= 0)
            {
                if (showMessages)
                {
                    MOG_Prompt.PromptMessage("No Platforms", "You must add at least one platform");
                    this.tbNewPlatformName.Focus();
                }

                return(false);
            }

            return(true);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Export to .txt file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListNotpadButton_Click(object sender, System.EventArgs e)
        {
            if (ListListView.SelectedItems.Count == 0)
            {
                MOG_Prompt.PromptMessage("No assets selected", "There are no assets selected to export to text.", Environment.StackTrace);
                return;
            }

            ArrayList items = new ArrayList();

            foreach (ListViewItem item in ListListView.SelectedItems)
            {
                items.Add(item);
            }
            ExportTo(EXPORTS.TEXT, items);
        }
Exemplo n.º 21
0
        private void btnAddPlatform_Click(object sender, System.EventArgs e)
        {
            if (this.tbNewPlatformName.Text == null || this.tbNewPlatformName.Text == "")
            {
                MOG_Prompt.PromptMessage("Missing Data", "Please enter a platform name");
                return;
            }

            if (lvPlatforms.FindPlatform(tbNewPlatformName.Text) == null)
            {
                if (!this.lvPlatforms.AddDefaultPlatform(this.tbNewPlatformName.Text))
                {
                    this.lvPlatforms.AddPlatform(this.tbNewPlatformName.Text);
                }
            }
        }
Exemplo n.º 22
0
        public bool CheckImportAssetName(string sourceFullName, ref string newAssetName, ref ArrayList properties, ArrayList potentialMatches)
        {
            // Strip sourceFullName down to only the name
            string assetName = Path.GetFileName(sourceFullName);

            try
            {
                ImportFile sourceFile = new ImportFile(sourceFullName);
                sourceFile.mPotentialFileMatches = potentialMatches;
                newAssetName = FixName(assetName, sourceFile, ref properties);
            }
            catch (Exception e)
            {
                MOG_Prompt.PromptMessage("Import FixName failed!", sourceFullName + "\n\n" + e.Message, e.StackTrace);
            }

            return(newAssetName != null);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Deletes the servers package for this asset then sends a package rebuild command to the server
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RebuildPackageMenuItem_Click(object sender, System.EventArgs e)
        {
            ArrayList selectedItems = ControlGetSelectedItems();
            MenuItem  platformItem  = (MenuItem)sender;
            string    platform      = platformItem.Text;

            string message = "";

            foreach (guiAssetTreeTag tag in selectedItems)
            {
                if (tag.Execute)
                {
                    message = message + tag.FullFilename + "\n";
                }
            }

            MOG_Prompt.PromptMessage("Rebuild not currently implemented!", message, Environment.StackTrace);
        }
Exemplo n.º 24
0
        private int CreateComboControls(int startY, MOG_Ini dialogInfo, string section)
        {
            int x = 8;
            int y = startY;

            SuspendLayout();
            for (int i = 0; i < dialogInfo.CountKeys(section); i++)
            {
                string key        = dialogInfo.GetKeyNameByIndexSLOW(section, i);
                string keySection = section + "." + key;

                if (dialogInfo.SectionExist(keySection))
                {
                    if (dialogInfo.KeyExist(keySection, "Description"))
                    {
                        y = CreateLabelControl(x, y, dialogInfo.GetString(keySection, "Description"));
                    }
                    else
                    {
                        MOG_Prompt.PromptMessage("Custom Tool", "Cound not correctly create ComboControl due to missing (Description) field in info", Environment.StackTrace);
                    }

                    if (dialogInfo.KeyExist(keySection, "range"))
                    {
                        if (dialogInfo.KeyExist(keySection, "defaultValue"))
                        {
                            y = CreateComboBoxControl(x, y, dialogInfo.GetString(keySection, "range"), dialogInfo.GetString(keySection, "defaultValue"));
                        }
                        else
                        {
                            y = CreateComboBoxControl(x, y, dialogInfo.GetString(keySection, "range"), "0");
                        }
                    }
                    else
                    {
                        MOG_Prompt.PromptMessage("Custom Tool", "Cound not correctly create ComboControl due to missing (Range) field in info", Environment.StackTrace);
                    }
                }
            }

            ResumeLayout(false);

            return(y);
        }
Exemplo n.º 25
0
        static private void MOGGlobalBranchCreate_Click(object sender, System.EventArgs e)
        {
            string branch = ((ToolStripMenuItem)sender).Text;

            CreateBranchForm newBranch = new CreateBranchForm();

            newBranch.BranchSourceTextBox.Text = MOG_ControllerProject.GetBranchName();

            if (newBranch.ShowDialog() == DialogResult.OK)
            {
                if (MOG_ControllerProject.BranchCreate(MOG_ControllerProject.GetBranchName(), newBranch.BranchNameTextBox.Text))
                {
                    // Rebuild the branch menu
                    MainMenuProjectsClass.MOGGlobalBranchesInit(true);
                    MOG_Prompt.PromptMessage("Create Branch", "New branch successfully created.\n" +
                                             "BRANCH: " + newBranch.BranchNameTextBox.Text);
                }
            }
        }
Exemplo n.º 26
0
        private void Clean_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker             = sender as BackgroundWorker;
            ArrayList        selectedItems      = e.Argument as ArrayList;
            string           workspaceDirectory = MOG_ControllerProject.GetWorkspaceDirectory() + "\\";

            for (int i = 0; i < selectedItems.Count && !worker.CancellationPending; i++)
            {
                string file         = selectedItems[i] as string;
                string relativeFile = file;
                if (file.StartsWith(workspaceDirectory, StringComparison.CurrentCultureIgnoreCase))
                {
                    relativeFile = file.Substring(workspaceDirectory.Length);
                }

                string message = "Deleting:\n" +
                                 "     " + Path.GetDirectoryName(relativeFile) + "\n" +
                                 "     " + Path.GetFileName(relativeFile);
                worker.ReportProgress(i * 100 / selectedItems.Count, message);

                // Check if this file really exists?
                if (DosUtils.FileExistFast(file))
                {
                    if (!DosUtils.Recycle(file))
                    {
                        // Error
                        MOG_Prompt.PromptMessage("Delete File", "Could not delete:\n" + file);
                    }
                    else
                    {
                        if (!DosUtils.DirectoryDeleteEmptyParentsFast(Path.GetDirectoryName(file), true))
                        {
                            if (DosUtils.GetLastError() != null && DosUtils.GetLastError().Length > 0)
                            {
                                // Error
                                MOG_Prompt.PromptMessage("Delete directory", "Could not delete directory:\n" + Path.GetDirectoryName(file));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Set the connection status in the status bar
        /// </summary>
        /// <param name="connected"></param>
        public static void ConnectionStatus(MogMainForm mainForm, bool connected)
        {
            bool problemLoadingIcon = false;

            if (connected)
            {
                if (mainForm.StatusBarImageList.Images.Count > 0)
                {
                    Bitmap home = new Bitmap(mainForm.StatusBarImageList.Images[0]);
                    mainForm.MOGStatusBarConnectionStatusBarPanel.Icon = System.Drawing.Icon.FromHandle(home.GetHicon());
                }
                else
                {
                    problemLoadingIcon = true;
                }
                mainForm.MOGStatusBarConnectionStatusBarPanel.Text = "Connected";

                mainForm.MOGStatusBarConnectionStatusBarPanel.ToolTipText = mainForm.RefreshConnectionToolText();
                MOG_ControllerSystem.GoOnline();
            }
            else
            {
                if (mainForm.StatusBarImageList.Images.Count > 1)
                {
                    Bitmap home = new Bitmap(mainForm.StatusBarImageList.Images[1]);
                    mainForm.MOGStatusBarConnectionStatusBarPanel.Icon = System.Drawing.Icon.FromHandle(home.GetHicon());
                }
                else
                {
                    problemLoadingIcon = true;
                }
                mainForm.MOGStatusBarConnectionStatusBarPanel.Text        = "Disconnected";
                mainForm.MOGStatusBarConnectionStatusBarPanel.ToolTipText = string.Concat("Could not connect to ", MOG_ControllerSystem.GetServerComputerName(), " IP:", MOG_ControllerSystem.GetServerComputerIP());
                MOG_ControllerSystem.GoOffline();
            }

            if (problemLoadingIcon)
            {
                MOG_Prompt.PromptMessage("Project Error", "Programmer: Please rebuild MOG_Client to have all the appropriate *.resx "
                                         + "\r\nfiles correctly included in this project.");
            }
        }
Exemplo n.º 28
0
        private void setAsActiveTagToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (TagsListView != null && TagsListView.SelectedItems != null)
            {
                if (TagsListView.SelectedItems.Count > 1)
                {
                    string message = "You can only select one tag as active!";
                    MOG_Prompt.PromptMessage("Set active tag", message);
                }
                else
                {
                    ListViewItem item = TagsListView.SelectedItems[0];

                    MOG_ControllerProject.GetProject().GetConfigFile().PutString("Project", "ActiveTag", item.Text);
                    MOG_ControllerProject.GetProject().GetConfigFile().Save();

                    SetActiveTagItem(item);
                }
            }
        }
Exemplo n.º 29
0
        public void Refresh()
        {
            try
            {
                if (mainForm.ConnectionsListView.Visible)
                {
                    mainForm.ConnectionsListView.Items.Clear();
                }

                if (mainForm.ConnectionManagerCommandsListView.Visible)
                {
                    mainForm.ConnectionManagerCommandsListView.Items.Clear();
                }

                // Make sure we add the server first
                ListViewItem serverItem = new ListViewItem();
                serverItem.Text = MOG_ControllerSystem.GetServerComputerName();
                serverItem.SubItems.Add(MOG_ControllerSystem.GetServerComputerIP());
                serverItem.SubItems.Add("1");
                serverItem.SubItems.Add("Server");
                serverItem.SubItems.Add("N/A");
                serverItem.SubItems.Add("1");
                serverItem.ForeColor  = Color.OrangeRed;
                serverItem.ImageIndex = (int)MOGImagesImages.SERVER;
                mainForm.ConnectionsListView.Items.Add(serverItem);

                mGroups.UpdateGroupItem(mainForm.ConnectionsListView, serverItem, "Type");

                MOG_ControllerSystem.RequestActiveConnections();
                MOG_ControllerSystem.RequestActiveCommands();
            }
            catch (Exception e)
            {
                MOG_Prompt.PromptMessage("Refresh Connection View", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
                return;
            }

            RefreshMerging();
            RefreshPosting();
            RefreshLateResolvers();
        }
Exemplo n.º 30
0
        private void Rename_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            bRenameSuccessful = true;

            try
            {
                // Store a list of assets we were unable to rename
                string listOfFailedRenames = "";

                // Iterates through asset(s) to be renamed.
                for (int i = 0; i < mSourceFiles.Count && !worker.CancellationPending; i++)
                {
                    string asset = mSourceFiles[i] as string;

                    // We jump here when we ignore errors (for missing files)
                    MOG_Filename assetName  = new MOG_Filename(asset);
                    string       targetName = GetTargetName(assetName);

                    // Rename the file with a new MOG_Controller
                    MOG_ControllerInbox.Rename(assetName, targetName, this.RenameFiles.Checked);

                    worker.ReportProgress(i * 100 / mSourceFiles.Count);
                }

                if (listOfFailedRenames.Length > 0)
                {
                    MOG_Prompt.PromptMessage("Failed Rename", "Unable to rename the following because "
                                             + "you account does not have the permission to do so:\r\n\r\n"
                                             + listOfFailedRenames);
                }
            }
            catch (Exception ex)
            {
                MOG_Report.ReportMessage("Rename ERROR!", "The following error occured: \n"
                                         + ex.Source + " <-- " + ex.Message, ex.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL);
                bRenameSuccessful = false;
            }
        }