本文整理汇总了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 );
}
示例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;
}
示例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;
}