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)); }
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); } } } }
private void UpdateSyncTarget() { MOG_Properties props = new MOG_Properties(ClassificationTextBox.Text); string seeds = ""; seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetClassificationTokenSeeds(Classification)); seeds = MOG_Tokens.AppendTokenSeeds(seeds, MOG_Tokens.GetPropertyTokenSeeds(props.GetPropertyList())); string resolvedSyncTargetPath = MOG_Tokens.GetFormattedString(props.SyncTargetPath, seeds); SyncTarget = resolvedSyncTargetPath; }
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; }
/// <summary> /// Update an existing ListView node for the asset manager inboxes /// </summary> /// <param name="pProperties"></param> /// <param name="nodeColor"></param> /// <returns></returns> public static void UpdateListViewItem(ListViewItem item, MOG_Filename asset, string status, MOG_Properties pProperties) { string date = ""; string size = ""; string creator = ""; string owner = ""; string group = ""; string target = ""; // Check if we have a properties? if (pProperties != null) { // If we have a valid gameDataController, set our platform scope if (MOG_ControllerProject.GetCurrentSyncDataController() != null) { // Set our current platform pProperties.SetScope(MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName()); } // Gather the following info from our properties date = MOG_Time.FormatTimestamp(pProperties.CreatedTime, ""); size = guiAssetController.FormatSize(pProperties.Size); creator = pProperties.Creator; owner = pProperties.Owner; group = pProperties.Group; // Check if this is a packaged asset? if (pProperties.IsPackagedAsset) { // Check if we have have any package assignments in our propeerties? ArrayList packages = pProperties.GetPackages(); if (packages.Count == 0) { // Indicate this is a packaged asset w/o any package assignments target = "Missing package assignment..."; } else if (packages.Count == 1) { MOG_Property package = packages[0] as MOG_Property; MOG_Filename packageName = new MOG_Filename(MOG_ControllerPackage.GetPackageName(package.mPropertyKey)); string packageGroupPath = MOG_ControllerPackage.GetPackageGroups(package.mPropertyKey); string displayString = MOG_ControllerPackage.CombinePackageAssignment(packageName.GetAssetLabel(), packageGroupPath, ""); target = "{Package} " + displayString + " in " + MOG_Filename.GetAdamlessClassification(packageName.GetAssetClassification()); } else { target = "{Package} " + packages.Count + " Assignments..."; } } else if (pProperties.SyncFiles) { // Get the formatted SyncTarget of this asset target = MOG_Tokens.GetFormattedString("{Workspace}\\" + pProperties.SyncTargetPath, asset, pProperties.GetPropertyList()); } } item.Text = asset.GetAssetLabel(); // Populate the item's SubItems // I tried for a long time to be smart here and use ColumnNameFind(thisListView.Columns, "Name") but // I kept running into walls because this function is used by a lot of workers outside of the ListView's thread. // So, I gave up and am just going to do it the ugly brute force way! YUCK!! item.SubItems[(int)AssetBoxColumns.NAME].Text = asset.GetAssetLabel(); item.SubItems[(int)AssetBoxColumns.CLASS].Text = asset.GetAssetClassification(); item.SubItems[(int)AssetBoxColumns.TARGETPATH].Text = target; item.SubItems[(int)AssetBoxColumns.DATE].Text = date; item.SubItems[(int)AssetBoxColumns.SIZE].Text = size; item.SubItems[(int)AssetBoxColumns.PLATFORM].Text = asset.GetAssetPlatform(); item.SubItems[(int)AssetBoxColumns.STATE].Text = status; item.SubItems[(int)AssetBoxColumns.CREATOR].Text = creator; item.SubItems[(int)AssetBoxColumns.RESPPARTY].Text = owner; item.SubItems[(int)AssetBoxColumns.OPTIONS].Text = ""; item.SubItems[(int)AssetBoxColumns.FULLNAME].Text = asset.GetEncodedFilename(); item.SubItems[(int)AssetBoxColumns.BOX].Text = asset.GetBoxName(); item.SubItems[(int)AssetBoxColumns.GROUP].Text = group; // Set the item's Icons item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(asset.GetEncodedFilename(), pProperties); if (MogMainForm.MainApp != null && MogMainForm.MainApp.mAssetManager != null) { // mAssetStatus.GetStatusInfo() is sort of a black sheep and should maybe become static item.StateImageIndex = MogMainForm.MainApp.mAssetManager.mAssetStatus.GetStatusInfo(status).IconIndex; } // Set the item's color item.ForeColor = MOG_AssetStatus.GetColor(status); // Check if this is a local item that has been blessed? if (asset.IsLocal() && string.Compare(status, MOG_AssetStatus.GetText(MOG_AssetStatusType.Blessed), true) == 0) { // Mark local blessed items with light gray item.ForeColor = Color.LightGray; } }
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); } }
private MOG_PropertiesIni Post(string targetFolder, MOG_PropertiesIni fileList) { bool title = false; MOG_PropertiesIni copiedFiles = new MOG_PropertiesIni(); string fullTargetPath = mSourceBinaries + "\\" + targetFolder + "\\" + mArchiveVersion; Console.WriteLine("----------------------------------------"); Console.WriteLine("Create " + targetFolder + " VERSION: " + mArchiveVersion); // Make our target directory DosUtils.DirectoryCreate(fullTargetPath); Console.WriteLine("---------------------------"); Console.WriteLine("Posting new " + targetFolder + " version"); Console.WriteLine("---------------------------"); if (fileList.SectionExist("Files")) { for (int i = 0; i < fileList.CountKeys("Files"); i++) { string label = fileList.GetKeyByIndexSLOW("Files", i); string filename = fileList.GetKeyNameByIndexSLOW("Files", i); string path = MOG_Tokens.GetFormattedString(Path.GetDirectoryName(filename), "{BuildType}=" + mBuildType); string file = Path.GetFileName(filename); if (!title && mVerbose) { Console.WriteLine(label); title = true; } // Copy the files foreach (FileInfo fileHandle in DosUtils.FileGetList(path, file)) { if (!title && !mVerbose) { Console.WriteLine(label); title = true; } try { fileHandle.CopyTo(fullTargetPath + "\\" + fileHandle.Name, true); copiedFiles.PutSectionString("FILES", fullTargetPath + "\\" + fileHandle.Name); Console.WriteLine(" POSTED: " + "<" + fileHandle.LastWriteTime.ToShortDateString().ToString() + " " + fileHandle.LastWriteTime.ToShortTimeString().ToString() + ">\t" + fileHandle.Name); } catch (Exception e) { Console.WriteLine(" ERROR POSTING: " + fileHandle.Name); Console.WriteLine(" ERROR MESSAGE: "+ e.Message); } } title = false; Console.WriteLine(""); } } return(copiedFiles); }