当前位置: 首页>>代码示例>>C#>>正文


C# ReferencedFileSave.GetAssetTypeInfo方法代码示例

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


在下文中一共展示了ReferencedFileSave.GetAssetTypeInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: GetIfShouldAddToManagers

        public static bool GetIfShouldAddToManagers(IElement saveObject, ReferencedFileSave referencedFile)
        {
            bool shouldAddToManagers = referencedFile.LoadedAtRuntime && !referencedFile.LoadedOnlyWhenReferenced;

            if (shouldAddToManagers)
            {
                AssetTypeInfo ati = referencedFile.GetAssetTypeInfo();

                // We don't want to add shared static stuff to the manager - it's just used to pull and clone objects out of.
                // Update September 12, 2012
                // We actually do want to add
                // static objects if they are part
                // of a Screen.
                shouldAddToManagers = ati != null &&
                    (!referencedFile.IsSharedStatic || saveObject is ScreenSave) &&
                    ati.AddToManagersMethod.Count != 0 && !string.IsNullOrEmpty(ati.AddToManagersMethod[0]) && referencedFile.AddToManagers;
            }
            return shouldAddToManagers;
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:19,代码来源:ReferencedFileSaveCodeGenerator.cs

示例3: GetAddToManagersForReferencedFile

        public static ICodeBlock GetAddToManagersForReferencedFile(IElement mSaveObject, ReferencedFileSave referencedFile)
        {
            bool shouldAddToManagers = GetIfShouldAddToManagers(mSaveObject, referencedFile);

            ICodeBlock codeBlock = new CodeDocument(3);

            // We don't want to add shared static stuff to the manager - it's just used to pull and clone objects out of.
            // Update September 12, 2012
            // We actually do want to add
            // static objects if they are part
            // of a Screen.
            if (shouldAddToManagers)
            {
                ICodeBlock currentBlock = codeBlock;

                AssetTypeInfo ati = referencedFile.GetAssetTypeInfo();
                string fileName = referencedFile.Name;

                AddIfConditionalSymbolIfNecesssary(codeBlock, referencedFile);

                string typeName = ati.RuntimeTypeName;
                string variableName = referencedFile.GetInstanceName();

                if (BaseElementTreeNode.IsOnOwnLayer(mSaveObject) && ati.LayeredAddToManagersMethod.Count != 0 && !string.IsNullOrEmpty(ati.LayeredAddToManagersMethod[0]))
                {
                    string layerAddToManagersMethod = ati.LayeredAddToManagersMethod[0];
                    if (mSaveObject is EntitySave)
                    {
                        layerAddToManagersMethod = layerAddToManagersMethod.Replace("mLayer", "layerToAddTo");
                    }

                    currentBlock.Line(layerAddToManagersMethod.Replace("this", variableName) + ";");
                }
                else if (ati.LayeredAddToManagersMethod.Count != 0 && !string.IsNullOrEmpty(ati.LayeredAddToManagersMethod[0]) && mSaveObject is ScreenSave)
                {
                    string layerAddToManagersMethod = ati.LayeredAddToManagersMethod[0];

                    // The Screen has an mLayer
                    //layerAddToManagersMethod = layerAddToManagersMethod.Replace("mLayer", "layerToAddTo");

                    currentBlock.Line(layerAddToManagersMethod.Replace("this", variableName) + ";");
                }
                else
                {
                    currentBlock.Line(ati.AddToManagersMethod[0].Replace("this", variableName) + ";");
                }

                if (referencedFile.IsManuallyUpdated && !string.IsNullOrEmpty(ati.MakeManuallyUpdatedMethod))
                {
                    currentBlock.Line(ati.MakeManuallyUpdatedMethod.Replace("this", variableName) + ";");
                }
                AddEndIfIfNecessary(codeBlock, referencedFile);
            }

            return codeBlock;
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:56,代码来源:ReferencedFileSaveCodeGenerator.cs

示例4: GetDestroyForReferencedFile

        protected ICodeBlock GetDestroyForReferencedFile(IElement element, ReferencedFileSave referencedFile)
        {
            ICodeBlock codeBlock = new CodeDocument(3);

            ///////////////////////////////EARLY OUT///////////////////////
            if (!referencedFile.LoadedAtRuntime || !referencedFile.DestroyOnUnload)
            {
                return codeBlock;
            }

            if (referencedFile.GetGeneratesMember() == false)
            {
                return codeBlock;
            }

            /////////////////////////////END EARLY OUT/////////////////////

            AddIfConditionalSymbolIfNecesssary(codeBlock, referencedFile);

            string fileName = referencedFile.Name;
            AssetTypeInfo ati = referencedFile.GetAssetTypeInfo();
            string variableName = referencedFile.GetInstanceName();

            bool isScreenSave = element is ScreenSave;
            if (referencedFile.LoadedOnlyWhenReferenced)
            {
                variableName = "m" + variableName;
                codeBlock = codeBlock.If(variableName + " != null");
            }
            if (ati != null && (!referencedFile.IsSharedStatic || isScreenSave))
            {
                string typeName = ati.RuntimeTypeName;
                string destroyMethod = ati.DestroyMethod;
                string recycleMethod = ati.RecycledDestroyMethod;
                if (string.IsNullOrEmpty(recycleMethod))
                {
                    recycleMethod = destroyMethod;
                }



                if (!string.IsNullOrEmpty(ati.DestroyMethod))
                {
                    if (isScreenSave && recycleMethod != destroyMethod)
                    {
                        codeBlock = codeBlock.If("this.UnloadsContentManagerWhenDestroyed && ContentManagerName != \"Global\"");
                        codeBlock.Line(destroyMethod.Replace("this", variableName) + ";");
                        if (referencedFile.LoadedOnlyWhenReferenced)
                        {
                            codeBlock = codeBlock.End().ElseIf(variableName + " != null");
                        }
                        else
                        {
                            codeBlock = codeBlock.End().Else();
                        }
                        codeBlock.Line(recycleMethod.Replace("this", variableName) + ";");
                        codeBlock = codeBlock.End();

                    }
                    else
                    {
                        codeBlock.Line(destroyMethod.Replace("this", variableName) + ";");
                    }
                }

                if (ati.ShouldBeDisposed && element.UseGlobalContent == false)
                {
                    codeBlock = codeBlock.If("this.UnloadsContentManagerWhenDestroyed && ContentManagerName != \"Global\"");
                    codeBlock.Line(string.Format("{0}.Dispose();", variableName));
                    codeBlock = codeBlock.End();
                }

                
            }

            if (element is ScreenSave && referencedFile.IsSharedStatic)
            {
                if (referencedFile.LoadedOnlyWhenReferenced)
                {
                    variableName = "m" + referencedFile.GetInstanceName();
                }
                // We used to do this here, but we want to do it after all Objects have been destroyed
                // because we may need to make the file one way before the destruction of the objects.

                if (ati != null && ati.SupportsMakeOneWay)
                {
                    codeBlock = codeBlock.If("this.UnloadsContentManagerWhenDestroyed && ContentManagerName != \"Global\"");
                    codeBlock.Line(string.Format("{0} = null;", variableName));
                    codeBlock = codeBlock.End().Else();
                    codeBlock.Line(string.Format("{0}.MakeOneWay();", variableName));
                    codeBlock = codeBlock.End();

                }
                else
                {
                    codeBlock.Line(string.Format("{0} = null;", variableName));

                }
            }

//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:101,代码来源:ReferencedFileSaveCodeGenerator.cs

示例5: GetPostCustomActivityForReferencedFile

        public static ICodeBlock GetPostCustomActivityForReferencedFile(ReferencedFileSave referencedFile)
        {
            ICodeBlock codeBlock = new CodeDocument();

            if (!referencedFile.LoadedAtRuntime)
            {
                return codeBlock;
            }

            AssetTypeInfo ati = referencedFile.GetAssetTypeInfo();

            // January 8, 2012
            // This used to not
            // check LoadedOnlyWhenReferenced
            // but I think it should otherwise
            // this code will always load Scenes
            // that are LoadedOnlyWhenReferenced by
            // calling their ManageAll method - so I
            // added a check for LoadedOnlyWhenReferenced.
            if (ati != null && !referencedFile.IsSharedStatic && !referencedFile.LoadedOnlyWhenReferenced && ati.AfterCustomActivityMethod != null)
            {
                AddIfConditionalSymbolIfNecesssary(codeBlock, referencedFile);
                string variableName = referencedFile.GetInstanceName();

                codeBlock.Line(ati.AfterCustomActivityMethod.Replace("this", variableName) + ";");
                AddEndIfIfNecessary(codeBlock, referencedFile);
                return codeBlock;
            }
            else
            {
                return codeBlock;
            }
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:33,代码来源:ReferencedFileSaveCodeGenerator.cs

示例6: GetPostInitializeForReferencedFile

        public static ICodeBlock GetPostInitializeForReferencedFile(ReferencedFileSave referencedFile)
        {
            AssetTypeInfo ati = referencedFile.GetAssetTypeInfo();
            ICodeBlock codeBlock = new CodeDocument();

            if (ati != null && !referencedFile.IsSharedStatic)
            {
                string variableName = referencedFile.GetInstanceName();
                if (!string.IsNullOrEmpty(ati.PostInitializeCode))
                {
                    codeBlock.Line(ati.PostInitializeCode.Replace("this", variableName) + ";");
                }
            }


            return codeBlock;
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:17,代码来源:ReferencedFileSaveCodeGenerator.cs

示例7: AddOrRemoveIndividualRfs

        private static bool AddOrRemoveIndividualRfs(ReferencedFileSave rfs, List<string> filesInModifiedRfs, ref bool shouldRemoveAndAdd, ProjectBase projectBase)
        {

            List<ProjectBase> projectsAlreadyModified = new List<ProjectBase>();

            bool usesContentPipeline = rfs.UseContentPipeline || rfs.GetAssetTypeInfo() != null && rfs.GetAssetTypeInfo().MustBeAddedToContentPipeline;

            if (rfs.GetAssetTypeInfo() != null && rfs.GetAssetTypeInfo().MustBeAddedToContentPipeline && rfs.UseContentPipeline == false)
            {
                rfs.UseContentPipeline = true;
                MessageBox.Show("The file " + rfs.Name + " must use the content pipeline");

            }
            else
            {
                string absoluteName = ProjectManager.MakeAbsolute(rfs.Name, true);

                shouldRemoveAndAdd = usesContentPipeline && !projectBase.IsFilePartOfProject(absoluteName, BuildItemMembershipType.CompileOrContentPipeline) ||
                    !usesContentPipeline && !projectBase.IsFilePartOfProject(absoluteName, BuildItemMembershipType.CopyIfNewer);

                if (shouldRemoveAndAdd)
                {
                    projectBase.RemoveItem(absoluteName);
                    projectBase.AddContentBuildItem(absoluteName, SyncedProjectRelativeType.Contained, usesContentPipeline);
                    projectsAlreadyModified.Add(projectBase);

                    #region Loop through all synced projects and add or remove the file referenced by the RFS

                    foreach (ProjectBase syncedProject in ProjectManager.SyncedProjects)
                    {

                        ProjectBase syncedContentProjectBase = syncedProject;
                        if (syncedProject.ContentProject != null)
                        {
                            syncedContentProjectBase = syncedProject.ContentProject;
                        }

                        if (!projectsAlreadyModified.Contains(syncedContentProjectBase))
                        {
                            projectsAlreadyModified.Add(syncedContentProjectBase);
                            syncedContentProjectBase.RemoveItem(absoluteName);

                            if (syncedContentProjectBase.SaveAsAbsoluteSyncedProject)
                            {
                                syncedContentProjectBase.AddContentBuildItem(absoluteName, SyncedProjectRelativeType.Contained, usesContentPipeline);

                            }
                            else
                            {
                                syncedContentProjectBase.AddContentBuildItem(absoluteName, SyncedProjectRelativeType.Linked, usesContentPipeline);
                            }
                        }
                    }
                    #endregion

                    List<string> filesReferencedByAsset = 
                        FileReferenceManager.Self.GetFilesReferencedBy(absoluteName, EditorObjects.Parsing.TopLevelOrRecursive.Recursive);

                    for (int i = 0; i < filesReferencedByAsset.Count; i++)
                    {
                        if (!filesInModifiedRfs.Contains(filesReferencedByAsset[i]))
                        {
                            filesInModifiedRfs.Add(filesReferencedByAsset[i]);
                        }
                    }
                }
            }
            return usesContentPipeline;
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:69,代码来源:ContentPipelineHelper.cs

示例8: AddCodeforFileLoad

        private static void AddCodeforFileLoad(ReferencedFileSave referencedFile, ref ICodeBlock codeBlock, 
            bool loadsUsingGlobalContentManager, ref bool directives, bool isProjectSpecific, 
            ref string fileName, ProjectBase project, LoadType loadType, string containerName)
        {
            if (project != null)
            {

                if (ProjectManager.IsContent(fileName))
                {
                    fileName = (ProjectManager.ContentProject.ContainedFilePrefix + fileName).ToLower();
                }

                if (isProjectSpecific)
                {
                    if (directives == true)
                    {
                        codeBlock = codeBlock.End()
                            .Line("#elif " + project.PrecompilerDirective)
                            .CodeBlockIndented();
                    }
                    else
                    {
                        directives = true;
                        codeBlock = codeBlock
                            .Line("#if " + project.PrecompilerDirective)
                            .CodeBlockIndented();
                    }
                }
                else
                {
                    if (directives == true)
                    {
                        codeBlock = codeBlock.End()
                            .Line("#else")
                            .CodeBlockIndented();
                    }
                }

                if (referencedFile.IsDatabaseForLocalizing)
                {
                    GenerateCodeForLocalizationDatabase(referencedFile, codeBlock, fileName, loadType);
                }
                else
                {
                    AssetTypeInfo ati = referencedFile.GetAssetTypeInfo();

                    // I think we can set the field rather than the property, and then Set() the MRE if necessary afterwards:
                    //string variableName = referencedFile.GetInstanceName();

                    string variableName = null;
                    if (NeedsFullProperty(referencedFile, containerName))
                    {
                        variableName = "m" + referencedFile.GetInstanceName();
                    }
                    else
                    {
                        variableName = referencedFile.GetInstanceName();
                    }

                    if (!referencedFile.IsCsvOrTreatedAsCsv && ati != null)
                    {
                        // If it's not a CSV, then we only support loading if the load type is complete
                        // I don't know if I'll want to change this (or if I can) in the future.
                        if (loadType == LoadType.CompleteLoad)
                        {
                            GenerateInitializationForAssetTypeInfoRfs(referencedFile, codeBlock, loadsUsingGlobalContentManager, variableName, fileName, ati, project);
                        }
                    }
                    else if(referencedFile.IsCsvOrTreatedAsCsv)
                    {
                        GenerateInitializationForCsvRfs(referencedFile, codeBlock, variableName, fileName, loadType);
                    }
                }


                NamedObjectSaveCodeGenerator.WriteTextSpecificInitialization(referencedFile, codeBlock);
            }
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:78,代码来源:ReferencedFileSaveCodeGenerator.cs

示例9: IsRfsOfType

        bool IsRfsOfType(ReferencedFileSave rfs, Type type)
        {
            AssetTypeInfo ati = rfs.GetAssetTypeInfo();

            if (ati != null)
            {
                return ati.QualifiedRuntimeTypeName.QualifiedType == type.FullName;
            }
            else
            {
                return false;
            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:13,代码来源:AvailableFileStringConverter.cs

示例10: UpdateIncludedAndExcluded

        private void UpdateIncludedAndExcluded(ReferencedFileSave instance)
        {
            ResetToDefault();

            AssetTypeInfo ati = instance.GetAssetTypeInfo();


            ExcludeMember("InvalidFileNameCharacters");
            ExcludeMember("ToStringDelegate");
            ExcludeMember("Properties");

            ContainerType containerType = instance.GetContainerType();

            if (containerType == ContainerType.Entity)
            {
                // We do this because this is set automatically if the Entity is unique
                ExcludeMember("IsSharedStatic");

                // We do this because whether the objects from a file are manually updated or not
                // should be up to the entity, not the source file.
                ExcludeMember("IsManuallyUpdated");
            }

            if (containerType == ContainerType.Entity || ati == null || ati.QualifiedRuntimeTypeName.QualifiedType != "Microsoft.Xna.Framework.Media.Song")
            {
                ExcludeMember("DestroyOnUnload");
            }

            #region Extension-based additions/removals
            string extension = FileManager.GetExtension(instance.Name);

            if (extension != "csv" && !instance.TreatAsCsv)
            {
                ExcludeMember("CreatesDictionary");
                ExcludeMember("IsDatabaseForLocalizing");
                ExcludeMember("UniformRowType");
            }
            else
            {
                IncludeMember("UniformRowType", typeof(ReferencedFileSave), new AvailablePrimitiveTypeArraysStringConverter());
            }

            if ((extension != "txt" && extension != "csv") ||
                (extension == "txt" && instance.TreatAsCsv == false)
                )
            {
                ExcludeMember("CsvDelimiter");
            }

            if (extension != "txt")
            {
                ExcludeMember("TreatAsCsv");
            }

            if (extension == "png")
            {
                Attribute[] fileDetailsCategoryAttribute = new Attribute[]{
                    new CategoryAttribute("File Details")};
                IncludeMember("ImageWidth", typeof(int), null, GetImageWidth, null, fileDetailsCategoryAttribute);
                IncludeMember("ImageHeight", typeof(int), null, GetImageHeight, null, fileDetailsCategoryAttribute);
            }

            if (extension == "emix")
            {
                Attribute[] fileDetailsCategoryAttribute = new Attribute[]{
                    new CategoryAttribute("File Details")};

                IncludeMember("EquilibriumParticleCount", typeof(float), null, GetEquilibriumParticleCount, null, fileDetailsCategoryAttribute);
                IncludeMember("BurstParticleCount", typeof(float), null, GetBurstParticleCount, null, fileDetailsCategoryAttribute);
                
            }

            #endregion

            AddProjectSpecificFileMember();


            if (!instance.LoadedAtRuntime)
            {
                ExcludeMember("IsSharedStatic");
                ExcludeMember("IsManuallyUpdated");
                ExcludeMember("LoadedOnlyWhenReferenced");
                ExcludeMember("HasPublicProperty");
                ExcludeMember("InstanceName");
                ExcludeMember("IncludeDirectoryRelativeToContainer");
            }

            if (ati == null || string.IsNullOrEmpty(ati.MakeManuallyUpdatedMethod))
            {
                ExcludeMember("IsManuallyUpdated");
            }

            if (!instance.GetCanUseContentPipeline())
            {
                ExcludeMember("UseContentPipeline");
            }
            if (!instance.UseContentPipeline || ati.QualifiedRuntimeTypeName.QualifiedType != "Microsoft.Xna.Framework.Graphics.Texture2D")
            {
                ExcludeMember("TextureFormat");
            }
//.........这里部分代码省略.........
开发者ID:GorillaOne,项目名称:FlatRedBall,代码行数:101,代码来源:ReferencedFileSavePropertyGridDisplayer.cs

示例11: WriteTextSpecificInitialization

        public static void WriteTextSpecificInitialization(ReferencedFileSave rfs, ICodeBlock codeBlock)
        {
            AssetTypeInfo ati = rfs.GetAssetTypeInfo();

            if (ati != null)
            {
                if (ati.QualifiedRuntimeTypeName.QualifiedType == "FlatRedBall.Scene" && !rfs.IsSharedStatic && ObjectFinder.Self.GlueProject.UsesTranslation)
                {
                    WriteTextInitializationLoopForScene(codeBlock, FileManager.RemovePath(FileManager.RemoveExtension(rfs.Name)));
                }
            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:12,代码来源:NamedObjectSaveCodeGenerator.cs

示例12: WriteMethodForClone

        private static string WriteMethodForClone(NamedObjectSave namedObject, ICodeBlock codeBlock,
            List<string[]> referencedFilesAlreadyUsingFullFile, AssetTypeInfo nosAti, string objectName,
            ReferencedFileSave rfs, IElement container, string containerName, string overridingName)
        {
            int lastParen = namedObject.SourceName.LastIndexOf(" (");
            string nameOfSourceInContainer = namedObject.SourceName.Substring(0, lastParen);
            // This could have a quote in the name.  If so we want to escape it since this will be put in code:
            nameOfSourceInContainer = nameOfSourceInContainer.Replace("\"", "\\\"");

            string cloneString = ".Clone()";

            string namedObjectToPullFrom = null;
            foreach (string[] stringPair in referencedFilesAlreadyUsingFullFile)
            {
                if (rfs != null && stringPair[0] == rfs.Name && !namedObject.SourceName.StartsWith("Entire File ("))
                {
                    namedObjectToPullFrom = stringPair[1];
                    break;
                }
            }

            // September 30, 2012
            // Now all files - whether
            // they are part of an Entity
            // or part of a Screen, are static.
            // This means that the rfs.IsSharedStatic
            // check will usually fail.  However, Screens
            // will still add to managers even for static
            // object, so we want to make sure that we don't
            // clone an object already added to managers, so we
            // need the last check to see if the container is a ScreenSave.
            if (nosAti == null || !nosAti.CanBeCloned || namedObjectToPullFrom != null || (rfs != null && rfs.IsSharedStatic == false) || container is ScreenSave)
            {
                cloneString = "";
            }

            if (nosAti != null && !string.IsNullOrEmpty(nosAti.CustomCloneMethod))
            {
                cloneString = nosAti.CustomCloneMethod;

            }
            AssetTypeInfo rfsAti = null;
            if (rfs != null)
            {
                rfsAti = rfs.GetAssetTypeInfo();
            }

            bool usesFullConversion = false;

            if (rfsAti != null && rfsAti.Conversion.Count != 0)
            {
                var foundConversion = rfsAti.Conversion.FirstOrDefault(item => item.ToType == namedObject.InstanceType);

                if (foundConversion != null)
                {
                    cloneString = foundConversion.ConversionPattern.Replace("{NEW}", objectName);
                    cloneString = cloneString.Replace("{THIS}", rfs.GetInstanceName());
                    usesFullConversion = true;
                }
            }

            if (namedObjectToPullFrom != null)
            {
                containerName = namedObjectToPullFrom;
            }
            if (!string.IsNullOrEmpty(overridingName))
            {
                containerName = overridingName;
            }

            string listMemberName = ContentParser.GetMemberNameForList(FileManager.GetExtension(namedObject.SourceFile), namedObject.InstanceType);

            if (!string.IsNullOrEmpty(listMemberName))
            {
                listMemberName += ".";
            }

            if (nameOfSourceInContainer == "Entire File" && string.IsNullOrEmpty(listMemberName))
            {
                if (usesFullConversion)
                {
                    codeBlock.Line(cloneString + ";");
                }
                else if (cloneString.Contains("{THIS}"))
                {
                    string entireString = cloneString.Replace("{THIS}", objectName);
                    entireString = entireString.Replace("{SOURCE_FILE}", containerName);

                    codeBlock.Line(entireString);
                }
                else
                {
                    codeBlock.Line(string.Format("{0} = {1}{2};",
                                                 objectName,
                                                 containerName,
                                                 cloneString));
                }
            }
            else
            {
//.........这里部分代码省略.........
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:101,代码来源:NamedObjectSaveCodeGenerator.cs

示例13: GetTextureFormatTag

        private static string GetTextureFormatTag(ReferencedFileSave rfs)
        {
            if (rfs.GetAssetTypeInfo() != null && rfs.GetAssetTypeInfo().RuntimeTypeName == "Texture2D")
            {
                return "ProcessorParameters_TextureFormat";
            }
            else
            {
                return "ProcessorParameters_TextureProcessorOutputFormat";
            }

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

示例14: UpdateTextureFormatFor

        public static void UpdateTextureFormatFor(ReferencedFileSave rfs)
        {
            string absoluteName = ProjectManager.MakeAbsolute(rfs.Name, true);

            bool usesContentPipeline = rfs.UseContentPipeline || rfs.GetAssetTypeInfo() != null && rfs.GetAssetTypeInfo().MustBeAddedToContentPipeline;

            string parameterTag = GetTextureFormatTag(rfs);
            string valueToSet = rfs.TextureFormat.ToString();

            SetParameterOnBuildItems(absoluteName, parameterTag, valueToSet);
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:11,代码来源:ContentPipelineHelper.cs

示例15: GenerateConvertToManuallyUpdated

        public static void GenerateConvertToManuallyUpdated(ICodeBlock currentBlock, ReferencedFileSave rfs)
        {
            if (rfs.LoadedAtRuntime && !rfs.LoadedOnlyWhenReferenced)
            {
                AssetTypeInfo ati = rfs.GetAssetTypeInfo();

                if (!rfs.IsSharedStatic && ati != null && !string.IsNullOrEmpty(ati.MakeManuallyUpdatedMethod))
                {
                    AddIfConditionalSymbolIfNecesssary(currentBlock, rfs);
                    currentBlock.Line(ati.MakeManuallyUpdatedMethod.Replace("this", rfs.GetInstanceName()) + ";");
                    AddEndIfIfNecessary(currentBlock, rfs);
                }
            }
        }
开发者ID:gitter-badger,项目名称:FlatRedBall,代码行数:14,代码来源:ReferencedFileSaveCodeGenerator.cs


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