private string GetFormattedString(string formatedSource)
        {
            string seeds = "";

            if (MOG_ControllerProject.GetUser() != null)
            {
                seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetPackageTokenSeeds("Game~Packages{All}PackageFile.Pak", "All", "", "", "Packages\\PackageFile.Pak"));
            }

            if (MOG_ControllerProject.GetProject() != null)
            {
                seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetProjectTokenSeeds(MOG_ControllerProject.GetProject()));
            }

            if (mAssetFilename != null)
            {
                seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetFilenameTokenSeeds(mAssetFilename));
                seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetRipperTokenSeeds(mAssetFilename.GetEncodedFilename() + "\\Files.Imported", "*.*", mAssetFilename.GetEncodedFilename() + "\\Files.All"));
            }

            seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetSystemTokenSeeds());
            seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetOSTokenSeeds());
            seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetTimeTokenSeeds(new MOG_Time()));


            return(MOG_Tokens.GetFormattedString(formatedSource, seeds));
        }
예제 #2
0
        public void View(MOG_Filename filename, AssetDirectories AssetDirectoryType, string viewer)
        {
            viewer = viewer.ToLower();

            // Onlcy create viewer processes for real viewers, not none
            if (viewer.Length > 0)
            {
                try
                {
                    viewer = MOG_Tokens.GetFormattedString(viewer, MOG_Tokens.GetProjectTokenSeeds(MOG_ControllerProject.GetProject()));

                    // Does this viewer have an extension
                    if (Path.GetExtension(viewer).Length == 0)
                    {
                        // Try tacking on an exe just for good measure
                        viewer += ".exe";
                    }

                    // Check to see if we can find the tool with the path provided
                    if (!DosUtils.Exist(viewer))
                    {
                        try
                        {
                            string locatedViewer = MOG_ControllerSystem.LocateTool(Path.GetDirectoryName(viewer), Path.GetFileName(viewer));
                            if (!String.IsNullOrEmpty(locatedViewer))
                            {
                                viewer = locatedViewer;
                            }
                        }
                        catch (Exception e)
                        {
                            MOG_Report.ReportMessage("Located Viewer", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL);
                        }
                    }
                }
                catch (Exception e2)
                {
                    MOG_Report.ReportMessage("Located Viewer", e2.Message, e2.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.CRITICAL);
                }

                // Get the binary files for this asset
                ArrayList binaryFiles = LocateAssetBinary(filename, AssetDirectoryType);

                if (binaryFiles.Count > 5)
                {
                    if (MOG_Prompt.PromptResponse("Asset View", "There are (" + binaryFiles.Count.ToString() + ") files to be viewed in this asset.\n\nShould we continue and launch one viewer per file?", MOGPromptButtons.OKCancel) == MOGPromptResult.Cancel)
                    {
                        return;
                    }
                }

                // Make sure viewer exists
                foreach (string binary in binaryFiles)
                {
                    AssetView assetViewer = new AssetView();
                    assetViewer.Asset = filename;

                    // If we have a viewer, we need to put quotes around our binary so that its arguments line up
                    if (viewer.Length > 0)
                    {
                        assetViewer.Binary = "\"" + binary + "\"";
                        assetViewer.Viewer = viewer;
                        //}
                        //else
                        //{
                        //    // If we don't have a viewer, we will be launching the biniary its self.
                        //    // Therefore, set the binary without quotes
                        //    assetViewer.Binary = binary;
                        //    assetViewer.Viewer = "";
                    }

                    Thread viewerThread = new Thread(new ThreadStart(assetViewer.ShellSpawnWithLock));
                    viewerThread.Start();
                }
            }
            else
            {
                MOG_Report.ReportMessage("View", "No viewer defined for this asset!", "", MOG_ALERT_LEVEL.ALERT);
            }
        }
예제 #3
0
        private void PropertyNameWizardPage_ShowFromNext(object sender, EventArgs e)
        {
            // Always reset our tree
            TreeNode root = PropertyContextMenuTreeView.Nodes[0];

            root.Nodes.Clear();

            // We need to initialize any previously existing menu
            if (mProperties.PropertyMenu.Length != 0)
            {
                string PropertyMenuFullName = MOG_Tokens.GetFormattedString(mProperties.PropertyMenu, MOG_Tokens.GetProjectTokenSeeds(MOG_ControllerProject.GetProject()));

                // Make sure we got a filename with a full path, if we didn't it is probably a relational path
                if (!Path.IsPathRooted(PropertyMenuFullName))
                {
                    PropertyMenuFullName = MOG_ControllerProject.GetProject().GetProjectToolsPath() + "\\" + PropertyMenuFullName;
                }

                // Find and open the menu
                if (DosUtils.FileExist(PropertyMenuFullName))
                {
                    MOG_PropertiesIni ripMenu = new MOG_PropertiesIni(PropertyMenuFullName);
                    if (ripMenu.SectionExist("Property.Menu"))
                    {
                        string property = "";

                        // Create the sub menu
                        CreateChangePropertiesSubMenu(property, PropertyContextMenuTreeView.Nodes[0], "Property.Menu", ripMenu);
                    }
                }
            }
        }
예제 #4
0
        private void PropertyFilenameWizardPage_CloseFromNext(object sender, MOG_ControlsLibrary.Utils.PageEventArgs e)
        {
            if (PropertyFilenameTextBox.Text.Length > 0)
            {
                string PropertyMenuFullName = MOG_Tokens.GetFormattedString(PropertyFilenameTextBox.Text, MOG_Tokens.GetProjectTokenSeeds(MOG_ControllerProject.GetProject()));

                string LocatedPropertyMenu = MOG_ControllerSystem.LocateTool(PropertyMenuFullName);

                if (LocatedPropertyMenu.Length == 0)
                {
                    // Make sure we got a filename with a full path, if we didn't it is probably a relational path
                    if (!Path.IsPathRooted(PropertyMenuFullName))
                    {
                        PropertyMenuFullName = MOG_ControllerProject.GetProject().GetProjectToolsPath() + "\\Property.Menus\\" + PropertyMenuFullName;
                    }
                }
                else
                {
                    PropertyMenuFullName = LocatedPropertyMenu;
                }

                // Create or open the existing properties
                MOG_PropertiesIni ripMenu = new MOG_PropertiesIni(PropertyMenuFullName);

                // Reset our menu
                ripMenu.Empty();

                // Add the properties
                ripMenu.PutSection("Property.Menu");
                SaveOutMenus(ripMenu, PropertyContextMenuTreeView.Nodes[0].Nodes);

                // Save the properties
                ripMenu.Save();

                // Save our new propertyMenu filename
                mPropertyMenu = PropertyMenuFullName;
            }

            // Skip to the end
            e.Page = PropertyEndWizardPage;
        }