示例#1
0
        public void AddNewFileOptions(Controls.NewFileWindow 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);

                }
            }

            
        }