public void Add(ProjectSpecificFile projectSpecificFile)
 {
     List.Add(projectSpecificFile);
 }
 public void Remove(ProjectSpecificFile projectSpecificFile)
 {
     List.Remove(projectSpecificFile);
 }
        private static void AddIfUnreferenced(BuildItem item, ProjectBase project, List<string> referencedFiles, List<ProjectSpecificFile> unreferencedFiles)
        {
            string nameToInclude;
            bool isUnreferenced = GetIfIsUnreferenced(item, project, referencedFiles, out nameToInclude);

            if (isUnreferenced)
            {
                nameToInclude = ProjectManager.ContentProject.Directory + ProjectManager.ContentProject.ContentDirectory + nameToInclude;
                nameToInclude = nameToInclude.Replace(@"/", @"\");

                if (!mListBeforeAddition.Contains(nameToInclude.ToLower()))
                {
                    var projectSpecificFile = new ProjectSpecificFile()
                    {
                        FilePath = nameToInclude.ToLower(),
                        ProjectId = project.ProjectId
                    };

                    lock (mLastAddedUnreferencedFiles)
                    {
                        mLastAddedUnreferencedFiles.Add(projectSpecificFile);
                    }
                }
                unreferencedFiles.Add(new ProjectSpecificFile()
                {
                    FilePath = nameToInclude,
                    ProjectId = project.ProjectId
                });
            }
        }
        public static AssetTypeInfo GetAssetTypeInfoForProjectSpecificFile(this ReferencedFileSave instance, ProjectSpecificFile psf)
        {
            string extension = FileManager.GetExtension(psf.FilePath);
            AssetTypeInfo thisAssetTypeInfo = instance.GetAssetTypeInfo();

            foreach (AssetTypeInfo assetTypeInfo in AvailableAssetTypes.Self.AllAssetTypes)
            {
                if (assetTypeInfo.Extension == extension &&
                    assetTypeInfo.RuntimeTypeName == thisAssetTypeInfo.RuntimeTypeName)
                {
                    return assetTypeInfo;
                }

            }
            return null;
        }
Пример #5
0
        public static AssetTypeInfo GetAssetTypeInfoForProjectSpecificFile(this ReferencedFileSave instance, ProjectSpecificFile psf)
        {
            string        extension         = FileManager.GetExtension(psf.FilePath);
            AssetTypeInfo thisAssetTypeInfo = instance.GetAssetTypeInfo();

            foreach (AssetTypeInfo assetTypeInfo in AvailableAssetTypes.Self.AllAssetTypes)
            {
                if (assetTypeInfo.Extension == extension &&
                    assetTypeInfo.RuntimeTypeName == thisAssetTypeInfo.RuntimeTypeName)
                {
                    return(assetTypeInfo);
                }
            }
            return(null);
        }
Пример #6
0
 public void Remove(ProjectSpecificFile projectSpecificFile)
 {
     List.Remove(projectSpecificFile);
 }
Пример #7
0
 public void Add(ProjectSpecificFile projectSpecificFile)
 {
     List.Add(projectSpecificFile);
 }
        private void BtnAddExistingFileClick(object sender, System.EventArgs e)
        {
            if (!ProjectTypeIsValid()) return;

            var openFileDialog = new OpenFileDialog();
            if (openFileDialog.ShowDialog() != DialogResult.OK) return;



            string projectDirectory = FileManager.GetDirectory(ProjectManager.ContentProject.FullFileName);
            string directoryThatFileShouldBeRelativeTo = ProjectManager.ContentDirectory + FileManager.GetDirectoryKeepRelative(Rfs.Name);
            string fileToAdd;

            if (!FileManager.IsRelativeTo(openFileDialog.FileName, projectDirectory))
            {
                fileToAdd = directoryThatFileShouldBeRelativeTo + FileManager.RemovePath(openFileDialog.FileName);
                fileToAdd = FileManager.MakeRelative(fileToAdd, projectDirectory);
                FileHelper.RecursivelyCopyContentTo(openFileDialog.FileName,
                    FileManager.GetDirectory(openFileDialog.FileName),
                    directoryThatFileShouldBeRelativeTo);
            }

            else
            {
                fileToAdd = FileManager.MakeRelative(openFileDialog.FileName, ProjectManager.ContentProject.Directory + ProjectManager.ContentProject.ContentDirectory);
            }

            var psf = new ProjectSpecificFile
                          {
                              ProjectId = cboProjectType.Text,
                              FilePath = fileToAdd
                          };

            Value.Add(psf);
            Rfs.ProjectSpecificFiles = Value;
            ProjectManager.UpdateFileMembershipInProject(Rfs);
            ProjectManager.SaveProjects();
            GlueCommands.Self.RefreshCommands.RefreshPropertyGrid();
            RefreshList();
        }
        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
                {
                    ProjectId = cboProjectType.Text,
                    FilePath = createdFile
                };

                Value.Add(psf);
                Rfs.ProjectSpecificFiles = Value;
                ProjectManager.UpdateFileMembershipInProject(Rfs);
                ProjectManager.SaveProjects();
                GlueCommands.Self.RefreshCommands.RefreshPropertyGrid();

                RefreshList();
            }
        }