Beispiel #1
0
        public static string fileToJson(string Url, string Name, string Type, string Host)
        {
            var a = new Models.WebFile
            {
                URL       = Url,
                Host      = Host,
                Title     = Path.GetFileNameWithoutExtension(new Uri(Url).LocalPath),
                Type      = Type,
                Size      = "-",
                DateAdded = "-"
            };

            return(JsonConvert.SerializeObject(a));
        }
Beispiel #2
0
        private void loadLocalFiles()
        {
            dataFilesLocal.Clear();

            foreach (var pathFile in Directory.GetFiles(userDownloadsDirectory))
            {
                var dataJson = new Models.WebFile
                {
                    URL       = pathFile,
                    Host      = rm.GetString("local"),
                    Title     = Path.GetFileNameWithoutExtension(pathFile),
                    Type      = Path.GetExtension(pathFile).Replace(".", "").ToUpper(),
                    Size      = UtilityTools.bytesToString(new FileInfo(pathFile).Length),
                    DateAdded = File.GetCreationTime(pathFile).ToString()
                };

                dataFilesLocal.Add(JsonConvert.SerializeObject(dataJson));
            }
        }