public VideoStreaming(string name, int MyPort, string ServerIP, int ServerPort, int fps, long datalength, int DPP = 1024) { this.client = new CLIENT.CLIENT(MyPort, ServerIP, ServerPort, name + "_strm", fps); this.DPP = DPP; this.Datalength = datalength; this.ReceiveData = new byte[datalength]; }
private void CIPCClose() { if (this.CIPCClient != null) { this.CIPCClient.Close(); this.CIPCClient = null; } }
/// <summary> /// オーバーロードコンストラクタ /// 各種設定を追加 /// </summary> /// <param name="parent"></param> /// <param name="name"></param> public StreamWindow(MainWindow parent, StreamClient SC) { InitializeComponent(); this.MouseLeftButtonDown += (sender, e) => this.DragMove(); this.Closing += StreamWindow_Closing; this.SC = SC; this.TitleText.Text = this.SC.name; this.textblock_settingdata.Text = "MyPort : " + this.SC.myport.ToString() + "\n" + "ServerIP : " + this.SC.serverIP + "\n" + "ServerPort : " + this.SC.serverport.ToString() + "\n" + "Mode : " + this.SC.mode.ToString() + "\n" + "FPS : " + this.SC.fps.ToString() + "\n" + "filepath : " + this.SC.filename + "\n"; #region set button and file open. switch (this.SC.mode) { case MODE.Sender: this.Button_Start.IsEnabled = true; this.Button_RecStart.IsEnabled = false; this.reader = new BinaryReader(File.OpenRead(this.SC.filename)); this.progressbar_datastream.Maximum = this.reader.BaseStream.Length; break; case MODE.Receiver: this.Button_Start.IsEnabled = false; this.Button_RecStart.IsEnabled = true; this.writer = new BinaryWriter(File.OpenWrite(this.SC.filename)); break; default: break; } #endregion this.cipc = new CIPC_CS.CLIENT.CLIENT(this.SC.myport, this.SC.serverIP, this.SC.serverport, this.SC.name, this.SC.fps); this.CTS = new System.Threading.CancellationTokenSource(); this.Fps_cipc = new FPSAdjuster.FPSAdjuster(); this.Fps_cipc.Fps = this.SC.fps; this.task = new Task(() => maintask(), this.CTS.Token); this.task.Start(); this.parent = parent; this.IsRecStarted = false; this.IsSendStarted = false; this.IsClosed = false; }
public ReceiveClient(int myport, string serverip, int serverport, string name, int fps, int id) { this.ServerIPAdress = serverip; this.ServerPortNumber = serverport; this.MyPortNumber = myport; this.Name = name; this.fps = fps; this.ID = id; this.client = new CIPC_CS.CLIENT.CLIENT(myport, serverip, serverport, name, fps); }
public ReceiveClient(int myport, string serverip, int serverport, string name, int fps, int id) { this.ServerIPAdress = serverip; this.ServerPortNumber = serverport; this.MyPortNumber = myport; this.Name = name; this.fps =fps; this.ID = id; this.client = new CIPC_CS.CLIENT.CLIENT(myport, serverip, serverport, name, fps); }
private void Button_CIPC_Connect_Click(object sender, RoutedEventArgs e) { if (this.CipcSyncClient != null) { return; } this.CipcSyncClient = new CIPC_CS.CLIENT.CLIENT(int.Parse(this.TextBox_ControlCIPC_myPort.Text), this.TextBox_ControlCIPC_remoteIP.Text, int.Parse(this.TextBox_ControlCIPC_remotePort.Text), "StreamController_SYNCREC", 30); this.CipcSyncClient.Setup(CIPC_CS.CLIENT.MODE.Receiver); this.CipcSyncClient.DataReceived += CipcSyncClient_DataReceived; }
private void Button_CIPC_Close_Click(object sender, RoutedEventArgs e) { this.CipcSyncClient.Close(); this.CipcSyncClient = null; }
/// <summary> /// オーバーロードコンストラクタ /// 各種設定を追加 /// </summary> /// <param name="parent"></param> /// <param name="name"></param> public StreamWindow(MainWindow parent, StreamClient SC) { try { InitializeComponent(); this.MouseLeftButtonDown += (sender, e) => this.DragMove(); this.Closing += StreamWindow_Closing; this.SC = SC; this.TitleText.Text = this.SC.name; this.textblock_settingdata.Text = "MyPort : " + this.SC.myport.ToString() + "\n" + "ServerIP : " + this.SC.serverIP + "\n" + "ServerPort : " + this.SC.serverport.ToString() + "\n" + "Mode : " + this.SC.mode.ToString() + "\n" + "FPS : " + this.SC.fps.ToString() + "\n" + "filepath : " + this.SC.filename; #region set button and file open. switch (this.SC.mode) { case MODE.Sender: this.Button_Start.IsEnabled = true; this.Button_RecStart.IsEnabled = false; this.reader = new BinaryReader(File.OpenRead(this.SC.filename)); this.progressbar_datastream.Maximum = this.reader.BaseStream.Length; break; case MODE.Receiver: this.Button_Start.IsEnabled = false; this.Button_RecStart.IsEnabled = true; this.writer = new BinaryWriter(File.OpenWrite(this.SC.filename)); break; default: break; } #endregion this.cipc = new CIPC_CS.CLIENT.CLIENT(this.SC.myport, this.SC.serverIP, this.SC.serverport, this.SC.name, this.SC.fps); this.CTS = new System.Threading.CancellationTokenSource(); this.Fps_cipc = new FPSAdjuster.FPSAdjuster(); this.Fps_cipc.Fps = this.SC.fps; this.task = new Task(() => maintask(), this.CTS.Token); this.task.Start(); this.parent = parent; this.IsRecStarted = false; this.IsSendStarted = false; this.IsClosed = false; this.textblock_settingdata.ToolTip = this.textblock_settingdata.Text; } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); } }
private void CIPC_lunchbutton_Click(object sender, RoutedEventArgs e) { this.CIPCClose(); this.CIPCClient = new CIPC_CS.CLIENT.CLIENT(int.Parse(this.TextBox_myPort.Text), this.TextBox_remoteIP.Text, int.Parse(this.TextBox_remotePort.Text), "PPMS", int.Parse(this.TextBox_fps.Text)); this.CIPCClient.Setup(CIPC_CS.CLIENT.MODE.Sender); }
/// <summary> /// cipcを終了します. /// </summary> private void cipc_stop() { try { this.CTS_cipc_shadow.Cancel(); Thread.Sleep(100); this.cipc_shadow.Close(); this.cipc_shadow = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void SetupInTask() { switch (this.sendto) { case SendTo.CIPCServer: try { this.FPS_maintask = new FPSAdjuster.FPSAdjuster(); try { this.Dispatcher.BeginInvoke(new Action(() => { try { this.FPS_maintask.Fps = int.Parse(this.tbx_fps.Text); } catch (Exception ex) { this.FPS_maintask.Fps = this.fps; } this.cipc_shadow = new CIPC_CS.CLIENT.CLIENT(int.Parse(tbx_myPort.Text), tbx_remoteIP.Text, int.Parse(tbx_remotePort.Text), name, this.FPS_maintask.Fps); })); Thread.Sleep(100); this.FPS_maintask.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } this.cipc_shadow.Setup(CIPC_CS.CLIENT.MODE.Sender); } catch (Exception ex) { MessageBox.Show(ex.Message); } break; case SendTo.ShadowKinectSensorTerminal: break; default: break; } }