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


C# Storage.OpenStream方法代码示例

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


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

示例1: ReadXml

 private static object ReadXml(Storage postStorage, string streamName, XmlReadHandler readHandler)
 {
     XmlTextReader reader = new XmlTextReader(new StreamReader(postStorage.OpenStream(streamName, StorageMode.Open, false), utf8Encoding, false));
     try
     {
         return readHandler(reader);
     }
     finally
     {
         reader.Close();
     }
 }
开发者ID:igoravl,项目名称:OpenLiveWriter,代码行数:12,代码来源:PostEditorFile.cs

示例2: WriteDateTime

 private static void WriteDateTime(Storage postStorage, string fieldName, DateTime fieldValue)
 {
     using (BinaryWriter writer = new BinaryWriter(postStorage.OpenStream(fieldName, StorageMode.Create, true)))
         writer.Write(fieldValue.Ticks);
 }
开发者ID:igoravl,项目名称:OpenLiveWriter,代码行数:5,代码来源:PostEditorFile.cs

示例3: WriteXml

 private static void WriteXml(Storage postStorage, string streamName, object data, XmlWriteHandler writeHandler)
 {
     XmlTextWriter writer = new XmlTextWriter(postStorage.OpenStream(streamName, StorageMode.Create, true), utf8Encoding);
     try
     {
         writer.WriteStartDocument();
         writeHandler(writer, data);
         writer.WriteEndDocument();
     }
     finally
     {
         writer.Close();
     }
 }
开发者ID:igoravl,项目名称:OpenLiveWriter,代码行数:14,代码来源:PostEditorFile.cs

示例4: ReadDateTime

 private static DateTime ReadDateTime(Storage postStorage, string fieldName)
 {
     using (BinaryReader reader = new BinaryReader(postStorage.OpenStream(fieldName, StorageMode.Open, false)))
         return new DateTime(reader.ReadInt64());
 }
开发者ID:igoravl,项目名称:OpenLiveWriter,代码行数:5,代码来源:PostEditorFile.cs

示例5: ReadStringUtf8

        private static string ReadStringUtf8(Storage postStorage, string fieldName)
        {

            using (StreamReader reader = new StreamReader(postStorage.OpenStream(fieldName, StorageMode.Open, false), utf8Encoding))
                return reader.ReadToEnd();
        }
开发者ID:igoravl,项目名称:OpenLiveWriter,代码行数:6,代码来源:PostEditorFile.cs

示例6: WriteStringUtf8

 private static void WriteStringUtf8(Storage postStorage, string fieldName, string fieldValue)
 {
     using (StreamWriter writer = new StreamWriter(postStorage.OpenStream(fieldName, StorageMode.Create, true), utf8Encoding))
         writer.Write(fieldValue);
 }
开发者ID:igoravl,项目名称:OpenLiveWriter,代码行数:5,代码来源:PostEditorFile.cs

示例7: WriteSpellingContextDictionary

 private void WriteSpellingContextDictionary(Storage postStorage, BlogPostSupportingFileStorage supportingFileStorage)
 {
     Stream spellingStream = supportingFileStorage.ReadSpellingContextDictionary();
     if (spellingStream != null)
     {
         using (spellingStream)
         {
             using (Stream stream = postStorage.OpenStream(SPELLING_CONTEXT_DICTIONARY, StorageMode.Create))
                 StreamHelper.Transfer(spellingStream, stream);
         }
     }
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:12,代码来源:PostEditorFile.cs

示例8: ReadSpellingContextDictionary

        private void ReadSpellingContextDictionary(Storage postStorage, BlogPostSupportingFileStorage supportingFileStorage)
        {
            // try to get the dictionary stream
            Stream dictionaryStream;
            try { dictionaryStream = postStorage.OpenStream(SPELLING_CONTEXT_DICTIONARY, StorageMode.Open); }
            catch (StorageException) { return; }

            // write it to supporting file storage
            using (dictionaryStream)
                supportingFileStorage.WriteSpellingContextDictionary(dictionaryStream);
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:11,代码来源:PostEditorFile.cs


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