示例#1
0
    public void Close()
    {
        if (_fileStream != null)
        {
            var end = _formatter.End();

            if (end != null)
            {
                Write(LocalTime.Default.Now, end);
            }

            _fileStream.Close();
            var name = _fileStream.Name;
            _fileStream = null;

            if (_fileAttributes != default(FileAttributes))
            {
                var attributes = File.GetAttributes(name);
                attributes |= _fileAttributes; // FileAttributes.ReadOnly | FileAttributes.Hidden;
                File.SetAttributes(name, attributes);
            }
        }
    }