/// <summary> /// 关闭所有警告窗口 /// </summary> public void clearWarning() { bool isFound = false; do { Thread.Sleep(500); isFound = false; if (Utils.FindWindow(null, "VOCALOID Editor") != IntPtr.Zero || Utils.FindWindow(null, "VOCALOID3 Editor") != IntPtr.Zero) { isFound = true; KeyBoard.Send(new byte[] { KeyBoard.keyEnter }); } } while (isFound); }
static void Main(string[] args) { // ISchoolReport sr = new SchoolReport(); // sr = new BeforeDecorator(sr); // sr = new AfterDecorator(sr); // sr.Report(); var sr = new AfterDecorator(new BeforeDecorator(new SchoolReport())); Console.WriteLine(sr.Report()); IComputer computer = new KeyBoard(new Monitor(new Disk(new Computer()))); Console.WriteLine(computer.getComputer()); }
/// <summary> /// 合成单个音频 /// </summary> /// <param name="vsqxFile"></param> public void synthesisOne(string vsqxFile, string outputWav) { if (File.Exists(outputWav)) { File.Delete(outputWav); } this.focusWindow(); //发送打开文件快捷键 KeyBoard.Send(new byte[] { KeyBoard.keyControl, KeyBoard.keyO }); this.clearWarning(); ClipBoard.Set(vsqxFile); Thread.Sleep(1000); KeyBoard.Send(new byte[] { KeyBoard.keyControl, KeyBoard.keyV }); Thread.Sleep(100); KeyBoard.Send(new byte[] { KeyBoard.keyEnter }); Thread.Sleep(500); this.clearWarning(); Thread.Sleep(500); //开始合成 KeyBoard.Send(new byte[] { KeyBoard.keyAlt, KeyBoard.keyF }); Thread.Sleep(100); KeyBoard.Send(new byte[] { KeyBoard.keyE }); Thread.Sleep(100); KeyBoard.Send(new byte[] { KeyBoard.keyW }); /* 只合成单音轨 * Thread.Sleep(100); * KeyBoard.Send(new byte[] { KeyBoard.keyAlt, KeyBoard.keyU });*/ Thread.Sleep(100); KeyBoard.Send(new byte[] { KeyBoard.keyEnter }); Thread.Sleep(100); this.clearWarning(); ClipBoard.Set(outputWav); KeyBoard.Send(new byte[] { KeyBoard.keyControl, KeyBoard.keyV }); Thread.Sleep(100); KeyBoard.Send(new byte[] { KeyBoard.keyEnter }); //阻塞,直到合成结束 this.waitUntillSynthesisFinish(); }