public bool AddPlatform(string platformName) { if (platformName == "") { // add a new blank platform ListViewItem newItem = new ListViewItem("NewPlatform"); this.Items.Add(newItem); newItem.ImageIndex = DEFAULT_INDEX; newItem.StateImageIndex = DEFAULT_INDEX; MOG_Platform plat = new MOG_Platform("NewPlatform"); MOG_ControllerProject.GetProject().PlatformAdd(plat); CopyIcon("platform"); newItem.BeginEdit(); return(true); } else { MOG_Platform plat = new MOG_Platform(platformName); if (MOG_ControllerProject.GetProject().PlatformAdd(plat)) { CopyIcon(platformName); ListViewItem newItem = new ListViewItem(platformName); this.Items.Add(newItem); newItem.ImageIndex = DEFAULT_INDEX; newItem.StateImageIndex = DEFAULT_INDEX; return(true); } return(false); } }
/// <summary> /// Add group or object to the database /// </summary> private bool AddGroupToDatabase(string addCandidate, MOG_Filename packageAsset) { // Are we platform generic? bool success = true; if (packageAsset.GetAssetPlatform() == "All") { string packageVersion = MOG_DBAssetAPI.GetAssetVersion(packageAsset); if (packageVersion.Length > 0) { success = MOG_DBPackageAPI.AddPackageGroupName(packageAsset, packageVersion, addCandidate, MOG_ControllerProject.GetUser().GetUserName()); } } // We are platform generic, loop through all platforms then ArrayList platforms = MOG_ControllerProject.GetProject().GetPlatforms(); for (int p = 0; p < platforms.Count && success; p++) { MOG_Platform platform = (MOG_Platform)platforms[p]; // Set this package to be platform specific for this platform name packageAsset = MOG_Filename.CreateAssetName(packageAsset.GetAssetClassification(), platform.mPlatformName, packageAsset.GetAssetLabel()); string packageVersion = MOG_DBAssetAPI.GetAssetVersion(packageAsset); if (packageVersion.Length > 0) { // Add to the database success &= MOG_DBPackageAPI.AddPackageGroupName(packageAsset, packageVersion, addCandidate, MOG_ControllerProject.GetUser().GetUserName()); } } return success; }
private void InitializePlatforms() { MilestonePlatformComboBox.Items.Clear(); // Add a item for every platform ArrayList platforms = mMog.GetProject().GetPlatforms(); for (int p = 0; p < platforms.Count; p++) { MOG_Platform platform = (MOG_Platform)platforms[p]; MilestonePlatformComboBox.Items.Add(platform.mPlatformName); } //MilestonePlatformComboBox.Items.Add("All"); }
public void InitializeItems(MenuItem Item) { Item.MenuItems.Add(CreateItem("Remove", new MogMenuItem_Click(RemoveMenuItem_Click))); Item.MenuItems.Add(CreateItem("Make Current", new MogMenuItem_Click(MakeCurrentMenuItem_Click))); MenuItem RebuildItem = CreateItem("Rebuild Package", null); // Add a menu item for each platform ArrayList platforms = MOG_ControllerProject.GetProject().GetPlatforms(); for (int p = 0; p < platforms.Count; p++) { MOG_Platform platform = (MOG_Platform)platforms[p]; RebuildItem.MenuItems.Add(CreateItem(platform.mPlatformName, new MogMenuItem_Click(RebuildPackageMenuItem_Click))); } RebuildItem.MenuItems.Add(CreateItem("All", new MogMenuItem_Click(RebuildPackageMenuItem_Click))); // Add this complex menu Item.MenuItems.Add(RebuildItem); }
public bool AddDefaultPlatform(DefaultPlatform platform) { ListViewItem newItem = null; switch (platform) { case DefaultPlatform.XBOX: if (!this.ListViewContainsItem(this, "xbox")) { newItem = new ListViewItem("XBox"); newItem.ImageIndex = XBOX_INDEX; newItem.StateImageIndex = XBOX_INDEX; } break; case DefaultPlatform.PC: if (!this.ListViewContainsItem(this, "pc")) { newItem = new ListViewItem("PC"); newItem.ImageIndex = PC_INDEX; newItem.StateImageIndex = PC_INDEX; } break; case DefaultPlatform.PS2: if (!this.ListViewContainsItem(this, "ps2")) { newItem = new ListViewItem("PS2"); newItem.ImageIndex = PS2_INDEX; newItem.StateImageIndex = PS2_INDEX; } break; case DefaultPlatform.GAMECUBE: if (!this.ListViewContainsItem(this, "gamecube")) { newItem = new ListViewItem("GameCube"); newItem.ImageIndex = GAMECUBE_INDEX; newItem.StateImageIndex = GAMECUBE_INDEX; } break; case DefaultPlatform.XBOX360: if (!this.ListViewContainsItem(this, "xbox360")) { newItem = new ListViewItem("XBox360"); newItem.ImageIndex = XBOX360_INDEX; newItem.StateImageIndex = XBOX360_INDEX; } break; case DefaultPlatform.PS3: if (!this.ListViewContainsItem(this, "ps3")) { newItem = new ListViewItem("PS3"); newItem.ImageIndex = PS3_INDEX; newItem.StateImageIndex = PS3_INDEX; } break; case DefaultPlatform.REVOLUTION: if (!this.ListViewContainsItem(this, "wii")) { newItem = new ListViewItem("wii"); newItem.ImageIndex = REVOLUTION_INDEX; newItem.StateImageIndex = REVOLUTION_INDEX; } break; case DefaultPlatform.PSP: if (!this.ListViewContainsItem(this, "psp")) { newItem = new ListViewItem("PSP"); newItem.ImageIndex = PSP_INDEX; newItem.StateImageIndex = PSP_INDEX; } break; case DefaultPlatform.DS: if (!this.ListViewContainsItem(this, "ds")) { newItem = new ListViewItem("DS"); newItem.ImageIndex = DS_INDEX; newItem.StateImageIndex = DS_INDEX; } break; } if (newItem != null) { this.Items.Add(newItem); // add to DB MOG_Platform plat = new MOG_Platform(newItem.Text); MOG_ControllerProject.GetProject().PlatformAdd(plat); CopyIcon(plat.mPlatformName); return(true); } return(false); }
private void CreateProject_Worker(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; MOG_Project project = new MOG_Project(); try { MOG_System sys = MOG_ControllerSystem.GetSystem(); if (sys != null) { project = sys.ProjectCreate(this.projectInfoControl.ProjectName); if (project != null) { worker.ReportProgress(0, "Setting project info..."); // project info project.SetProjectPath(this.projectInfoControl.ProjectPath); project.SetProjectToolsPath(this.projectInfoControl.ProjectPath + "\\Tools"); project.SetProjectUsersPath(this.projectInfoControl.ProjectPath + "\\Users"); worker.ReportProgress(0, "Copying tools..."); worker.ReportProgress(0, "Saving and logging in..."); // create project and login project.Save(); MOG_ControllerProject.LoginProject(this.projectInfoControl.ProjectName, ""); worker.ReportProgress(0, "Creating current branch..."); // create default branch MOG_ControllerProject.BranchCreate("", "Current"); worker.ReportProgress(0, "Creating classification tree..."); // platforms MOG_Platform pcPlatform = new MOG_Platform(); pcPlatform.mPlatformName = "PC"; project.PlatformAdd(pcPlatform); // create classifications MogUtil_ClassificationLoader classLoader = new MogUtil_ClassificationLoader(); classLoader.ProjectName = this.projectInfoControl.ProjectName; foreach (MOG_Properties props in classLoader.GetClassPropertiesListFromFiles()) { if (props.Classification.ToLower() == project.GetProjectName().ToLower()) { // create only project name root class node project.ClassificationAdd(props.Classification); MOG_Properties properties = project.GetClassificationProperties(props.Classification); properties.SetImmeadiateMode(true); properties.SetProperties(props.GetPropertyList()); break; } } project.Save(); } else { throw new Exception("Failed to create the project."); } } else { throw new Exception("System not initialized."); } } catch (Exception ex) { MOG_Report.ReportMessage("Project Creation Failed", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } e.Result = project; }
public void AddPlatform(MOG_Platform platform) { // Grab the name AddPlatform(platform.mPlatformName); }
static public void MOGGlobalToolsRequestBuild(MogMainForm mainForm, MenuItem MenuPlatform) { // Build default values string targetProject = MOG_ControllerProject.GetProject().GetProjectCvsName().ToLower(); string targetDirectory = MOG_ControllerProject.GetProject().GetProjectBuildDirectory(); string sourceDirectory = MOG_ControllerProject.GetProject().GetProjectToolsPath(); // Get the build type string parentMenu = MenuPlatform.Parent.ToString().ToLower(); // Parse the string to get to the name "Advent.Gold" then move our index to the length of the word "advent" + 1 for the "." string BuildType = parentMenu.Substring(parentMenu.LastIndexOf(targetProject) + targetProject.Length + 1); // Get the list of available slaves to use for builds string validSlaves = ""; if (MOG_ControllerProject.GetProject().GetConfigFile().SectionExist("BuildMachines")) { for (int i = 0; i < MOG_ControllerProject.GetProject().GetConfigFile().CountKeys("BuildMachines"); i++) { if (validSlaves.Length == 0) { validSlaves = MOG_ControllerProject.GetProject().GetConfigFile().GetKeyNameByIndexSLOW("BuildMachines", i); } else { validSlaves = string.Concat(validSlaves, ",", MOG_ControllerProject.GetProject().GetConfigFile().GetKeyNameByIndexSLOW("BuildMachines", i)); } } } string platform; // Determine BuildPlatform if (string.Compare(MenuPlatform.Text, "All", true) == 0) { ArrayList platformList = MOG_ControllerProject.GetProject().GetPlatforms(); for (int p = 0; p < platformList.Count; p++) { MOG_Platform MogPlatform = (MOG_Platform)platformList[p]; platform = MogPlatform.mPlatformName; // Create build name string buildName = string.Concat(MOG_ControllerProject.GetProjectName(), ".", "Build.", targetProject, ".", BuildType, ".AdventGameCode.", platform); // Fire the refresh build // if (MOG_ControllerProject.Build(buildName, sourceDirectory, targetDirectory, validSlaves, false, MOG_ControllerProject::GetActiveUser().GetUserName(), "")) // { // MessageBox.Show(string.Concat("Server has recieved your build request for a (", BuildPlatform, ") build. You will be notified when it completes."), "Refresh Build", MOGPromptButtons.OK); // } } } else { platform = MenuPlatform.Text; // Create build name string buildName = string.Concat(MOG_ControllerProject.GetProjectName(), ".", "Build.", targetProject, ".", BuildType, ".AdventGameCode.", platform); // Fire the refresh build // if (MOG_ControllerProject.Build(buildName, sourceDirectory, targetDirectory, validSlaves, false, MOG_ControllerProject::GetActiveUser().GetUserName(), "")) // { // MessageBox.Show("Server has recieved your build request. You will be notified when it completes.", "Refresh Build", MOGPromptButtons.OK); // } } }
/// <summary> /// Remove a Group or Package Object from the database /// </summary> /// <param name="removeCandidate">Full path of Group or Object with /// '/' as delimiter, starting from package name.</param> /// <param name="packageAsset">The Asset that is the Package</param> /// <param name="platformGeneric"> /// Whether or not this is a platform Generic operation. /// /// This is where the "Show Platform Specific" checkbox would /// plug in from the PackageManagementTreeView /// </param> /// <returns>Bool indicating success/failure</returns> public bool RemoveGroupFromDatabase(string removeCandidate, MOG_Filename packageAsset) { try { bool success = true; // Get the current version of this package string packageVersion = MOG_DBAssetAPI.GetAssetVersion(packageAsset); // Check to see if any assets reference this if (MOG_DBPackageAPI.GetAllAssetsInPackageGroup(packageAsset, packageVersion, removeCandidate).Count == 0) { // If all is ok, remove it from the database success &= MOG_DBPackageAPI.RemovePackageGroupName(packageAsset, packageVersion, removeCandidate, MOG_ControllerProject.GetUser().GetUserName()); } else { throw (new Exception("Cannot remove object or group that is used by active assets!")); } // Are we platform generic? if (String.Compare(packageAsset.GetAssetPlatform(), "All", true) == 0) { // We are platform generic, loop through all platforms then ArrayList platforms = MOG_ControllerProject.GetProject().GetPlatforms(); for (int p = 0; p < platforms.Count; p++) { MOG_Platform platform = (MOG_Platform)platforms[p]; // Set this package to be platform specific for this platform name packageAsset = MOG_Filename.CreateAssetName(packageAsset.GetAssetClassification(), platform.mPlatformName, packageAsset.GetAssetLabel()); packageVersion = MOG_DBAssetAPI.GetAssetVersion(packageAsset); if (packageVersion.Length > 0) { // Check to see if any assets reference this if (MOG_DBPackageAPI.GetAllAssetsInPackageGroup(packageAsset, packageVersion, removeCandidate).Count == 0) { // If all is ok, remove it from the database success &= MOG_DBPackageAPI.RemovePackageGroupName(packageAsset, packageVersion, removeCandidate, MOG_ControllerProject.GetUser().GetUserName()); } else { throw (new Exception("Cannot remove object or group that is used by active assets!")); } } } } return success; } catch (Exception e) { // Get the current version of this package string packageVersion = MOG_DBAssetAPI.GetAssetVersion(packageAsset); // See if we can report to the user about why this node could not be deleted ArrayList assignedAssets = MOG_DBPackageAPI.GetAllAssetsInPackageGroup(packageAsset, packageVersion, removeCandidate); if (assignedAssets != null) { // Walk all associated assets and make a list string assets = ""; foreach (MOG_Filename assetName in assignedAssets) { if (assets.Length == 0) { assets = assetName.GetEncodedFilename(); } else { assets = assets + "\n" + assetName.GetEncodedFilename(); } } // Tell the user MOG_Prompt.PromptMessage("Remove node", "Cannot remove this node because the following assets are assigned to it:\n\n" + assets); } else { // This must have been another problem MOG_Prompt.PromptMessage("Remove node", "Cannot remove this node.\nMessage\n" + e.Message); } } return false; }