示例#1
0
        private void UpdateSyncTargetTree()
        {
            // Attempt to drill to the specified path
            string relativeSyncTargetPath = DosUtils.PathMakeRelativePath(this.SyncTargetTreeView.MOGRootNode.FullPath, SyncTargetTextBox.Text);

            this.SyncTargetTreeView.MOGSelectedNode = MogUtil_ClassificationTrees.FindAndExpandTreeNodeFromFullPath(this.SyncTargetTreeView.MOGRootNode.Nodes, "\\", relativeSyncTargetPath);
        }
        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);
                    }
                }
            }
        }
示例#3
0
        private void SyncTargetTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            string relativePath = DosUtils.PathMakeRelativePath(MOG_ControllerProject.GetWorkspaceDirectory(), e.Node.FullPath);

            SyncTargetTextBox.Text      = relativePath;
            SyncTargetTextBox.BackColor = Color.PaleGreen;
        }
示例#4
0
        public void LoadFilter(string filterName)
        {
            // Is this an already fully qualified name?
            if (DosUtils.ExistFast(filterName) == false)
            {
                // No, then lets assume it came from the user's tools directory
                filterName = MOG_ControllerSystem.LocateTool(filterName + ".sync");
            }

            SyncFilterComboBox.Text = Path.GetFileNameWithoutExtension(filterName);
            SyncFilterComboBox.Tag  = filterName;

            if (DosUtils.ExistFast(filterName))
            {
                //if (ClassificationTreeView.Visible)
                //{
                // Reset the tree
                ClassificationTreeView.Initialize(OnWorkerCompleteLoadFilter);
                //}
                //else
                //{
                //    OnWorkerCompleteLoadFilter();
                //}
            }
        }
示例#5
0
        public static bool Generate(string filename, string macAddress, DateTime expiration, int clientLicenseCount, string disabledFeatureList)
        {
            DateTime installDate = DateTime.Now;

            string output = String.Concat(macAddress, "$", installDate.ToString(), "$", expiration.ToString(), "$", clientLicenseCount.ToString(), "$", disabledFeatureList, "$");

            Random rand = new Random(DateTime.Now.Second);

            for (int i = 0; i < 1024; i++)
            {
                char ch = (char)rand.Next('0', '9');
                output = String.Concat(output, ch);
            }

            Int64 checksum = 0;

            for (int i = 0; i < output.Length; i++)
            {
                checksum += Convert.ToInt64(Char.GetNumericValue(output[i]));
            }

            output = String.Concat(checksum.ToString(), "$", output);

            output = MOG_Encryption.Encrypt(output);
            return(DosUtils.FileWrite(filename, output));
        }
示例#6
0
        private AssetTreeNode CreateTreeFromDisk(string rootPath, string path, BackgroundWorker worker)
        {
            if (Directory.Exists(path))
            {
                // Show the relative path so we have more real estate in the progress dialog
                string relativePath = DosUtils.PathMakeRelativePath(rootPath, path);
                worker.ReportProgress(0, "Loading:\n" + relativePath);

                AssetTreeNode node = CreateFolderNode(path);

                //Add subdirectories
                foreach (string subdir in Directory.GetDirectories(path))
                {
                    node.Nodes.Add(CreateTreeFromDisk(rootPath, subdir, worker));
                }

                //Add files
                foreach (string file in Directory.GetFiles(path))
                {
                    node.Nodes.Add(CreateFileNode(file, path));
                }

                return(node);
            }

            return(null);
        }
