public static string GetDropboxFolder() { if (MainProgram.ApplicationInstalled("Dropbox")) { string infoPath = @"Dropbox\info.json"; string jsonPath = Path.Combine(Environment.GetEnvironmentVariable("LocalAppData"), infoPath); if (!Directory.Exists(Directory.GetDirectoryRoot(jsonPath))) { return(""); } if (!File.Exists(jsonPath)) { jsonPath = Path.Combine(Environment.GetEnvironmentVariable("AppData"), infoPath); } if (!File.Exists(jsonPath)) { return(""); } string jsonContent = File.ReadAllText(jsonPath); try { DropboxJson dropboxJson = JsonConvert.DeserializeObject <DropboxJson>(jsonContent); if (dropboxJson != null) { if (dropboxJson.personal != null) { return(dropboxJson.personal.Path); } else if (dropboxJson.business != null) { return(dropboxJson.business.Path); } } } catch { MainProgram.DoDebug("Failed to deserialize Dropbox Json"); MainProgram.DoDebug(jsonContent); } } else { MainProgram.DoDebug("Dropbox not installed"); return(""); } return(""); }