public VersionManagerClass(MOG_ServerManagerMainForm main) { mainForm = main; mainForm.VersionFilesListView.SmallImageList = MogUtil_AssetIcons.Images; ListViewSortManager serverVersions = new ListViewSortManager(mainForm.ServerListView, new Type[] { typeof(ListViewTextCaseInsensitiveSort), typeof(ListViewTextCaseInsensitiveSort) }); ListViewSortManager clientVersions = new ListViewSortManager(mainForm.ClientListView, new Type[] { typeof(ListViewTextCaseInsensitiveSort), typeof(ListViewTextCaseInsensitiveSort) }); mListViewSort_Manager.Add(serverVersions); mListViewSort_Manager.Add(clientVersions); mListViewSort_Manager.Add(new ListViewSortManager(mainForm.VersionFilesListView, new Type[] { typeof(ListViewTextCaseInsensitiveSort), typeof(ListViewDateSort), typeof(ListViewInt64Sort) } )); serverVersions.Sort(0, SortOrder.Descending); clientVersions.Sort(0, SortOrder.Descending); DeploymentDirectory = MOG_ControllerSystem.GetSystem().GetConfigFile().GetString("MOG", "Updates"); DeploymentDirectory = DeploymentDirectory.ToLower().Replace(MOG_Tokens.GetSystemRepositoryPath().ToLower(), MOG_ControllerSystem.GetSystemRepositoryPath()); }
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; }
public List <string> DrillToAsset_BuildDrillPathParts(MOG_Filename assetFilename, bool includeRevisions) { List <string> parts = new List <string>(); if (Nodes != null) { if (Nodes.Count > 0) { if (!String.IsNullOrEmpty(assetFilename.GetOriginalFilename())) { // Add classification elements string classification = assetFilename.GetAssetClassification(); if (!String.IsNullOrEmpty(classification)) { string[] classificationParts = MOG_Filename.SplitClassificationString(classification); parts.AddRange(classificationParts); // Add asset name elements string assetName = assetFilename.GetAssetName(); if (!String.IsNullOrEmpty(assetName)) { parts.Add(assetName); // Check if we have a version? if (!String.IsNullOrEmpty(assetFilename.GetVersionTimeStamp()) && includeRevisions) { // Date format string string dateFormat = MOG_Tokens.GetMonth_1() + "/" + MOG_Tokens.GetDay_1() + "/" + MOG_Tokens.GetYear_4() + " " + MOG_Tokens.GetHour_1() + ":" + MOG_Tokens.GetMinute_2() + " " + MOG_Tokens.GetAMPM(); parts.Add(Revisions_Text); parts.Add("<" + assetFilename.GetVersionTimeStampString(dateFormat) + ">"); } } } } } } return(parts); }
public override void MakeAssetCurrent(MOG_Filename assetFilename) { // Call our parent's MakeAssetCurrent base.MakeAssetCurrent(assetFilename); // Make sure this assetFilename has the info we want if (assetFilename != null && assetFilename.GetVersionTimeStamp().Length > 0) { TreeNode foundNode = FindNode(assetFilename.GetAssetFullName()); if (foundNode != null) { // Check if this node was previously marked as a deleted version? if (foundNode.ForeColor == Archive_Color) { // Collapse this baby and let it get rebuilt the next time the user expands it because it needs to change it internal structure foundNode.Collapse(); foundNode.Nodes.Clear(); foundNode.Nodes.Add(Blank_Node_Text); } // Reset the color foundNode.ForeColor = Color.Black; // Update this parent node with the new information concerning this asset Mog_BaseTag assetTag = foundNode.Tag as Mog_BaseTag; if (assetTag != null) { // Create a dateFormat just like that used in standard MS Windows USA regional date settings string dateFormat = MOG_Tokens.GetMonth_1() + "/" + MOG_Tokens.GetDay_1() + "/" + MOG_Tokens.GetYear_4() + " " + MOG_Tokens.GetHour_1() + ":" + MOG_Tokens.GetMinute_2() + " " + MOG_Tokens.GetAMPM(); // Scan the children nodes looking for other places needing to be fixed up foreach (TreeNode node in foundNode.Nodes) { // Make sure this is a valid node? if (node != null) { // Checkif this is the 'All Revisions'? if (node.Text == Revisions_Text) { bool bFoundCurrentRevisionNode = false; // Fixup this list of revisions foreach (TreeNode revisionNode in node.Nodes) { Mog_BaseTag baseTag = revisionNode.Tag as Mog_BaseTag; if (baseTag != null) { MOG_Filename revisionFilename = new MOG_Filename(baseTag.FullFilename); if (revisionFilename.GetVersionTimeStamp() == assetFilename.GetVersionTimeStamp()) { revisionNode.ForeColor = CurrentVersion_Color; bFoundCurrentRevisionNode = true; } else { revisionNode.ForeColor = Color.Black; } } } // Check if we need to add our new revision node? if (!bFoundCurrentRevisionNode) { // Looks like this is a new revision and needs to be added // Hey Whipple - What do I do here? // It seems like this is already added by an earlier event so I suspect we will never hit this. } } else { // Check if this is the 'Current <' node if (node.Text.StartsWith(Current_Text + " <")) { node.Text = Current_Text + " <" + assetFilename.GetVersionTimeStampString(dateFormat) + ">"; } // Update it's tag Mog_BaseTag currentTag = node.Tag as Mog_BaseTag; if (currentTag != null) { assetTag.FullFilename = assetFilename.GetOriginalFilename(); } // Finally collapse this baby and let it get rebuilt the next time the user expands it node.Collapse(); node.Nodes.Clear(); node.Nodes.Add(Blank_Node_Text); } } } } } } }
/// <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); } }
static protected void assetTreeViewCreate_AddVersionNodes(TreeView tree, TreeNode parent, int defaultIndex) { // Add version nodes TreeNode versionRoot = new TreeNode(VERSION_TOKEN, defaultIndex, 0); versionRoot.Tag = parent.Tag; parent.Nodes.Clear(); // Date format string string dateFormat = MOG_Tokens.GetMonth_1() + "/" + MOG_Tokens.GetDay_1() + "/" + MOG_Tokens.GetYear_4() + " " + MOG_Tokens.GetHour_1() + ":" + MOG_Tokens.GetMinute_2() + " " + MOG_Tokens.GetAMPM(); // Create a tag for ease of use guiAssetTreeTag parentTag = (guiAssetTreeTag)parent.Tag; // Get the lastest version string string versionStr = MOG_DBAssetAPI.GetAssetVersion(new MOG_Filename(parentTag.FullFilename)); // Populate HDD versions DirectoryInfo[] hddVersions = DosUtils.DirectoryGetList(parentTag.FullFilename, ""); // Arrange it latest date first Array.Reverse(hddVersions); // Populate DB versions ArrayList dbVersions = MOG_DBAssetAPI.GetAllAssetRevisions(new MOG_Filename(parentTag.FullFilename)); // Turn off sorting for this part of the tree tree.Sorted = false; foreach (DirectoryInfo version in hddVersions) { // Create a new versionNode MOG_Filename versionFile = new MOG_Filename(version.FullName); string textLabel = "<" + versionFile.GetVersionTimeStampString(dateFormat) + ">"; TreeNode versionNode = new TreeNode(textLabel, defaultIndex, 0); // Add guiAssetTreeTag and change color to indicate HDD-only status versionNode.Tag = new guiAssetTreeTag(version.FullName, guiAssetTreeTag.TREE_FOCUS.VERSION, true); // If this is a version matched in the DB, color is black if (assetTreeViewCreate_IsAssetVersionInDB(dbVersions, version.Name)) { versionNode.ForeColor = Color.Black; } // Else, turn color gray else { versionNode.ForeColor = Color.DarkGray; } //glk: This still needs to be tested against the case where there is no directory that matches the verion in versionStr // If this is the most recent asset, display it as such if (versionStr == versionFile.GetVersionTimeStamp()) { versionNode.ForeColor = Color.Blue; // Create a currentVersion node, manually cloning versionNode // glk: object.Clone() does not function properly TreeNode currentVersion = new TreeNode(textLabel, versionNode.ImageIndex, versionNode.SelectedImageIndex); currentVersion.ForeColor = Color.Blue; currentVersion.Tag = new guiAssetTreeTag(version.FullName, guiAssetTreeTag.TREE_FOCUS.VERSION, true); // Keep tree from drawing itself for a bit tree.BeginUpdate(); // Document the horizontal and vertical // positions of tree's scrollbar using extern functions int horizPos = GetHScrollPosition(tree); int vertPos = GetVScrollPosition(tree); // Expand the tree: This is the operation which causes // really erratic behavior from TreeView Control currentVersion.Expand(); // Add ghost node for further expansion currentVersion.Nodes.Add(new TreeNode("")); parent.Nodes.Add(currentVersion); // Set the scrollbar horizontal and vertical positions // back to what they were. SetHScrollPosition(tree, horizPos); SetVScrollPosition(tree, vertPos); // Allow tree to draw itself tree.EndUpdate(); } // Add new placeholder for further expansion versionNode.Nodes.Add(new TreeNode("")); versionRoot.Nodes.Add(versionNode); } parent.Nodes.Add(versionRoot); // Turn sorting back on tree.Sorted = true; }
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); }