Exemplo n.º 1
0
        private static SynchronizedFileStream GetFileStream(string filepath)
        {
            lock ( _sync )
            {
                if (_collection.Contains(filepath))
                {
                    return(_collection[filepath]);
                }

                else
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(filepath));
                    var stream = new SynchronizedFileStream(filepath);
                    _collection.Add(stream);
                    return(stream);
                }
            }
        }
Exemplo n.º 2
0
 private static void WriteText(SynchronizedFileStream stream, string content, Encoding encoding, bool flush)
 {
     stream.WriteText(content, encoding, AutoFlush || flush);
 }