private static NewFileWindow CreateNewFileWindow() { NewFileWindow nfw = new NewFileWindow(); PluginManager.AddNewFileOptions(nfw); if (GlueState.Self.CurrentElement != null) { foreach (ReferencedFileSave fileInElement in GlueState.Self.CurrentElement.ReferencedFiles) { nfw.NamedAlreadyUsed.Add(FileManager.RemovePath(FileManager.RemoveExtension(fileInElement.Name))); } } // Also add CSV files nfw.AddOption(new AssetTypeInfo("csv", "", null, "Spreadsheet (.csv)", "", "")); return(nfw); }
public BuildToolAssociation GetBuildToolAssocationAndNameFor(string fileName, out bool userCancelled, out bool userPickedNone, out string rfsName, out string extraCommandLineArguments) { userCancelled = false; userPickedNone = false; rfsName = null; BuildToolAssociation buildToolAssociation = null; string sourceExtension = FileManager.GetExtension(fileName); List <BuildToolAssociation> btaList = new List <BuildToolAssociation>(); foreach (BuildToolAssociation bta in BuildToolAssociationManager.Self.ProjectSpecificBuildTools.BuildToolList) { if (bta.SourceFileType != null && bta.SourceFileType.ToLower() == sourceExtension.ToLower()) { btaList.Add(bta); } } NewFileWindow nfw = new NewFileWindow(); nfw.ComboBoxMessage = "Which builder would you like to use for this file?"; int commandLineArgumentsId = nfw.AddTextBox("Enter extra command line arguments:"); bool showNoneOption = Elements.AvailableAssetTypes.Self.AllAssetTypes .Any(item => item.Extension == sourceExtension && string.IsNullOrEmpty(item.CustomBuildToolName)); if (showNoneOption) { nfw.AddOption("<None>"); } foreach (BuildToolAssociation bta in btaList) { nfw.AddOption(bta); } if (btaList.Count != 0) { nfw.SelectedItem = btaList[0]; } nfw.ResultName = FileManager.RemoveExtension(FileManager.RemovePath(fileName)); //DialogResult result = cbmb.ShowDialog(); DialogResult result = nfw.ShowDialog(); extraCommandLineArguments = ""; if (result == DialogResult.OK) { buildToolAssociation = nfw.SelectedItem as BuildToolAssociation; if (buildToolAssociation != null) { rfsName = nfw.ResultName; extraCommandLineArguments = nfw.GetValueFromId(commandLineArgumentsId); } else { userPickedNone = nfw.SelectedItem is string && (nfw.SelectedItem as string) == "<None>"; } } else { userCancelled = true; } return(buildToolAssociation); }