private Logger(string app, string folder = null) { App = app; if (folder != null && folder[0] == '.') { string path = AppDomain.CurrentDomain.BaseDirectory; string removeDot = folder.Substring(1); folder = CombinePaths(path, removeDot); } if (FileLocations.ContainsKey(app)) { if (folder != null && FileLocations[app].FolderPath != folder) { FileLocations[app].FolderPath = folder; FileLocations[app].FilePath = CombinePaths(folder, NewFileName()); SaveLocations(); } _FolderPath = FileLocations[app].FolderPath; _FilePath = FileLocations[app].FilePath; } else { if (folder != null) { _FolderPath = folder; _FilePath = CombinePaths(_FolderPath, NewFileName()); FileLocations[App] = FileLocation(_FolderPath, _FilePath); SaveLocations(); } else { _FolderPath = DefaultFolder; _FilePath = CombinePaths(_FolderPath, NewFileName()); } } try { if (!Directory.Exists(_FolderPath)) { Directory.CreateDirectory(_FolderPath); } StartFile(); } catch { } }