public Configuration(String fileName, configLocation fileLocation, String filePath) { switch (fileLocation) { case configLocation.APPDIR: this.path = "./" + fileName + ".conf"; break; case configLocation.APPDATA: if (filePath == null) { throw new Exception("AppData directory name not found."); } else { if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + filePath)) { Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + filePath); } this.path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + filePath + "/" + fileName + ".conf"; } break; case configLocation.CUSTOM: if (filePath == null) { throw new Exception("Custom directory path not found."); } else { this.path = filePath + "/" + fileName + ".conf"; } break; } }
public Configuration(String fileName, configLocation fileLocation) : this(fileName, fileLocation, ".") { }