예제 #1
0
파일: Form1.cs 프로젝트: stooged/DeskCastC
 void WC1_GotChannel(object sender, wClient e)
 {
     string[] Spl1, Spl2;
     if (e.PlData.Contains("\"URL\":\"ws") == true)
     {
         Timer1.Enabled = false;
         AppLog(e.PlData);
         Spl1       = Regex.Split(e.PlData, "\"URL\":\"");
         Spl2       = Regex.Split(Spl1[1], "\"");
         UTL1.CmdID = 0;
         WS1.ConnectWs(Spl2[0]);
     }
 }
예제 #2
0
        public void DelReceiver(string LocalIP, string ChromeCastIP, string CC_Receiver)
        {
            wClient ClientEvent = new wClient();

            try
            {
                WebClient oWeb = new WebClient();
                oWeb.Headers.Add("Origin", "http://" + LocalIP);
                string Result = oWeb.UploadString("http://" + ChromeCastIP + ":8008/apps/" + CC_Receiver, "DELETE", "");
                ClientEvent.PlData = Result;
                GotDelReceiver(this, ClientEvent);
            }
            catch (Exception ex)
            {
                ClientEvent.ErrorMessage = ex.Message;
                DelReceiverError(this, ClientEvent);
            }
        }
예제 #3
0
        public void PostChannel(string LocalIP, string ChromeCastIP, string CC_Receiver, string ChromeCastUID)
        {
            wClient ClientEvent = new wClient();

            try
            {
                WebClient oWeb = new WebClient();
                oWeb.Headers.Add("Content-Type", "application/json");
                oWeb.Headers.Add("Origin", "http://" + LocalIP);
                string Result = oWeb.UploadString("http://" + ChromeCastIP + ":8008/connection/" + CC_Receiver, "POST", "{\"channel\":0,\"senderId\":{\"appName\":\"" + CC_Receiver + "\", \"senderId\":\"" + ChromeCastUID + "\"}}");
                ClientEvent.PlData = Result;
                GotChannel(this, ClientEvent);
            }
            catch (Exception ex)
            {
                ClientEvent.ErrorMessage = ex.Message;
                ChannelError(this, ClientEvent);
            }
        }
예제 #4
0
        /*
         * string encReceiver = "PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCiAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vd3d3LmdzdGF0aWMuY29tL2Nhc3QvanMvcmVjZWl2ZXIvMS4wL2Nhc3RfcmVjZWl2ZXIuan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Pg0KPC9odG1sPg==";
         */

        public void PostInit(string LocalIP, string ChromeCastIP, string CC_Receiver, string LocalPort)
        {
            wClient ClientEvent = new wClient();

            try
            {
                WebClient oWeb = new WebClient();
                oWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
                oWeb.Headers.Add("Origin", "http://" + LocalIP);
                string Result = oWeb.UploadString("http://" + ChromeCastIP + ":8008/apps/" + CC_Receiver, "POST", "http://" + LocalIP + ":" + LocalPort + "/receiver.html");
                //  string Result = oWeb.UploadString("http://" + ChromeCastIP + ":8008/apps/" + CC_Receiver, "POST", "data:text/html;base64," + encReceiver);
                ClientEvent.PlData = Result;
                GotInit(this, ClientEvent);
            }
            catch (Exception ex)
            {
                ClientEvent.ErrorMessage = ex.Message;
                InitError(this, ClientEvent);
            }
        }
예제 #5
0
파일: Form1.cs 프로젝트: stooged/DeskCastC
 void WC1_DelReceiverError(object sender, wClient e)
 {
 }
예제 #6
0
파일: Form1.cs 프로젝트: stooged/DeskCastC
 void WC1_GotDelReceiver(object sender, wClient e)
 {
 }
예제 #7
0
파일: Form1.cs 프로젝트: stooged/DeskCastC
 void WC1_ChannelError(object sender, wClient e)
 {
 }
예제 #8
0
파일: Form1.cs 프로젝트: stooged/DeskCastC
 void WC1_InitError(object sender, wClient e)
 {
     AppLog(e.ErrorMessage);
 }
예제 #9
0
파일: Form1.cs 프로젝트: stooged/DeskCastC
 void WC1_GotInit(object sender, wClient e)
 {
     AppLog(e.PlData);
     Timer1.Start();
 }