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 }
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."); } }
static private void MOGGlobalBranches_Click(object sender, System.EventArgs e) { string branch = ((ToolStripMenuItem)sender).Text; // Check if we already have an Active Branch? if (MOG_ControllerProject.IsBranch()) { // Check if they just specified the already active Branch? if (string.Compare(MOG_ControllerProject.GetBranchName(), branch, true) == 0) { // No need to login into the already active project return; } } // Login into the specified Branch if (guiProject.SetLoginBranch(branch)) { ((ToolStripMenuItem)sender).Checked = true; } else { guiProject.UpdateGuiBranch(MOG_ControllerProject.GetBranchName()); } }
static public bool SetLoginProject(string name, string branch) { // Initialize users on the Asset Manager page if (mainForm.mAssetManager != null) { mainForm.mAssetManager.DeInitialize(); } if (MOG_ControllerProject.ProjectExists(name)) { if (MOG_ControllerProject.LoginProject(name, branch) != null) { // Initialize branches MainMenuProjectsClass.MOGGlobalBranchesInit(true); UpdateGuiBranch(MOG_ControllerProject.GetBranchName()); // Initialize the project icons (clear them first) MogUtil_AssetIcons.ClassIconsClear(); MogUtil_AssetIcons.ClassIconInitialize(); // Initialize users on the Asset Manager page if (mainForm.mAssetManager != null) { //mainForm.mAssetManager.DeInitialize(); mainForm.mAssetManager.Initialize(); List <string> departments = guiStartup.GetDepartments(name); mainForm.AssetManagerActiveUserDepartmentsComboBox.Items.Clear(); mainForm.AssetManagerActiveUserDepartmentsComboBox.Items.AddRange(departments.ToArray()); } // Load web tabs if (mainForm.mWebTabManager != null) { mainForm.mWebTabManager.LoadTabs(); } // Update the project related gui stuff UpdateGuiProject(name); // Check if we passed in a valid branch if (branch.Length != 0) { UpdateGuiBranch(MOG_ControllerProject.GetBranchName()); } // Save our prefs file guiUserPrefs.SaveStatic_ProjectPrefs(); return(true); } } return(false); }
public CreateNewLocalBranchForm() { InitializeComponent(); NewLocalMogControl_LocalBranchTreeView.MOGSorted = true; // Initialize the local branch view to show only drives NewLocalMogControl_LocalBranchTreeView.InitializeDrivesOnly(); // Intialize the branch List <string> branches = guiStartup.GetBranches(MOG_ControllerProject.GetProjectName()); NewLocalBranchComboBox.Items.Clear(); NewLocalBranchComboBox.Items.AddRange(branches.ToArray()); NewLocalBranchComboBox.SelectedIndex = 0; NewLocalBranchComboBox.Text = MOG_ControllerProject.GetBranchName(); UpdateLocalBranchComboBox(); }
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); } } }
private void LoginProjectsComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { // Fill in our ComboBoxes through guiStartup List <string> branches = guiStartup.GetBranches(LoginProjectsComboBox.Text); LoginBranchesComboBox.Items.Clear(); LoginBranchesComboBox.Items.AddRange(branches.ToArray()); if (LoginBranchesComboBox.Items.Contains(MOG_ControllerProject.GetBranchName())) { LoginBranchesComboBox.SelectedItem = MOG_ControllerProject.GetBranchName(); } List <string> departments = guiStartup.GetDepartments(LoginProjectsComboBox.Text); LoginDepartmentComboBox.Items.Clear(); LoginDepartmentComboBox.Items.AddRange(departments.ToArray()); if (LoginDepartmentComboBox.Items.Contains(MOG_ControllerProject.GetDepartment())) { LoginDepartmentComboBox.SelectedItem = MOG_ControllerProject.GetDepartment(); } }
private void ExpandArchivalTreeDown(TreeNode node) { // Create names for our lookup into the DB string parentClassification = node.FullPath; string branchName = MOG_ControllerProject.GetBranchName(); // Make our node.Tag easy to use Mog_BaseTag parentTag = (Mog_BaseTag)node.Tag; // Get a list of the classifications for our regular views ArrayList classifications; // If we have attached classifications, use them if (parentTag.AttachedClassifications != null && parentTag.AttachedClassifications.Count > 0) { classifications = parentTag.AttachedClassifications; } else { classifications = MOG_ControllerProject.GetProject().GetSubClassifications(parentClassification, branchName); } // Get a list of archived classifications to compare our regular classifications to ArrayList archiveClassifications = MOG_ControllerProject.GetProject().GetArchivedSubClassifications(parentClassification); // If we have null classifcations, quit our function if (classifications == null || archiveClassifications == null) { return; } FillInClassifications(node, classifications, archiveClassifications); //Populate assets for this classification // If classificationNode is in a treeView (so we can use the FullPath property) AND we want Assets... if (node.TreeView != null && ExpandAssets) { FillInAssets(node); } }
private void FillInClassifications(TreeNode node, ArrayList classifications, ArrayList archiveClassifications) { string parentClassification = node.FullPath; string branchName = MOG_ControllerProject.GetBranchName(); Mog_BaseTag parentTag = (Mog_BaseTag)node.Tag; // Fill in our classifications, comparing to archive classifications foreach (string childTempClassification in archiveClassifications) { // Hold the childClassification name in a mutable variable string childClassification = parentClassification + PathSeparator + childTempClassification; TreeNode classificationNode = new TreeNode(); // Add our classification node classificationNode.Text = childTempClassification; classificationNode.Tag = new Mog_BaseTag(classificationNode, childClassification); ((Mog_BaseTag)classificationNode.Tag).PackageNodeType = PackageNodeTypes.Class; // If we are in the Archive View and this classification is not in our classifications, // change our color to Archive_Color if (!classifications.Contains(childTempClassification)) { classificationNode.ForeColor = Archive_Color; } node.Nodes.Add(classificationNode); classificationNode.Name = classificationNode.FullPath; SetImageIndices(classificationNode, GetClassificationImageIndex(classificationNode.FullPath)); // JohnRen - Speed up trees (This is a lot of extra work just so we can know if there is anything inside) if (true) { // Add our node classificationNode.Nodes.Add(new TreeNode(Blank_Node_Text)); } } }
static public bool SetLoginBranch(string branch) { if (string.Compare(MOG_ControllerProject.GetBranchName(), branch, true) != 0) { if (MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), branch) != null && string.Compare(MOG_ControllerProject.GetBranchName(), branch, true) == 0) { MessageBox.Show("You have been switched to a different branch of the project.\n" + "Please keep this in mind as you bless assets, browse project trees or configure project settings.\n\n" + " BRANCH: " + branch + "\n", "Changing Project Branch", MessageBoxButtons.OK); UpdateGuiBranch(MOG_ControllerProject.GetBranchName()); // Check if we have a current workspace? if (MOG_ControllerProject.GetCurrentSyncDataController() != null) { // Check if this branch is different than our workspace's branch? if (string.Compare(branch, MOG_ControllerProject.GetCurrentSyncDataController().GetBranchName(), true) != 0) { // Switch the associated branch of the current workspace WorkspaceManager.SwitchCurrentWorkspaceBranch(branch); } } // Update the project manager if it has been initialized if (mainForm.mProjectManager != null) { mainForm.mProjectManager.BuildRepositoryTrees(true); } return(true); } MOG_Prompt.PromptMessage("Login Branch", "Could not login to selected branch!\nProject:" + MOG_ControllerProject.GetProjectName() + "\nBranch:" + branch, Environment.StackTrace); return(false); } return(true); }
/// <summary> /// Create Package for each platform in this Project /// </summary> private MOG_Filename CreatePackageForPlatform(NodeLabelEditEventArgs e, MOG_Filename packageName, TreeNode parent) { // Initialize our ArrayList for MOG_Property objects ArrayList targetSyncPath = null; // If our node name already exists, return... if (!ValidateNewNodeName(e, packageName)) { return null; } // If our targetSyncPath is null, even after we try to get a valid one, return... if (targetSyncPath == null && (targetSyncPath = GetValidTargetSyncPath(e, packageName)) == null) { return null; } MOG_Property syncTargetPathProperty = targetSyncPath[0] as MOG_Property; // Create the new package MOG_Filename createdPackageFilename = MOG_ControllerProject.CreatePackage(packageName, syncTargetPathProperty.mValue); if (createdPackageFilename == null) { return null; } RenameNode(e, createdPackageFilename); // Post the projects new assets string jobLabel = "NewPackageCreated." + MOG_ControllerSystem.GetComputerName() + "." + MOG_Time.GetVersionTimestamp(); MOG_ControllerProject.PostAssets(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName(), jobLabel); // Return our created package return createdPackageFilename; }
static public void MOGGlobalBranchesInit(bool force) { // Add all valid login projects if (mainForm.branchesToolStripMenuItem.DropDownItems.Count == 0 || force) { mainForm.branchesToolStripMenuItem.DropDownItems.Clear(); ArrayList Branches = MOG_DBProjectAPI.GetActiveBranchNames(); if (Branches != null) { foreach (MOG_DBBranchInfo branch in Branches) { // Only show branches, not TAGS if (!branch.mTag) { ToolStripMenuItem Item = new ToolStripMenuItem(branch.mBranchName); Item.Click += new System.EventHandler(MainMenuProjectsClass.MOGGlobalBranches_Click); // Check if this is our currently selected branch if (string.Compare(branch.mBranchName, MOG_ControllerProject.GetBranchName(), true) == 0) { Item.Checked = true; } // Set light version control MogUtil_VersionInfo.SetLightVersionControl(Item); mainForm.branchesToolStripMenuItem.DropDownItems.Add(Item); } } } mainForm.branchesToolStripMenuItem.Enabled = true; } }
static private void LaunchBuild(MogMainForm mainForm, string command, MOG_Ini options) { // Extract the Build's Options string BuildPlatform = ""; string BuildType = ""; // Split up the Build's Options string [] commands = command.Trim().Split(" ".ToCharArray()); if (command.Length == 0 || commands.Length < 1) { MOG_Prompt.PromptMessage("Request build", "Bad or missing command (" + command + ") in request build!", Environment.StackTrace); return; } BuildType = commands[0]; if (commands.Length > 1) { BuildPlatform = commands[1]; } // Get the list of available slaves to use for builds // Get the highest slaves string validSlaves = ""; if (options.SectionExist("Builds.ValidSlaves") && options.KeyExist("Builds.ValidSlaves", "Builds")) { validSlaves = options.GetString("Builds.ValidSlaves", "Builds"); } string buildTypeSection = "Builds." + BuildType; // Locate the buildTool within the Build.Options.Info file string buildTool = ""; // Determine what the executable name is if (options.SectionExist(buildTypeSection)) { // Check for a buildTypeSection level validSlaves definition if (options.SectionExist("Builds.ValidSlaves") && options.KeyExist("Builds.ValidSlaves", buildTypeSection)) { validSlaves = options.GetString("Builds.ValidSlaves", buildTypeSection); } // Check if a specific BuildPlatform was specified? and // Check if we have keys in our buildTypeSection? if (BuildPlatform.Length > 0 && options.CountKeys(buildTypeSection) > 0) { // Obtain the build tool for this build type and BuildPlatform buildTool = options.GetString(buildTypeSection, BuildPlatform); if (buildTool.Length > 0) { // Check for a BuildPlatform level validSlaves definition if (options.SectionExist("Builds.ValidSlaves") && options.KeyExist("Builds.ValidSlaves", buildTypeSection + "." + BuildPlatform)) { validSlaves = options.GetString("Builds.ValidSlaves", buildTypeSection + "." + BuildPlatform); } } } else if (options.KeyExist("Builds", BuildType)) { buildTool = options.GetString("Builds", BuildType); } else { } } // Make sure we have a valid build tool? if (buildTool.Length > 0) { // Locate the buildTool in the tools directories string buildToolRelativePath = Path.GetDirectoryName(buildTool); buildTool = MOG_ControllerSystem.LocateTool(buildToolRelativePath, buildTool); if (buildTool.Length > 0) { //:: ----------------------------------------------------------------------- //:: MOG ENVIRONMENT VARIABLES //:: ----------------------------------------------------------------------- string EnvVariables = MOG_EnvironmentVars.CreateToolsPathEnvironmentVariableString(buildToolRelativePath) + "," + MOG_EnvironmentVars.GetBuildProjectName() + "=" + MOG_ControllerProject.GetProjectName() + "," + MOG_EnvironmentVars.GetBuildProjectBranchName() + "=" + MOG_ControllerProject.GetBranchName() + "," + MOG_EnvironmentVars.GetBuildType() + "=" + BuildType + "," + MOG_EnvironmentVars.GetBuildPlatformName() + "=" + BuildPlatform + "," + MOG_EnvironmentVars.GetBuildTool() + "=" + buildTool + "," + MOG_EnvironmentVars.GetBuildToolPath() + "=" + System.IO.Path.GetDirectoryName(buildTool) + "," + MOG_EnvironmentVars.GetBuildRequestedBy() + "=" + MOG_ControllerProject.GetUser().GetUserName(); // Fire off the build if (MOG_ControllerProject.Build(buildTool, validSlaves, MOG_ControllerProject.GetUser().GetUserName(), EnvVariables)) { string message = "Build Request Successfull.\n" + "You will be notified when it is completed."; MessageBox.Show(message, "Refresh Build", MessageBoxButtons.OK); } } else { string message = "MOG was unable to locate the specified build tool.\n" + "BUILD TOOL: " + buildTool + "\n\n" + "Your MOG Administrator may need to internalize this tool before it will work."; MOG_Prompt.PromptMessage("Request Build", message); } } else { string message = "No build tool was located for the selected build type.\n" + "BUILD TYPE: " + buildTypeSection + "\n\n" + "Your MOG Administrator may need to edit the 'Build.Options.Info' file to configure this build type."; MOG_Prompt.PromptMessage("Request Build", message); } }
/// <summary> /// Expand this tree down as a type of our Classification TreeView /// </summary> /// <param name="parentNode"></param> protected override void ExpandTreeDown(TreeNode node) { try { // Change to mouse to hourglass Cursor = Cursors.WaitCursor; if (node != null) { if (node.Nodes.Count == 1 && node.Nodes[0].Text == Blank_Node_Text) { // this is the first time we are expanding this tree node // If we are down to the Asset/Package level... if (IsAtAssetLevel(node) && ExpandAssets) { // Expand our Asset/Package nodes base.ExpandTreeDown(node); } // Else expand according to RootTreeType else { // Clean out the temp(s) node.Nodes.Clear(); ExpandArchivalTreeDown(node); } } } else { // We need to add a root node ArrayList classifications = MOG_ControllerProject.GetProject().GetSubClassifications("", MOG_ControllerProject.GetBranchName()); // This will cause a Windows exception, if index is out of range... TreeNode rootNode; if (classifications != null && classifications.Count > 0) { foreach (string classification in classifications) { rootNode = new TreeNode(classification, new TreeNode[] { new TreeNode(Blank_Node_Text) }); rootNode.Tag = new Mog_BaseTag(rootNode, rootNode.Text); ((Mog_BaseTag)rootNode.Tag).PackageNodeType = PackageNodeTypes.Class; Nodes.Add(rootNode); rootNode.Name = rootNode.FullPath; } // Since we do have our first node now, go ahead and expand it foreach (TreeNode root in Nodes) { root.Expand(); } } else { Enabled = false; Nodes.Add(NothingReturned_Text); } } } catch (Exception ex) { MOG_Report.ReportMessage("Error expanding Archive Tree", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.ERROR); } finally { Cursor = Cursors.Default; } }
string ResolveToken(string token) { string value = ""; // Make sure this token starts with the '{'? if (token.StartsWith("{")) { // Get the name of this token string[] parts = token.Split("{}.".ToCharArray(), 3); // Make sure this resembled a real token? if (parts.Length == 3) { // Check for any contained commands? string testToken = "{" + parts[1] + "}"; // Determine which token we have? switch (testToken) { // Repository Tokens case TOKEN_Repository_Path: value = MOG_ControllerSystem.GetSystemRepositoryPath(); break; case TOKEN_Repository_ProjectsPath: value = MOG_ControllerSystem.GetSystemProjectsPath(); break; case TOKEN_Repository_ToolsPath: value = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Tools"; break; case TOKEN_Repository_Project_Path: value = MOG_ControllerProject.GetProjectPath(); break; case TOKEN_Repository_Project_ToolsPath: value = MOG_ControllerProject.GetProjectPath() + "\\Tools"; break; case TOKEN_Repository_Project_AssetsPath: value = MOG_ControllerRepository.GetRepositoryPath(); break; case TOKEN_Repository_Project_ArchivePath: value = MOG_ControllerRepository.GetArchivePath(); break; case TOKEN_Repository_Project_UsersPath: value = MOG_ControllerProject.GetProjectPath() + "\\Users"; break; // Project Tokens case TOKEN_Project_Name: value = MOG_ControllerProject.GetProjectName(); break; case TOKEN_Project_BranchName: value = MOG_ControllerProject.GetBranchName(); break; case TOKEN_Project_UserName: value = MOG_ControllerProject.GetUserName_DefaultAdmin(); break; case TOKEN_Project_PlatformName: value = MOG_ControllerProject.GetPlatformName(); break; case TOKEN_Project_WorkspaceDirectory: value = MOG_ControllerProject.GetWorkspaceDirectory(); break; // Ripper Tokens case TOKEN_Ripper_SourcePath: value = mRipperSourcePath; break; case TOKEN_Ripper_SourceFilePattern: value = mRipperSourceFilePattern; break; case TOKEN_Ripper_DestinationPath: value = mRipperDestinationPath; break; // Package Tokens case TOKEN_Package_WorkspaceDirectory: if (mPackageFileInfo != null) { value = mPackageFileInfo.mPackageWorkspaceDirectory; } break; case TOKEN_Package_DataDirectory: if (mPackageFileInfo != null) { value = mPackageFileInfo.mPackageDataDirectory; } break; case TOKEN_Package_PackageFile_Filename: if (mPackageFileInfo != null) { value = mPackageFileInfo.mPackageFile; } break; case TOKEN_Package_PackageFile_FullName: { MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment)); value = packageFilename.GetAssetFullName(); } break; case TOKEN_Package_PackageFile_Classification: { MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment)); value = packageFilename.GetAssetClassification(); } break; case TOKEN_Package_PackageFile_Label: { MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment)); value = packageFilename.GetAssetLabel(); } break; case TOKEN_Package_PackageFile_Platform: { MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment)); value = packageFilename.GetAssetPlatform(); } break; case TOKEN_Package_PackageFile_Group: value = MOG_ControllerPackage.GetPackageGroups(mPackageAssignment); break; case TOKEN_Package_PackageFile_Object: value = MOG_ControllerPackage.GetPackageObjects(mPackageAssignment); break; // Inbox Tokens case TOKEN_Inbox_UserName: value = mAssetFilename.GetUserName(); break; case TOKEN_Inbox_UserPath: value = mAssetFilename.GetUserPath(); break; case TOKEN_Inbox_BoxName: value = mAssetFilename.GetBoxName(); break; case TOKEN_Inbox_BoxPath: value = mAssetFilename.GetBoxPath(); break; // Asset Tokens case TOKEN_Asset_AssetName_Path: value = mAssetFilename.GetPath(); break; case TOKEN_Asset_AssetName_FullName: value = mAssetFilename.GetAssetFullName(); break; case TOKEN_Asset_AssetName_Classification: value = mAssetFilename.GetAssetClassification(); break; case TOKEN_Asset_AssetName_Name: value = mAssetFilename.GetAssetName(); break; case TOKEN_Asset_AssetName_PlatformName: value = mAssetFilename.GetAssetPlatform(); break; case TOKEN_Asset_AssetName_Label: value = mAssetFilename.GetAssetLabel(); break; case TOKEN_Asset_ImportedFile: case TOKEN_Asset_RippedFile: value = ResolveToken_AssetFile(token); break; case TOKEN_Asset_Property: value = ResolveToken_Property(token); break; case TOKEN_Asset_ClassificationPath: value = MOG_Filename.GetClassificationPath(mAssetFilename.GetAssetClassification()); break; case TOKEN_Asset_VersionTimeStamp: value = mAssetFilename.GetVersionTimeStamp(); break; } // Check if we have a command? if (parts[2] != ".") { } } } return(value); }
public ConfigureProjectForm(MOG_Project project) { InitializeComponent(); this.project = project; this.Text = "Project Configuration - Project: " + project.GetProjectName() + " ( Branch: " + MOG_ControllerProject.GetBranchName() + " )"; // project info this.projectInfoControl1.LoadFromProject(project); // platforms this.platformEditor.LoadDefaults(); this.platformEditor.LoadFromProject(project); //departments departmentManager.LoadFromProject(project); // users this.userManager.LoadFromProject(project); // Privileges MOG_ControllerProject.RefreshPrivileges(); this.MogControl_Privileges.Initialize_Control(MOG_ControllerProject.GetPrivileges()); // asset classes this.assetClassificationConfigControl1.LoadProjectClassifications2(project); //this.assetClassificationConfigControl1.LoadProjectClassifications(project); }
private void InitializeClassificationList_Worker(object sender, DoWorkEventArgs e) { lock (mRequiredClassifications) { ArrayList classifications; ExclusionList = MOG_Filename.GetProjectLibraryClassificationString(); classifications = MOG_DBReports.ClassificationForProperty("", MOG_PropertyFactory.MOG_Sync_OptionsProperties.New_SyncFiles(true), false); mRequiredClassifications.Clear(); if (classifications != null && classifications.Count > 0) { foreach (string classificationName in classifications) { // Do we already have this class? if (!mRequiredClassifications.Contains(classificationName)) { bool excluded = false; if (ExclusionList.Length > 0) { excluded = StringUtils.IsFiltered(classificationName, ExclusionList); } // Is it excluded? if (excluded == false) { //we don't have this classification yet, so add it and give it a container for assets List <string> assetList = new List <string>(); mRequiredClassifications.Add(classificationName, assetList); } } } } if (ShowAssets) { // Enable this if we wnat to show assets in this tree ArrayList assets = MOG_DBAssetAPI.GetAllAssets(true, MOG_ControllerProject.GetBranchName()); // Enable this if we wnat to show assets in this tree if (assets != null && assets.Count > 0) { foreach (MOG_Filename asset in assets) { int index = mRequiredClassifications.IndexOfKey(asset.GetAssetClassification()); if (index >= 0) { List <string> assetList = mRequiredClassifications.GetByIndex(index) as List <string>; if (assetList != null) { bool excluded = false; if (ExclusionList.Length > 0) { excluded = StringUtils.IsFiltered(asset.GetAssetFullName(), ExclusionList); } // Is it excluded? if (excluded == false) { assetList.Add(asset.GetAssetFullName()); } } } } } } } }
public static bool SetOffline(MogMainForm mainForm, bool offline) { if (offline) { // TODO KIER How do we go offline now? // string targetPath = string.Concat(MOG_ControllerProject.GetGameData().GetGameDataPath(), "\\MOG\\Offline"); // if (MOG_ControllerProject.GetProject().Offline(targetPath)) // { // // Disconnect from the server // MOG_ControllerSystem.GoOffline(); // // if (MOG_ControllerSystem.GetSystem().Load(MOG_Main.BuildDefaultConfigFile(targetPath, "", ""))) // { // // Reload the project // MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName()); // // // Set our gui // guiStartup.ConnectionStatus(mainForm, false); // } // } } else { // Connect to the server MOG_ControllerSystem.GoOnline(); if (MOG_ControllerSystem.GetSystem().Load(MOG_Main.BuildDefaultConfigFile())) { // Reload the project MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName()); // Login user MOG_ControllerProject.LoginUser(MOG_ControllerProject.GetUser().GetUserName()); // Set our gui guiStartup.ConnectionStatus(mainForm, true); } } return(true); }
public void RefreshPosting() { if (mainForm != null && mainForm.ConnectionManagerPostingListView != null && mainForm.ConnectionManagerPostingListView.Items != null) { mainForm.ConnectionManagerPostingListView.Items.Clear(); if (MOG_ControllerProject.GetProject() != null) { ArrayList posts = MOG.DATABASE.MOG_DBPostCommandAPI.GetScheduledPosts(MOG_ControllerProject.GetBranchName()); mainForm.ConnectionManagerPostingListView.BeginUpdate(); IComparer oldSorter = mainForm.ConnectionManagerPostingListView.ListViewItemSorter; mainForm.ConnectionManagerPostingListView.ListViewItemSorter = null; foreach (MOG_DBPostInfo post in posts) { CreatePostItem(post); } mainForm.ConnectionManagerPostingListView.ListViewItemSorter = oldSorter; mainForm.ConnectionManagerPostingListView.EndUpdate(); } } }
static public void MOGGlobalLaunchProjectLogin(string projectName, bool forceLogin) { // Launch the login dialog LoginForm login = new LoginForm(projectName); mainForm.Enabled = false; Login: // Show the dialog if (login.ShowDialog(mainForm) == DialogResult.OK) { try { // Login to the specified Project if (guiProject.SetLoginProject(login.LoginProjectsComboBox.Text, login.LoginBranchesComboBox.Text)) { // Set the login user guiUser guiUsers = new guiUser(mainForm); if ((string.Compare(login.LoginUsersComboBox.Text, "Choose Valid User", true) == 0) || (login.LoginUsersComboBox.Text.Length == 0)) { MessageBox.Show("A valid user must be selected!", "Missing User"); goto Login; } if (guiUsers.SetLoginUser(login.LoginUsersComboBox.Text)) { mainForm.Enabled = true; // Disable the Change SQL Server menu item if the logged in user is not an administrator MOGGlobalSetSQLConnectionMenuItemEnabled(login.LoginUsersComboBox.Text); // Disable the Configure Project menu item if the logged in user is not an administrator MOGGlobalSetToolsConfigureProjectMenuItemEnabled(login.LoginUsersComboBox.Text); // Disable the Set MOG Repository menu item if the logged in user is not an administrator MOGGlobalSetFileMOGRepositoryMenuItemEnabled(login.LoginUsersComboBox.Text); } else { MessageBox.Show("A valid user must be selected!", "Login Error"); goto Login; } } else { MessageBox.Show("A valid project and branch must be selected!", "Login Error"); goto Login; } } catch (Exception e) { MOG_Report.ReportMessage("Login Project", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR); goto Login; } } else if (login.DialogResult == DialogResult.Cancel && forceLogin) { if (MessageBox.Show(mainForm, "Do you wish to exit MOG?", "Exit?", MessageBoxButtons.YesNo) == DialogResult.Yes) { mainForm.Close(); mainForm.Shutdown(); } else { goto Login; } } else { if (!MOG_ControllerProject.IsProject() || !MOG_ControllerProject.IsUser()) { MessageBox.Show("A valid project and user must be selected!", "Missing Project or User"); goto Login; } mainForm.Enabled = true; } // Always initialize our Database before leaving because the dialog loads projects that will leave us in a dirty state MOG_ControllerSystem.InitializeDatabase("", MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName()); }
public void RefreshLateResolvers() { if (mainForm != null && mainForm.ConnectionManagerLateResolversListView != null && mainForm.ConnectionManagerLateResolversListView.Items != null) { mainForm.ConnectionManagerLateResolversListView.Items.Clear(); if (MOG_ControllerProject.GetProject() != null) { ArrayList packageCommands = MOG.DATABASE.MOG_DBPackageCommandAPI.GetScheduledPackageCommands(MOG_ControllerProject.GetBranchName()); mainForm.ConnectionManagerLateResolversListView.BeginUpdate(); foreach (MOG_DBPackageCommandInfo packageCommand in packageCommands) { if (packageCommand.mPackageCommandType == MOG_PACKAGECOMMAND_TYPE.MOG_PackageCommand_LateResolver) { CreateLateResolverItem(packageCommand); } } mainForm.ConnectionManagerLateResolversListView.EndUpdate(); } } }
private void btnCreate_Click(object sender, EventArgs e) { if (IsInformationValid()) { string[] platforms = Platform.Split(",".ToCharArray()); // Make sure there was something specified before we do anything if (platforms.Length > 0) { bool bPromptUser = true; bool bCreatePackage = true; bool bRebuildPackage = false; foreach (string platform in platforms) { // Create the new package name MOG_Filename assetName = MOG_Filename.CreateAssetName(Classification, platform.Trim(), PackageName); // Check if we should prompt the user? if (bPromptUser) { // Don't bother the user again bPromptUser = false; // Check if this was a platform specific package? if (assetName.IsPlatformSpecific()) { // Check if there are ANY assiciated assets with this new platform-specific package? if (MOG_ControllerPackage.GetAssociatedAssetsForPackage(assetName).Count > 0) { // Prompt the user if they wish to automatically populate this new platform-specific packages? string message = "Whenever new platform-specific packages are created, they sometimes need to be populated if existing package assignments exist.\n\n" + "MOG has detected this to be the case and recommends you to automatically populated this package."; MOGPromptResult result = MOG_Prompt.PromptResponse("Automatically populate this new platform-specific package?", message, MOGPromptButtons.YesNo); switch (result) { case MOGPromptResult.Yes: bCreatePackage = true; bRebuildPackage = true; break; case MOGPromptResult.No: bCreatePackage = true; bRebuildPackage = false; break; case MOGPromptResult.Cancel: bCreatePackage = false; bRebuildPackage = false; break; } } } } // Check if we should create the package? if (bCreatePackage) { MOG_Filename newPackage = MOG_ControllerProject.CreatePackage(assetName, SyncTarget); if (newPackage != null) { // Post the new package into the project mAssetName = newPackage; string jobLabel = "NewPackageCreated." + MOG_ControllerSystem.GetComputerName() + "." + MOG_Time.GetVersionTimestamp(); MOG_ControllerProject.PostAssets(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName(), jobLabel); // Check if we should rebuild the package? if (bRebuildPackage) { jobLabel = "PopulateNewPackage." + MOG_ControllerSystem.GetComputerName() + "." + MOG_Time.GetVersionTimestamp(); // Schedule the rebuild command MOG_ControllerPackage.RebuildPackage(assetName, jobLabel); // Start the job MOG_ControllerProject.StartJob(jobLabel); } // Well, this is a bit of a hack but was the easiest and safest way to ensure unique JobIDs... // JobIDs are only accurate to the microsecond so lets sleep for a very short time. Thread.Sleep(10); // Setting the dialog's result will automatically close the dialog since we proceeded to create the package DialogResult = DialogResult.OK; } } } } } }
public void CreateAssetConfigs() { RaiseAssetImport_Begin(); try { MOG_Project proj = MOG_ControllerProject.GetProject(); if (proj != null) { ProgressDialog progress = new ProgressDialog("Importing Assets", "Please wait while the Assets are imported into the Project's Repository.", CreateAssetConfigs_Worker, null, true); progress.ShowDialog(); // Post the projects new assets skipping the PostScanProcess MOG_ControllerProject.PostAssets(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName(), MOG_ControllerProject.GetProjectName(), true); } } catch (Exception e) { MOG_Report.ReportMessage("Unable to import asset", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL); } finally { RaiseAssetImport_Finish(); } }