public void Initialize() { BuildToolAssociation bta = new BuildToolAssociation(){ SourceFileType = "src", DestinationFileType = "dst", BuildTool = "c:\\WHATEVER.exe"}; BuildToolAssociationManager.Self.ProjectSpecificBuildTools = new BuildToolAssociationList(); BuildToolAssociationManager.Self.ProjectSpecificBuildTools.BuildToolList.Add(bta); }
private void AddButton_Click(object sender, EventArgs e) { BuildToolAssociation newItem = new BuildToolAssociation(); mBuildToolList.Add(newItem); listBox1.Items.Add(newItem); listBox1.SelectedItem = newItem; }
public void AddIfNecessary(BuildToolAssociation association) { var found = BuildToolAssociationManager.Self.ProjectSpecificBuildTools.BuildToolList.FirstOrDefault( possible => possible.ToString().ToLowerInvariant() == association.ToString().ToLowerInvariant()); if (found == null) { BuildToolAssociationManager.Self.ProjectSpecificBuildTools.BuildToolList.Add(association); BuildToolAssociationManager.Self.SaveProjectSpecificBuildTools(); } }
void AddIfNecessary(BuildToolAssociation association) { if (System.IO.File.Exists(association.BuildTool)) { var buildToolList = BuildToolAssociationManager.Self.ProjectSpecificBuildTools.BuildToolList; bool found = buildToolList.Any( possible => possible.ToString().ToLowerInvariant() == association.ToString().ToLowerInvariant()); if (!found) { BuildToolAssociationManager.Self.ProjectSpecificBuildTools.BuildToolList.Add(association); BuildToolAssociationManager.Self.SaveProjectSpecificBuildTools(); } } }
BuildToolAssociation MakeBmfcBuildToolAssociation() { BuildToolAssociation toReturn = new BuildToolAssociation(); string folder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); if (!folder.EndsWith("\\") && !folder.EndsWith("/")) { folder += "\\"; } string bmFontAbsolutePath = folder + @"AngelCode\BMFont\bmfont.exe"; toReturn.BuildTool = bmFontAbsolutePath; toReturn.SourceFileType = "bmfc"; toReturn.DestinationFileType = "fnt"; toReturn.SourceFileArgumentPrefix = "-c"; toReturn.DestinationFileArgumentPrefix = "-o"; return toReturn; }
public ReferencedFileSave AddSingleFileTo(string fileName, string rfsName, string extraCommandLineArguments, BuildToolAssociation buildToolAssociation, bool isBuiltFile, string options, IElement sourceElement, string directoryOfTreeNode) { // Is the file relative to the project? // If not, don't allow the addition. string projectRoot = ProjectManager.ProjectRootDirectory; ReferencedFileSave toReturn = null; //string directoryOfTreeNode = EditorLogic.CurrentTreeNode.GetRelativePath(); string targetDirectory = FlatRedBall.Glue.Plugins.ExportedImplementations.CommandInterfaces.ElementCommands.GetFullPathContentDirectory(sourceElement, directoryOfTreeNode); string targetFile = fileName; string errorMessage = null; bool failed = false; if (isBuiltFile) { targetFile = targetDirectory + rfsName + "." + buildToolAssociation.DestinationFileType; } string targetFileWithOriginalExtension = FileManager.RemoveExtension(targetFile) + "." + FileManager.GetExtension(fileName); bool copied = false; if (!FileManager.IsRelativeTo(fileName, projectRoot) && isBuiltFile) { copied = PluginManager.TryCopyFile(fileName, targetFileWithOriginalExtension); if (!copied) { MessageBox.Show("Could not add the file\n" + fileName + "\n\nBecause it is not relative to\n" + projectRoot + "\n\nPlease move this file to a folder inside your project and try again"); failed = true; } else { // the file was copied - from now on just use the copied file name: fileName = targetFileWithOriginalExtension; } } if (!failed) { if (isBuiltFile) { errorMessage = buildToolAssociation.PerformBuildOn(fileName, targetFile, extraCommandLineArguments, PluginManager.ReceiveOutput, PluginManager.ReceiveError); } string creationReport; if (String.IsNullOrWhiteSpace(errorMessage)) { string directoryToUse = null; if (!isBuiltFile) { directoryToUse = directoryOfTreeNode; } toReturn = ElementCommands.CreateReferencedFileSaveForExistingFile( sourceElement, directoryToUse, targetFile, PromptHandleEnum.Prompt, AvailableAssetTypes.Self.GetAssetTypeFromExtension(FileManager.GetExtension(targetFile)), out creationReport, out errorMessage); // If toReturn was null, that means the object wasn't created // The user could have said No/Cancel to some option if (toReturn != null) { TaskManager.Self.OnUiThread(() => { ElementViewWindow.UpdateChangedElements(); }); if (sourceElement == null) { GlueCommands.Self.RefreshCommands.RefreshGlobalContent(); } if (!string.IsNullOrEmpty(errorMessage)) { // this is handled below //MessageBox.Show(errorMessage); } else if (string.IsNullOrEmpty(toReturn.Name)) { MessageBox.Show("There was an error creating the named object for\n" + fileName); } else { if (isBuiltFile) { toReturn.SourceFile = ProjectManager.MakeRelativeContent(fileName); toReturn.AdditionalArguments = extraCommandLineArguments; toReturn.BuildTool = buildToolAssociation.ToString(); // If a background sync is happening, this can lock the thread, so we want to // make sure this doesn't happen at the same time as a background sync: TaskManager.Self.AddAsyncTask(() => { UpdateReactor.UpdateFile(ProjectManager.MakeAbsolute(toReturn.Name)); }, "Updating file " + toReturn.Name); string directoryOfFile = FileManager.GetDirectory(ProjectManager.MakeAbsolute(fileName)); RightClickHelper.SetExternallyBuiltFileIfHigherThanCurrent(directoryOfFile, false); } PluginManager.ReactToNewFile(toReturn); GluxCommands.Self.SaveGlux(); } } } } if (!string.IsNullOrWhiteSpace(errorMessage)) { PluginManager.ReceiveError(errorMessage); // I think we should show an error message. I had a user // try to add a file and no popup appeared telling them that // the entity was named that. MessageBox.Show(errorMessage); } if (toReturn != null) { ApplyOptions(toReturn, options); } return toReturn; }