You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
328 lines
8.7 KiB
328 lines
8.7 KiB
2 weeks ago
|
using System;
|
||
|
using System.Collections.Concurrent;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Diagnostics;
|
||
|
using System.Drawing;
|
||
|
using System.IO;
|
||
|
using System.Linq;
|
||
|
using System.Net;
|
||
|
using System.Text;
|
||
|
using System.Threading;
|
||
|
using System.Windows.Forms;
|
||
|
using iMonitorApp.Classes;
|
||
|
using iMonitorApp.Properties;
|
||
|
|
||
|
namespace iMonitorApp
|
||
|
{
|
||
|
// Token: 0x02000018 RID: 24
|
||
|
public partial class PhoneDialer : Form
|
||
|
{
|
||
|
// Token: 0x060000AA RID: 170 RVA: 0x0000770C File Offset: 0x0000590C
|
||
|
public PhoneDialer(ParentForm pf)
|
||
|
{
|
||
|
this.parentForm = pf;
|
||
|
this.InitializeComponent();
|
||
|
this.Initialize();
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000AB RID: 171 RVA: 0x00007740 File Offset: 0x00005940
|
||
|
public void Initialize()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
MessageBox.Show("Unable to get Skype Handle\r\n Reboot skype and Click Tools -> Options -> ConnectToSkype");
|
||
|
}
|
||
|
BackgroundWorker backgroundWorker = new BackgroundWorker();
|
||
|
backgroundWorker.DoWork += this.bw_DoWork;
|
||
|
backgroundWorker.RunWorkerAsync();
|
||
|
this.li = new AsyncBindingList<PhoneCall>(this);
|
||
|
this._queue = new ConcurrentQueue<PhoneCall>();
|
||
|
this.li.ListChanged += this.li_ListChanged;
|
||
|
Thread thread = new Thread(new ThreadStart(this.LaunchListener));
|
||
|
thread.Start();
|
||
|
new System.Windows.Forms.Timer
|
||
|
{
|
||
|
Interval = 10000
|
||
|
}.Tick += this.timer_Tick;
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000AC RID: 172 RVA: 0x00007800 File Offset: 0x00005A00
|
||
|
private void timer_Tick(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
bool isRunning = this.sw.IsRunning;
|
||
|
if (isRunning)
|
||
|
{
|
||
|
bool flag = this.sw.Elapsed.TotalSeconds > 60.0;
|
||
|
if (flag)
|
||
|
{
|
||
|
this.Log("Stopwatch Elapsed Secs:" + this.sw.Elapsed.TotalSeconds.ToString());
|
||
|
bool flag2 = this.sw.Elapsed.TotalSeconds > 300.0;
|
||
|
if (flag2)
|
||
|
{
|
||
|
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://202.58.207.66/ectime/phonecall.php?email=manas@4ecap.com,sd@4ecap.com&phone=+6596999610,+6590211987&subject=EMERGENCY_SKYPE_NOT_WORKING");
|
||
|
string str = Convert.ToBase64String(Encoding.ASCII.GetBytes(Settings.Default.ExternalHeartbeatUsername + ":" + Settings.Default.ExternalHeartbeatPassword));
|
||
|
httpWebRequest.Headers.Add("Authorization", "Basic " + str);
|
||
|
httpWebRequest.ReadWriteTimeout = 30000;
|
||
|
httpWebRequest.Timeout = 30000;
|
||
|
httpWebRequest.Method = "GET";
|
||
|
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000AD RID: 173 RVA: 0x00007958 File Offset: 0x00005B58
|
||
|
private void bw_DoWork(object sender, DoWorkEventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000AE RID: 174 RVA: 0x00007980 File Offset: 0x00005B80
|
||
|
private void LaunchListener()
|
||
|
{
|
||
|
this.asl = new AsynchronousSocketListener(Settings.Default.CurrentIP, Settings.Default.PhonePort);
|
||
|
AsynchronousSocketListener.Received += this.AsynchronousSocketListener_Received;
|
||
|
this.Log("Listening on port: " + Settings.Default.PhonePort.ToString() + " IP: " + Settings.Default.CurrentIP);
|
||
|
AsynchronousSocketListener.StartListening();
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000AF RID: 175 RVA: 0x000038AE File Offset: 0x00001AAE
|
||
|
private void li_ListChanged(object sender, ListChangedEventArgs e)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000B0 RID: 176 RVA: 0x000079F8 File Offset: 0x00005BF8
|
||
|
private void ProcessQueue()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
}
|
||
|
PhoneCall phoneCall;
|
||
|
bool flag = this._queue.TryDequeue(out phoneCall);
|
||
|
bool flag2 = flag;
|
||
|
if (flag2)
|
||
|
{
|
||
|
bool flag3 = !PhoneScheduleCheck.IsPhoneActive();
|
||
|
if (flag3)
|
||
|
{
|
||
|
this.Log("Phone Disabled in Schedule");
|
||
|
int num = 2;
|
||
|
int frequency = 4000;
|
||
|
int duration = 200;
|
||
|
for (int i = 0; i < num; i++)
|
||
|
{
|
||
|
Console.Beep(frequency, duration);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
}
|
||
|
foreach (string text in phoneCall.Numbers)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||
|
string requestUriString = "https://secure.hoiio.com/open/ivr/start/dial?dest=" + text + "&access_token=ssMWqlCqLcJUElOv&app_id=hQKILptEKhHNqXSC&msg=Call&caller_id=private";
|
||
|
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUriString);
|
||
|
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
|
||
|
using (Stream responseStream = httpWebResponse.GetResponseStream())
|
||
|
{
|
||
|
using (StreamReader streamReader = new StreamReader(responseStream))
|
||
|
{
|
||
|
string text2 = streamReader.ReadToEnd();
|
||
|
}
|
||
|
}
|
||
|
string str = "Dialed: ";
|
||
|
string str2 = text;
|
||
|
string str3 = " Response: ";
|
||
|
HttpWebResponse httpWebResponse2 = httpWebResponse;
|
||
|
this.Log(str + str2 + str3 + ((httpWebResponse2 != null) ? httpWebResponse2.ToString() : null));
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
this.Log("Exception: " + ex.Message);
|
||
|
}
|
||
|
}
|
||
|
this.Log("Stop Watch Started");
|
||
|
this.Log("Dialing: " + string.Join(" , ", phoneCall.Numbers));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000B1 RID: 177 RVA: 0x00007BF4 File Offset: 0x00005DF4
|
||
|
private void AsynchronousSocketListener_Received(object sender, EventArgs e)
|
||
|
{
|
||
|
this.Log("Received: " + sender.ToString());
|
||
|
string text = sender.ToString().Replace("<EOF>", "");
|
||
|
List<string> list = (from t in text.Split(new char[]
|
||
|
{
|
||
|
','
|
||
|
}).ToList<string>()
|
||
|
where t.Trim() != ""
|
||
|
select t).ToList<string>();
|
||
|
List<string> list2 = new List<string>();
|
||
|
foreach (string text2 in list)
|
||
|
{
|
||
|
string text3 = text2.Replace(" ", "");
|
||
|
text3 = text3.Trim();
|
||
|
bool flag = text3[0] != '+';
|
||
|
if (!flag)
|
||
|
{
|
||
|
list2.Add(text3);
|
||
|
}
|
||
|
}
|
||
|
PhoneCall item = new PhoneCall
|
||
|
{
|
||
|
Numbers = list2,
|
||
|
Count = list.Count,
|
||
|
Status = "Queued"
|
||
|
};
|
||
|
this._queue.Enqueue(item);
|
||
|
this.ProcessQueue();
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000B2 RID: 178 RVA: 0x00007D30 File Offset: 0x00005F30
|
||
|
private void skype_ContactsFocused(string Username)
|
||
|
{
|
||
|
this.Log(Username + " focused");
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000B3 RID: 179 RVA: 0x00007D48 File Offset: 0x00005F48
|
||
|
public void Log(string text)
|
||
|
{
|
||
|
bool invokeRequired = this.tb_log.InvokeRequired;
|
||
|
if (invokeRequired)
|
||
|
{
|
||
|
this.tb_log.Invoke(new Action(delegate()
|
||
|
{
|
||
|
this.tb_log.Text = string.Concat(new string[]
|
||
|
{
|
||
|
DateTime.Now.ToString("dd/MMM hh:mm:ss"),
|
||
|
" ",
|
||
|
text,
|
||
|
"\r\n",
|
||
|
this.tb_log.Text
|
||
|
});
|
||
|
}));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.tb_log.Text = string.Concat(new string[]
|
||
|
{
|
||
|
DateTime.Now.ToString("dd/MMM hh:mm:ss"),
|
||
|
" ",
|
||
|
text,
|
||
|
"\r\n",
|
||
|
this.tb_log.Text
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000B4 RID: 180 RVA: 0x00007DE8 File Offset: 0x00005FE8
|
||
|
public void StatusUpdate(string text)
|
||
|
{
|
||
|
StatusStrip a = (StatusStrip)base.MdiParent.Controls["statusStrip"];
|
||
|
bool invokeRequired = a.InvokeRequired;
|
||
|
if (invokeRequired)
|
||
|
{
|
||
|
a.Invoke(new Action(delegate()
|
||
|
{
|
||
|
a.Text = text;
|
||
|
}));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
a.Text = text;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000B5 RID: 181 RVA: 0x00007E60 File Offset: 0x00006060
|
||
|
public void UpdateLabel(Label l, string text)
|
||
|
{
|
||
|
bool invokeRequired = l.InvokeRequired;
|
||
|
if (invokeRequired)
|
||
|
{
|
||
|
l.Invoke(new Action(delegate()
|
||
|
{
|
||
|
l.Text = text;
|
||
|
}));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
l.Text = text;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000B6 RID: 182 RVA: 0x00007EC0 File Offset: 0x000060C0
|
||
|
private void button1_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
PhoneSchedule phoneSchedule = new PhoneSchedule();
|
||
|
phoneSchedule.ShowDialog();
|
||
|
}
|
||
|
|
||
|
// Token: 0x060000B7 RID: 183 RVA: 0x00007EDC File Offset: 0x000060DC
|
||
|
private void button2_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||
|
string text = "https://secure.hoiio.com/open/ivr/start/dial?dest=6596999610&access_token=ssMWqlCqLcJUElOv&app_id=hQKILptEKhHNqXSC&msg=Call&caller_id=private";
|
||
|
this.Log(text);
|
||
|
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(text);
|
||
|
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
|
||
|
string text2;
|
||
|
using (Stream responseStream = httpWebResponse.GetResponseStream())
|
||
|
{
|
||
|
using (StreamReader streamReader = new StreamReader(responseStream))
|
||
|
{
|
||
|
text2 = streamReader.ReadToEnd();
|
||
|
}
|
||
|
}
|
||
|
this.Log(text2);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
this.Log("Exception: " + ex.Message);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x0400006B RID: 107
|
||
|
private ParentForm parentForm;
|
||
|
|
||
|
// Token: 0x0400006C RID: 108
|
||
|
private AsynchronousSocketListener asl;
|
||
|
|
||
|
// Token: 0x0400006D RID: 109
|
||
|
public AsyncBindingList<PhoneCall> li;
|
||
|
|
||
|
// Token: 0x0400006E RID: 110
|
||
|
private ConcurrentQueue<PhoneCall> _queue;
|
||
|
|
||
|
// Token: 0x0400006F RID: 111
|
||
|
private Stopwatch sw = new Stopwatch();
|
||
|
}
|
||
|
}
|