📄 wappush.cs
字号:
namespace mCore
{
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Threading;
using System.Windows.Forms;
public class WapPush : IWapPush
{
private const string a = "05";
private const string b = "06";
private const string c = "07";
private const string d = "08";
private const string e = "09";
private string f = "";
private string g = "";
private string h = "";
private string i = "0";
private string j = "07";
private DateTime k = new DateTime();
private f l;
private SMS m;
private const int n = 1;
internal WapPush(ref SMS A_0)
{
this.m = A_0;
this.l = this.m.gm;
}
private void a()
{
if (this.l.ac.Length > 0)
{
switch (this.l.ac.ToUpper())
{
case "GENERAL":
throw new GeneralException("ERROR " + this.l.z.ToString() + ": " + this.l.y);
case "SMSSEND":
throw new SMSSendException("ERROR " + this.l.z.ToString() + ": " + this.l.y);
case "SMSREAD":
throw new SMSReadException("ERROR " + this.l.z.ToString() + ": " + this.l.y);
case "SMSDELETE":
throw new SMSDeleteException("ERROR " + this.l.z.ToString() + ": " + this.l.y);
case "WAPPUSH":
throw new WapPushException("ERROR " + this.l.z.ToString() + ": " + this.l.y);
case "VCARD":
throw new vCardException("ERROR " + this.l.z.ToString() + ": " + this.l.y);
case "VCALENDAR":
throw new vCalendarException("ERROR " + this.l.z.ToString() + ": " + this.l.y);
}
}
}
public string Send()
{
mCore.WapPush.a a = new mCore.WapPush.a(ref this.m, this.f, this.g, this.h, this.i, this.j, this.k, this.l.bh, this.l.bi);
Thread thread = new Thread(new ThreadStart(a.a));
thread.Name = "WP_SendMethodThread";
thread.Priority = ThreadPriority.AboveNormal;
thread.Start();
while (thread.IsAlive)
{
Thread.Sleep(1);
Application.DoEvents();
}
string l = a.l;
if (a != null)
{
a = null;
}
string str = l;
this.a();
return str;
}
public string SendToQueue()
{
mCore.WapPush.a a = new mCore.WapPush.a(ref this.m, this.f, this.g, this.h, this.i, this.j, this.k, this.l.bh, this.l.bi);
a.k = 2;
Thread thread = new Thread(new ThreadStart(a.b));
thread.Name = "SendWapPushToQueueMethodThread";
thread.Priority = ThreadPriority.AboveNormal;
thread.Start();
while (thread.IsAlive)
{
Thread.Sleep(1);
Application.DoEvents();
}
string m = a.m;
if (a != null)
{
a = null;
}
string str = m;
this.a();
return str;
}
public string SendToQueue(QueuePriority Priority)
{
mCore.WapPush.a a = new mCore.WapPush.a(ref this.m, this.f, this.g, this.h, this.i, this.j, this.k, this.l.bh, this.l.bi);
a.k = (int) Priority;
Thread thread = new Thread(new ThreadStart(a.b));
thread.Name = "SendWapPushToQueueMethodThread";
thread.Priority = ThreadPriority.AboveNormal;
thread.Start();
while (thread.IsAlive)
{
Thread.Sleep(1);
Application.DoEvents();
}
string m = a.m;
if (a != null)
{
a = null;
}
string str = m;
this.a();
return str;
}
public WapPushAction Action
{
get
{
WapPushAction signalHigh;
this.l.av();
switch (this.j)
{
case "06":
return WapPushAction.SignalLow;
case "07":
return WapPushAction.SignalMedium;
case "08":
signalHigh = WapPushAction.SignalHigh;
break;
}
return signalHigh;
}
set
{
this.l.av();
if ((value >= WapPushAction.SignalLow) & (value <= WapPushAction.SignalHigh))
{
switch (value)
{
case WapPushAction.SignalLow:
this.j = "06";
goto Label_007F;
case WapPushAction.SignalMedium:
this.j = "07";
goto Label_007F;
case WapPushAction.SignalHigh:
this.j = "08";
goto Label_007F;
}
}
else
{
this.l.a(0x1b5cL, "Invalid action attribute", "WAPPUSH");
this.j = "07";
}
Label_007F:
this.a();
}
}
public DateTime Created
{
get
{
this.l.av();
DateTime k = this.k;
this.a();
return k;
}
set
{
this.l.av();
if (DateTime.Compare(value, DateTime.MinValue) == 0)
{
this.k = value;
}
else if (Information.IsDate(value))
{
this.k = value;
}
else
{
this.l.a(0x1b5dL, "Invalid create date value", "WAPPUSH");
this.k = new DateTime();
}
this.a();
}
}
public string Destination
{
get
{
this.l.av();
return this.h;
}
set
{
this.l.av();
if (value == null)
{
value = "";
}
this.h = value.Trim();
if ((this.h.Length == 0) | (!this.l.j(this.h) & !this.l.f(this.h)))
{
this.l.a(0x1b59L, "Invalid destination mobile number", "WAPPUSH");
this.h = "";
}
this.a();
}
}
public string Expiry
{
get
{
this.l.av();
return this.i;
}
set
{
string str = "";
long num = 0L;
bool flag = true;
try
{
this.l.av();
if (value == null)
{
value = "0";
}
if (value.Trim() == "0")
{
this.i = "0";
}
else
{
if (value.Length >= 2)
{
str = value.Substring(value.Length - 1, 1).ToUpper();
if ((Versioned.IsNumeric(value.Substring(0, value.Length - 1)) & !value.Contains(",")) & !value.Contains("."))
{
num = Conversions.ToLong(value.Substring(0, value.Length - 1));
}
else
{
this.i = "0";
flag = false;
}
}
else
{
this.i = "0";
flag = false;
}
if ((num == 0L) & (((str == "H") | (str == "D")) | (str == "M")))
{
this.i = "0";
}
else if ((((str == "H") | (str == "D")) | (str == "M")) & (num > 0L))
{
if (((((str == "H") & (num <= 0x18L)) & (num >= 1L)) | (((str == "D") & (num <= 0x1fL)) & (num >= 1L))) | (((str == "M") & (num <= 12L)) & (num >= 1L)))
{
this.i = value.ToUpper();
}
else
{
this.i = "0";
flag = false;
}
}
else
{
this.i = "0";
flag = false;
}
if (!flag)
{
this.i = "0";
this.l.a(0x1b5eL, "Invalid expiry time", "WAPPUSH");
}
}
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
Exception exception = exception1;
this.m.r.b("[WapPush:Expiry:1] " + exception.Message);
ProjectData.ClearProjectError();
}
this.a();
}
}
public bool IsLengthOK
{
get
{
bool flag;
string str = "";
string str2 = "";
string str3 = "";
try
{
flag = false;
str = this.l.a(this.f, this.g, this.k, this.i, this.j);
str2 = this.l.am();
str3 = this.l.aw();
if (((int) Math.Round((double) (((double) (str + str2 + str3).Length) / 2.0))) <= 140)
{
flag = true;
}
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
Exception exception = exception1;
this.m.r.b("[WapPush:IsLengthOK:1] " + exception.Message);
ProjectData.ClearProjectError();
}
return flag;
}
}
public WapPushAction mCore.IWapPush.Action
{
get
{
WapPushAction signalHigh;
this.l.av();
switch (this.j)
{
case "06":
return WapPushAction.SignalLow;
case "07":
return WapPushAction.SignalMedium;
case "08":
signalHigh = WapPushAction.SignalHigh;
break;
}
return signalHigh;
}
set
{
this.l.av();
if ((value >= WapPushAction.SignalLow) & (value <= WapPushAction.SignalHigh))
{
switch (value)
{
case WapPushAction.SignalLow:
this.j = "06";
goto Label_007F;
case WapPushAction.SignalMedium:
this.j = "07";
goto Label_007F;
case WapPushAction.SignalHigh:
this.j = "08";
goto Label_007F;
}
}
else
{
this.l.a(0x1b5cL, "Invalid action attribute", "WAPPUSH");
this.j = "07";
}
Label_007F:
this.a();
}
}
public DateTime mCore.IWapPush.Created
{
get
{
this.l.av();
DateTime k = this.k;
this.a();
return k;
}
set
{
this.l.av();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -