public void Get(MovieData data)
 {
     Data = new MovieDataState();
     Data.data = data;
     Data.state = 0;
     if (GetNew != null)
     {
         GetNew(this, EventArgs.Empty);
     }
 }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //lock (StaticTempSave.ListData)
            //{

            //HttpRequest request = context.Request;
            //HttpResponse response = context.Response;

            //if (request.Headers["KCApp"] == null)
            //{
            //    if (request.Headers["Referer"] != null)
            //    {
            //        if (!request.Headers["Referer"].StartsWith("http://vod.kcplayer.com/") && !request.Headers["Referer"].StartsWith("http://yun.7tbw.com/"))
            //        {
            //            lock (StaticTempSave.RefreshList)
            //            {
            //                StaticTempSave.RefreshList.Add(request.Headers["Referer"]);
            //            }
            //            response.StatusCode = 403;
            //            response.End();
            //        }
            //    }
            //    else
            //    {
            //        response.StatusCode = 403;
            //        response.End();
            //    }
            //}

            string jsonp = context.Request.QueryString["jsonp"];

            int start = -1;
            bool issok = int.TryParse(context.Request.QueryString["s"], out start);
            int end = -1;
            bool iseok = int.TryParse(context.Request.QueryString["e"], out end);
            string str = context.Request.QueryString["filter"];
            bool isFilter = true;
            if (!string.IsNullOrEmpty(str))
            {
                isFilter = str.ToLower() == "true" ? true : false;
            }
            lock (StaticTempSave.ListData)
            {
                MovieData[] tempData = null;
                //if (context.Request.Headers["KCApp"] != null)
                //{
                if (issok)
                {
                    List<MovieData> allData = null;
                    if (isFilter)
                    {
                        //allData = StaticTempSave.ListData.FindAll(item => item.Url.Trim().ToLower().StartsWith("ftp"));
                        allData = new List<MovieData>();
                        foreach (MovieData item in StaticTempSave.ListData)
                        {
                            if (item != null && item.Url.ToLower().Trim().StartsWith("ftp://"))
                            {
                                allData.Add(item);
                            }
                        }
                    }
                    else
                    {
                        allData = StaticTempSave.ListData;
                    }
                    end = iseok ? end : allData.Count;

                    if (start > allData.Count - 1)
                    {
                        context.Response.StatusCode = 403;
                        context.Response.End();
                    }

                    int count = end - start;
                    if (count > allData.Count)
                        count = allData.Count - start;

                    if (count <= 0)
                    {
                        context.Response.StatusCode = 403;
                        context.Response.End();
                    }
                    else
                    {
                        tempData = new MovieData[count];
                        allData.CopyTo(start, tempData, 0, tempData.Length);
                    }
                }
                //}
                if (tempData != null)
                {
                    string data = JsonMapper.ToJson(tempData);
                    if (data != null)
                    {
                        if (jsonp != null && jsonp != string.Empty)
                            context.Response.Write(jsonp + "(" + data + ")");
                        else
                            context.Response.Write(data);
                    }
                }
                else
                {
                    context.Response.StatusCode = 403;
                }
            }
            context.Response.End();
            //}
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //HttpRequest request = context.Request;
            //HttpResponse response = context.Response;

            //if (request.Headers["KCApp"] == null)
            //{
            //    if (request.Headers["Referer"] != null)
            //    {
            //        if (!request.Headers["Referer"].StartsWith("http://vod.kcplayer.com/") && !request.Headers["Referer"].StartsWith("http://yun.7tbw.com/"))
            //        {
            //            lock (StaticTempSave.RefreshList)
            //            {
            //                StaticTempSave.RefreshList.Add(request.Headers["Referer"]);
            //            }
            //            response.StatusCode = 403;
            //            response.End();
            //        }
            //    }
            //    else
            //    {
            //        response.StatusCode = 403;
            //        response.End();
            //    }
            //}

            string text = context.Request.QueryString["url"];
            string gcid = context.Request.QueryString["gcid"];

            if (text != string.Empty
                && gcid != string.Empty)
            //&& context.Request.Headers["KCApp"] != null)
            {
                //if (File.Exists(context.Server.MapPath(DataPath)))
                //    listData = JsonMapper.ToObject<List<MovieData>>(File.ReadAllText(context.Server.MapPath(DataPath)));
                lock (StaticTempSave.ListData)
                {
                    MovieData data = null;
                    foreach (MovieData item in StaticTempSave.ListData)
                    {
                        if (item.Url == text.Trim())
                        {
                            data = item;
                            break;
                        }
                    }
                    if (data != null)
                    {
                        context.Response.StatusCode = 403;
                        context.Response.End();
                        return;
                    }

                    data = new MovieData
                    {
                        Gcid = gcid,
                        Url = text
                    };

                    StaticTempSave.ListData.Insert(0, data);
                    //if (data.Url.StartsWith("ftp"))
                    //{
                    StaticTempSave.TopNew.Get(data);
                    //}
                    TimeSpan span = (DateTime.Now - StaticTempSave.DateTime);
                    if (span.TotalHours >= 24)
                    {
                        StaticTempSave.ListData.Clear();
                        File.WriteAllText(context.Server.MapPath(DataPath), JsonMapper.ToJson(StaticTempSave.ListData));
                        StaticTempSave.DateTime = DateTime.Now;
                    }
                }
            }

            context.Response.StatusCode = 403;
            context.Response.End();
        }