예제 #1
0
        public void SaveChanges()
        {
            MOG_Project proj = MOG_ControllerProject.GetProject();

            if (proj != null)
            {
                // removed nodes
                foreach (classTreeNode tn in this.removedClasses)
                {
                    proj.ClassificationRemove(tn.props.Classification);
                }
                this.removedClasses.Clear();

                // new nodes
                foreach (classTreeNode tn in this.newClasses)
                {
                    if (!tn.IsAssetFilenameNode)
                    {
                        tn.props.Classification = tn.FullPath;
                        proj.ClassificationAdd(tn.FullPath);
                    }
                }
                this.newClasses.Clear();

                SaveConfigTree(this.tvClassifications.Nodes, proj);
            }
        }
예제 #2
0
        public int AddNewClasses(BackgroundWorker worker, int classificationProgress, int classificationTotal, MOG_Project project, TreeNodeCollection nodes)
        {
            foreach (AssetTreeNode atn in nodes)
            {
                if (atn.IsAClassification && !atn.InDB)
                {
                    string classFullName = atn.FullPath.Replace(atn.TreeView.PathSeparator, "~");

                    worker.ReportProgress(classificationProgress++ *100 / classificationTotal, "Creating " + classFullName);

                    project.ClassificationAdd(classFullName);
                    MOG_Properties properties = project.GetClassificationProperties(classFullName);
                    properties.SetImmeadiateMode(true);

                    //If all the kids have the same sync target, we're setting the classification sync target to the same one
                    string commonSyncTarget = FindCommonSyncTarget(atn);
                    if (commonSyncTarget != "")
                    {
                        // Set the classification's sync target to the common sync target of all the assets
                        atn.FileFullPath = commonSyncTarget;
                    }

                    atn.InDB = true;
                }

                // recurse
                classificationProgress = AddNewClasses(worker, classificationProgress, classificationTotal, project, atn.Nodes);
            }

            return(classificationProgress);
        }
        private void OKButton_Click(object sender, System.EventArgs e)
        {
            if (this.NewClassificationTextBox.Text == null || this.NewClassificationTextBox.Text.Length < 1)
            {
                MessageBox.Show(this, "Please enter a valid classification name, or click 'Cancel' "
                                + "to close the dialog.", "No classification name found!",
                                MessageBoxButtons.OK);
                return;
            }

            if (this.FullClassificationNameTextBox.Text.IndexOf("{") > -1 ||
                this.FullClassificationNameTextBox.Text.IndexOf("}") > -1)
            {
                MessageBox.Show(this, "Invalid character (for Classification), '{' and/or '}', detected.\r\n\r\n"
                                + "Classification name:\r\n" + this.FullClassificationNameTextBox.Text,
                                "Invalid Character(s) for Classification Name Found!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.CurrentClassificationTextBox.Text  = this.CurrentClassificationTextBox.Text.Replace("{", "");
                this.CurrentClassificationTextBox.Text  = this.CurrentClassificationTextBox.Text.Replace("}", "");
                this.FullClassificationNameTextBox.Text = this.FullClassificationNameTextBox.Text.Replace("{", "");
                this.FullClassificationNameTextBox.Text = this.FullClassificationNameTextBox.Text.Replace("}", "");
                return;
            }

            MOG_Project project = MOG_ControllerProject.GetProject();

            project.ClassificationAdd(FullClassificationNameTextBox.Text);

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #4
0
        private void CreateAllExtantClasses_Helper(MOG_Project proj, classTreeNode ctn)
        {
            if (ctn == null || ctn.TreeView == null)
            {
                return;
            }

            string fullClass = ctn.FullPath.Replace(ctn.TreeView.PathSeparator, "~");

            proj.ClassificationAdd(fullClass);

            foreach (classTreeNode subNode in ctn.Nodes)
            {
                CreateAllExtantClasses_Helper(proj, subNode);
            }
        }
예제 #5
0
        public void CreateAll()
        {
            MOG_Project proj = MOG_ControllerProject.GetProject();

            if (proj != null)
            {
                foreach (classTreeNode tn in BuildAllClassNodesList(this.tvClassifications.Nodes))
                {
                    if (!tn.IsAssetFilenameNode)
                    {
                        proj.ClassificationAdd(tn.FullPath);
                        MOG_Properties props = new MOG_Properties(tn.FullPath);
                        props.SetProperties(tn.props.GetPropertyList());
                    }
                }
            }
        }
예제 #6
0
        public override void Initialize(MethodInvoker OnInitializeDone)
        {
            this.OnInitializeDone = OnInitializeDone;

            UseWaitCursor = true;
            Nodes.Clear();

            //Before we do anything here we need to make sure there is going to be a library classification
            string classification = MOG_Filename.GetProjectLibraryClassificationString();

            if (classification.Length > 0)
            {
                //Before we do anything here we need to make sure there is going to be a library classification
                MOG_Project project = MOG_ControllerProject.GetProject();
                if (project != null)
                {
                    if (!project.ClassificationExists(classification))
                    {
                        //Oh no there's not one!  No big deal, just create it.
                        if (project.ClassificationAdd(classification))
                        {
                            MOG_Properties props = MOG_Properties.OpenClassificationProperties(classification);
                            if (props != null)
                            {
                                // This is a library
                                props.IsLibrary = true;

                                props.AssetIcon = "Images\\FileTypes\\MOG Library.bmp";
                                props.ClassIcon = "Images\\FileTypes\\MOG Library Folder.bmp";

                                // And we want to checkout all assets to a dir under the project name
                                props.SyncTargetPath = "{AssetClassificationPath.Full}";
                                props.Close();
                            }
                        }
                    }
                }
            }
            mWorker                     = new BackgroundWorker();
            mWorker.DoWork             += InitializeLibraryClassificationList_Worker;
            mWorker.RunWorkerCompleted += OnWorkerCompleted;

            mWorker.RunWorkerAsync();
        }
예제 #7
0
        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;
        }