コード例 #1
0
        private FileLogger()
        {
            var    fileHierarchy = FileHierarchy.GetInstance();
            string path          = fileHierarchy.LogsDirectory + "\\" + DateTime.Today.Ticks;
            var    directoryInfo = new FileInfo(path).Directory;

            directoryInfo?.Create();
            if (directoryInfo != null)
            {
                directoryInfo.Attributes &= ~FileAttributes.ReadOnly;
            }
            _file     = File.Open(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite);
            writelock = new SemaphoreSlim(1, 1);
        }
コード例 #2
0
ファイル: FileHierarchy.cs プロジェクト: fcccode/Sentro
 public static FileHierarchy GetInstance()
 {
     return(_fileHierarchy ?? (_fileHierarchy = new FileHierarchy()));
 }