コード例 #1
0
        private static CustomizableNewFileWindow CreateNewFileWindow()
        {
            var nfw = new CustomizableNewFileWindow();

            PluginManager.AddNewFileOptions(nfw);

            if (GlueState.Self.CurrentElement != null)
            {
                foreach (ReferencedFileSave fileInElement in GlueState.Self.CurrentElement.ReferencedFiles)
                {
                    nfw.NamesAlreadyUsed.Add(FileManager.RemovePath(FileManager.RemoveExtension(fileInElement.Name)));
                }
            }

            // Also add CSV files
            nfw.AddOption(new AssetTypeInfo("csv", "", null, "Spreadsheet (.csv)", "", ""));
            return(nfw);
        }
コード例 #2
0
ファイル: NewFilePlugin.cs プロジェクト: coldacid/FlatRedBall
        void AddNewFileOptions(CustomizableNewFileWindow newFileWindow)
        {
            var listOfFiles = GetAvailableFilesForNewFile();

            List <string> filesNotInAtiList = listOfFiles.Select(item => FileManager.GetExtension(item)).Distinct().ToList();


            foreach (var ati in AvailableAssetTypes.Self.AllAssetTypes.Where(item => (item.Extension != null && item.HideFromNewFileWindow == false)))
            {
                while (filesNotInAtiList.Contains(ati.Extension))
                {
                    filesNotInAtiList.Remove(ati.Extension);
                }
            }

            // If there's any new options here, let's create new ATIs for it
            foreach (var extension in filesNotInAtiList)
            {
                CreateNoCodeGenerationAtiFor(extension);
            }


            foreach (var ati in AvailableAssetTypes.Self.AllAssetTypes.Where(item => (item.Extension != null && item.HideFromNewFileWindow == false)))
            {
                bool added = false;
                if (!string.IsNullOrEmpty(ati.Extension) && !string.IsNullOrEmpty(ati.QualifiedSaveTypeName))
                {
                    newFileWindow.AddOption(ati);
                    added = true;
                }

                // special case .txt
                if (!added && ati.Extension == "txt")
                {
                    newFileWindow.AddOption(ati);
                    added = true;
                }

                if (!added && GetNewFileTemplateForExtension(listOfFiles, ati.Extension, false) != null)
                {
                    newFileWindow.AddOption(ati);
                }
            }
        }