示例#1
0
        /// <inheritdoc cref="BaseStore.PutTxExecution(Libplanet.Tx.TxSuccess)"/>
        public override void PutTxExecution(TxSuccess txSuccess)
        {
            UPath path    = TxExecutionPath(txSuccess);
            UPath dirPath = path.GetDirectory();

            CreateDirectoryRecursively(_txExecutions, dirPath);
            using Stream f =
                      _txExecutions.OpenFile(path, System.IO.FileMode.OpenOrCreate, FileAccess.Write);
            Codec.Encode(SerializeTxExecution(txSuccess), f);
        }
示例#2
0
 /// <summary>
 /// Files the read text reader.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <returns></returns>
 /// <exception cref="StorageException">Error opening file '{path.RealPath}'. - 16</exception>
 public TextReader FileOpenTextReader(IVirtualPath path)
 {
     try
     {
         var stream = workSpaceFileSystem.OpenFile(path.RealPath, FileMode.Open, FileAccess.Read);
         return(new StreamReader(stream));
     }
     catch (Exception e)
     {
         throw new StorageException(logger, $"Error opening file '{path.RealPath}'.", e, 16);
     }
 }