📄 sgipconnection.cs
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: SgipConnection.java
using System;
namespace com.sms.sgip.data
{
// Referenced classes of package com.sms.sgip.data:
// SMSBind, SMSBindResp, SgipException, SMSUnBind,
// SMSUnBindResp, SMSSubmit, SMSSubmitResp, SMSDeliver,
// SMSDeliverResp
public class SgipConnection : IThreadRunnable
{
virtual public System.String Host
{
get
{
return m_strHost;
}
}
virtual public int Port
{
get
{
return m_iPort;
}
}
virtual public bool Available
{
get
{
long available;
available = m_is.BaseStream.Length - m_is.BaseStream.Position;
return (int) available > 0;
}
}
virtual public System.String CorpID
{
get
{
return corpID;
}
set
{
this.corpID = value;
}
}
virtual public System.String SpNumber
{
get
{
return spNumber;
}
set
{
this.spNumber = value;
}
}
internal System.Net.Sockets.TcpClient m_sk;
//UPGRADE_TODO: Class“java.io.DataOutputStream”被转换为具有不同行为的 'System.IO.BinaryWriter'。 "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataOutputStream'"
internal System.IO.BinaryWriter m_os;
//UPGRADE_TODO: Class“java.io.DataInputStream”被转换为具有不同行为的 'System.IO.BinaryReader'。 "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
internal System.IO.BinaryReader m_is;
internal System.String m_strHost;
internal int m_iPort;
internal System.String corpID;
internal System.String spNumber;
public SgipConnection()
{
m_sk = null;
}
public virtual void connect(System.String strHost, int iPort)
{
m_sk = new System.Net.Sockets.TcpClient(strHost, iPort);
//UPGRADE_TODO: Class“java.io.DataOutputStream”被转换为具有不同行为的 'System.IO.BinaryWriter'。 "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataOutputStream'"
m_os = new System.IO.BinaryWriter(m_sk.GetStream());
m_is = new System.IO.BinaryReader(new System.IO.BufferedStream(m_sk.GetStream()));
}
public virtual void close()
{
if (m_sk == null && m_is == null && m_os == null)
return ;
try
{
m_sk.Close();
}
catch (System.Exception e)
{
}
m_sk = null;
m_is = null;
m_os = null;
}
public virtual void bind(System.String loginName, System.String loginPassword, int loginType)
{
SMSBind smsbind = new SMSBind();
smsbind.getValue(corpID);
smsbind.LoginName = loginName;
smsbind.LoginPassword = loginPassword;
smsbind.LoginType = loginType;
smsbind.write(m_os);
SMSBindResp smsbindresp = new SMSBindResp();
long beginTime = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
do
{
long available;
available = m_is.BaseStream.Length - m_is.BaseStream.Position;
if ((int) available > 0)
{
smsbindresp.read(m_is);
break;
}
if ((System.DateTime.Now.Ticks - 621355968000000000) / 10000 - beginTime >= 30000L)
throw new SgipException();
}
while (true);
System.Console.Out.WriteLine("bind resp result:" + smsbindresp.Result);
if (smsbindresp.Result != 0)
throw new SgipException();
else
return ;
}
public virtual void unBind()
{
SMSUnBind smsunbind = new SMSUnBind();
smsunbind.getValue(corpID);
smsunbind.write(m_os);
SMSUnBindResp smsunbindresp = new SMSUnBindResp();
long beginTime = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
do
{
long available;
available = m_is.BaseStream.Length - m_is.BaseStream.Position;
if ((int) available > 0)
{
smsunbindresp.read(m_is);
break;
}
if ((System.DateTime.Now.Ticks - 621355968000000000) / 10000 - beginTime >= 30000L)
throw new SgipException();
}
while (true);
}
public virtual System.String submit(System.String chargeNumber, System.String userNumber, System.String messageContent, System.String spNumber, System.String corpID, System.String serviceType, int feeType, System.String feeValue, System.String givenValue, int morelatetoMTFlag, int reportFlag, int messageCoding, System.String expireTime, System.String scheduleTime)
{
SMSSubmit smssubmit = new SMSSubmit();
smssubmit.getValue(this.corpID);
smssubmit.ChargeNumber = chargeNumber;
smssubmit.UserNumber = userNumber;
smssubmit.MessageContent = messageContent;
if (spNumber != null && !spNumber.Equals(""))
smssubmit.SpNumber = spNumber;
smssubmit.CorpId = corpID;
smssubmit.ServiceType = serviceType;
smssubmit.FeeType = feeType;
smssubmit.FeeValue = feeValue;
smssubmit.GivenValue = givenValue;
smssubmit.MorelatetoMTFlag = morelatetoMTFlag;
smssubmit.ReportFlag = reportFlag;
smssubmit.MessageCoding = messageCoding;
smssubmit.ExpireTime = expireTime;
smssubmit.ScheduleTime = scheduleTime;
smssubmit.write(m_os);
System.String resp = smssubmit.seqAddr + ";" + smssubmit.seqDate + ";" + smssubmit.sequence;
return resp;
}
public virtual SMSSubmitResp submitresp()
{
SMSSubmitResp smssubmitresp = new SMSSubmitResp();
smssubmitresp.read(m_is);
return smssubmitresp;
}
public virtual SMSDeliver deliver(System.String userNumber, System.String messageContent)
{
SMSDeliver smsdeliver = new SMSDeliver();
smsdeliver.getValue(corpID);
smsdeliver.UserNumber = userNumber;
smsdeliver.SpNumber = spNumber;
smsdeliver.MessageContent = messageContent;
smsdeliver.write(m_os);
SMSDeliverResp smsdeliverresp = new SMSDeliverResp();
long beginTime = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
do
{
long available;
available = m_is.BaseStream.Length - m_is.BaseStream.Position;
if ((int) available > 0)
{
smsdeliverresp.read(m_is);
break;
}
if ((System.DateTime.Now.Ticks - 621355968000000000) / 10000 - beginTime >= 30000L)
throw new SgipException();
}
while (true);
if (smsdeliverresp.Result != 0)
throw new SgipException();
else
return smsdeliver;
}
public virtual void Run()
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -