示例#1
0
        public void SaveJSON(VideoJSON Vid, string path)
        {
            var json = new JavaScriptSerializer().Serialize(Vid);

            json = ProcessJSONComma(json.Replace("{", "{\n"), ',', "\n");
            File.WriteAllText(path, json);
        }
示例#2
0
        static string ProcessPath(string OGpath, VideoJSON X, string ext)
        {
            string PathCP = OGpath;

            //Enviroment Var Declaration
            //@[url] - video id
            //@[file] - cdn server file id
            //@[hd] - Hd video status *UNUSED*
            //@[title] - video title
            //@[category] - Video Category
            //@[uploaded_by] - uploader
            //@[uploaded_on] - upload date
            //@[ext] - Extension //MANDATORY

            string[] categories = { "All", "Film & Animation", "Autos & Vehicles", "Music", "Pets & Animals", "Sports", "Travel & Events", "Gaming", "People & Blogs", "Comedy", "Entertainment", "News & Politics", "Howto & Style", "Education", "Science & Technology", "Nonprofits & Activism" };

            PathCP = PathCP.Replace("@[url]", X.url);
            PathCP = PathCP.Replace("@[file]", X.file);

            PathCP = PathCP.Replace("@[uploaded_by]", X.uploaded_by);
            PathCP = PathCP.Replace("@[uploaded_on]", X.uploaded_on);
            PathCP = PathCP.Replace("@[ext]", ext);
            string CatName = "";

            if (PathCP.Contains("@[category]"))
            {
                PathCP.Replace("@[category]", categories[X.category]);
            }

            PathCP = PathCP.Replace("@[title]", RemoveIllegal(X.title));
            return(PathCP);
        }