Example #1
0
 public MainWindow()
     : base(Gtk.WindowType.Toplevel)
 {
     ICookieGetter cg = CookieGetter.CreateInstance(BrowserType.Chromium);
     Cookie cookie = cg.GetCookie(new Uri("http://live.nicovideo.jp/"),"user_session");
     _user = new NicoUser(cookie);
     Build ();
 }
Example #2
0
 public void DoNicoru(NicoUser user)
 {
     string url = "http://ru-cliapi.nicovideo.jp/1/item/nicoru";
     Json.NicoruResponse json = Post(user,url);
     if(json.Error != null){
         throw new Exception(String.Format("ニコるのに失敗しました {0} {1} {2} {3}",json.Status,json.StatusCode,json.Error.Code,json.Error.Description));
     }
 }
Example #3
0
        Json.NicoruResponse Post(NicoUser user,string url)
        {
            string data = String.Format("items={1}&token={0}",user.Token,_nicoru);
            byte[] datab = Encoding.UTF8.GetBytes(data);
            WebRequest req = WebRequest.Create(url);
            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            req.ContentLength = datab.Length;

            Stream st = req.GetRequestStream();
            st.Write(datab,0,data.Length);
            st.Close();
            WebResponse res = req.GetResponse();
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Json.NicoruResponse));
            Stream resst = res.GetResponseStream();
            return (Json.NicoruResponse)ser.ReadObject(resst);
        }
Example #4
0
 public Nicorepo(NicoUser user)
 {
     items = new List<INicorepoItem>();
     _user = user;
 }
Example #5
0
 public Json.NicoruResponse Nicorare(NicoUser user)
 {
     string url = "http://ru-cliapi.nicovideo.jp/1/item/nicorare_count";
     return Post(user,url);
 }