示例#1
0
        static public AttemptResult AttemptRead(this StreamSystem item, string path, TryProcess <Stream> process, long milliseconds = StreamSystem.DEFAULT_WAIT)
        {
            Stream        stream;
            AttemptResult result = item.OpenStreamForReading(path, out stream, milliseconds);

            using (stream)
            {
                if (result.IsDesired())
                {
                    if (process(stream) == false)
                    {
                        result = AttemptResult.Failed;
                    }
                }
            }

            return(result);
        }
示例#2
0
 public override AttemptResult OpenStreamForReading(string path, out Stream stream, long milliseconds = StreamSystem.DEFAULT_WAIT)
 {
     return(stream_system.OpenStreamForReading(CalculatePath(path), out stream, milliseconds));
 }