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);
     }
 }
Beispiel #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);
                }
            }
        }
Beispiel #3
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.");
            }
        }
Beispiel #4
0
        public static ArrayList FindDatabases(string serverName)
        {
            ArrayList databases = new ArrayList();

            try
            {
                TimeOut = 1;
                OleDbConnection myConnection = GetConnection(serverName);
                myConnection.Open();
                DataTable schemaTable = myConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Catalogs,
                                                                         null);

                myConnection.Close();
                foreach (DataRow dr in schemaTable.Rows)
                {
                    databases.Add(dr[0] as string);
                }
            }
            catch
            {
                MOG_Prompt.PromptResponse("Open SQL Connection Error!", "Couldn't access server " + serverName + "\nMake sure that this is not an instanced server that would require the instance name.\ni.e MyServer\\InstanceName", "", MOGPromptButtons.OK, MOG_ALERT_LEVEL.ERROR);
            }


            return(databases);
        }
Beispiel #5
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);
        }
Beispiel #6
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
        }
Beispiel #7
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);
            }
        }
Beispiel #8
0
        private void SyncDelButton_Click(object sender, EventArgs e)
        {
            if (SyncFilterComboBox.SelectedItem != null)
            {
                ComboBoxItem item = SyncFilterComboBox.SelectedItem as ComboBoxItem;
                if (item != null)
                {
                    string filterFileName = item.FullPath;

                    if (MOG_Prompt.PromptResponse("Delete filter?", "Are you sure you want to delete this filter?\n" + item.FullPath, MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                    {
                        if (DosUtils.ExistFast(filterFileName) && DosUtils.DeleteFast(filterFileName))
                        {
                            UpdateFilterDropDown("");

                            mFilter.Clear();
                            //if (ClassificationTreeView.Visible)
                            //{
                            ClassificationTreeView.Initialize();
                            //}

                            SyncSaveButton.Enabled  = false;
                            SyncFilterComboBox.Text = mOriginalSyncComboBoxMessage;
                        }
                    }
                }
            }
        }
        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.");
            }
        }
		/// <summary>
		/// Utility method to make sure we have a valid Package name (which should have an extension)
		/// </summary>
		private bool ValidatePackageExtension(NodeLabelEditEventArgs e, MOG_Filename packageName)
		{
			// Make sure packages have extensions, if not make strong warning
			if (packageName.GetExtension().Length == 0)
			{
				string message = "This package does not have an extension!\r\n"
					+ "Most engines require extensions on packages.\r\n\r\n"
					+ "(Click 'Ignore' to continue without adding an extension)";
				switch (MOG_Prompt.PromptResponse("Create new package", message, MOGPromptButtons.AbortRetryIgnore))
				{
				case MOGPromptResult.Retry:
					e.CancelEdit = true;
					e.Node.TreeView.LabelEdit = true;
					e.Node.BeginEdit();
					return false;
				case MOGPromptResult.Abort:
					e.Node.Remove();
					e.CancelEdit = true;
					return false;
				}
			}

			// We finished the block.  Return true.
			return true;
		}
Beispiel #11
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;
                    }
                }
            }
        }
Beispiel #12
0
        private void btnTestSMTP_Click(object sender, System.EventArgs e)
        {
            if (tbEmailSMTP.Text == "")
            {
                MOG_Prompt.PromptResponse("Missing SMTP Server", "Please enter the name of your SMTP Server", MOGPromptButtons.OK);
                tbEmailSMTP.Focus();
            }
            else
            {
                if (lvUsers.SelectedItems.Count == 0)
                {
                    MOG_Prompt.PromptResponse("No User Selected", "Please select a user in the list to send a test message to his/her email address.", MOGPromptButtons.OK);
                }
                else
                {
                    MOG_User user = CreateUser(lvUsers.SelectedItems[0]);

                    List <object> args = new List <object>();
                    args.Add(user);
                    args.Add(tbEmailSMTP.Text);

                    ProgressDialog progress = new ProgressDialog("Testing SMTP Server", "Sending test message using your SMTP Server", TestSMTP_Worker, args, false);
                    progress.ShowDialog(this);
                }
            }
        }
Beispiel #13
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();
                }
            }
        }
Beispiel #14
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);
            }
        }
Beispiel #15
0
        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            if (!DuplicateProjectNameCheck(this.projectInfoControl.ProjectName, true))
            {
                this.projectInfoControl.FocusProjectName();
                return;
            }

            if (this.executeCreate)
            {
                MOG_Project proj = CreateProject(true);
                if (proj == null)
                {
                    // If project creation failed, return
                    return;
                }

                MOG_ControllerProject.LoginProject(proj.GetProjectName(), "");

                try
                {
                    Hide();
                    ConfigureProjectWizardForm wiz = new ConfigureProjectWizardForm(proj);
                    wiz.ShowDialog(this);
                }
                catch (Exception ex)
                {
                    MOG_Prompt.PromptResponse("Configure Error", ex.Message, ex.StackTrace, MOGPromptButtons.OK, MOG_ALERT_LEVEL.CRITICAL);
                }
            }

            this.DialogResult = DialogResult.OK;
            Hide();
        }
