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); }
public static FileHierarchy GetInstance() { return(_fileHierarchy ?? (_fileHierarchy = new FileHierarchy())); }