コード例 #1
0
ファイル: FilePackageReader.cs プロジェクト: heran/DekiWiki
 public Result<ImportItem> ReadData(ImportItem item, Result<ImportItem> result) {
     string file = _package[string.Format("map/item[@dataid='{0}']/@path", item.DataId)].AsText;
     string path = Path.Combine(_packageDirectory, file);
     if(!File.Exists(path)) {
         throw new FileNotFoundException(string.Format("Unable to locate file for dataid '{0}'", item.DataId), path);
     }
     FileStream fileStream = File.OpenRead(path);
     result.Return(item.WithData(fileStream, fileStream.Length));
     return result;
 }
コード例 #2
0
        private Yield ReadData_Helper(ImportItem item, Result <ImportItem> result)
        {
            if (_package == null)
            {
                yield return(Coroutine.Invoke(ReadPackage_Helper, new Result()));
            }
            string   file  = _package[string.Format("map/item[@dataid='{0}']/@path", item.DataId)].AsText;
            ZipEntry entry = _zipFile.GetEntry(file);

            result.Return(item.WithData(_zipFile.GetInputStream(entry), entry.Size));
            yield break;
        }
コード例 #3
0
        public Result <ImportItem> ReadData(ImportItem item, Result <ImportItem> result)
        {
            string file = _package[string.Format("map/item[@dataid='{0}']/@path", item.DataId)].AsText;
            string path = Path.Combine(_packageDirectory, file);

            if (!File.Exists(path))
            {
                throw new FileNotFoundException(string.Format("Unable to locate file for dataid '{0}'", item.DataId), path);
            }
            FileStream fileStream = File.OpenRead(path);

            result.Return(item.WithData(fileStream, fileStream.Length));
            return(result);
        }
コード例 #4
0
 private Yield ReadData_Helper(ImportItem item, Result<ImportItem> result) {
     if(_package == null) {
         yield return Coroutine.Invoke(ReadPackage_Helper, new Result());
     }
     string file = _package[string.Format("map/item[@dataid='{0}']/@path", item.DataId)].AsText;
     ZipEntry entry = _zipFile.GetEntry(file);
     result.Return(item.WithData(_zipFile.GetInputStream(entry), entry.Size));
     yield break;
 }