Beispiel #1
0
        public static Channel Load(string path)
        {
            if (!File.Exists(path + @"Channel" + Info.extension))
            {
                return(null);
            }
            SerializationReader SR = new SerializationReader(path + @"Channel" + Info.extension);

            SR.Read();
            SR.ReadDeclaration();
            SR.ReadStartElement();
            Channel channel = new Channel();

            channel.Load(SR);
            SR.Close();

            channel.Appearances = Info.LoadFileAppearances(path + @"Appearances" + Info.extension);

            if (!Directory.Exists(path + @"\Channel\"))
            {
                Directory.CreateDirectory(path + @"\Channel\");
            }
            DirectoryInfo dir = new DirectoryInfo(path + @"/Channel");

            foreach (FileInfo file in dir.GetFiles())
            {
                WebTVJSON webjson = LoadFileWebTVJSON(file.FullName);
                channel.Add(webjson);
            }

            channel.ForumList.Load(path + @"/Forum");

            return(channel);
        }
        public void New_WebTV(string[] str)
        {
            if (str.Length < 17)
            {
                return;
            }

            WebTVJSON webtvjson = new WebTVJSON();
            int       i         = 1;

            webtvjson.Media.VideoPlayer    = str[i++];
            webtvjson.Media.Source         = str[i++];
            webtvjson.Hourly.Title         = str[i++];
            webtvjson.Hourly.Category      = str[i++];
            webtvjson.Hourly.Subcategory   = str[i++];
            webtvjson.Hourly.Description   = str[i++];
            webtvjson.Media.Duration       = StringToInt(str[i++]);
            webtvjson.Hourly.ImageUrl      = str[i++];
            webtvjson.Hourly.BackGroundUrl = str[i++];
            webtvjson.Social.WebSite       = str[i++];
            webtvjson.Social.Youtube       = str[i++];
            webtvjson.Social.Facebook      = str[i++];
            webtvjson.Social.Twitter       = str[i++];
            webtvjson.Social.Google        = str[i++];
            webtvjson.Social.Dailymotion   = str[i++];
            webtvjson.Social.Vimeo         = str[i++];
            webtvjson.Social.Email         = str[i++];

            Channels.SaveFileWebTVJSON(webtvjson, Info.address_WebTV + @"WebTVJSON\" + webtvjson.Hourly.Category + @"\" + webtvjson.Hourly.Subcategory + @"\");

            Add(new MsgJSON_Object("WEBTV_TITLE", webtvjson));
            ToHourly(webtvjson.Hourly.Category);
        }
        public void ToTitle(string title, string category, string subcategory)
        {
            string    path      = Info.address_WebTV + @"WebTVJSON\" + category + @"\" + subcategory + @"\" + title + Info.extension;;
            WebTVJSON webtvjson = Channels.LoadFileWebTVJSON(path);

            if (webtvjson != null)
            {
                Add(new MsgJSON_Object("WEBTV_TITLE", webtvjson));
            }
        }
Beispiel #4
0
        public static void AddWebTV(string name, WebTVJSON webtvjson)
        {
            Channel channel = Find(name);

            if (channel == null)
            {
                return;
            }
            channel.Add(webtvjson);
        }
Beispiel #5
0
        public static void Add(WebTVJSON tv)
        {
            WebTVJSON[] temp = new WebTVJSON[WebTVJSON.Length + 1];
            for (int i = 0; i < WebTVJSON.Length; i++)
            {
                temp[i] = WebTVJSON[i];
            }

            temp[WebTVJSON.Length] = tv;
            WebTVJSON = temp;
        }
Beispiel #6
0
 public WebTVJSON(WebTVJSON webtvjson)
 {
     //Hourly = webtvjson.Hourly;
     ////Note = webtvjson.Note;
     ////Social = webtvjson.Social;
     //Media = new WebTV_Media();
     //Media.VideoPlayer = webtvjson.Media.VideoPlayer;
     //Media.Source = webtvjson.Media.Source;
     //Media.StartSeconds = (int)(new TimeSpan(DateTime.Now.Ticks - webtvjson.Hourly.DateJSON.Ticks + new TimeSpan(0, 0, webtvjson.Media.StartSeconds).Ticks).TotalSeconds);
     //Media.Duration = webtvjson.Media.Duration - Media.StartSeconds;
     //Media.Quality = webtvjson.Media.Quality;
 }
Beispiel #7
0
        public void CallWebTV(string[] str)
        {
            if (str.Length < 3)
            {
                return;
            }
            string channel = str[1];
            string id      = str[2];
            //webtvjson = new WebTVJSON();
            WebTVJSON webtvjson = WebTV.Channels.FindChannel(channel);

            if (webtvjson != null)
            {
                Add(new MsgJSON_WebTV("WEBTV", id, webtvjson));
            }
        }
Beispiel #8
0
        public static void LoadWebTVJSON(string path)
        {
            if (Directory.Exists(path))
            {
                DirectoryInfo d = new DirectoryInfo(path);

                foreach (FileInfo f in d.GetFiles())
                {
                    WebTVJSON webjson = Channels.LoadFileWebTVJSON(f.FullName);
                    Add(webjson);
                }
                foreach (DirectoryInfo dir in d.GetDirectories())
                {
                    LoadWebTVJSON(dir.FullName);
                }
            }
        }
Beispiel #9
0
        public void ChannelTV(string[] str)
        {
            if (str.Length < 3)
            {
                return;
            }
            string    channelname = str[1];
            string    id          = str[2];
            WebTVJSON webtvjson   = WebTV.Channels.FindChannel(channelname);

            ((WebTVInfo)PageInfo).Channel = channelname;
            Add(new MsgJSON_String("CHANNEL", channelname));
            //Add(new MsgJSON_Channel("CHANNEL", id, channelname));
            if (webtvjson != null)
            {
                Add(new MsgJSON_WebTV("WEBTV", id, webtvjson));
            }
        }
Beispiel #10
0
        public static void LoadAndSaveDirectory(string path)
        {
            if (Directory.Exists(path))
            {
                DirectoryInfo d = new DirectoryInfo(path);

                foreach (FileInfo f in d.GetFiles())
                {
                    WebTVJSON webjson = LoadFileWebTVJSON(f.FullName);
                    f.Delete();
                    SaveFileWebTVJSON(webjson, path);
                }
                foreach (DirectoryInfo dir in d.GetDirectories())
                {
                    LoadAndSaveDirectory(d.FullName);
                }
            }
        }
Beispiel #11
0
        public static WebTVJSON LoadFileWebTVJSON(string path)
        {
            WebTVJSON           webtvjson = new WebTVJSON();
            SerializationReader SR        = new SerializationReader(path);

            SR.Read();
            SR.ReadDeclaration();
            SR.ReadStartElement();
            SR.ReadStartElement();
            int version = SR.ReadVersion();

            switch (version)
            {
            case 0:
            {
                //webtvjson.Hourly.Title = SR.ReadString();
                //webtvjson.Media.VideoPlayer = SR.ReadString();
                //webtvjson.Media.Source = SR.ReadString();
                //webtvjson.Media.Duration = SR.ReadInt();
                //webtvjson.Media.StartSeconds = SR.ReadInt();
                //webtvjson.Media.Quality = SR.ReadString();
                //webtvjson.Hourly.Category = SR.ReadString();
                //webtvjson.Hourly.Subcategory = SR.ReadString();
                //webtvjson.Note.Like = SR.ReadInt();
                //webtvjson.Note.Dislike = SR.ReadInt();
                //webtvjson.Note.NumberView = SR.ReadInt();
                //webtvjson.Hourly.Description = SR.ReadString();
                //webtvjson.Hourly.ImageUrl = SR.ReadString();
                //webtvjson.Hourly.BackGroundUrl = SR.ReadString();
                //webtvjson.Social.WebSite = SR.ReadString();
                //webtvjson.Social.Youtube = SR.ReadString();
                //webtvjson.Social.Facebook = SR.ReadString();
                //webtvjson.Social.Twitter = SR.ReadString();
                //webtvjson.Social.Google = SR.ReadString();
                //webtvjson.Social.Dailymotion = SR.ReadString();
                //webtvjson.Social.Vimeo = SR.ReadString();
                //webtvjson.Social.Email = SR.ReadString();
                break;
            }
            }
            SR.ReadEndElement();
            SR.Close();
            return(webtvjson);
        }
Beispiel #12
0
        public void CallWebTVNext(string[] str)
        {
            if (str.Length < 3)
            {
                return;
            }
            string  channelname = str[1];
            string  id          = str[2];
            Channel channel     = Channels.Find(channelname);

            if (channel != null)
            {
                WebTVJSON webtvjson = channel.FindNext();
                if (webtvjson != null)
                {
                    Add(new MsgJSON_WebTV("WEBTVNEXT", id, webtvjson));
                }
            }
        }
Beispiel #13
0
        public void Add(WebTVJSON tv)
        {
            if (TV.Length == 0)
            {
                tv.Hourly.DateJSON = new DateJSON(DateTime.Now);
            }
            else
            {
                tv.Hourly.DateJSON = new DateJSON(TV[TV.Length - 1].Hourly.DateJSON.DateTime + new TimeSpan(0, 0, TV[TV.Length - 1].Media.Duration));
            }

            WebTVJSON[] temp = new WebTVJSON[TV.Length + 1];
            for (int i = 0; i < TV.Length; i++)
            {
                temp[i] = TV[i];
            }

            temp[TV.Length] = tv;
            TV = temp;
        }
Beispiel #14
0
        //public static Channel Load(string path)
        //{
        //    if (!File.Exists(path + @"Channel" + Info.extension)) return null;
        //    SerializationReader SR = new SerializationReader(path + @"Channel" + Info.extension);
        //    SR.Read();
        //    SR.ReadDeclaration();
        //    SR.ReadStartElement();
        //    Channel channel = new Channel();
        //    channel.Load(SR);
        //    SR.Close();

        //    channel.Appearances = Info.LoadFileAppearances(path + @"Appearances" + Info.extension);

        //    if (!Directory.Exists(path + @"\Channel\"))
        //        Directory.CreateDirectory(path + @"\Channel\");
        //    DirectoryInfo dir = new DirectoryInfo(path + @"/Channel");
        //    foreach (FileInfo file in dir.GetFiles())
        //    {
        //        WebTVJSON webjson = LoadFileWebTVJSON(file.FullName);
        //        //channel.Add(webjson);
        //    }

        //    channel.ForumList.Load(path + @"/Forum");

        //    return channel;
        //}



        public static void SaveFileWebTVJSON(WebTVJSON webtvjson, string path)
        {
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            //path += webtvjson.Hourly.Title + Info.extension;
            SerializationWriter SW = new SerializationWriter(path);

            SW.Start("Info");
            SW.WriteStartElement("WebTVJSON");
            SW.WriteVersion(0);

            //SW.Write("Title", webtvjson.Hourly.Title);
            //SW.Write("VideoPlayer", webtvjson.Media.VideoPlayer);
            //SW.Write("Source", webtvjson.Media.Source);
            //SW.Write("Duration", webtvjson.Media.Duration);
            //SW.Write("StartSeconds", webtvjson.Media.StartSeconds);
            //SW.Write("Quality", webtvjson.Media.Quality);
            //SW.Write("Category", webtvjson.Hourly.Category);
            //SW.Write("Subcategory", webtvjson.Hourly.Subcategory);
            //SW.Write("Like", webtvjson.Note.Like);
            //SW.Write("Dislike", webtvjson.Note.Dislike);
            //SW.Write("NumberView", webtvjson.Note.NumberView);
            //SW.Write("Description", webtvjson.Hourly.Description);
            //SW.Write("ImageUrl", webtvjson.Hourly.ImageUrl);
            //SW.Write("BackGroundUrl", webtvjson.Hourly.BackGroundUrl);
            //SW.Write("WebSite", webtvjson.Social.WebSite);
            //SW.Write("Youtube", webtvjson.Social.Youtube);
            //SW.Write("Facebook", webtvjson.Social.Facebook);
            //SW.Write("Twitter", webtvjson.Social.Twitter);
            //SW.Write("Google", webtvjson.Social.Google);
            //SW.Write("Dailymotion", webtvjson.Social.Dailymotion);
            //SW.Write("Vimeo", webtvjson.Social.Vimeo);
            //SW.Write("Email", webtvjson.Social.Email);


            SW.WriteEndElement();
            SW.End();
        }
Beispiel #15
0
        public void New_WebTV(string[] str)
        {
            if (str.Length < 17)
            {
                return;
            }


            WebTVJSON webtvjson = new WebTVJSON();
            int       i         = 1;

            webtvjson.Media.VideoPlayer = str[i++];
            webtvjson.Media.Source      = str[i++];


            //webtvjson.VideoPlayer = str[1];// "Youtube";// Video, Html5, Youtube, Dailymotion, vimeo, ect.. STREAMING WebCAM
            //webtvjson.Source = str[2];// "5Y2F-j2SASc";

            webtvjson.Hourly.Title         = str[i++];              // "Sophie's Tips Trailer";
            webtvjson.Hourly.Category      = str[i++];              // "Tutorial";
            webtvjson.Hourly.Subcategory   = str[i++];
            webtvjson.Hourly.Description   = str[i++];              // "Sophie's Tips tutorial de maquillages décoratifs.";
            webtvjson.Media.Duration       = StringToInt(str[i++]); // 0;
            webtvjson.Hourly.ImageUrl      = str[i++];
            webtvjson.Hourly.BackGroundUrl = str[i++];
            webtvjson.Social.WebSite       = str[i++];
            webtvjson.Social.Youtube       = str[i++];
            webtvjson.Social.Facebook      = str[i++];
            webtvjson.Social.Twitter       = str[i++];
            webtvjson.Social.Google        = str[i++];
            webtvjson.Social.Dailymotion   = str[i++];
            webtvjson.Social.Vimeo         = str[i++];
            webtvjson.Social.Email         = str[i++];

            Channels.SaveFileWebTVJSON(webtvjson, Info.address_WebTV + @"WebTVJSON\" + webtvjson.Hourly.Category + @"\" + webtvjson.Hourly.Subcategory + @"\");
        }
Beispiel #16
0
 public class MsgJSON_WebTV : MessageJSON { public string ID = ""; public WebTVJSON WebTV = null; public MsgJSON_WebTV(string command, string id, WebTVJSON webtv) : base(command)
                                            {
                                                ID = id; WebTV = webtv;
                                            }