Esempio n. 1
0
        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();
            }
        }
		/// <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;
		}
Esempio n. 3
0
        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;
                            }
                        }
                    }
                }
            }
        }