Guest User

Untitled

a guest
Jun 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.59 KB | None | 0 0
  1. while (true)
  2.             {
  3.                 try
  4.                 {
  5.                     TcpClient client = listen.AcceptTcpClient();
  6.                     NetworkStream strm = client.GetStream();
  7.                     StreamReader rd = new StreamReader(strm);
  8.                     string cmd = rd.ReadToEnd();
  9.                     string[] brk = cmd.Split(new string[] { "=<@:@>=" }, StringSplitOptions.None);
  10.                     string tcmd = brk[0];
  11.                     string args = brk[1];
  12.                     if (tcmd == "hal")
  13.                     {
  14.                         Form frm = new Form();
  15.                         frm.FormBorderStyle = FormBorderStyle.None;
  16.                         frm.BackgroundImage = Properties.Resources.hal;
  17.                         frm.BackgroundImageLayout = ImageLayout.Stretch;
  18.                         frm.Width = Properties.Resources.hal.Width;
  19.                         frm.Height = Properties.Resources.hal.Height;
  20.                         //frm.
  21.                         frm.Opacity = 0;
  22.                         frm.Show();
  23.                         frm.FormBorderStyle = FormBorderStyle.None;
  24.                         //frm.WindowState = FormWindowState.Maximized;
  25.                         frm.TopMost = true;
  26.  
  27.                         Rectangle rect = Screen.PrimaryScreen.WorkingArea;
  28.                         //Divide the screen in half, and find the center of the form to center it
  29.                         frm.Top = (rect.Height / 2) - (frm.Height / 2);
  30.                         frm.Left = (rect.Width / 2) - (frm.Width / 2);
  31.  
  32.                         fade_in(frm);
  33.  
  34.                         MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
  35.                         MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
  36.                         defaultDevice.AudioEndpointVolume.Mute = false;
  37.                         //defaultDevice.AudioEndpointVolume.MasterVolumeLevel = 100.0f;
  38.                         for (int i = 0; i < 100; i++)
  39.                         {
  40.                             defaultDevice.AudioEndpointVolume.VolumeStepUp();
  41.                         }
  42.  
  43.  
  44.                         SpeechSynthesizer reader = new SpeechSynthesizer();
  45.                         reader.Speak(args);
  46.  
  47.                         //reader.Speak(args);
  48.                         fade_out(frm);
  49.  
  50.                     }
  51.                     else
  52.                     {
  53.  
  54.                     }
  55.                 }
  56.                 catch
  57.                 {
  58.                     //MessageBox.Show(err.Message,"Error");
  59.                 }
  60.             }
  61.         }
Add Comment
Please, Sign In to add comment