示例#7
0
        private void MilestoneTargetTextBox_TextChanged(object sender, System.EventArgs e)
        {
            // Check if any other patches exist
            string patchInfo = string.Concat(MilestoneTargetTextBox.Text, "\\MOG\\Patches\\Patches.Info");

            if (DosUtils.FileExist(patchInfo))
            {
                PatchNameComboBox.Items.Clear();

                // Open it and add it to our patch list
                MOG_Ini patches = new MOG_Ini(patchInfo);

                // Add a key for our local build first.
                PatchNameComboBox.Items.Add("Local");

                if (patches.SectionExist("PATCHES"))
                {
                    for (int i = 0; i < patches.CountKeys("PATCHES"); i++)
                    {
                        PatchNameComboBox.Items.Add(patches.GetKeyNameByIndex("PATCHES", i));
                    }
                }

                if (patches.SectionExist("Local") && patches.KeyExist("Local", "Current"))
                {
                    PatchNameComboBox.Text = patches.GetString("Local", "Current");
                }
                else
                {
                    PatchNameComboBox.Text = "Unknown";
                }
            }
        }
示例#8
0
        private void SyncPromoteButton_Click(object sender, EventArgs e)
        {
            string toolsPath = Path.Combine(MOG_ControllerProject.GetProjectPath(), "Tools");

            ComboBoxItem filter = SyncFilterComboBox.SelectedItem as ComboBoxItem;

            if (filter != null)
            {
                string targetFilterName = "";
                string filterFileName   = filter.FullPath;
                if (filterFileName.Contains(MOG_ControllerProject.GetUserPath()))
                {
                    targetFilterName = filterFileName.Replace(MOG_ControllerProject.GetUser().GetUserToolsPath(), toolsPath);
                }
                else
                {
                    // This is a project tool and should be demoted
                    targetFilterName = filterFileName.Replace(toolsPath, MOG_ControllerProject.GetUser().GetUserToolsPath());
                }

                // This is a user tool and should be promoted
                if (DosUtils.FileCopyFast(filterFileName, targetFilterName, true))
                {
                    if (DosUtils.FileDeleteFast(filterFileName))
                    {
                        UpdateFilterDropDown(Path.GetFileNameWithoutExtension(targetFilterName));
                        UpdatePromoteButton();
                    }
                }
            }
        }
示例#9
0
        public void AssetPopulate(MOG_Properties asset)
        {
            mProperties = asset;

            this.AssetDescriptionTextBox.Text = mProperties.GetDescription();
            this.AssetFormatTextBox.Text      = mProperties.GetGameDataPath();
            this.AssetRipperTextBox.Text      = mProperties.GetAssetRipper();
            this.AssetRipTaskerTextBox.Text   = mProperties.GetAssetRipTasker();
            this.AssetNameTextBox.Text        = mProperties.GetClassification();

            this.AssetIconTextBox.Text = mProperties.GetAssetIcon();
            if (DosUtils.FileExist(string.Concat(MOG_ControllerProject.GetProject().GetProjectToolsPath(), "\\", mProperties.GetAssetIcon())))
            {
                this.AssetIconPictureBox.Image = Image.FromFile(string.Concat(MOG_ControllerProject.GetProject().GetProjectToolsPath(), "\\", mProperties.GetAssetIcon()));
            }

            switch (mProperties.GetPackagedAsset().ToLower())
            {
            case "true":
                this.AssetPackageCheckBox.Checked = true;
                break;

            case "false":
                this.AssetPackageCheckBox.Checked = false;
                break;

            default:
                MessageBox.Show(this, "This asset has an invalid package value");
                break;
            }
        }
示例#10
0
        private bool InitializeTargetDirectory()
        {
            if (mConsoleCopy)
            {
                if (!XboxUtils.FileExist(mSyncRoot))
                {
                    if (!XboxUtils.DirectoryCreateVerify(mSyncRoot, true))
                    {
                        // Error
                        //MOG_REPORT.ShowMessageBox("Xbox Dir Error", string.Concat(mSyncRoot, " could not be created!"), MessageBoxButtons.OK);
                        throw new Exception(mSyncRoot + " could not be created!");
                    }
                }
            }
            else
            {
                // Create the initial directory on the pc
                if (!DosUtils.Exist(mSyncRoot))
                {
                    try
                    {
                        Directory.CreateDirectory(mSyncRoot);
                    }
                    catch (Exception e)
                    {
                        // Error
                        MOG_REPORT.ShowMessageBox("Dir Error", string.Concat(mSyncRoot, " could not be created!", "\n", e.ToString()), MessageBoxButtons.OK);
                        throw new Exception(mSyncRoot + " could not be created!", e);
                        //return false;
                    }
                }
            }

            return(true);
        }
示例#11
0
        public void MarkCurrentVersion(ListView list, string type)
        {
            // Check our current versions version
            if (DosUtils.DirectoryExist(DeploymentDirectory + "\\" + type + "\\" + DeploymentTarget))
            {
                VersionNode current = this.CreateVersionNode(DeploymentTarget, DeploymentDirectory + "\\" + type + "\\" + DeploymentTarget);

                if (current != null)
                {
                    //this.bCheckOverride = true;
                    // Walk all the items of this list and check or bold the items that match
                    foreach (ListViewItem item in list.Items)
                    {
                        // Get our version node from this item
                        VersionNode target = (VersionNode)item.Tag;

                        if (string.Compare(target.Name, current.Name, true) == 0 &&
                            target.MajorVersion == current.MajorVersion &&
                            target.MinorVersion == current.MinorVersion)
                        {
                            item.ForeColor = Color.DarkGreen;
                            item.Font      = new Font(item.Font.FontFamily, item.Font.Size, FontStyle.Bold);
                            item.Checked   = true;
                        }
                    }

                    //this.bCheckOverride = false;
                }
            }
        }
        public void InitializeItems(MenuItem menu)
        {
            string dir      = mCustomToolsInfo.Substring(0, mCustomToolsInfo.LastIndexOf("\\"));
            string wildcard = mCustomToolsInfo.Substring(mCustomToolsInfo.LastIndexOf("\\") + 1, (mCustomToolsInfo.Length - mCustomToolsInfo.LastIndexOf("\\")) - 1);

            foreach (FileInfo file in DosUtils.FileGetList(dir, wildcard))
            {
                MOG_Ini customTools = new MOG_Ini(file.FullName);

                // Remove the beginning of the info name
                string tmp  = wildcard.Substring(0, wildcard.IndexOf("*"));
                string name = file.Name.Replace(tmp, "");

                // Remove the .info
                name = name.Replace(".info", "");

                // Create the main Item
                MenuItem parent = new MenuItem(name);

                if (customTools.SectionExist("USER_TOOLS"))
                {
                    mClickHandlers = new ArrayList();
                    for (int i = 0; i < customTools.CountKeys("USER_TOOLS"); i++)
                    {
                        parent.MenuItems.Add(CreateItem(customTools.GetKeyNameByIndexSLOW("USER_TOOLS", i), new MogMenuItem_Click(CustomToolMenuItem_Click)));
                    }
                }

                menu.MenuItems.Add(parent);
            }
        }
示例#13
0
        private void Restore(string projName, string iniFilename)
        {
            // make sure iniFilename points to valid file
            if (File.Exists(iniFilename))
            {
                // make sure directory exists
                if (Directory.Exists(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName))
                {
                    if (DosUtils.DirectoryExistFast(MOG_ControllerSystem.GetSystemProjectsPath() + "\\" + projName))
                    {
                        // A project of this name already exists
                        MOG_Prompt.PromptMessage("Project Name Conflict", "Projects cannot be restored over the top of another active project.");
                        return;
                    }

                    List <string> args = new List <string>();
                    args.Add(projName);
                    args.Add(iniFilename);

                    string message = "Please wait while MOG restores deleted project.\n" +
                                     "   PROJECT: " + projName;
                    ProgressDialog progress = new ProgressDialog("Restoring project", message, Restore_Worker, args, false);
                    progress.ShowDialog();
                }
            }
        }
示例#14
0
        /// <summary>
        /// Post the build in the users data directory to their inbox
        /// <summary>
        public void BuildPost()
        {
            MOG_ControllerSyncData gameDataHandle = MOG_ControllerProject.GetCurrentSyncDataController();

            try
            {
                string ProjectName     = gameDataHandle.GetProjectName();
                string ProjectDir      = gameDataHandle.GetSyncDirectory();
                string ProjectPlatform = gameDataHandle.GetPlatformName();
                string ImportName      = string.Concat(MOG_ControllerProject.GetProjectName(), ".Build.Release.", ProjectName, ".", ProjectPlatform);
                string command         = string.Concat(MOG_ControllerProject.GetProject().GetProjectToolsPath(), "\\MOG_UserBless.bat");
                string output          = "";

                // Make sure the tool we need exits
                if (DosUtils.FileExist(command))
                {
                    guiCommandLine.ShellSpawn(command, string.Concat(ProjectName, " ", ProjectDir, " ", ProjectPlatform, " ", ImportName), ProcessWindowStyle.Normal, ref output);
                }
                else
                {
                    MOG_Prompt.PromptMessage("Tool", string.Concat("This tool(", command, ") is missing."), Environment.StackTrace);
                }
            }
            catch (Exception e)
            {
                MOG_Prompt.PromptMessage("Build Post", "Could not perform post due to error:\n\n" + e.Message, e.StackTrace);
            }
        }
        private int LoadIcon(string imageFileName, ImageList imageList)
        {
            try
            {
                if (imageFileName != null && imageFileName.Length > 0)
                {
                    // Load the icon specified by the Icon= key
                    string iconName = imageFileName;

                    // Make sure that the icon file exists
                    if (DosUtils.FileExist(iconName))
                    {
                        // Get the image
                        Image myImage = new Bitmap(iconName);

                        // Add the image and the type to the arrayLists
                        imageList.Images.Add(myImage);

                        return(imageList.Images.Count - 1);
                    }
                }
            }
            catch (Exception e)
            {
                MOG_Report.ReportMessage("Load Icon", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
            }

            return(0);
        }
示例#16
0
        public bool ToolNewerCheck(MOG_Filename mogAsset, string version, MOG_Project pProject, ref string failedString)
        {
            MOG_Time assetTime        = new MOG_Time(version);
            MOG_Time correctAssetTime = new MOG_Time();

            DirectoryInfo [] dirs = DosUtils.DirectoryGetList(MOG_ControllerRepository.GetAssetBlessedPath(mogAsset).GetEncodedFilename(), "*.*");

            if (dirs != null)
            {
                foreach (DirectoryInfo dir in dirs)
                {
                    string   checkVersion = dir.Name.Substring(dir.Name.LastIndexOf(".") + 1);
                    MOG_Time dirTime      = new MOG_Time(checkVersion);

                    // Is this asset equal or newer than this dir version?
                    if (assetTime.Compare(dirTime) < 0)
                    {
                        failedString = "Out of date," + failedString;
                        return(false);
                    }
                }
            }

            return(true);
        }
示例#17
0
        private ListViewItem CreateListViewItemForFile(string localFile)
        {
            ListViewItem item = null;

            // Only put the asset in the list if it is actually a library asset
            if (MOG_ControllerLibrary.IsPathWithinLibrary(localFile))
            {
                item = new ListViewItem(Path.GetFileName(localFile));

                string classification = MOG_ControllerLibrary.ConstructLibraryClassificationFromPath(localFile);
                string localTimestamp = GetLocalFileTimestamp(localFile);
                string fullname       = localFile;
                string status         = "Unknown";
                string extension      = DosUtils.PathGetExtension(localFile);

                // Populate the item
                item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(localFile);
                item.SubItems.Add(extension);               // Extension
                item.SubItems.Add(classification);          // Classification
                item.SubItems.Add("");                      // User
                item.SubItems.Add("");                      // Comment
                item.SubItems.Add(localTimestamp);          // Local TimeStamp
                item.SubItems.Add("");                      // Server Timestamp
                item.SubItems.Add(status);                  // Status
                item.SubItems.Add(fullname);                // Fullname
                item.SubItems.Add(localFile);               // LocalFile
                item.SubItems.Add("");                      // RepositoryFile

                UpdateListViewItemColors(item, status);
            }

            return(item);
        }
示例#18
0
        private void LibraryListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.Label != null)
            {
                // Rename the asset
                ListViewItem renamedAsset = LibraryListView.Items[e.Item];
                string       fullName     = GetItemFullName(renamedAsset);
                string       label        = renamedAsset.SubItems[FindColumn("Name")].Text;
                string       extension    = DosUtils.PathGetExtension(fullName);

                string rename = fullName.Replace(label, e.Label);

                if (DosUtils.FileExistFast(rename))
                {
                    MOG_Prompt.PromptMessage("Rename Error", "Cannot rename (" + label + ") to (" + e.Label + ") because this asset already exists!");
                    e.CancelEdit = true;
                }
                else
                {
                    if (!DosUtils.RenameFast(fullName, rename, false))
                    {
                        MOG_Prompt.PromptMessage("Rename Error", DosUtils.GetLastError());
                        e.CancelEdit = true;
                    }
                    else
                    {
                        // Update the full filename
                        renamedAsset.SubItems[FindColumn("Fullname")].Text  = rename;
                        renamedAsset.SubItems[FindColumn("Extension")].Text = extension;
                    }
                }
            }
        }
示例#19
0
        private string InitializeSummaryMap()
        {
            // Summary filename
            string summaryFile = string.Concat(mSourcePath, "\\MOG\\platformSincSummary.", mMog.GetActivePlatform().mPlatformName, ".info");

            // Clear out the summary file if it exists
            if (DosUtils.FileExist(summaryFile))
            {
                if (!DosUtils.FileDelete(summaryFile))
                {
                    throw(new Exception("Could not delete summaryFile:" + summaryFile));
                }
            }

            string summaryPendingFile = summaryFile + "." + Path.GetFileNameWithoutExtension(mTargetConsole) + ".pending";

            if (DosUtils.FileExist(summaryPendingFile))
            {
                if (!DosUtils.FileDelete(summaryPendingFile))
                {
                    throw(new Exception("Could not delete summaryPendingFile:" + summaryPendingFile));
                }
            }

            mSummary     = new MOG_Ini(summaryFile);
            mPendingCopy = new MOG_Ini(summaryPendingFile);

            return(summaryFile);
        }
示例#20
0
        static private int LoadIcon(string imageFileName, string assetClassName)
        {
            try
            {
                // Load the icon specified by the Icon= key
                string iconName = imageFileName;

                // Make sure this is a full path, if not append the tools directory to it?
                iconName = MOG_ControllerSystem.LocateTool(imageFileName);

                lock (mAssetTypes)
                {
                    // Make sure that the icon file exists
                    if (iconName.Length > 0 && DosUtils.FileExist(iconName))
                    {
                        // Get the image
                        Image myImage = new Bitmap(iconName);

                        // Add the image and the type to the arrayLists
                        mAssetTypeImages.Images.Add(myImage);
                        mAssetTypes.Add(assetClassName, mAssetTypeImages.Images.Count - 1);

                        return(mAssetTypeImages.Images.Count - 1);
                    }
                }
            }
            catch (Exception e)
            {
                MOG_Report.ReportMessage("Load Icon", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
            }

            return(0);
        }
示例#21
0
        private void InitializeSourceVersions()
        {
            MilestoneSourceComboBox.Items.Clear();

            // Add the local version first
            string platform = MilestonePlatformComboBox.Text;

            if (mMog.GetProject().GetPlatform(platform) != null)
            {
                MilestoneSourceComboBox.Items.Add(string.Concat(mMog.GetProject().GetPlatform(platform).mPlatformTargetPath, "\\MOG\\LocalVersion.info"));
            }
            else if (string.Compare(platform, "All", true) == 0)
            {
                // error out for now
                MOG_REPORT.ShowMessageBox("ERROR", "All platform not supported yet.", MessageBoxButtons.OK);
            }

            // Add the global current version next
            string globalPath = string.Concat(mMog.GetProject().GetProjectPath(), "\\Versions\\");

            MilestoneSourceComboBox.Items.Add(string.Concat(globalPath, "Current.info"));

            foreach (FileInfo file in DosUtils.FileGetList(globalPath, "*.info"))
            {
                if (string.Compare(file.Name, "Current.info", true) != 0)
                {
                    MilestoneSourceComboBox.Items.Add(string.Concat(globalPath, file.Name));
                }
            }
        }
        public void TargetXboxMakeIso()
        {
            // Optimize all the data
            string output    = "";
            string sourceDir = mainForm.mAssetManager.GetTargetPath();

            // Get the tool listed on the startup page
            string command = "[ProjectPath]\\Mog\\Tools\\Xbox\\Optimize\\Optimize.bat";

            if (command.IndexOf("[ProjectPath]") != -1)
            {
                command = string.Concat(command.Substring(0, command.IndexOf("[")), mainForm.mAssetManager.GetTargetPath(), command.Substring(command.IndexOf("]") + 1));
            }

            // Make sure the tool we need exits
            if (DosUtils.FileExist(command))
            {
                if (guiCommandLine.ShellExecute(command, mainForm.mAssetManager.GetTargetPath() + "\\System", ProcessWindowStyle.Normal, ref output) != 0)
                {
                    MOG_REPORT.ShowMessageBox("XBox Tools", string.Concat(output), MessageBoxButtons.OK);
                }

                // Sync to the target xbox or folder
                TargetXboxSynch(false, false);
            }
            else
            {
                MOG_REPORT.ShowMessageBox("XBox Tools", string.Concat("This tool is missing, have you updated to the latest version?"), MessageBoxButtons.OK);
            }
        }
示例#23
0
        private void SyncDelButton_Click(object sender, EventArgs e)
        {
            if (SyncFilterComboBox.SelectedItem != null)
            {
                ComboBoxItem item = SyncFilterComboBox.SelectedItem as ComboBoxItem;
                if (item != null)
                {
                    string filterFileName = item.FullPath;

                    if (MOG_Prompt.PromptResponse("Delete filter?", "Are you sure you want to delete this filter?\n" + item.FullPath, MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                    {
                        if (DosUtils.ExistFast(filterFileName) && DosUtils.DeleteFast(filterFileName))
                        {
                            UpdateFilterDropDown("");

                            mFilter.Clear();
                            //if (ClassificationTreeView.Visible)
                            //{
                            ClassificationTreeView.Initialize();
                            //}

                            SyncSaveButton.Enabled  = false;
                            SyncFilterComboBox.Text = mOriginalSyncComboBoxMessage;
                        }
                    }
                }
            }
        }
示例#24
0
        static private int LoadIcon(string imageFileName, string assetClassName)
        {
            try
            {
                if (imageFileName != null && imageFileName.Length > 0)
                {
                    // Load the icon specified by the Icon= key
                    string iconName = imageFileName;

                    // Make sure this is a full path, if not append the tools directory to it?
                    iconName = MOG_ControllerSystem.LocateTool(imageFileName);

                    // Make sure that the icon file exists
                    if (iconName.Length > 0 && DosUtils.FileExist(iconName))
                    {
                        // Get the image
                        Image image = new Bitmap(iconName);

                        return(InternalAddIconToLists(assetClassName, iconName, image));
                    }
                }
            }
            catch (Exception e)
            {
                MOG_Report.ReportSilent("Load Icon", e.Message, e.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
            }

            return(0);
        }
        public void PcLaunchDeep(string optionalTarget)
        {
            string output = "";
            // Get the tool listed on the startup page
            string command = "";            //;mParent.mainForm.StartupDeepTextBox.Text;

            if (command.IndexOf("[ProjectPath]") != -1)
            {
                command = string.Concat(command.Substring(0, command.IndexOf("[")), mainForm.mAssetManager.GetTargetPath(), command.Substring(command.IndexOf("]") + 1));
            }

            string target = optionalTarget;

            // Make sure the tool we need exits
            if (DosUtils.FileExist(command))
            {
                if (optionalTarget.Length != 0)
                {
                    guiCommandLine.ShellSpawn(command, target, ProcessWindowStyle.Normal, ref output);
                }
                else
                {
                    guiCommandLine.ShellSpawn(command);
                }
            }
            else
            {
                MOG_REPORT.ShowMessageBox("PC Tools", string.Concat("This tool is missing, have you updated to the latest version?"), MessageBoxButtons.OK);
            }
        }
示例#26
0
        private void GameDataTreeView_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e)
        {
            try
            {
                // Make sure an edit actually occured
                if (e.Label != null)
                {
                    guiAssetTreeTag tag = (guiAssetTreeTag)e.Node.Tag;

                    string sourceDirectoryName = tag.FullFilename;
                    string targetDirectoryName = tag.FullFilename.Replace(e.Node.Text, e.Label);

                    e.Node.Tag = new guiAssetTreeTag(targetDirectoryName, e.Node, false);

                    if (!DosUtils.DirectoryMove(sourceDirectoryName, targetDirectoryName))
                    {
                        MOG.PROMPT.MOG_Prompt.PromptResponse("Rename Directory", DosUtils.GetLastError(), MOGPromptButtons.OK);
                        e.Node.Remove();
                        e.CancelEdit = true;
                    }

                    // Fire off our AfterSelect, so that it updates everything propertly
                    e.Node.Text = e.Label;
                    this.GameDataTreeView_AfterSelect(this.GameDataTreeView, new TreeViewEventArgs(e.Node, TreeViewAction.Unknown));
                }
                GameDataTreeView.LabelEdit = false;
            }
            catch (Exception ex)
            {
                MOG.PROMPT.MOG_Prompt.PromptResponse("Rename Directory", ex.Message, MOGPromptButtons.OK);
                e.CancelEdit = true;
                e.Node.Remove();
                GameDataTreeView.LabelEdit = false;
            }
        }
示例#27
0
        private bool CreateTargetDirectoryPath(string targetPath)
        {
            // Check for a sub-dir
            int index = targetPath.LastIndexOf("\\");

            if (index != -1 && targetPath[index - 1] != ':')
            {
                string RootDir = targetPath.Substring(0, index);
                if (!CreateTargetDirectoryPath(RootDir))
                {
                    return(false);
                }
            }

            if (mConsoleCopy)
            {
                // Check if it already exists
                if (!XboxUtils.FileExist(targetPath))
                {
                    //
                    if (!XboxUtils.DirectoryCreateVerify(targetPath, false))
                    {
                        // Error
                        MOG_REPORT.ShowMessageBox("Create Target Directory Path", string.Concat(RemapDirectoryString(targetPath), " could not be created!"), MessageBoxButtons.OK);
                        return(false);
                    }

                    XboxUtils.DM_FILE_ATTRIBUTES att = new XboxUtils.DM_FILE_ATTRIBUTES();
                    XboxUtils.GetFileAttributes(targetPath, ref att);
                    if (!(att.SizeHigh != 0 && att.SizeLow != 0))
                    {
                        // Error
                        MOG_REPORT.ShowMessageBox("Create Target Directory Path", string.Concat(RemapDirectoryString(targetPath), " could not be created!"), MessageBoxButtons.OK);
                        return(false);
                    }
                }
            }
            else
            {
                // Check if it already exists
                if (!DosUtils.FileExist(targetPath))
                {
                    //
                    try
                    {
                        Directory.CreateDirectory(targetPath);
                    }
                    catch (Exception e)
                    {
                        // Error
                        MOG_REPORT.ShowMessageBox("Create Directory Error", string.Concat(RemapDirectoryString(targetPath), " could not be created!", "\n", e.ToString()), MessageBoxButtons.OK);
                        return(false);
                    }
                }
            }

            return(true);
        }
示例#28
0
        /// <summary>
        /// Edit the ripper in notepad
        /// </summary>
        private void EditRipper()
        {
            if (this.PropertiesList.Length > 0)
            {
                MOG_Properties properties = PropertiesList[0] as MOG_Properties;

                // Get the assigned ripper information
                string ripper = properties.AssetRipper;
                string tool   = DosUtils.FileStripArguments(properties.AssetRipper);
                string args   = DosUtils.FileGetArguments(properties.AssetRipper);

                // Do we have a ripper to edit?
                if (ripper.Length > 0)
                {
                    // Locate the ripper
                    ripper = MOG_ControllerSystem.LocateTool("", tool);
                    if (ripper.Length > 0)
                    {
                        // Edit the ripper
                        guiCommandLine.ShellSpawn("Notepad.exe", ripper);
                    }
                    else
                    {
                        // If not, do we want to create one?
                        if (MOG_Prompt.PromptResponse("No Ripper Found", "This appears to be a new ripper.\n" +
                                                      "RIPPER: " + tool + "\n\n" +
                                                      "Would you like to create a new one for editing?", MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                        {
                            // Create a new one using the user's specified name
                            string defaultRipperName = tool;
                            ripper = Path.Combine(MOG_ControllerProject.GetProject().GetProjectToolsPath(), defaultRipperName);

                            // Do we want to start from the template?
                            if (MOG_Prompt.PromptResponse("Use Ripper Template", "Would you like to base the new ripper from MOG's ripper template?", MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                            {
                                // If so, copy the template to this new ripper
                                string template = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Tools\\Rippers\\TemplateComplex_ripper.bat";

                                DosUtils.CopyFast(template, ripper, false);
                            }

                            // Launch the editor
                            string output = "";
                            guiCommandLine.ShellExecute("Notepad.exe", ripper, System.Diagnostics.ProcessWindowStyle.Normal, ref output);

                            // Now, set this new ripper as the ripper assigned to this asset restoring the users args
                            properties.AssetRipper = ripper + " " + args;
                            this.PropertiesRippingRipperComboBox.Text = properties.AssetRipper;
                        }
                    }
                }
                else
                {
                    MOG_Prompt.PromptMessage("Edit Ripper", "There is no ripper to edit.");
                }
            }
        }
示例#29
0
 static public void LoadHelpText(MOG_ServerManagerMainForm mainForm, string doc)
 {
     if (DosUtils.FileExistFast(doc))
     {
         mainForm.StartPageInfoRichTextBox.LoadFile(doc, RichTextBoxStreamType.RichText);
         mHelpDoc = doc;
         mainForm.StartPageInfoRichTextBox.SelectAll();
         mainForm.StartPageInfoRichTextBox.SelectionColor = System.Drawing.Color.SteelBlue;
     }
 }
示例#30
0
        public void Load(string section)
        {
            if (mSkinDef != null)
            {
                if (mSkinDef.SectionExist(section))
                {
                    ArrayList SkinNames = new ArrayList();
                    ArrayList Skins     = new ArrayList();

                    for (int i = 0; i < mSkinDef.CountKeys(section); i++)
                    {
                        string label        = mSkinDef.GetKeyNameByIndexSLOW(section, i);
                        string file         = mSkinDef.GetKeyByIndexSLOW(section, i);
                        string fullFilename = "";

                        if (Path.IsPathRooted(file))
                        {
                            fullFilename = file;
                        }
                        else
                        {
                            fullFilename = MOG.MOG_Main.GetExecutablePath() + "\\" + file;
                        }

LoadImage:

                        if (string.Compare(file, "none", true) != 0)
                        {
                            if (DosUtils.FileExist(fullFilename))
                            {
                                // Get the group image
                                Image myImage = new Bitmap(fullFilename);

                                // Add the image and the type to the arrayLists
                                Skins.Add(myImage);
                                SkinNames.Add(label);
                            }
                            else
                            {
                                switch (MOG_Prompt.PromptResponse("Custom skin", "Skin label:\n" + label + "\nSkin bitmap:\n" + fullFilename + "+\nCould not be found or is missing! This image will be nullified.", MOGPromptButtons.RetryCancel))
                                {
                                case MOGPromptResult.Retry:
                                    goto LoadImage;
                                }
                            }
                        }
                    }

                    mSections.Add(SkinNames);
                    mSectionNames.Add(section);
                    mSkins.Add(Skins);
                    mSkinNames.Add(SkinNames);
                }
            }
        }