• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SaveClasses.ReferencedFileSave类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中FlatRedBall.Glue.SaveClasses.ReferencedFileSave的典型用法代码示例。如果您正苦于以下问题:C# ReferencedFileSave类的具体用法?C# ReferencedFileSave怎么用?C# ReferencedFileSave使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReferencedFileSave类属于FlatRedBall.Glue.SaveClasses命名空间,在下文中一共展示了ReferencedFileSave类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AdjustDataFilesIfIsCsv

        public static void AdjustDataFilesIfIsCsv(string oldName, ReferencedFileSave rfs)
        {
            // We'll remove the old file from the project, delete it, then have the RFS regenerate/add the new one to the project

            //////////////Early Out///////////////////

            if (!rfs.IsCsvOrTreatedAsCsv || UsesAlterntaiveClass(rfs))
            {
                return;
            }
            ////////////End Early Out/////////////////
            string className = rfs.GetTypeForCsvFile(oldName);

            string whatToRemove = "DataTypes/" + className + ".Generated.cs";
            ProjectManager.ProjectBase.RemoveItem(whatToRemove);
            string fileToDelete = whatToRemove;
            fileToDelete = ProjectManager.MakeAbsolute(fileToDelete);
            if (System.IO.File.Exists(fileToDelete))
            {
                try
                {
                    FileHelper.DeleteFile(fileToDelete);
                }
                catch (Exception e)
                {
                    GlueGui.ShowMessageBox("Could not delete the file " + fileToDelete + "\n\nThe file is no longer referneced by the project so it is not necessary to delete this file manually.");
                }
            }

            CsvCodeGenerator.GenerateAndSaveDataClass(rfs, rfs.CsvDelimiter);
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:31,代码来源:ReferencedFileSaveSetVariableLogic.cs


示例2: GetTreeNodeFor

        private TreeNode GetTreeNodeFor(ReferencedFileSave referencedFileSave, string currentPath, TreeNode treeNode)
        {

            return null;


		}
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:7,代码来源:ReferencedFileListTreeNode.cs


示例3: GetMemberNamesFrom

        internal static List<string> GetMemberNamesFrom(ReferencedFileSave rfs)
        {
            List<string> toReturn = new List<string>();
                
                        
            string fileName = rfs.Name;
            fileName = ProjectManager.MakeAbsolute(fileName);

            RuntimeCsvRepresentation rcr = CsvFileManager.CsvDeserializeToRuntime(
                fileName);

                            
            for (int i = 0; i < rcr.Headers.Length; i++)
            {
                string memberName = rcr.Headers[i].Name;

                if (memberName.Trim().StartsWith("//"))
                {
                    continue;
                }

                memberName = StringFunctions.RemoveWhitespace(memberName); 

                if (memberName.Contains("("))
                {
                    memberName = memberName.Substring(0, memberName.IndexOfAny(new char[] { '(' }));
                }

                toReturn.Add(memberName);
            }


            return toReturn;
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:34,代码来源:CsvCodeGenerator.cs


示例4: CreateZip

        public static string CreateZip(ReferencedFileSave rfs)
        {
            string absoluteFile = ProjectManager.MakeAbsolute(rfs.Name, true);

            List<string> allFiles = FileReferenceManager.Self.GetFilesReferencedBy(
                absoluteFile, TopLevelOrRecursive.Recursive);

            #region Check for relative files

            string directoryOfMainFile = FileManager.GetDirectory(absoluteFile);
            bool areAnyFilesOutsideOfMainDirectory = false;
            foreach (string referencedFile in allFiles)
            {
                if (!FileManager.IsRelativeTo(referencedFile, directoryOfMainFile))
                {
                    areAnyFilesOutsideOfMainDirectory = true;
                    break;
                }
            }


            #endregion
            string outputFile;

            if (areAnyFilesOutsideOfMainDirectory)
            {
                outputFile = null;    
            }
            else
            {
                allFiles.Add(absoluteFile);

                string extension = FileManager.GetExtension(rfs.Name);
                string newExtension = "zip";
                if (extension.Length == 4 && extension[3] == 'x')
                {
                    newExtension = extension.Substring(0, 3) + 'z';
                }

                outputFile = FileManager.RemoveExtension(absoluteFile) + "." + newExtension;

                using (ZipFile zip = new ZipFile())
                {
                    foreach (string fileToAdd in allFiles)
                    {
                        string directory = FileManager.MakeRelative(FileManager.GetDirectory(fileToAdd), directoryOfMainFile);
                        if (directory.EndsWith("/"))
                        {
                            directory = directory.Substring(0, directory.Length - 1);
                        }

                        zip.AddFile(fileToAdd, directory);
                    }

                    zip.Save(outputFile);
                }
            }
            return outputFile;
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:59,代码来源:Zipper.cs


示例5: GenerateTimedEmit

 public static void GenerateTimedEmit(ICodeBlock codeBlock, ReferencedFileSave rfs, IElement element)
 {
     if (rfs.LoadedAtRuntime && !rfs.LoadedOnlyWhenReferenced && (element is ScreenSave || rfs.IsSharedStatic == false)
         && !string.IsNullOrEmpty(rfs.Name) && FileManager.GetExtension(rfs.Name) == "emix")
     {
         codeBlock.Line(rfs.GetInstanceName() + ".TimedEmit();");
     }
 }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:8,代码来源:ParticleCodeGenerator.cs


示例6: Select

        public void Select(ReferencedFileSave referencedFile, string objectInFile = null)
        {
            // first let's select it:
            GlueState.Self.CurrentReferencedFileSave = referencedFile;

            // Next lets tell the plugin manager to try to find this object:
            if( string.IsNullOrEmpty(objectInFile) == false)
            {
                PluginManager.SelectItemInCurrentFile(objectInFile);
            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:11,代码来源:SelectCommands.cs


示例7: CreateCsvContainerEntitySave

        private void CreateCsvContainerEntitySave()
        {
            mCsvContainerEntitySave = new EntitySave();
            mCsvContainerEntitySave.Name = "CsvContainerEntityInExposedVariableTests";
            ObjectFinder.Self.GlueProject.Entities.Add(mCsvContainerEntitySave);

            ReferencedFileSave rfs = new ReferencedFileSave();
            rfs.SourceFile = "Whatever.csv";
            rfs.Name = "Whatever.csv";
            mCsvContainerEntitySave.ReferencedFiles.Add(rfs);
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:11,代码来源:ExposedVariableTests.cs


示例8: RenameReferencedFile

        public static void RenameReferencedFile(string oldName, string newName, ReferencedFileSave rfs, IElement container)
        {
            string oldDirectory = FileManager.GetDirectory(oldName);
            string newDirectory = FileManager.GetDirectory(newName);
            string newFileNameAbsolute = ProjectManager.MakeAbsolute(newName);
            string instanceName = FileManager.RemovePath(FileManager.RemoveExtension(newName));
            string whyIsntValid;
            if (oldDirectory != newDirectory)
            {
                MessageBox.Show("The old file was located in \n" + oldDirectory + "\n" +
                    "The new file is located in \n" + newDirectory + "\n" +
                    "Currently Glue does not support changing directories.", "Warning");

                rfs.SetNameNoCall(oldName);
            }
            else if (NameVerifier.IsReferencedFileNameValid(instanceName, rfs.GetAssetTypeInfo(), rfs, container, out whyIsntValid) == false)
            {
                MessageBox.Show(whyIsntValid);
                rfs.SetNameNoCall(oldName);

            }
            else
            {
                bool shouldMove = true;
                bool shouldContinue = true;

                CheckForExistingFileOfSameName(oldName, rfs, newFileNameAbsolute, ref shouldMove, ref shouldContinue);

                if (shouldContinue)
                {
                    MoveFileIfNecessary(oldName, newName, shouldMove);

                    string rfsType = rfs.RuntimeType;
                    if (rfsType != null && rfsType.Contains("."))
                    {
                        // We dont want the fully qualified type.
                        rfsType = FileManager.GetExtension(rfsType);
                    }
                    UpdateObjectsUsingFile(container, oldName, rfs, rfsType);

                    RegenerateCodeAndUpdateUiAccordingToRfsRename(oldName, newName, rfs);

                    UpdateBuildItemsForRenamedRfs(oldName, newName);

                    AdjustDataFilesIfIsCsv(oldName, rfs);

                    GluxCommands.Self.SaveGlux();

                    ProjectManager.SaveProjects();
                }
            }
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:52,代码来源:ReferencedFileSaveSetVariableLogic.cs


示例9: GetDictionaryTypes

        public static void GetDictionaryTypes(ReferencedFileSave referencedFileSave, out string keyType, out string valueType)
        {
            valueType = referencedFileSave.GetTypeForCsvFile();

            // To know the value type, we gotta pop this bad boy open and find the first requied type
            keyType = null;

            char oldDelimiter = CsvFileManager.Delimiter;

            switch (referencedFileSave.CsvDelimiter)
            {
                case AvailableDelimiters.Comma:
                    CsvFileManager.Delimiter = ',';
                    break;
                case AvailableDelimiters.Tab:
                    CsvFileManager.Delimiter = '\t';
                    break;
                case AvailableDelimiters.Pipe:
                    CsvFileManager.Delimiter = '|';
                    break;
            }

            string absoluteFileName = ProjectManager.MakeAbsolute(referencedFileSave.Name);

            // If the file doesn't exist this will generate bad code.  But this isn't
            // considered a silent failure because Glue will raise flags about missing
            // files earlier (like when it first starts up).  We don't want to crash the
            // entire application in this case.
            if (System.IO.File.Exists(absoluteFileName))
            {
                RuntimeCsvRepresentation rcr = CsvFileManager.CsvDeserializeToRuntime(absoluteFileName);

                // See if any of the headers are required
                foreach (CsvHeader header in rcr.Headers)
                {
                    int indexOfOpeningParen = header.Name.IndexOf("(");

                    if (indexOfOpeningParen != -1)
                    {
                        if (header.Name.IndexOf("required", indexOfOpeningParen) != -1)
                        {
                            keyType = CsvHeader.GetClassNameFromHeader(header.Name);
                            break;
                        }
                    }
                }
            }

            CsvFileManager.Delimiter = oldDelimiter;
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:50,代码来源:CsvCodeGenerator.cs


示例10: SetFrom

        public void SetFrom(ReferencedFileSave rfs)
        {
            backingData = rfs;

            foreach(var project in GlueState.Self.GetProjects())
            {
                var projectName = project.Name;

                var settings = new IndividualProjectSetting();
                settings.ProjectName = projectName;
                settings.IsEnabled = backingData.ProjectsToExcludeFrom.Contains(projectName) == false;
                settings.PropertyChanged += HandlePropertyChanged;

                ProjectSettings.Add(settings);
            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:16,代码来源:FileExclusionViewModel.cs


示例11: ExcludeFileFromProject

        private static void ExcludeFileFromProject(string projectName, ReferencedFileSave rfs)
        {
            rfs.ProjectsToExcludeFrom.Add(projectName);

            var syncedProject = GlueState.Self.GetProjects().FirstOrDefault(item => item.Name == projectName);

            if(syncedProject != null)
            {
                string absolute = GlueCommands.Self.GetAbsoluteFileName(rfs);
                syncedProject.RemoveItem(absolute);
                if (syncedProject.ContentProject != null)
                {
                    syncedProject.ContentProject.RemoveItem(absolute);
                }
            }
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:16,代码来源:FileExclusionViewModel.cs


示例12: PopulateWithReferencesTo

        public void PopulateWithReferencesTo(ReferencedFileSave rfs)
        {
            List<IElement> elements = ObjectFinder.Self.GetAllElementsReferencingFile(rfs.Name);

            foreach (IElement element in elements)
            {
                var rfsInThisElement = element.GetReferencedFileSave(rfs.Name);
                listBox1.Items.Add(rfsInThisElement);

                foreach(var namedObject in element.AllNamedObjects)
                {
                    if(namedObject.SourceType == SourceType.File &&
                        namedObject.SourceFile == rfsInThisElement.Name)
                    {
                        listBox1.Items.Add(namedObject);
                    }
                }
            }

            // If this is a CSV, then loop through all of the variables and see if any of them use this type
            if (rfs.IsCsvOrTreatedAsCsv)
            {
                string className = rfs.Name;
                CustomClassSave customClass = ObjectFinder.Self.GlueProject.GetCustomClassReferencingFile(rfs.Name);
                if (customClass != null)
                {
                    className = customClass.Name;
                }

                foreach (IElement element in ObjectFinder.Self.GlueProject.Screens)
                {
                    foreach (CustomVariable customVariable in element.CustomVariables.Where(customVariable => customVariable.Type == className))
                    {
                        listBox1.Items.Add(customVariable);
                    }
                }
                foreach (IElement element in ObjectFinder.Self.GlueProject.Entities)
                {
                    foreach (CustomVariable customVariable in element.CustomVariables.Where(customVariable => customVariable.Type == className))
                    {
                        listBox1.Items.Add(customVariable);
                    }
                }
            }

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:46,代码来源:ElementReferenceListWindow.cs


示例13: CopyToBuildFolder

        public void CopyToBuildFolder(ReferencedFileSave rfs)
        {
            string projectName = FileManager.RemovePath(FileManager.RemoveExtension(GlueState.Self.CurrentGlueProjectFileName));
            string buildFolder = FileManager.GetDirectory(GlueState.Self.CurrentGlueProjectFileName) + "bin/x86/debug/Content/";

            string destination = buildFolder + rfs.Name;
            string source = ProjectManager.ContentDirectory + rfs.Name;

            try
            {
                System.IO.File.Copy(source, destination, true);

                PluginManager.ReceiveOutput("Copied " + source + " ==> " + destination);
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show("Error copying file:\n\n" + e.ToString());

            }
        }
开发者ID:GorillaOne,项目名称:FlatRedBall,代码行数:20,代码来源:ProjectCommands.cs


示例14: Initialize

        public void Initialize()
        {

            // Couldn't run tests here because it requires FRB to be initialized.  
            OverallInitializer.Initialize();

            mBaseEntity = new EntitySave();
            mBaseEntity.Name = "ReferencedFileSaveTestsBaseEntity";

            ReferencedFileSave rfs = new ReferencedFileSave();


            ObjectFinder.Self.GlueProject.Entities.Add(mBaseEntity);

            mDerivedEntity = new EntitySave();
            mDerivedEntity.Name = "ReferencedFileSaveTestsDerivedEntity";
            mDerivedEntity.BaseEntity = mBaseEntity.Name;
            ObjectFinder.Self.GlueProject.Entities.Add(mDerivedEntity);

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:20,代码来源:ReferencedFileSaveTests.cs


示例15: ContainsRecursively

        public static bool ContainsRecursively(this IElement element, ReferencedFileSave whatToLookFor)
        {
            foreach (ReferencedFileSave rfs in element.ReferencedFiles)
            {
                if (rfs == whatToLookFor)
                {
                    return true;
                }
            }

            if (!string.IsNullOrEmpty(element.BaseElement))
            {
                IElement baseElement = ObjectFinder.Self.GetIElement(element.BaseElement);
                if (baseElement != null)
                {
                    return baseElement.ContainsRecursively(whatToLookFor);
                }
            }
            return false;
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:20,代码来源:IElementHelper.cs


示例16: TestReferencedFileSave

        public void TestReferencedFileSave()
        {
            EntitySave entitySave = new EntitySave();

            ReferencedFileSave rfs = new ReferencedFileSave();
            rfs.Name = "File.png";
            entitySave.ReferencedFiles.Add(rfs);

            string whyNot;
            NameVerifier.IsReferencedFileNameValid("File", null, null, entitySave, out whyNot);
            if(string.IsNullOrEmpty(whyNot))
            {
                throw new Exception("Same-named files shouldn't be allowed, but the NameVerifier allows it.");
            }

            NameVerifier.IsReferencedFileNameValid("File.wav", null, null, entitySave, out whyNot);
            if (string.IsNullOrEmpty(whyNot))
            {
                throw new Exception("Same-named files shouldn't be allowed, but the NameVerifier allows it.");
            }

            NameVerifier.IsReferencedFileNameValid("Folder/File.wav", null, null, entitySave, out whyNot);
            if (string.IsNullOrEmpty(whyNot))
            {
                throw new Exception("Same-named files shouldn't be allowed, but the NameVerifier allows it.");
            }

            NameVerifier.IsReferencedFileNameValid("Folder/File", null, null, entitySave, out whyNot);
            if (string.IsNullOrEmpty(whyNot))
            {
                throw new Exception("Same-named files shouldn't be allowed, but the NameVerifier allows it.");
            }

            NameVerifier.IsReferencedFileNameValid("if", null, null, entitySave, out whyNot);
            if (string.IsNullOrEmpty(whyNot))
            {
                throw new Exception("'if' is a reserved keyword and should not be allowed as a file name");
            }

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:40,代码来源:NameVerifierTests.cs


示例17: SelectFile

        public void SelectFile(ReferencedFileSave rfs)
        {
            // see if this has a created class
            var customClass = ObjectFinder.Self.GetCustomClassFor(rfs);

            TreeNode treeNodeToSelect = null;

            if(customClass != null)
            {
                var treeNode = this.TreeView.Nodes
                    .FirstOrDefault(item => item.Tag == customClass);

                if(treeNode != null)
                {
                    var subnode = treeNode.Nodes
                        .FirstOrDefault(item => item.Text == rfs.Name);

                    treeNodeToSelect = subnode;
                }
            }
            
            TreeView.SelectedNode = treeNodeToSelect;
        }
开发者ID:GorillaOne,项目名称:FlatRedBall,代码行数:23,代码来源:CustomClassWindow.cs


示例18: RemoveReferencedFile

 public void RemoveReferencedFile(ReferencedFileSave referencedFileToRemove, List<string> additionalFilesToRemove)
 {
     RemoveReferencedFile(referencedFileToRemove, additionalFilesToRemove, true);
 }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:4,代码来源:GluxCommands.cs


示例19: ApplyOptions

 private static void ApplyOptions(ReferencedFileSave toReturn, string options)
 {
     if (toReturn.IsCsvOrTreatedAsCsv)
     {
         toReturn.CreatesDictionary = options == "Dictionary";
     }
 }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:7,代码来源:GluxCommands.cs


示例20: ReferencedFileSaveTreeNode

        public TreeNode ReferencedFileSaveTreeNode(ReferencedFileSave referencedFileSave)
        {
            IElement container = referencedFileSave.GetContainer();

            if (container == null)
            {
                return TreeNodeByTagIn(referencedFileSave, ElementViewWindow.GlobalContentFileNode.Nodes);
            }
            else if (container is ScreenSave)
            {
                ScreenTreeNode screenTreeNode = GlueState.Self.Find.ScreenTreeNode((ScreenSave)container);
                return screenTreeNode.GetTreeNodeFor(referencedFileSave);
            }
            else if (container is EntitySave)
            {
                EntityTreeNode entityTreeNode = GlueState.Self.Find.EntityTreeNode((EntitySave)container);
                return entityTreeNode.GetTreeNodeFor(referencedFileSave);
            }

            return null;

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:22,代码来源:FindManager.cs



注:本文中的FlatRedBall.Glue.SaveClasses.ReferencedFileSave类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Gui.Window类代码示例发布时间:2022-05-24
下一篇:
C# SaveClasses.NamedObjectSave类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap