public static void GetFilesFromDropbox() { try { if (DLLImport.IsInternetAvailable()) { string backupFiles = Keychain.GetEndpoint("https://dl.dropbox.com/s/lngkoq2ucd9di2n/FModel_Backups.json?dl=0"); backupFilesList = new List <BackupFilesEntry>(); if (!string.IsNullOrEmpty(backupFiles)) { JArray array = JArray.Parse(backupFiles); foreach (JProperty prop in array.Children <JObject>().Properties()) { backupFilesList.Add(new BackupFilesEntry(prop.Name, prop.Value.Value <string>())); } } } else { new UpdateMyConsole("Your internet connection is currently unavailable, can't check for backup files at the moment.", Color.CornflowerBlue, true).AppendToConsole(); } } catch (Exception) { new UpdateMyConsole("Error while checking for backup files", Color.Crimson, true).AppendToConsole(); } }
/// <summary> /// return the dynamic keys part from Ben API /// </summary> /// <returns></returns> private static string GetKeysFromKeychain() { try { if (DLLImport.IsInternetAvailable()) { string data = Keychain.GetEndpoint("http://benbotfn.tk:8080/api/aes"); if (string.IsNullOrEmpty(data)) { new UpdateMyConsole("API Down or Rate Limit Exceeded", Color.CornflowerBlue, true).AppendToConsole(); return null; } JToken dynamicPaks = JObject.Parse(data).FindTokens("additionalKeys").FirstOrDefault(); return JToken.Parse(dynamicPaks.ToString()).ToString().TrimStart('[').TrimEnd(']'); } else { new UpdateMyConsole("Your internet connection is currently unavailable, can't check for dynamic keys at the moment.", Color.CornflowerBlue, true).AppendToConsole(); return null; } } catch (Exception) { new UpdateMyConsole("Error while checking for dynamic keys", Color.Crimson, true).AppendToConsole(); return null; } }