Beispiel #16
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.");
            }
        }
        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);
                }
            }
        }
Beispiel #18
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.");
                }
            }
        }
Beispiel #19
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 + "!");
        }
Beispiel #20
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);
            }
        }
        public void Load(string section)
        {
            if (mSkinDef != null)
            {
                if (mSkinDef.SectionExist(section))
                {
                    ArrayList SkinNames = new ArrayList();
                    ArrayList Skins     = new ArrayList();

                    for (int i = 0; i < mSkinDef.CountKeys(section); i++)
                    {
                        string label        = mSkinDef.GetKeyNameByIndexSLOW(section, i);
                        string file         = mSkinDef.GetKeyByIndexSLOW(section, i);
                        string fullFilename = "";

                        if (Path.IsPathRooted(file))
                        {
                            fullFilename = file;
                        }
                        else
                        {
                            fullFilename = MOG.MOG_Main.GetExecutablePath() + "\\" + file;
                        }

LoadImage:

                        if (string.Compare(file, "none", true) != 0)
                        {
                            if (DosUtils.FileExist(fullFilename))
                            {
                                // Get the group image
                                Image myImage = new Bitmap(fullFilename);

                                // Add the image and the type to the arrayLists
                                Skins.Add(myImage);
                                SkinNames.Add(label);
                            }
                            else
                            {
                                switch (MOG_Prompt.PromptResponse("Custom skin", "Skin label:\n" + label + "\nSkin bitmap:\n" + fullFilename + "+\nCould not be found or is missing! This image will be nullified.", MOGPromptButtons.RetryCancel))
                                {
                                case MOGPromptResult.Retry:
                                    goto LoadImage;
                                }
                            }
                        }
                    }

                    mSections.Add(SkinNames);
                    mSectionNames.Add(section);
                    mSkins.Add(Skins);
                    mSkinNames.Add(SkinNames);
                }
            }
        }
Beispiel #22
0
        private void SQLTestButton_Click(object sender, System.EventArgs e)
        {
            BuildConnectionString();

            SqlConnection myConnection = MOG.DATABASE.MOG_DBAPI.GetOpenSqlConnection(mConnectString);

            MOG_Prompt.PromptResponse("DataBase", "Successfully connected to SQL database " + SQLServerComboBox.Text + "!", MOGPromptButtons.OK);
            //MessageBox.Show("DB", "Successfully connected to SQL database " + SQLServerComboBox.Text + "!",MOGPromptButtons.OK);

            myConnection.Close();
        }
Beispiel #23
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...");
     }
 }
Beispiel #24
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();
        }
 private void EditOkButton_Click(object sender, System.EventArgs e)
 {
     if (!Regex.IsMatch(this.LabelNameTextBox.Text, "\\S"))
     {
         MOG_Prompt.PromptResponse("Missing Information", "You must enter at least one character (other "
                                   + " than whitespace) into the label, or click 'Cancel' to cancel...");
     }
     else
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Beispiel #26
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);
                    }
                }
            }
        }
Beispiel #27
0
        private void GameDataCreateMenuItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                // Create a directory as a child directory of a node
                if (GameDataTreeView.SelectedNode != null)
                {
                    guiAssetTreeTag tag = GameDataTreeView.SelectedNode.Tag as guiAssetTreeTag;

                    string   directoryPath = tag.FullFilename + "\\NewDirectory";
                    TreeNode directory     = CreateDirectoryNode(tag.FullFilename + "\\NewDirectory", null);

                    // Now create the folder
                    if (!DosUtils.DirectoryCreate(directoryPath))
                    {
                        MOG_Prompt.PromptResponse("Create Directory", DosUtils.GetLastError(), MOGPromptButtons.OK);
                    }
                    else
                    {
                        // Now edit the name of this node
                        GameDataTreeView.LabelEdit = true;
                        GameDataTreeView.SelectedNode.Nodes.Add(directory);
                        GameDataTreeView.SelectedNode = directory;
                        GameDataTreeView.SelectedNode.BeginEdit();
                    }
                }
                else
                {
                    // Create a directory at the root of the project
                    string   directoryPath = MOG_ControllerProject.GetCurrentSyncDataController().GetSyncDirectory() + "\\NewDirectory";
                    TreeNode directory     = CreateDirectoryNode(directoryPath, null);

                    // Now create the folder
                    if (!DosUtils.DirectoryCreate(directoryPath))
                    {
                        MOG_Prompt.PromptResponse("Create Directory", DosUtils.GetLastError(), MOGPromptButtons.OK);
                    }
                    else
                    {
                        // Now edit the name of this node
                        GameDataTreeView.LabelEdit    = true;
                        GameDataTreeView.SelectedNode = directory;
                        directory.BeginEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                MOG_Report.ReportMessage("Create Directory", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
            }
        }
Beispiel #28
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");
         }
     }
 }
 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;
             }
         }
     }
 }
        /// <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);
        }