Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (true)
- {
- try
- {
- TcpClient client = listen.AcceptTcpClient();
- NetworkStream strm = client.GetStream();
- StreamReader rd = new StreamReader(strm);
- string cmd = rd.ReadToEnd();
- string[] brk = cmd.Split(new string[] { "=<@:@>=" }, StringSplitOptions.None);
- string tcmd = brk[0];
- string args = brk[1];
- if (tcmd == "hal")
- {
- Form frm = new Form();
- frm.FormBorderStyle = FormBorderStyle.None;
- frm.BackgroundImage = Properties.Resources.hal;
- frm.BackgroundImageLayout = ImageLayout.Stretch;
- frm.Width = Properties.Resources.hal.Width;
- frm.Height = Properties.Resources.hal.Height;
- //frm.
- frm.Opacity = 0;
- frm.Show();
- frm.FormBorderStyle = FormBorderStyle.None;
- //frm.WindowState = FormWindowState.Maximized;
- frm.TopMost = true;
- Rectangle rect = Screen.PrimaryScreen.WorkingArea;
- //Divide the screen in half, and find the center of the form to center it
- frm.Top = (rect.Height / 2) - (frm.Height / 2);
- frm.Left = (rect.Width / 2) - (frm.Width / 2);
- fade_in(frm);
- MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
- MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
- defaultDevice.AudioEndpointVolume.Mute = false;
- //defaultDevice.AudioEndpointVolume.MasterVolumeLevel = 100.0f;
- for (int i = 0; i < 100; i++)
- {
- defaultDevice.AudioEndpointVolume.VolumeStepUp();
- }
- SpeechSynthesizer reader = new SpeechSynthesizer();
- reader.Speak(args);
- //reader.Speak(args);
- fade_out(frm);
- }
- else
- {
- }
- }
- catch
- {
- //MessageBox.Show(err.Message,"Error");
- }
- }
- }
Add Comment
Please, Sign In to add comment