// Saved Files (Convert: File Link -> Json) public static string fileToJson(string Url, string Name, string Type, string Host) { var a = new DatabaseFilesEntity { URL = Url, Host = Host, Title = Path.GetFileNameWithoutExtension(new Uri(Url).LocalPath), Type = Type, Size = "-", DateAdded = "-" }; return(a.ToJson()); }
public string selectedFilesFileType = "", selectedFilesHost = "", selectedFilesQuality = "", selectedFiles = "Video"; // Filter Preferences private void loadLocalFiles() { dataFilesLocal.Clear(); foreach (string fileName in Directory.GetFiles(userDownloadsDirectory)) { var data = new DatabaseFilesEntity(); data.Title = Path.GetFileNameWithoutExtension(fileName); data.Host = rm.GetString("local"); data.Type = Path.GetExtension(fileName).Replace(".", "").ToUpper(); data.URL = fileName; dataFilesLocal.Add(data.ToJson()); } }
private void loadLocalFiles() { dataFilesLocal.Clear(); foreach (var pathFile in Directory.GetFiles(userDownloadsDirectory)) { var data = new DatabaseFilesEntity { URL = pathFile, Host = rm.GetString("local"), Title = Path.GetFileNameWithoutExtension(pathFile), Type = Path.GetExtension(pathFile).Replace(".", "").ToUpper(), Size = Utilities.ToFileSize(new FileInfo(pathFile).Length), DateAdded = File.GetCreationTime(pathFile).ToString() }; dataFilesLocal.Add(data.ToJson()); } }