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


C# IFileSystem.IsFileExist方法代码示例

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


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

示例1: Intro

        public override void Intro( params object [] args )
        {
            variableTable = new VariableTable ();

            fileSystem = FileSystemManager.GetFileSystem ( "LocalFileSystem" );
            if ( fileSystem.IsFileExist ( "vartab.dat" ) )
                variableTable.Load ( fileSystem.OpenFile ( "vartab.dat" ) );
            else
            {
                variableTable.AddPackageVariableTable ( myGuid, 3 );
                variableTable.SetVariable ( myGuid, 0, 0 );
                variableTable.SetVariable ( myGuid, 1, 0.0 );
                variableTable.SetVariable ( myGuid, 2, false );
            }

            base.Intro ( args );
        }
开发者ID:Daramkun,项目名称:Misty,代码行数:17,代码来源:Container.cs

示例2: LoadFromFileSystem

        public static PackageInfo LoadFromFileSystem( IFileSystem fileSystem )
        {
            if ( !fileSystem.IsFileExist ( "packageInfo.json" ) )
                throw new ArgumentException ();

            PackageInfo packageInfo = new PackageInfo ();
            JsonContainer entry = new JsonContainer ( fileSystem.OpenFile ( "packageInfo.json" ) );

            packageInfo.PackageName = entry [ "title" ] as string;

            packageInfo.Author = entry [ "author" ] as string;
            packageInfo.Copyright = entry [ "copyright" ] as string;
            packageInfo.Description = entry [ "description" ] as string;

            packageInfo.PackageID = new Guid ( entry [ "packId" ] as string );
            packageInfo.Version = new Version ( entry [ "version" ] as string );
            packageInfo.ReleaseDate = DateTime.Parse ( entry [ "release_date" ] as string );

            if ( packageInfo.IsSubPackage = ( bool ) entry [ "issubpack" ] )
            {
                List<Guid> mainGuid = new List<Guid> ();
                JsonContainer mainPackIds = entry [ "mainpacks" ] as JsonContainer;
                foreach ( object item in mainPackIds.GetListEnumerable () )
                    mainGuid.Add ( new Guid ( item as string ) );

                if ( !mainGuid.Contains ( Core.MainPackage.PackageID ) )
                {
                    bool isContains = false;
                    foreach ( PackageInfo subpack in Core.SubPackages )
                        if ( mainGuid.Contains ( subpack.PackageID ) )
                            isContains = true;
                    if ( !isContains )
                        throw new ArgumentException ( "This package is not allowed to this package." );
                }

                packageInfo.MainPackageIDs = mainGuid.ToArray ();
            }

            if ( fileSystem.IsFileExist ( "packageCover.png" ) )
            {
                ImageInfo imageInfo;
                new PngDecoder ().Decode ( fileSystem.OpenFile ( "packageCover.png" ), out imageInfo );
                packageInfo.PackageCover = imageInfo;
            }

            if ( fileSystem.IsFileExist ( "stringTable.stt" ) )
                packageInfo.StringTable = new StringTable ( fileSystem.OpenFile ( "stringTable.stt" ) );

            if ( fileSystem.IsFileExist ( "resourceTable.rst" ) )
                packageInfo.ResourceTable = new ResourceTable ( new ZipFileSystem ( fileSystem.OpenFile ( "resourceTable.rst" ) ) );

            return packageInfo;
        }
开发者ID:Daramkun,项目名称:Misty,代码行数:53,代码来源:PackageInfo.cs

示例3: LoadFromFileSystem

        public static PackageInfo LoadFromFileSystem( IFileSystem fileSystem )
        {
            if ( !fileSystem.IsFileExist ( "packageInfo.json" ) )
                throw new ArgumentException ();

            PackageInfo packageInfo = new PackageInfo ();
            JsonEntry entry = JsonParser.Parse ( fileSystem.OpenFile ( "packageInfo.json" ) );

            packageInfo.PackageName = entry [ "title" ] as string;

            packageInfo.Author = entry [ "author" ] as string;
            packageInfo.Copyright = entry [ "copyright" ] as string;
            packageInfo.Description = entry [ "description" ] as string;

            packageInfo.PackageID = new Guid ( entry [ "packId" ] as string );
            packageInfo.Version = new Version ( entry [ "version" ] as string );
            packageInfo.ReleaseDate = DateTime.Parse ( entry [ "release_date" ] as string );

            if ( packageInfo.IsSubPackage = ( bool ) entry [ "issubpack" ] )
            {
                List<Guid> mainGuid = new List<Guid> ();
                JsonArray mainPackIds = entry [ "mainpacks" ] as JsonArray;
                foreach ( object item in mainPackIds )
                    mainGuid.Add ( new Guid ( item as string ) );

                if ( !mainGuid.Contains ( PackageSystem.MainPackage.PackageID ) )
                {
                    bool isContains = false;
                    foreach ( PackageInfo subpack in PackageSystem.SubPackages )
                        if ( mainGuid.Contains ( subpack.PackageID ) )
                            isContains = true;
                    if ( !isContains )
                        throw new SubPackageNotAllowedThisPackageException ();
                }

                packageInfo.MainPackageIDs = mainGuid.ToArray ();
            }

            if ( fileSystem.IsFileExist ( "packageCover.png" ) )
                packageInfo.PackageCover = new PngDecoder ().Decode ( fileSystem.OpenFile ( "packageCover.png" ) );

            if ( fileSystem.IsFileExist ( "stringTable.stt" ) )
                packageInfo.StringTable = new StringTable ( fileSystem.OpenFile ( "stringTable.stt" ) );

            if ( fileSystem.IsFileExist ( "resourceTable.rst" ) )
                packageInfo.ResourceTable = new ContentManager ( new ZipFileSystem ( fileSystem.OpenFile ( "resourceTable.rst" ) ) );

            if ( fileSystem.IsFileExist ( "scriptTable.scr" ) )
                packageInfo.ScriptTable = new ScriptTable ( fileSystem.OpenFile ( "scriptTable.scr" ) );

            return packageInfo;
        }
开发者ID:Daramkun,项目名称:ProjectLiqueur,代码行数:52,代码来源:PackageInfo.cs


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