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


C# UFile.GetFileName方法代码示例

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


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

示例1: Import

        public override IEnumerable<AssetItem> Import(UFile rawAssetPath, AssetImporterParameters importParameters)
        {
            var asset = new TextureAsset { Source = rawAssetPath };

            // Creates the url to the texture
            var textureUrl = new UFile(rawAssetPath.GetFileName(), null);

            yield return new AssetItem(textureUrl, asset);
        }
开发者ID:releed,项目名称:paradox,代码行数:9,代码来源:TextureImporter.cs

示例2: ImportTextures

        private static void ImportTextures(IEnumerable<string> textureDependencies, List<AssetItem> assetReferences)
        {
            if (textureDependencies == null)
                return;

            foreach (var textureFullPath in textureDependencies.Distinct(x => x))
            {
                var texturePath = new UFile(textureFullPath);

                var source = texturePath;
                var texture = new TextureAsset { Source = source, PremultiplyAlpha = false };

                // Create asset reference
                assetReferences.Add(new AssetItem(texturePath.GetFileName(), texture));
            }
        }
开发者ID:robterrell,项目名称:paradox,代码行数:16,代码来源:ModelAssetImporter.cs

示例3: Import

        public override IEnumerable<AssetItem> Import(UFile rawAssetPath, AssetImporterParameters importParameters)
        {
            // Creates the url to the texture
            var asset = new AssetImportObjectTest
                {
                    Source = rawAssetPath, 
                    Name = rawAssetPath.GetFileName() + "Name"
                };

            var assetUrl = new UFile(rawAssetPath.GetFileName(), null);

            // Emulate a change in a sub-asset
            var subAsset = new AssetObjectTestSub() { Value = value };
            value++;

            var subAssetItem = new AssetItem(rawAssetPath.GetFileName() + "_SubAsset", subAsset);

            asset.References.Add("Test", new AssetReference<AssetObjectTestSub>(subAsset.Id, subAssetItem.Location));

            var list = new List<AssetItem>
                {
                    new AssetItem(assetUrl, asset),
                    subAssetItem
                };

            return list;
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:27,代码来源:TestAssetImport.cs

示例4: ImportAnimation

        private static void ImportAnimation(List<AssetItem> assetReferences, UFile localPath, List<string> animationNodes, bool shouldPostFixName)
        {
            if (animationNodes != null && animationNodes.Count > 0)
            {
                var assetSource = localPath;

                var asset = new AnimationAsset { Source = assetSource };
                var animUrl = localPath.GetFileName() + (shouldPostFixName? " Animation": "");

                assetReferences.Add(new AssetItem(animUrl, asset));
            }
        }
开发者ID:robterrell,项目名称:paradox,代码行数:12,代码来源:ModelAssetImporter.cs

示例5: ImportModel

        private static AssetItem ImportModel(List<AssetItem> assetReferences, UFile assetSource, UFile localPath, EntityInfo entityInfo, bool shouldPostFixName)
        {
            var asset = new ModelAsset { Source = assetSource };

            if (entityInfo.Models != null)
            {
                var loadedMaterials = assetReferences.Where(x => x.Asset is MaterialAsset).ToList();
                foreach (var material in entityInfo.Materials)
                {
                    var foundMaterial = loadedMaterials.FirstOrDefault(x => x.Location == new UFile(material.Key, null));
                    if (foundMaterial != null)
                        asset.Materials.Add(new ModelMaterial { Name = material.Key, MaterialInstance = new MaterialInstance() { Material = AttachedReferenceManager.CreateSerializableVersion<Material>(foundMaterial.Id, foundMaterial.Location) } });
                }
            }

            if (entityInfo.Nodes != null)
            {
                foreach (var node in entityInfo.Nodes)
                    asset.Nodes.Add(new NodeInformation(node.Name, node.Depth, node.Preserve));
            }

            if (entityInfo.AnimationNodes != null && entityInfo.AnimationNodes.Count > 0)
                asset.PreserveNodes(entityInfo.AnimationNodes);

            var modelUrl = new UFile(localPath.GetFileName() + (shouldPostFixName?" Model": ""), null);
            var assetItem = new AssetItem(modelUrl, asset);
            assetReferences.Add(assetItem);
            return assetItem;
        }
开发者ID:robterrell,项目名称:paradox,代码行数:29,代码来源:ModelAssetImporter.cs

示例6: ImportAnimation

        private static void ImportAnimation(List<AssetItem> assetReferences, UFile localPath, List<string> animationNodes, bool shouldPostFixName, AssetItem skeletonAsset)
        {
            if (animationNodes != null && animationNodes.Count > 0)
            {
                var assetSource = localPath;

                var asset = new AnimationAsset { Source = assetSource };
                var animUrl = localPath.GetFileName() + (shouldPostFixName ? " Animation" : "");

                if (skeletonAsset != null)
                    asset.Skeleton = AttachedReferenceManager.CreateProxyObject<Skeleton>(skeletonAsset.Id, skeletonAsset.Location);

                assetReferences.Add(new AssetItem(animUrl, asset));
            }
        }
开发者ID:cg123,项目名称:xenko,代码行数:15,代码来源:ModelAssetImporter.cs

示例7: ImportModel

        private static AssetItem ImportModel(List<AssetItem> assetReferences, UFile assetSource, UFile localPath, EntityInfo entityInfo, bool shouldPostFixName, AssetItem skeletonAsset)
        {
            var asset = new ModelAsset { Source = assetSource };

            if (entityInfo.Models != null)
            {
                var loadedMaterials = assetReferences.Where(x => x.Asset is MaterialAsset).ToList();
                foreach (var material in entityInfo.Materials)
                {
                    var modelMaterial = new ModelMaterial
                    {
                        Name = material.Key,
                        MaterialInstance = new MaterialInstance()
                    };
                    var foundMaterial = loadedMaterials.FirstOrDefault(x => x.Location == new UFile(material.Key));
                    if (foundMaterial != null)
                    {
                        var reference = AttachedReferenceManager.CreateProxyObject<Material>(foundMaterial.Id, foundMaterial.Location);
                        modelMaterial.MaterialInstance.Material = reference;
                    }
                    //todo Instead of null material add a default xenko material
                    asset.Materials.Add(AttachId(modelMaterial));
                }
                //handle the case where during import we imported no materials at all
                //todo Instead of null material add a default xenko material
                if (entityInfo.Materials.Count == 0)
                {
                    var modelMaterial = new ModelMaterial { Name = "Material", MaterialInstance = new MaterialInstance() };
                    asset.Materials.Add(AttachId(modelMaterial));
                }
            }

            if (skeletonAsset != null)
                asset.Skeleton = AttachedReferenceManager.CreateProxyObject<Skeleton>(skeletonAsset.Id, skeletonAsset.Location);

            var modelUrl = new UFile(localPath.GetFileName() + (shouldPostFixName?" Model": ""));
            var assetItem = new AssetItem(modelUrl, asset);
            assetReferences.Add(assetItem);
            return assetItem;
        }
开发者ID:cg123,项目名称:xenko,代码行数:40,代码来源:ModelAssetImporter.cs

示例8: ImportSkeleton

        private static AssetItem ImportSkeleton(List<AssetItem> assetReferences, UFile assetSource, UFile localPath, EntityInfo entityInfo)
        {
            var asset = new SkeletonAsset { Source = assetSource };

            if (entityInfo.Nodes != null)
            {
                foreach (var node in entityInfo.Nodes)
                    asset.Nodes.Add(new NodeInformation(node.Name, node.Depth, node.Preserve));
            }

            if (entityInfo.AnimationNodes != null && entityInfo.AnimationNodes.Count > 0)
                asset.PreserveNodes(entityInfo.AnimationNodes);

            var skeletonUrl = new UFile(localPath.GetFileName() + " Skeleton", null);
            var assetItem = new AssetItem(skeletonUrl, asset);
            assetReferences.Add(assetItem);
            return assetItem;
        }
开发者ID:joewan,项目名称:xenko,代码行数:18,代码来源:ModelAssetImporter.cs

示例9: ImportSkeleton

        private static AssetItem ImportSkeleton(List<AssetItem> assetReferences, UFile assetSource, UFile localPath, EntityInfo entityInfo)
        {
            var asset = new SkeletonAsset { Source = assetSource };

            if (entityInfo.Nodes != null)
            {
                for (int i = 0; i < entityInfo.Nodes.Count; i++)
                {
                    var node = entityInfo.Nodes[i];
                    var nodeInfo = new NodeInformation(node.Name, node.Depth, node.Preserve);

                    // Try to keep identifier id consistent
                    // TODO: We might remove this as we don't expect Skeleton asset to be inherited, but they could
                    int sameNameAndDepthCount = 0;
                    for (int j = 0; j < i; j++)
                    {
                        var againstNode = entityInfo.Nodes[i];
                        // If we found a node with the same name and depth, we use a increment a counter
                        if (againstNode.Name == node.Name && againstNode.Depth == node.Depth)
                        {
                            sameNameAndDepthCount++;
                        }
                    }

                    var nodeNameKey = nodeInfo.Name + nodeInfo.Depth + ((sameNameAndDepthCount > 0) ? "_" + sameNameAndDepthCount : string.Empty);
                    var nodeId = ObjectId.FromBytes(Encoding.UTF8.GetBytes(nodeNameKey)).ToGuid();

                    IdentifiableHelper.SetId(nodeInfo, nodeId);

                    asset.Nodes.Add(nodeInfo);
                }
            }

            if (entityInfo.AnimationNodes != null && entityInfo.AnimationNodes.Count > 0)
                asset.PreserveNodes(entityInfo.AnimationNodes);

            var skeletonUrl = new UFile(localPath.GetFileName() + " Skeleton");
            var assetItem = new AssetItem(skeletonUrl, asset);
            assetReferences.Add(assetItem);
            return assetItem;
        }
开发者ID:cg123,项目名称:xenko,代码行数:41,代码来源:ModelAssetImporter.cs

示例10: GenerateSeparateTextureURL

 private static string GenerateSeparateTextureURL(UFile originalLocation, string suffixName)
 {
     return originalLocation.GetDirectory() + "/" + SplittedTextureNamePrefix + originalLocation.GetFileName() + suffixName;
 }
开发者ID:cg123,项目名称:xenko,代码行数:4,代码来源:TextureAlphaComponentSplitter.cs

示例11: ImportEntity

        private static AssetItem ImportEntity(List<AssetItem> assetReferences, UFile localPath, AssetItem modelItem)
        {
            var entityUrl = new UFile(localPath.GetFileName(), null);

            // TODO: Entities do not have source anymore, if this is needed again we should make scene assets that do not inherits from entity assets.
            var asset = new EntityAsset(); // { Source = localPath };
            var rootEntityData = new Entity();
            asset.Hierarchy.Entities.Add(rootEntityData);
            asset.Hierarchy.RootEntity = rootEntityData.Id;

            rootEntityData.Name = entityUrl;
            // Use modelUrl.Path to get the url without the extension
            rootEntityData.Add(ModelComponent.Key, new ModelComponent { Model = AttachedReferenceManager.CreateSerializableVersion<Rendering.Model>(modelItem.Id, modelItem.Location) });

            var assetReference = new AssetItem(entityUrl, asset);
            assetReferences.Add(assetReference);

            return assetReference;
        }
开发者ID:dejavvu,项目名称:paradox,代码行数:19,代码来源:ModelAssetImporter.cs

示例12: ImportEntity

        private static AssetItem ImportEntity(List<AssetItem> assetReferences, UFile localPath, AssetItem modelItem)
        {
            var entityUrl = new UFile(localPath.GetFileName(), null);

            var asset = new EntityAsset { Source = localPath };
            var rootEntityData = new Entity();
            asset.Hierarchy.Entities.Add(rootEntityData);
            asset.Hierarchy.RootEntity = rootEntityData.Id;

            rootEntityData.Name = entityUrl;
            // Use modelUrl.Path to get the url without the extension
            rootEntityData.Add(ModelComponent.Key, new ModelComponent { Model = AttachedReferenceManager.CreateSerializableVersion<Rendering.Model>(modelItem.Id, modelItem.Location) });

            var assetReference = new AssetItem(entityUrl, asset);
            assetReferences.Add(assetReference);

            return assetReference;
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:18,代码来源:ModelAssetImporter.cs

示例13: TestWithNormalization

        public void TestWithNormalization()
        {
            var assetPath = new UFile("/a/b/.././././//c.txt");
            Assert.AreEqual("/a", assetPath.GetDirectory());
            Assert.AreEqual("c", assetPath.GetFileName());
            Assert.AreEqual(".txt", assetPath.GetFileExtension());
            Assert.AreEqual("/a/c", assetPath.GetDirectoryAndFileName());
            Assert.AreEqual("/a/c.txt", assetPath.FullPath);

            assetPath = new UFile("../.././././//c.txt");
            Assert.AreEqual("../..", assetPath.GetDirectory());
            Assert.AreEqual("c", assetPath.GetFileName());
            Assert.AreEqual(".txt", assetPath.GetFileExtension());
            Assert.AreEqual("../../c", assetPath.GetDirectoryAndFileName());
            Assert.AreEqual("../../c.txt", assetPath.FullPath);

            assetPath = new UFile("a/../../../c.txt");
            Assert.AreEqual("../../c.txt", assetPath.FullPath);
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:19,代码来源:TestUPathOld.cs

示例14: TestWithSimplePathWithExtension

 public void TestWithSimplePathWithExtension()
 {
     var assetPath = new UFile("/a/b/c.txt");
     Assert.AreEqual("/a/b", assetPath.GetDirectory());
     Assert.AreEqual("c", assetPath.GetFileName());
     Assert.AreEqual(".txt", assetPath.GetFileExtension());
     Assert.AreEqual("/a/b/c", assetPath.GetDirectoryAndFileName());
     Assert.AreEqual("/a/b/c.txt", assetPath.FullPath);
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:9,代码来源:TestUPathOld.cs


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