static public int GetFileIconIndex(string filename, string overlayIcon) { if (mFileTypeManager == null) { mFileTypeManager = new IconListManager(mAssetTypeImages, IconReader.IconSize.Small); } int returnInt = 0; // Make sure this is a full path, if not append the tools directory to it? string overlayIconFilename = MOG_ControllerSystem.LocateTool(overlayIcon); // Try getting a File Icon if (File.Exists(filename) && File.Exists(overlayIconFilename)) { returnInt = mFileTypeManager.AddFileOverlayIcon(filename, "MISSING", overlayIconFilename); } // If we got the default index, return our Class Icon index if (returnInt == 0) { return(GetAssetIconIndex(filename, null)); } else { return(returnInt); } }
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); }
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 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(); //} } }
/// <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."); } } }
/// <summary> InitializeAssetIcons /// Loads all the bmp's specified in the asset declarations /// in the Project.ini files. Each bmp is added to a /// list allong with its key added to a corresponding list /// for later searching. /// </summary> static public void ClassIconInitialize() { // Check to see if our project is loaded if (!MOG_ControllerProject.IsProject()) { return; } // Only allow population of the images array once if (mAssetTypes.Count > 0) { return; } lock (mAssetTypes) { // Add the active item icon first // Get the image if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool("Images", "BaseNode.bmp"))) { // Get the group image Image myImage = new Bitmap(MOG_ControllerSystem.LocateTool("Images", "BaseNode.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("dot"); } if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool("Images", "Group.bmp"))) { // Get the group image Image myImage = new Bitmap(MOG_ControllerSystem.LocateTool("Images", "Group.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("group"); } } mAssetTypeImages.TransparentColor = Color.Magenta; // Initialize state icons FileInfo [] stateImages = DosUtils.FileGetList(MOG_ControllerSystem.LocateTool("Images\\States", ""), "*.bmp"); foreach (FileInfo stateImage in stateImages) { LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName, Path.GetFileNameWithoutExtension(stateImage.Name)); } // Load our file icons as small icons mFileTypeManager = new IconListManager(mAssetTypeImages, IconReader.IconSize.Small); }
private System.Drawing.Bitmap SetIcon(string filename) { try { return(new System.Drawing.Bitmap(MOG_ControllerSystem.LocateTool("\\Images\\States", filename))); } catch (Exception e1) { MOG_Report.ReportSilent("Initialize state icon", "Icon:\n" + "\\Images\\States\\" + filename + "\nCould not be loaded\n\n" + e1.Message, e1.StackTrace, MOG_ALERT_LEVEL.ERROR); return(null); } }
static public void MOGGlobalViewRemoteMachine(MogMainForm mainForm, string MachineName) { string output = ""; // Get the tool listed on the startup page string command = MOG_ControllerSystem.LocateTool("RemoteConnections", MachineName + ".Rdp"); if (command == null || command.Length == 0) { MessageBox.Show(string.Concat("The target Rdp (", MachineName, ") does not exist in any of our valid tools directories!", "Warning!", MessageBoxButtons.OK)); return; } guiCommandLine.ShellSpawn(command, "", ProcessWindowStyle.Normal, ref output); }
public RequestBuildForm() { // // Required for Windows Form Designer support // InitializeComponent(); string buildTool = MOG_ControllerSystem.LocateTool("Configs", "Build.Options.Info"); if (DosUtils.FileExist(buildTool)) { mOptions = new MOG_Ini(buildTool); InitFormOptions(); } // Load prefs PreloadLastSettings(); }
static private void MOGGlobalViewRemoteMachine_Click(object sender, System.EventArgs e) { ToolStripItem menu = sender as ToolStripItem; string MachineName = menu.Text; string output = ""; // Get the tool listed on the startup page string command = MOG_ControllerSystem.LocateTool("RemoteConnections", MachineName + ".Rdp"); if (command == null || command.Length == 0) { MessageBox.Show(string.Concat("The target Rdp (", MachineName, ") does not exist in any of our valid tools directories!", "Warning!", MessageBoxButtons.OK)); return; } guiCommandLine.ShellSpawn(command, "", ProcessWindowStyle.Normal, ref output); }
/// <summary> InitializeAssetIcons /// Loads all the bmp's specified in the asset declarations /// in the Project.ini files. Each bmp is added to a /// list allong with its key added to a corresponding list /// for later searching. /// </summary> static public void ClassIconInitialize() { // Check to see if our project is loaded if (!MOG_ControllerProject.IsProject()) { return; } // Only allow population of the images array once if (mAssetTypes.Count > 0) { return; } // Add the active item icon first // Get the image AddIcon("Images", "BaseNode.bmp", "dot"); AddIcon("Images", "Group.bmp", "group"); AddIcon("Images", "FileLocked.png", "locked"); //mAssetTypeImages.TransparentColor = Color.Magenta; mAssetTypeImages.ColorDepth = ColorDepth.Depth32Bit; // Initialize state icons FileInfo [] stateImages = DosUtils.FileGetList(MOG_ControllerSystem.LocateTool("Images\\States", ""), "*.bmp"); foreach (FileInfo stateImage in stateImages) { LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName.ToLower(), Path.GetFileNameWithoutExtension(stateImage.Name).ToLower()); } // Initialize state icons stateImages = DosUtils.FileGetList(MOG_ControllerSystem.LocateTool("Images\\States", ""), "*.png"); foreach (FileInfo stateImage in stateImages) { LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName.ToLower(), Path.GetFileNameWithoutExtension(stateImage.Name).ToLower()); } // Load our file icons as small icons mFileTypeManager = new IconListManager(mAssetTypeImages, IconReader.IconSize.Small); }
static public bool AddIcon(string directory, string filename, string key) { Tst.TstDictionaryEntry node = mAssetTypes.Find(key); if (node == null) { // Add the active item icon first // Get the image if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool(directory, filename))) { string iconName = MOG_ControllerSystem.LocateTool(directory, filename); // Get the group image Image myImage = new Bitmap(iconName); InternalAddIconToLists(key, iconName, myImage); return(true); } } return(false); }
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; }
static public void ExplorerIconInitialize() { // Only allow population of the images array once if (mAssetTypes.Count > 0) { return; } lock (mAssetTypes) { // Add the active item icon first // Get the image if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool("Images", "BaseNode.bmp"))) { // Get the group image Image myImage = new Bitmap(MOG_ControllerSystem.LocateTool("Images", "BaseNode.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("dot"); } if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool("Images", "Group.bmp"))) { // Get the group image Image myImage = new Bitmap(MOG_ControllerSystem.LocateTool("Images", "Group.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("group"); } } mAssetTypeImages.TransparentColor = Color.Magenta; // Load our file icons as small icons mFileTypeManager = new IconListManager(mAssetTypeImages, IconReader.IconSize.Small); }
static public bool AddIcon(string directory, string filename, string key) { Tst.TstDictionaryEntry node = mAssetTypes.Find(key); if (node == null) { lock (mAssetTypes) { // Add the active item icon first // Get the image if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool(directory, filename))) { // Get the group image Image myImage = new Bitmap(MOG_ControllerSystem.LocateTool(directory, filename)); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add(key, mAssetTypeImages.Images.Count - 1); return(true); } } } return(false); }
static private void LaunchBuild(MogMainForm mainForm, string command, MOG_Ini options) { // Extract the Build's Options string BuildPlatform = ""; string BuildType = ""; // Split up the Build's Options string [] commands = command.Trim().Split(" ".ToCharArray()); if (command.Length == 0 || commands.Length < 1) { MOG_Prompt.PromptMessage("Request build", "Bad or missing command (" + command + ") in request build!", Environment.StackTrace); return; } BuildType = commands[0]; if (commands.Length > 1) { BuildPlatform = commands[1]; } // Get the list of available slaves to use for builds // Get the highest slaves string validSlaves = ""; if (options.SectionExist("Builds.ValidSlaves") && options.KeyExist("Builds.ValidSlaves", "Builds")) { validSlaves = options.GetString("Builds.ValidSlaves", "Builds"); } string buildTypeSection = "Builds." + BuildType; // Locate the buildTool within the Build.Options.Info file string buildTool = ""; // Determine what the executable name is if (options.SectionExist(buildTypeSection)) { // Check for a buildTypeSection level validSlaves definition if (options.SectionExist("Builds.ValidSlaves") && options.KeyExist("Builds.ValidSlaves", buildTypeSection)) { validSlaves = options.GetString("Builds.ValidSlaves", buildTypeSection); } // Check if a specific BuildPlatform was specified? and // Check if we have keys in our buildTypeSection? if (BuildPlatform.Length > 0 && options.CountKeys(buildTypeSection) > 0) { // Obtain the build tool for this build type and BuildPlatform buildTool = options.GetString(buildTypeSection, BuildPlatform); if (buildTool.Length > 0) { // Check for a BuildPlatform level validSlaves definition if (options.SectionExist("Builds.ValidSlaves") && options.KeyExist("Builds.ValidSlaves", buildTypeSection + "." + BuildPlatform)) { validSlaves = options.GetString("Builds.ValidSlaves", buildTypeSection + "." + BuildPlatform); } } } else if (options.KeyExist("Builds", BuildType)) { buildTool = options.GetString("Builds", BuildType); } else { } } // Make sure we have a valid build tool? if (buildTool.Length > 0) { // Locate the buildTool in the tools directories string buildToolRelativePath = Path.GetDirectoryName(buildTool); buildTool = MOG_ControllerSystem.LocateTool(buildToolRelativePath, buildTool); if (buildTool.Length > 0) { //:: ----------------------------------------------------------------------- //:: MOG ENVIRONMENT VARIABLES //:: ----------------------------------------------------------------------- string EnvVariables = MOG_EnvironmentVars.CreateToolsPathEnvironmentVariableString(buildToolRelativePath) + "," + MOG_EnvironmentVars.GetBuildProjectName() + "=" + MOG_ControllerProject.GetProjectName() + "," + MOG_EnvironmentVars.GetBuildProjectBranchName() + "=" + MOG_ControllerProject.GetBranchName() + "," + MOG_EnvironmentVars.GetBuildType() + "=" + BuildType + "," + MOG_EnvironmentVars.GetBuildPlatformName() + "=" + BuildPlatform + "," + MOG_EnvironmentVars.GetBuildTool() + "=" + buildTool + "," + MOG_EnvironmentVars.GetBuildToolPath() + "=" + System.IO.Path.GetDirectoryName(buildTool) + "," + MOG_EnvironmentVars.GetBuildRequestedBy() + "=" + MOG_ControllerProject.GetUser().GetUserName(); // Fire off the build if (MOG_ControllerProject.Build(buildTool, validSlaves, MOG_ControllerProject.GetUser().GetUserName(), EnvVariables)) { string message = "Build Request Successfull.\n" + "You will be notified when it is completed."; MessageBox.Show(message, "Refresh Build", MessageBoxButtons.OK); } } else { string message = "MOG was unable to locate the specified build tool.\n" + "BUILD TOOL: " + buildTool + "\n\n" + "Your MOG Administrator may need to internalize this tool before it will work."; MOG_Prompt.PromptMessage("Request Build", message); } } else { string message = "No build tool was located for the selected build type.\n" + "BUILD TYPE: " + buildTypeSection + "\n\n" + "Your MOG Administrator may need to edit the 'Build.Options.Info' file to configure this build type."; MOG_Prompt.PromptMessage("Request Build", message); } }
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); } }