Ejemplo n.º 1
0
 /// <summary>
 /// this will overwrite server profile 2
 /// </summary>
 /// <param name="SMTPserver"></param>
 /// <param name="From"></param>
 /// <param name="To"></param>
 /// <param name="Username"></param>
 /// <param name="Password"></param>
 /// <param name="Subject"></param>
 /// <param name="Message"></param>
 /// <returns></returns>
 public InternetRequestResponse Internet_SMTP(string SMTPserver, string From, string To, string Username, string Password, string Subject, string Message)
 {
     InternetServiceProfile profile = new InternetServiceProfile(2, InternetServiceType.Smtp, 0);
     profile.address = SMTPserver;
     profile.user = Username;
     profile.passwd = Password;
     profile.smFrom = From;
     profile.smRcpt = To;
     profile.smSubj = Subject;
     profile.smAuth = "1";
     profile.alphabet = Alphabet.international_reference_alphabet;
     profile.tcpPort = "25";
     Internet_Setup_Service_Profile(profile);
     return Internet_SMTP(profile, Message);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// this will over write server profile 0
 /// </summary>
 /// <param name="RequestURL"></param>
 /// <param name="Host"></param>
 /// <param name="Data"></param>
 /// <returns></returns>
 public InternetRequestResponse Internet_HttpRequest_SOAP(string RequestURL, string XML)
 {
     InternetServiceProfile service = new InternetServiceProfile(1, InternetServiceType.Http, 0);
     service.hcMethod = InternetServiceMethod.POST;
     service.address = RequestURL;
     service.hcContLen = XML.Length.ToString();
     //service.hcProp = "Host:\\20" + Host + "\\0d\\0aContent-Type:\\20application/soap+xml\\3b\\20charset=utf-8\\0d\\0aContent-Length:\\20" + XML.Length.ToString();
     service.hcProp = "Content-Type:\\20application/soap+xml\\3b\\20charset=utf-8";
     Internet_Setup_Service_Profile(service);
     return Internet_HttpRequest_POST(service.profileID, service.conId, XML);
 }
Ejemplo n.º 3
0
 public InternetRequestResponse Internet_SMTP(InternetServiceProfile Profile, string Message)
 {
     return Internet_SMTP(Profile.profileID, Profile.conId, Message);
 }
Ejemplo n.º 4
0
 public InternetRequestResponse Internet_HttpRequest_POST(InternetServiceProfile Profile, string Data)
 {
     return Internet_HttpRequest_POST(Profile.profileID, Profile.conId, Data);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// this will over write server profile 1
 /// </summary>
 /// <param name="RequestURL"></param>
 /// <param name="Headers"></param>
 /// <param name="Data"></param>
 /// <returns></returns>
 public InternetRequestResponse Internet_HttpRequest_POST(string RequestURL, HttpHeaders Headers, string Data)
 {
     InternetServiceProfile service = new InternetServiceProfile(1, InternetServiceType.Http, 0);
     service.hcMethod = InternetServiceMethod.POST;
     service.address = RequestURL;
     service.hcContLen = Data.Length.ToString();
     if (Headers != null)
         service.hcProp = Headers.ToString();
     Internet_Setup_Service_Profile(service);
     return Internet_HttpRequest_POST(service.profileID, service.conId, Data);
 }
Ejemplo n.º 6
0
        public InternetServiceProfile Internet_Read_Service_Profile(int ProfileID)
        {
            GeneralResponse re = SendATCommand("AT^SISS?");

            if (re.IsSuccess && re.PayLoad.Length > 0)
            {
                InternetServiceProfile p = new InternetServiceProfile(ProfileID, InternetServiceType.none, -1);
                for (int i = 0; i < re.PayLoad.Length; i++)
                {
                    string[] values = re.PayLoad[i].Split(',');
                    if (values[0].IndexOf("^SISS") < 0)
                        continue;

                    if (values[0].Split(' ')[1].Equals(ProfileID.ToString()))
                    {
                        switch (values[1])
                        {
                            case "\"address\"": p.address = values[2].Split('"')[1]; break;
                            case "\"alphabet\"": p.alphabet = (Alphabet)int.Parse(values[2].Split('"')[1]); break;
                            case "\"conId\"": p.conId = int.Parse(values[2].Split('"')[1]); break;
                            case "\"hcAuth\"": p.hcAuth = values[2].Split('"')[1]; break;
                            case "\"hcContent\"": p.hcContent = values[2].Split('"')[1]; break;
                            case "\"hcContLen\"": p.hcContLen = values[2].Split('"')[1]; break;
                            case "\"hcMethod\"": p.hcMethod = (InternetServiceMethod)int.Parse(values[2].Split('"')[1]); break;
                            case "\"hcProp\"": p.hcProp = values[2].Split('"')[1]; break;
                            case "\"hcRedir\"": p.hcRedir = values[2].Split('"')[1]; break;
                            case "\"hcUsrAgent\"": p.hcUsrAgent = values[2].Split('"')[1]; break;
                            case "\"passwd\"": p.passwd = values[2].Split('"')[1]; break;
                            case "\"pCmd\"": p.pCmd = (POPCommand)int.Parse(values[2].Split('"')[1]); break;
                            case "\"pDelFlag\"": p.pDelFlag = (POPDeleteFlage)int.Parse(values[2].Split('"')[1]); break;
                            case "\"pLength\"": p.pLength = values[2].Split('"')[1]; break;
                            case "\"pNumber\"": p.pNumber = values[2].Split('"')[1]; break;
                            case "\"smAuth\"": p.smAuth = values[2].Split('"')[1]; break;
                            case "\"smCC\"": p.smCC = values[2].Split('"')[1]; break;
                            case "\"smFrom\"": p.smFrom = values[2].Split('"')[1]; break;
                            case "\"smHdr\"": p.smHdr = values[2].Split('"')[1]; break;
                            case "\"smRcpt\"": p.smRcpt = values[2].Split('"')[1]; break;
                            case "\"smSubj\"": p.smSubj = values[2].Split('"')[1]; break;
                            case "\"srvType\"": p.srvType = InternetServiceProfile.GetInternetServiceType(values[2].Split('"')[1]); break;
                            case "\"tcpMR\"": p.tcpMR = values[2].Split('"')[1]; break;
                            case "\"tcpOT\"": p.tcpOT = values[2].Split('"')[1]; break;
                            case "\"tcpPort\"": p.tcpPort = values[2].Split('"')[1]; break;
                            case "\"user\"": p.user = values[2].Split('"')[1]; break;
                            case "\"secOpt\"": p.secOpt = values[2].Split('"')[1]; break;
                        }
                    }
                }

                return p;
            }

            return null;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// this will over write server profile 0
 /// </summary>
 /// <param name="URL"></param>
 /// <returns></returns>
 public InternetRequestResponse Internet_HttpRequest_GET(string URL)
 {
     InternetServiceProfile service = new InternetServiceProfile(0, InternetServiceType.Http, 0);
     service.address = URL;
     service.hcContLen = "0";
     service.hcMethod = InternetServiceMethod.GET;
     Internet_Setup_Service_Profile(service);
     return Internet_HttpRequest_GET(service);
 }
Ejemplo n.º 8
0
 public InternetReadResponse Internet_Service_Read_Date(InternetServiceProfile Profile)
 {
     return Internet_Service_Read_Date(Profile.profileID);
 }
Ejemplo n.º 9
0
 public int Internet_Service_Write_Date(InternetServiceProfile Profile, string Data)
 {
     return Internet_Service_Write_Date(Profile.profileID, Data);
 }
Ejemplo n.º 10
0
 public void Internet_Close_Service(InternetServiceProfile Profile)
 {
     Internet_Close_Service(Profile.profileID);
 }
Ejemplo n.º 11
0
        public int Internet_Service_Peek_Date(InternetServiceProfile Profile)
        {
            GeneralResponse re = SendATCommand("AT^SISR=" + Profile.profileID + ",0");
            if (re.IsSuccess && re.PayLoad.Length == 1)
                return int.Parse(re.PayLoad[0].Split(',')[1]);

            return -1;
        }
Ejemplo n.º 12
0
 public bool Internet_Open_Service(InternetServiceProfile Profile)
 {
     return Internet_Open_Service(Profile.profileID);
 }
Ejemplo n.º 13
0
 public InternetError Internet_Service_Error(InternetServiceProfile Profile)
 {
     return Internet_Service_Error(Profile.profileID);
 }
Ejemplo n.º 14
0
 public InternetServiceInfo Internet_Service_Information(InternetServiceProfile Profile)
 {
     return Internet_Service_Information(Profile.profileID);
 }
Ejemplo n.º 15
0
 public InternetRequestResponse Internet_POP(InternetServiceProfile Profile)
 {
     return Internet_POP(Profile.profileID, Profile.conId);
 }
Ejemplo n.º 16
0
 public InternetRequestResponse Internet_HttpRequest_GET(InternetServiceProfile Profile)
 {
     return Internet_HttpRequest_GET(Profile.profileID, Profile.conId);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// this will over write server profile 3
 /// </summary>
 /// <param name="POPserver"></param>
 /// <param name="Username"></param>
 /// <param name="Password"></param>
 /// <param name="Command"></param>
 /// <param name="MessageID"></param>
 /// <param name="Flage"></param>
 /// <returns></returns>
 public InternetRequestResponse Internet_POP(string POPserver, string Username, string Password, POPCommand Command, string MessageID, POPDeleteFlage Flage)
 {
     InternetServiceProfile profile = new InternetServiceProfile(3, InternetServiceType.Pop3, 0);
     profile.address = POPserver;
     profile.user = Username;
     profile.passwd = Password;
     profile.pCmd = Command;
     profile.pNumber = MessageID;
     profile.pDelFlag = Flage;
     profile.smAuth = "1";
     profile.alphabet = Alphabet.international_reference_alphabet;
     profile.tcpPort = "110";
     Internet_Setup_Service_Profile(profile);
     return Internet_POP(profile);
 }
Ejemplo n.º 18
0
 public void Internet_Setup_Service_Profile(InternetServiceProfile profile)
 {
     SendATCommand("AT^SISS=" + profile.profileID + ",srvType," + InternetServiceProfile.GetInternetServiceString(profile.srvType));
     SendATCommand("AT^SISS=" + profile.profileID + ",hcMethod," + (int)profile.hcMethod);
     SendATCommand("AT^SISS=" + profile.profileID + ",conID," + profile.conId);
     SendATCommand("AT^SISS=" + profile.profileID + ",address," + profile.address);
     if (profile.alphabet != Alphabet.unknown)
         SendATCommand("AT^SISS=" + profile.profileID + ",alphabet," + (int)profile.alphabet);
     if (profile.hcAuth.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",hcAuth," + profile.hcAuth);
     if (profile.hcContent.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",hcContent," + profile.hcContent);
     if (profile.hcContLen.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",hcContLen," + profile.hcContLen);
     if (profile.hcProp.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",hcProp," + profile.hcProp);
     if (profile.hcRedir.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",hcRedir," + profile.hcRedir);
     if (profile.hcUsrAgent.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",hcUsrAgent," + profile.hcUsrAgent);
     if (profile.passwd.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",passwd," + profile.passwd);
     if (profile.pCmd != POPCommand.unknown)
         SendATCommand("AT^SISS=" + profile.profileID + ",pCmd," + (int)profile.pCmd);
     if (profile.pDelFlag != POPDeleteFlage.unknown)
         SendATCommand("AT^SISS=" + profile.profileID + ",pDelFlag," + (int)profile.pDelFlag);
     if (profile.pLength.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",pLength," + profile.pLength);
     if (profile.pNumber.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",pNumber," + profile.pNumber);
     if (profile.smAuth.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",smAuth," + profile.smAuth);
     if (profile.smCC.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",smCC," + profile.smCC);
     if (profile.smFrom.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",smFrom," + profile.smFrom);
     if (profile.smHdr.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",smHdr," + profile.smHdr);
     if (profile.smRcpt.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",smRcpt," + profile.smRcpt);
     if (profile.smSubj.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",smSubj," + profile.smSubj);
     if (profile.tcpMR.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",tcpMR," + profile.tcpMR);
     if (profile.tcpOT.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",tcpOT," + profile.tcpOT);
     if (profile.tcpPort.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",tcpPort," + profile.tcpPort);
     if (profile.user.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",user," + profile.user);
     if (profile.secOpt.Length > 0)
         SendATCommand("AT^SISS=" + profile.profileID + ",secOpt," + profile.secOpt);
 }