Esempio n. 1
0
        public async Task <bool> SetEmailReminderStatus(bool status)
        {
            try
            {
                HttpEngine httpRequest = new HttpEngine();
                string     enable;
                if (status)
                {
                    enable = "1";
                }
                else
                {
                    enable = "0";
                }
                string result = await httpRequest.GetAsync("http://api.sellmoe.com/email_reminder_set?key=" + key + "&enable=" + enable + "&hash=" + new Random().Next());

                JObject json = JObject.Parse(result);
                ErrorProcessor(json);
                emailReminderStatus = status;
                return(true);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 2
0
        public async Task <bool> GetEmailReminderStatus()
        {
            try
            {
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync("http://api.sellmoe.com/get_user_info?key=" + key + "&hash=" + new Random().Next());

                JObject json = JObject.Parse(result);
                ErrorProcessor(json);

                int status = (int)json["data"]["email"];
                if (status == 1)
                {
                    emailReminderStatus = true;
                }
                else
                {
                    emailReminderStatus = false;
                }
                return(true);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 3
0
        public async void Search()
        {
            ProgressBar.Text           = "搜索中...";
            ProgressBar.IsVisible      = true;
            SearchBox.IsEnabled        = false;
            LongListSelector.IsEnabled = false;
            try
            {
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync("http://mediaso.xmp.kankan.xunlei.com/search.php?keyword=" + SearchBox.Text + "&hash=" + new Random().Next());

                App.ViewModel.SearchResultItems.Clear();
                string name_flag_begin  = "sname=\"";
                string name_flag_end    = "\",";
                string id_flag_begin    = "imovieid=";
                string id_flag_end      = ",";
                string type_flag_begin  = "Typedesc=\"";
                string type_flag_end    = "\",";
                int    name_index_begin = result.IndexOf(name_flag_begin);
                while (name_index_begin != -1)
                {
                    // name
                    int    name_index_end = result.IndexOf(name_flag_end, name_index_begin);
                    string name           = result.Substring(name_index_begin + name_flag_begin.Length, name_index_end - name_index_begin - name_flag_begin.Length);
                    // id
                    int    id_index_begin = result.IndexOf(id_flag_begin, name_index_end);
                    int    id_index_end   = result.IndexOf(id_flag_end, id_index_begin);
                    string id             = result.Substring(id_index_begin + id_flag_begin.Length, id_index_end - id_index_begin - id_flag_begin.Length);
                    // type
                    int    type_index_begin = result.IndexOf(type_flag_begin, id_index_end);
                    string type             = "";
                    if (type_index_begin != -1)
                    {
                        int type_index_end = result.IndexOf(type_flag_end, type_index_begin);
                        type = result.Substring(type_index_begin + type_flag_begin.Length, type_index_end - type_index_begin - type_flag_begin.Length);
                    }
                    if (type != "电影")
                    {
                        App.ViewModel.SearchResultItems.Add(new ViewModels.SearchResultModel()
                        {
                            Name = name, ID = id, Type = type
                        });
                    }
                    name_index_begin = result.IndexOf(name_flag_begin, id_index_end);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "错误", MessageBoxButton.OK);
            }
            finally
            {
                SearchBox.IsEnabled        = true;
                LongListSelector.IsEnabled = true;
                ProgressBar.IsVisible      = false;
                ProgressBar.Text           = "";
            }
        }
Esempio n. 4
0
        public async Task <bool> GetSubscriptionList()
        {
            try
            {
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync("http://api.sellmoe.com/get_user_info?key=" + key + "&sb=Ricter&hash=" + new Random().Next());

                JObject json = JObject.Parse(result);
                ErrorProcessor(json);

                subscriptionList.Clear();
                updateNumber = 0;
                JArray subscription = json["data"]["subscription"] as JArray;
                foreach (JObject item in subscription)
                {
                    Anime anime = new Anime();
                    anime.aid       = (string)item["id"];
                    anime.name      = (string)item["name"];
                    anime.status    = ((int)item["isover"]).ToString();
                    anime.epi       = ((int)item["episode"]).ToString();
                    anime.read      = ((int)item["watch"]).ToString();
                    anime.highlight = ((int)item["isread"]).ToString();
                    subscriptionList.Add(anime);

                    if (anime.highlight != "0")
                    {
                        updateNumber++;
                    }
                }

                subscriptionList.Sort((Anime a, Anime b) =>
                {
                    if (a.highlight != "0" && b.highlight == "0")
                    {
                        return(-1);
                    }
                    return(0);
                });


                for (int i = 0; i < subscriptionList.Count; ++i)
                {
                    subscriptionList[i].num = i + 1;
                }

                return(true);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 5
0
        public async Task <bool> ChangePsw(string oldPsw, string newPsw)
        {
            try
            {
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync("http://api.sellmoe.com/changepw?key=" + key + "&oldpw=" + oldPsw + "&newpw=" + newPsw + "&hash=" + new Random().Next());

                JObject json = JObject.Parse(result);
                ErrorProcessor(json);
                return(true);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 6
0
        public async Task <bool> SetReadEpi(string aid, string epi)
        {
            try
            {
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync("http://api.sellmoe.com/epiedit?key=" + key + "&aid=" + aid + "&epi=" + epi + "&hash=" + new Random().Next());

                JObject json = JObject.Parse(result);
                ErrorProcessor(json);
                return(true);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 7
0
        public async Task <bool> DelHighlight(string aid)
        {
            try
            {
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync("http://api.sellmoe.com/highlight?key=" + key + "&aid=" + aid + "&method=del&hash=" + new Random().Next());

                JObject json = JObject.Parse(result);
                ErrorProcessor(json);
                return(true);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 8
0
        public async Task <bool> GetAnimeDetail(string aid)
        {
            try
            {
                string url = "http://data.pad.kankan.com/mobile/detail/" + aid[0] + aid[1] + "/" + aid + ".json";
                Debug.WriteLine(url);
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync(url);

                Debug.WriteLine(result);
                JObject json = JObject.Parse(result);

                animeDetail.Get(json);

                return(true);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 9
0
        private async void EpiButton_Click(object sender, RoutedEventArgs e)
        {
            if (!DeviceNetworkInformation.IsWiFiEnabled)
            {
                MessageBoxResult result = MessageBox.Show("检测到您正在使用移动数据网络,跳转到播放页面可能会使用您的数据流量,是否继续?", "提示", MessageBoxButton.OKCancel);
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
            }


            LodingGrid.Visibility = System.Windows.Visibility.Visible;

            string id  = null;
            string aid = subscriptionIndex.aid;

            try
            {
                string     url         = "http://data.pad.kankan.com/mobile/sub_detail/" + aid[0] + aid[1] + "/" + aid + ".json";
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync(url);

                JObject json = JObject.Parse(result);
                foreach (JObject item in (json["episodes"] as JArray))
                {
                    if (((int)item["index"] + 1).ToString() == ((sender as Button).Tag as string))
                    {
                        foreach (JObject part in (item["parts"] as JArray))
                        {
                            if (((int)part["index"]) == 0)
                            {
                                id = ((int)part["id"]).ToString();
                                break;
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception exception)
            {
                LodingGrid.Visibility = System.Windows.Visibility.Collapsed;
                MessageBox.Show(exception.Message, "获取播放地址失败", MessageBoxButton.OK);
            }

            if (id != null)
            {
                string playUrl = "http://m.kankan.com/v/" + aid[0] + aid[1] + "/" + aid + ".shtml?subid=" + id + "&quality=2";
                Debug.WriteLine(playUrl);
                LodingGrid.Visibility = System.Windows.Visibility.Collapsed;
                WebBrowserTask task = new WebBrowserTask();
                task.Uri = new Uri(playUrl, UriKind.Absolute);
                task.Show();
            }
            else
            {
                LodingGrid.Visibility = System.Windows.Visibility.Collapsed;
                MessageBox.Show("", "获取播放地址失败", MessageBoxButton.OK);
            }
        }
Esempio n. 10
0
        public async Task <bool> GetUpdateSchedule()
        {
            try
            {
                HttpEngine httpRequest = new HttpEngine();
                string     result      = await httpRequest.GetAsync("http://api.sellmoe.com/get_update_schedule?hash=" + new Random().Next());

                JObject json = JObject.Parse(result);
                ErrorProcessor(json);

                scheduleList.Clear();
                JArray list = json["data"]["update_list"] as JArray;
                foreach (JObject item in list)
                {
                    Anime anime = new Anime();
                    anime.name = (string)item["name"];
                    anime.time = (string)item["time"];

                    string url = (string)item["url"];
                    if (url.Contains("vod"))
                    {
                        anime.aid = url.Substring(27, 5);
                    }
                    else
                    {
                        anime.aid = url.Substring(url.Length - 5, 5);
                    }

                    int week = (int)item["week"];
                    switch (week)
                    {
                    case 0:
                        anime.week = "星期天";
                        break;

                    case 1:
                        anime.week = "星期一";
                        break;

                    case 2:
                        anime.week = "星期二";
                        break;

                    case 3:
                        anime.week = "星期三";
                        break;

                    case 4:
                        anime.week = "星期四";
                        break;

                    case 5:
                        anime.week = "星期五";
                        break;

                    case 6:
                        anime.week = "星期六";
                        break;
                    }

                    scheduleList.Add(anime);
                }

                for (int i = 0; i < scheduleList.Count; ++i)
                {
                    scheduleList[i].num = i + 1;
                }

                return(true);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 运行计划任务的代理
        /// </summary>
        /// <param name="task">
        /// 调用的任务
        /// </param>
        /// <remarks>
        /// 调用定期或资源密集型任务时调用此方法
        /// </remarks>
        protected override async void OnInvoke(ScheduledTask task)
        {
            //TODO: 添加用于在后台执行任务的代码
            if (IsolatedStorageSettings.ApplicationSettings.Contains("UserKey"))
            {
                try
                {
                    DateTime TimeLast   = (DateTime)IsolatedStorageSettings.ApplicationSettings["LastUpdatedTime"];
                    DateTime TimeNow    = DateTime.Now;
                    TimeSpan TimeOffset = TimeNow - TimeLast;
                    int      TimeSet    = 0;
                    switch ((int)IsolatedStorageSettings.ApplicationSettings["UpdateInterval"])
                    {
                    case 0:
                        TimeSet = 2;
                        break;

                    case 1:
                        TimeSet = 4;
                        break;

                    case 2:
                        TimeSet = 8;
                        break;

                    case 3:
                        TimeSet = 12;
                        break;

                    case 4:
                        TimeSet = 24;
                        break;
                    }
                    if (Debugger.IsAttached || TimeOffset.TotalHours >= (double)TimeSet)
                    {
                        HttpEngine httpRequest = new HttpEngine();
                        string     result      = await httpRequest.GetAsync("http://api.anime.mmmoe.info/get_user_info?key=" + IsolatedStorageSettings.ApplicationSettings["UserKey"] + "&sb=Ricter&hash=" + new Random().Next());

                        JObject json = JObject.Parse(result);

                        List <Anime> subscriptionList = new List <Anime>();
                        int          pushNumber       = 0;
                        int          updatedNumber    = 0;
                        JArray       subscription     = json["data"]["subscription"] as JArray;
                        foreach (JObject item in subscription)
                        {
                            Anime anime = new Anime();
                            anime.name      = (string)item["name"];
                            anime.epi       = ((int)item["episode"]).ToString();
                            anime.highlight = ((int)item["isread"]).ToString();
                            subscriptionList.Add(anime);

                            if (anime.highlight != "0")
                            {
                                updatedNumber++;
                            }
                        }

                        subscriptionList.Sort((Anime x, Anime y) =>
                        {
                            if (x.highlight != "0" && y.highlight == "0")
                            {
                                return(-1);
                            }
                            if (x.highlight == "0" && y.highlight != "0")
                            {
                                return(0);
                            }
                            if (x.highlight != "0" && y.highlight != "0")
                            {
                                if (x.highlight == "1" && y.highlight == "2")
                                {
                                    return(-1);
                                }
                                if (x.highlight == "2" && y.highlight == "1")
                                {
                                    return(0);
                                }
                            }
                            return(-1);
                        });

                        if (Debugger.IsAttached)
                        {
                            for (int i = 0; i < subscriptionList.Count; ++i)
                            {
                                Debug.WriteLine(subscriptionList[i].name);
                                Debug.WriteLine(subscriptionList[i].epi);
                                Debug.WriteLine(subscriptionList[i].highlight);
                                Debug.WriteLine("----------------------------");
                            }
                        }

                        string[] TileContent = new string[3];
                        string   showName    = "";
                        if (subscriptionList.Count >= 1 && subscriptionList[0].highlight != "0")
                        {
                            TileContent[0] = "订阅更新";
                            TileContent[1] = subscriptionList[0].name + " 更新到第 " + subscriptionList[0].epi + " 集";
                            showName       = subscriptionList[0].name;
                        }
                        if (subscriptionList.Count >= 2 && subscriptionList[1].highlight != "0")
                        {
                            TileContent[2] = subscriptionList[1].name + " 更新到第 " + subscriptionList[1].epi + " 集";
                        }

                        ShellTile Tile = ShellTile.ActiveTiles.FirstOrDefault();
                        if (Tile != null)
                        {
                            var TileData = new IconicTileData()
                            {
                                Title           = "新番提醒",
                                Count           = updatedNumber,
                                BackgroundColor = System.Windows.Media.Colors.Transparent,
                                WideContent1    = TileContent[0],
                                WideContent2    = TileContent[1],
                                WideContent3    = TileContent[2]
                            };
                            Tile.Update(TileData);
                        }
                        if (pushNumber > 0)
                        {
                            ShellToast toast = new ShellToast();
                            toast.Title   = showName + " 等 " + pushNumber.ToString() + " 个订阅更新,点击查看";
                            toast.Content = "";
                            toast.Show();
                        }
                        IsolatedStorageSettings.ApplicationSettings["LastUpdatedTime"] = TimeNow;
                        IsolatedStorageSettings.ApplicationSettings.Save();
                    }
                }
                catch
                {
                }
            }
            NotifyComplete();
        }