📄 处理方法.cs
字号:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using OpenNETCF.Media.WaveAudio;
using OpenNETCF.Media;
using System.IO;
using System.Windows.Forms;
using System.Threading;
namespace SmartAnswerCall
{
class 处理方法
{
private const int a = 0x72;
private const int b = 0x73;
private const int c = 2;
private static Recorder recorder录音;
private static SoundPlayer play播放;
private static Stream f;
public static Form frm录音记录;
private static string h;
private static int i;
public static int int录音连贯值;
private static System.Windows.Forms.Timer k;
private static System.Windows.Forms.Timer l2;
public static bool m;
private static bool n;
private static string o;
private static int p;
private static System.Windows.Forms.Timer q;
private static bool r;
private static System.Windows.Forms.Timer s;
// Methods
static 处理方法()
{
recorder录音 = new Recorder();
play播放 = new SoundPlayer();
frm录音记录 = new 录音记录 ();
h = "";
i = 0;
int录音连贯值 = 300;
k = new System.Windows.Forms.Timer();
l2 = new System.Windows.Forms.Timer();
m = false;
n = false;
p = 0;
q = new System.Windows.Forms.Timer();
r = false;
s = new System.Windows.Forms.Timer();
}
public 处理方法()
{
}
//public static void a2(string A_0) { }
public static void 播放文件(string A_0)
{
play播放.Stop();
if (File.Exists(A_0))
{
play播放 = new SoundPlayer(A_0);
play播放.Play();
}
}
public static void 停止播放()
{
play播放.Stop();
}
public static void 挂断()
{
//按下 Home Screen
模拟按键操作.keybd_event(0x73, 0, 0, 0);
//放开
模拟按键操作.keybd_event(0x73, 0, 2, 0);
}
public static void 接听()
{
//按下接听键
模拟按键操作.keybd_event(0x72, 0, 0, 0);
//放开
模拟按键操作.keybd_event(0x72, 0, 2, 0);
}
public static void 播放提示录音()
{
if (!r)
{
PlayEventSound(录音记录.str程序目录 + @"\Answer.wav", 0);
r = true;
}
if (!s.Enabled)
{
if (s.Interval != 0x2710)
{
s.Interval = 0x2710;
s.Tick += new EventHandler(处理方法.停止播放提示录音);
}
s.Enabled = true;
}
}
private static void 停止播放提示录音(object A_0, EventArgs A_1)
{
s.Enabled = false;
try
{
StopEventSounds(录音记录.str程序目录 + @"\Answer.wav");
r = false;
}
catch
{
}
}
public static void 用户留言录音(string A_0, short A_1)
{
if (m && (A_1 != 10))
{
o = A_0;
if (!l2.Enabled)
{
if (l2.Interval != 0x3e8)
{
l2.Interval = 0x3e8;
l2.Tick += new EventHandler(处理方法.l1 );
}
l2.Enabled = true;
}
}
else
{
m = true;
h = A_0.Substring(0, A_0.LastIndexOf(@"\"));
if (File.Exists(A_0))
{
File.Delete(A_0);
}
f = File.OpenWrite(A_0);
recorder录音.RecordFor(f, 0xe10);
if (!k.Enabled)
{
if (k.Interval != 0x1388)
{
k.Interval = 0x1388;
k.Tick += new EventHandler(处理方法.k1);
}
k.Enabled = true;
}
}
}
private static void j1(object A_0, EventArgs A_1)
{
if (File.Exists(h + i.ToString() + ".wav"))
{
play播放 = new SoundPlayer(h + i.ToString() + ".wav");
play播放.Play();
i++;
}
else
{
q.Enabled = false;
}
}
private static void k1(object A_0, EventArgs A_1)
{
if (录音记录 .bool接通 )
{
p++;
if (p >= int录音连贯值)
{
if (p == int录音连贯值)
{
recorder录音.Stop();
}
else
{
k.Enabled = false;
p = 0;
i++;
用户留言录音(h + @"\" + i.ToString() + ".wav", 20);
}
}
}
else
{
i = 0;
k.Enabled = false;
recorder录音.Stop();
Thread.Sleep(0x1388);
m = false;
}
}
private static void l1(object A_0, EventArgs A_1)
{
l2.Enabled = false;
用户留言录音(o, 10);
}
[DllImport("OSSVCS.DLL")]
private static extern int PlayEventSound(string A_0, int A_1);
[DllImport("ossvcs.dll", EntryPoint = "#218")]
private static extern void setSpeaker(int A_0);
[DllImport("OSSVCS.DLL")]
private static extern int StopEventSounds(string A_0);
// Nested Types
private static class 模拟按键操作
{
// Methods模拟按键操作
[DllImport("coredll.dll")]
public static extern void keybd_event(byte A_0, byte A_1, int A_2, int A_3);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -