private void BtnAddNewFileClick(object sender, System.EventArgs e)
{
if (!ProjectTypeIsValid())
{
return;
}
NewFileWindow nfw = new NewFileWindow();
foreach (var ati in AvailableAssetTypes.Self.AllAssetTypes)
{
if (!string.IsNullOrEmpty(ati.Extension) && !string.IsNullOrEmpty(ati.QualifiedSaveTypeName))
{
nfw.AddOption(ati);
}
// special case .txt
if (ati.Extension == "txt")
{
nfw.AddOption(ati);
}
}
// Also add CSV files
//nfw.AddOption(new AssetTypeInfo("csv", "", null, "Spreadsheet (.csv)", "", ""));
nfw.AddOption(AvailableAssetTypes.Self.AllAssetTypes.First(item => item.FriendlyName == "Spreadsheet (.csv)"));
if (nfw.ShowDialog() == DialogResult.OK)
{
AssetTypeInfo resultAssetTypeInfo = nfw.ResultAssetTypeInfo;
bool make2D = nfw.GetOptionFor(resultAssetTypeInfo) == "2D";
string name = nfw.ResultName;
string createdFile = PluginManager.CreateNewFile(resultAssetTypeInfo, make2D, FileManager.GetDirectoryKeepRelative(Rfs.Name), name);
//var createdFile = resultAssetTypeInfo.CreateNewFile(FileManager.GetDirectoryKeepRelative(Rfs.Name) + name, "", make2D);
createdFile = ProjectManager.MakeRelativeContent(createdFile);
var psf = new ProjectSpecificFile
{
ProjectName = cboProjectType.Text,
FilePath = createdFile
};
Value.Add(psf);
Rfs.ProjectSpecificFiles = Value;
GlueCommands.Self.ProjectCommands.UpdateFileMembershipInProject(Rfs);
ProjectManager.SaveProjects();
GlueCommands.Self.RefreshCommands.RefreshPropertyGrid();
RefreshList();
}
}