Пример #1
0
 public void DataReceivedEventHandler( object sender, DataReceivedEventArgs e )
 {
     //UnityEngine.Debug.Log( "Size: " + e.Data.Length );
     m_mutex.WaitOne();
     m_messages.Enqueue( e.Data );
     m_mutex.ReleaseMutex();
 }
Пример #2
0
        public void OnDataReceived(IConnection sender, DataReceivedEventArgs e)
        {
            var handler = DataReceived;

            if (handler != null)
            { DataReceived(sender, e); }
        }
Пример #3
0
 void HandleOutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     float x;
     if (float.TryParse (e.Data, out x)) {
         this.x = x;
     }
 }
Пример #4
0
 void OnClientMessage(WebSocketConnection sender, DataReceivedEventArgs e)
 {
     User user = Users.Single(a => a.Connection == sender);
     if (e.Data.Contains("/nick"))
     {
         string[] tmpArray = e.Data.Split(new char[] { ' ' });
         if (tmpArray.Length > 1)
         {
             string myNewName = tmpArray[1];
             while (Users.Where(a => a.Name == myNewName).Count() != 0)
             {
                 myNewName += "_";
             }
             if (user.Name != null)
                 wss.SendToAll("server: '" + user.Name + "' changed name to '" + myNewName + "'");
             else
                 sender.Send("you are now know as '" + myNewName + "'");
             user.Name = myNewName;
         }
     }
     else
     {
         string name = (user.Name == null) ? unknownName : user.Name;
         wss.SendToAllExceptOne(name + ": " + e.Data, sender);
         sender.Send("me: " + e.Data);
     }
 }
 private void ServerProc_DataReceived(object sender , DataReceivedEventArgs e)
 {
     if (e.Data == null)
     {
         return;
     }
     ConsoleStream += e.Data + "\r";
 }
 public void SimulateReceivement(byte[] rawData)
 {
     if(OnDataReceived != null)
     {
         DataReceivedEventArgs eventArgs = new DataReceivedEventArgs();
         eventArgs.RawData = rawData;
         OnDataReceived.Invoke(this, eventArgs);
        	}
 }
Пример #7
0
        void OnServerDataReceived(object sender, DataReceivedEventArgs e)
        {
            byte[] msg;
            int size = ParseBufSizeInFront(e.Data, out msg);

            // test
            //string sRecieved = Encoding.ASCII.GetString(msg, 0, size);
            RobotMessage cmsg = RobotMessage.CreateBuilder().MergeFrom(msg).Build();
            string sRecieved = cmsg.BehaviorCmd.Behaviorname + "|" + cmsg.BehaviorCmd.Success;

            ServerOnDataRecFunc(sRecieved);
        }
Пример #8
0
    private static void CalendarUpcomingEventsOutputHandler(object sendingProcess,
            DataReceivedEventArgs outLine)
    {
        // Collect the sort command output.
        if (!String.IsNullOrEmpty(outLine.Data))
        {
            numOutputLines++;

            // Add the text to the collected output.
            calendarOutput.Append(" " +
                "[" + numOutputLines.ToString() + "] - " + outLine.Data);
        }
    }
Пример #9
0
        private void InternalPlotData(object sender, DataReceivedEventArgs e)
        {
            var data = e.DataReceived.Points;
            for(int i = 0; i < data.Count; i++) {
                points.Add(MeasurementToPoint(data[i], i));
            }

            if(points.Count < 2) { return; }
            for(int i = 0; i < points.Count - 1; i++) {
                Lines.Add(lineFactory.FromPoints(points[i], points[i + 1]));
            }
            Lines.Add(lineFactory.FromPoints(points.Last(), points.First()));
            Lines.Add(lineFactory.FromPoints(new Point(0, 0), new Point(0, 100)));
        }
Пример #10
0
        /// <summary>
        /// 云风blog爬取
        /// </summary>
        /// <param name="args"></param>
        private static string JGZFBlogProcess(DataReceivedEventArgs args)
        {
            if (!args.Url.Contains("details")) return string.Empty;
            // 在此处解析页面,可以用类似于 HtmlAgilityPack(页面解析组件)的东东、也可以用正则表达式、还可以自己进行字符串分析

            HtmlDocument htmlDoc = new HtmlDocument();
            htmlDoc.LoadHtml(args.Html);

            //var parseHtml = htmlDoc.DocumentNode.InnerText;
            var parseHtml = string.Empty;
            var content = htmlDoc.GetElementbyId("article_content");
             if(content!=null)
            { parseHtml= content.InnerText; }

            parseHtml = parseHtml.Replace("<", "").Replace(">", "");
            //var url = args.Url;
            return parseHtml;
        }
Пример #11
0
		void SocketDataReceivedFunction (object o, DataReceivedEventArgs e)
		{
			Debug.WriteLine ("Socket received data");
			Debug.WriteLine (e.Data.ToString ());
		}
Пример #12
0
 void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     Console.WriteLine(e.Data);
 }
Пример #13
0
 private void P_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     ShowLog(e.Data);
 }
Пример #14
0
 private void ProcessErrorDataReceived(object sender, DataReceivedEventArgs e)
 {
     ProcessOutput(e.Data);
 }
Пример #15
0
 void ErrorHandler(object sendingProcess, DataReceivedEventArgs outLine)
 {
     ErrorFormat("{0}", outLine.Data);
 }
Пример #16
0
 protected virtual void OnSmsMessageFormatReceived(DataReceivedEventArgs e)
 {
     if (SmsMessageFormatReceived != null)
     {
         SmsMessageFormatReceived(this, e);
     }
 }
 void haxeProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     TraceManager.AddAsync(e.Data, 2);
 }
 protected void OnDataReceivedEvent(DataReceivedEventArgs dataReceivedEventArgs)
 {
     if (DataReceivedEvent == null)
         return;
     DataReceivedEvent(this, dataReceivedEventArgs);
 }
Пример #19
0
 void ReadErrors(object sender, DataReceivedEventArgs e)
 {
     Console.WriteLine($"{Name}:\t{e.Data}");
 }
Пример #20
0
 void onOutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     //Console.WriteLine("D: " + e.Data);
 }
Пример #21
0
        void onErrorDataReceived(object sender, DataReceivedEventArgs e)
        {
            var line = e.Data;

            if (line == null)
            {
                return;
            }

            Console.WriteLine("E: " + line);

            if (new Regex(@"^Local port .+ SOCKS dynamic forwarding").IsMatch(line))
            {
                reconnectPeriod = 1;
                isLastSuccess   = true;
                IsConnected     = true;
                IsConnecting    = false;
                Connected();
            }
            else if (line.StartsWith("Nothing left to send, closing channel"))
            {
                portCloseCount = Math.Min(1, portCloseCount + 1);
            }
            else if (line.StartsWith("Forwarded port closed"))
            {
                var now = DateTime.Now;

                if (lastPortCloseTime == null || now - lastPortCloseTime >= new TimeSpan(2000000))
                {
                    lastPortCloseTime = now;
                    if (--portCloseCount < -settings.SshAbortionBeforeReconnect && settings.SshAutoReconnect)
                    {
                        Stop(true);
                    }
                }
            }
            else if (line.StartsWith("The server's host key is not cached in the registry."))
            {
                process.StandardInput.WriteLine("y");
            }
            else if (line.StartsWith("Password authentication failed"))
            {
                Error = resources["PlinkAuthFailed"] as string;
                Stop(settings.SshReconnectAnyCondition);
            }
            else if (line.StartsWith("Server refused our key"))
            {
                Error = resources["SshPrivKeyRefused"] as string;
                Stop(settings.SshReconnectAnyCondition);
            }
            else
            {
                var match = new Regex(@"Failed to connect to (.+?): Network error: No route to host").Match(line);
                if (match.Success)
                {
                    var ip = match.Groups[1].Value;
                    var si = new ProcessStartInfo("arp", "-d " + ip);
                    si.CreateNoWindow  = true;
                    si.UseShellExecute = false;
                    Process.Start(si);
                }
                match = new Regex(@"Unable to use key file (.+?)").Match(line);
                if (match.Success)
                {
                    Error = resources["SshPrivKeyFormatError"] as string;
                    Stop(settings.SshReconnectAnyCondition);
                }
            }
            //else if (line.StartsWith("FATAL ERROR:")) {
            //    Stop(settings.SshReconnectAnyCondition);
            //}
        }
Пример #22
0
 private void OnBinaryMessage(object sender, DataReceivedEventArgs e)
 {
     BinaryMessage(e.Data, 0, e.Data.Length).GetAwaiter().GetResult();
 }
 private void OutputReceivedHandle(Object sender, DataReceivedEventArgs e)
 {
     parent.ShellOutputReturn($"{e.Data}\n");
 }
Пример #24
0
 private static void OnChildStderr(object sender, DataReceivedEventArgs e)
 => OnChildOutputImpl(sender as Process, e.Data, LogLevel.Error);
Пример #25
0
 protected virtual void OnDataHeaderStateReceived(DataReceivedEventArgs e)
 {
     if (DataHeaderStateReceived != null)
     {
         DataHeaderStateReceived(this, e);
     }
 }
 void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     Console.Write(e.Data);
 }
Пример #27
0
 protected virtual void OnGprsStateReceived(DataReceivedEventArgs e)
 {
     if (GprsStateReceived != null)
     {
         GprsStateReceived(this, e);
     }
 }
 void process_ErrorDataReceived(object sender, DataReceivedEventArgs e)
 {
     //throw new NotImplementedException();
 }
Пример #29
0
 private static void PollNetworkDevice(object stateInfo)
 {
     var deviceState = (DeviceState) stateInfo;
     var offset = deviceState.LinkType == 1 ? 14 : 4;
     var pkt_data = IntPtr.Zero;
     var pkt_header = IntPtr.Zero;
     while (!deviceState.Cancel)
     {
         var num = pcap_next_ex(deviceState.Handle, ref pkt_header, ref pkt_data);
         if (num < 0)
         {
             break;
         }
         if (num == 0)
         {
             Thread.Sleep(10);
         }
         else
         {
             var pcapPkthdr = (pcap_pkthdr) Marshal.PtrToStructure(pkt_header, typeof (pcap_pkthdr));
             if (pcapPkthdr.caplen > offset)
             {
                 var destination = new byte[pcapPkthdr.caplen - offset];
                 Marshal.Copy(IntPtr.Add(pkt_data, offset), destination, 0, (int) pcapPkthdr.caplen - offset);
                 var e = new DataReceivedEventArgs();
                 e.Data = destination;
                 e.Device = deviceState;
                 OnDataReceived(e);
             }
             else
             {
                 continue;
             }
         }
         pkt_header = IntPtr.Zero;
         pkt_data = IntPtr.Zero;
         if (deviceState.Cancel)
         {
             break;
         }
     }
 }
	public void StdErr(object sender, DataReceivedEventArgs e)
	{
		childProcess.StdErr(sender, e);
	}
Пример #31
0
 private void OnErrorDataReceived(object sender, DataReceivedEventArgs e)
 {
     InsertOutputLine(e.Data);
 }
Пример #32
0
		/**
		* IPC communication messages handler
		*/
		private void DataExchangeReception(object sender, DataReceivedEventArgs e)
		{
			try
			{
				switch (e.ChannelName)
				{
					case "FileOpen":
						this.OpenDocumentsFromStartArgs((string[])e.Data, true);
						break;
					case "ExitApplication":
						if (this.Handle == (IntPtr)e.Data) Application.Exit();
						break;
				}
			}
			catch {}
		}
Пример #33
0
 /// <summary>
 /// Handle a line of output/error data from the process.
 /// </summary>
 private void HandleOutput(object sender, DataReceivedEventArgs e)
 {
     LastOutputTime = DateTime.Now;
     Log(e.Data);
 }
Пример #34
0
 static void process_AsyncOutputStream_OutputDataReceived2(object sender, DataReceivedEventArgs e)
 {
     s_process_AsyncOutputStream_sb.Append(e.Data);
     Process p = sender as Process;
     p.CancelOutputRead();
 }
Пример #35
0
 void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
 {
     InfoFormat("{0}", outLine.Data);
 }
Пример #36
0
 public static void process_AsyncErrorStream_ErrorDataReceived(object sender, DataReceivedEventArgs e)
 {
     s_process_AsyncErrorStream_sb.Append(e.Data);
 }
 protected virtual void OnProcessOnOutputDataReceived(object sender, DataReceivedEventArgs args) {
     if (!string.IsNullOrEmpty(args.Data)) {
         StandardOutputArray.Add(args.Data);
     }
 }
Пример #38
0
 /// <summary>
 /// The master data received event.
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 private static void MasterDataReceivedEvent(DataReceivedEventArgs args)
 {
     // 在此处解析页面,可以用类似于 HtmlAgilityPack(页面解析组件)的东东、也可以用正则表达式、还可以自己进行字符串分析
 }
Пример #39
0
        private void DataReceivedCallback(object sender, DataReceivedEventArgs e)
        {
            try
              {
            if (e.Error != null)
              throw e.Error;

            if (!isServerRunning)
              return;

            var connectionId = ((ServerConnection)sender).Id;
            var command = ServerModel.API.GetCommand(e.ReceivedData);
            var args = new ServerCommandArgs
            {
              Message = e.ReceivedData,
              ConnectionId = connectionId,
            };

            requestQueue.Add(connectionId, command, args);
              }
              catch (Exception exc)
              {
            ServerModel.Logger.Write(exc);
              }
        }
 private void Client_Received(object sender, DataReceivedEventArgs e)
 {
     Dispatcher.Invoke(async() =>
     {
         //"設定"
         if (e.CommandType == typeof(PipeCommands.LoadVRMPath))
         {
             var d = (PipeCommands.LoadVRMPath)e.Data;
             Globals.CurrentVRMFilePath = d.Path;
         }
         else if (e.CommandType == typeof(PipeCommands.LoadControllerTouchPadPoints))
         {
             var d = (PipeCommands.LoadControllerTouchPadPoints)e.Data;
             Globals.LeftControllerPoints        = d.LeftPoints;
             Globals.LeftControllerCenterEnable  = d.LeftCenterEnable;
             Globals.RightControllerPoints       = d.RightPoints;
             Globals.RightControllerCenterEnable = d.RightCenterEnable;
         }
         else if (e.CommandType == typeof(PipeCommands.LoadControllerStickPoints))
         {
             var d = (PipeCommands.LoadControllerStickPoints)e.Data;
             Globals.LeftControllerStickPoints  = d.LeftPoints;
             Globals.RightControllerStickPoints = d.RightPoints;
         }
         else if (e.CommandType == typeof(PipeCommands.LoadSkeletalInputEnable))
         {
             var d = (PipeCommands.LoadSkeletalInputEnable)e.Data;
             Globals.EnableSkeletal = d.enable;
         }
         else if (e.CommandType == typeof(PipeCommands.LoadKeyActions))
         {
             var d = (PipeCommands.LoadKeyActions)e.Data;
             Globals.KeyActions = d.KeyActions;
         }
         else if (e.CommandType == typeof(PipeCommands.LoadHandRotations))
         {
             var d = (PipeCommands.LoadHandRotations)e.Data;
             Globals.LeftHandRotation  = d.LeftHandRotation;
             Globals.RightHandRotation = d.RightHandRotation;
         }
         //"背景色"
         else if (e.CommandType == typeof(PipeCommands.LoadCustomBackgroundColor))
         {
             var d       = (PipeCommands.LoadCustomBackgroundColor)e.Data;
             customColor = Color.FromArgb(255, (byte)(d.r * 255f), (byte)(d.g * 255f), (byte)(d.b * 255f));
             ColorCustomButton.Background = new SolidColorBrush(customColor);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadIsTopMost))
         {
             var d = (PipeCommands.LoadIsTopMost)e.Data;
             SilentChangeChecked(TopMostCheckBox, d.enable, TopMostCheckBox_Checked, TopMostCheckBox_Unchecked);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadHideBorder))
         {
             var d = (PipeCommands.LoadHideBorder)e.Data;
             SilentChangeChecked(WindowBorderCheckBox, d.enable, WindowBorderCheckBox_Checked, WindowBorderCheckBox_Unchecked);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadSetWindowClickThrough))
         {
             var d = (PipeCommands.LoadSetWindowClickThrough)e.Data;
             SilentChangeChecked(WindowClickThroughCheckBox, d.enable, WindowClickThroughCheckBox_Checked, WindowClickThroughCheckBox_Unchecked);
         }
         //"カメラ"
         else if (e.CommandType == typeof(PipeCommands.LoadShowCameraGrid))
         {
             var d = (PipeCommands.LoadShowCameraGrid)e.Data;
             SilentChangeChecked(CameraGridCheckBox, d.enable, CameraGridCheckBox_Checked, CameraGridCheckBox_Unchecked);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadCameraMirror))
         {
             var d = (PipeCommands.LoadCameraMirror)e.Data;
             SilentChangeChecked(CameraMirrorCheckBox, d.enable, CameraMirrorCheckBox_Checked, CameraMirrorCheckBox_Unchecked);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadCameraFOV))
         {
             var d = (PipeCommands.LoadCameraFOV)e.Data;
             LoadSlider(d.fov, 1.0f, FOVSlider, FOVSlider_ValueChanged);
         }
         //"リップシンク"
         else if (e.CommandType == typeof(PipeCommands.LoadLipSyncEnable))
         {
             var d = (PipeCommands.LoadLipSyncEnable)e.Data;
             SilentChangeChecked(LipSyncCheckBox, d.enable, LipSyncCheckBox_Checked, LipSyncCheckBox_Unchecked);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadLipSyncMaxWeightEnable))
         {
             var d = (PipeCommands.LoadLipSyncMaxWeightEnable)e.Data;
             SilentChangeChecked(MaxWeightCheckBox, d.enable, MaxWeightCheckBox_Checked, MaxWeightCheckBox_Unchecked);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadLipSyncMaxWeightEmphasis))
         {
             var d = (PipeCommands.LoadLipSyncMaxWeightEmphasis)e.Data;
             SilentChangeChecked(MaxWeightEmphasisCheckBox, d.enable, MaxWeightEmphasisCheckBox_Checked, MaxWeightEmphasisCheckBox_Unchecked);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadLipSyncDevice))
         {
             var d = (PipeCommands.LoadLipSyncDevice)e.Data;
             LoadLipSyncDevice(d.device);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadLipSyncGain))
         {
             var d = (PipeCommands.LoadLipSyncGain)e.Data;
             LoadSlider(d.gain, 10.0f, GainSlider, GainSlider_ValueChanged);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadLipSyncWeightThreashold))
         {
             var d = (PipeCommands.LoadLipSyncWeightThreashold)e.Data;
             LoadSlider(d.threashold, 1000.0f, WeightThreasholdSlider, WeightThreasholdSlider_ValueChanged);
         }
         //"表情制御"
         else if (e.CommandType == typeof(PipeCommands.LoadAutoBlinkEnable))
         {
             var d = (PipeCommands.LoadAutoBlinkEnable)e.Data;
             SilentChangeChecked(AutoBlinkCheckBox, d.enable, AutoBlinkCheckBox_Checked, AutoBlinkCheckBox_Unchecked);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadDefaultFace))
         {
             var d = (PipeCommands.LoadDefaultFace)e.Data;
             if (string.IsNullOrEmpty(d.face))
             {
                 return;
             }
             if (DefaultFaces.Contains(d.face) == false)
             {
                 DefaultFaces.Insert(0, d.face);
                 DefaultFacesBase.Insert(0, d.face);
             }
             DefaultFaceComboBox.SelectionChanged -= DefaultFaceComboBox_SelectionChanged;
             DefaultFaceComboBox.SelectedIndex     = DefaultFaces.IndexOf(d.face);
             DefaultFaceComboBox.SelectionChanged += DefaultFaceComboBox_SelectionChanged;
         }
         else if (e.CommandType == typeof(PipeCommands.LoadBlinkTimeMin))
         {
             var d = (PipeCommands.LoadBlinkTimeMin)e.Data;
             LoadSlider(d.time, 10.0f, BlinkTimeMinSlider, BlinkTimeMinSlider_ValueChanged);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadBlinkTimeMax))
         {
             var d = (PipeCommands.LoadBlinkTimeMax)e.Data;
             LoadSlider(d.time, 10.0f, BlinkTimeMaxSlider, BlinkTimeMaxSlider_ValueChanged);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadCloseAnimationTime))
         {
             var d = (PipeCommands.LoadCloseAnimationTime)e.Data;
             LoadSlider(d.time, 100.0f, CloseAnimationTimeSlider, CloseAnimationTimeSlider_ValueChanged);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadOpenAnimationTime))
         {
             var d = (PipeCommands.LoadOpenAnimationTime)e.Data;
             LoadSlider(d.time, 100.0f, OpenAnimationTimeSlider, OpenAnimationTimeSlider_ValueChanged);
         }
         else if (e.CommandType == typeof(PipeCommands.LoadClosingTime))
         {
             var d = (PipeCommands.LoadClosingTime)e.Data;
             LoadSlider(d.time, 100.0f, ClosingTimeSlider, ClosingTimeSlider_ValueChanged);
         }
         else if (e.CommandType == typeof(PipeCommands.SetLightAngle))
         {
             var d = (PipeCommands.SetLightAngle)e.Data;
             LoadSlider(d.X, 1.0f, LightXSlider, LightSlider_ValueChanged);
             LoadSlider(d.Y, 1.0f, LightYSlider, LightSlider_ValueChanged);
         }
         else if (e.CommandType == typeof(PipeCommands.ChangeLightColor))
         {
             var d = (PipeCommands.ChangeLightColor)e.Data;
             LightColorButton.Background = new SolidColorBrush(Color.FromArgb((byte)(d.a * 255f), (byte)(d.r * 255f), (byte)(d.g * 255f), (byte)(d.b * 255f)));
         }
         else if (e.CommandType == typeof(PipeCommands.SetWindowNum))
         {
             var d            = (PipeCommands.SetWindowNum)e.Data;
             CurrentWindowNum = d.Num;
             UpdateWindowTitle();
         }
         //for Debug
         else if (e.CommandType == typeof(PipeCommands.KeyDown))
         {
             var d = (PipeCommands.KeyDown)e.Data;
             logKeyConfig(d.Config, true);
         }
         else if (e.CommandType == typeof(PipeCommands.KeyUp))
         {
             var d = (PipeCommands.KeyUp)e.Data;
             logKeyConfig(d.Config, false);
         }
     });
 }
Пример #41
0
        /// <summary>
        /// The master data received event.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        private static void MasterDataReceivedEvent(DataReceivedEventArgs args)
        {
            // 在此处解析页面,可以用类似于 HtmlAgilityPack(页面解析组件)的东东、也可以用正则表达式、还可以自己进行字符串分析
            //NSoup.Nodes.Document doc = NSoup.NSoupClient.Parse(args.Html);

            #region 接收数据处理

            fileQueue.Enqueue(args.Html);
            ThreadPool.QueueUserWorkItem(o =>
            {
                while (true)
                {
                    try
                    {
                        if (fileQueue.Count > 0)
                        {
                            fileId++;
                            string fileContent = fileQueue.Dequeue();
                            if (fileContent.Trim() != "")
                            {
                                WriteToFiles(fileContent);
                            }
                        }
                        else
                        {
                            Thread.Sleep(2000);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            });

            #endregion 接收数据处理
        }
Пример #42
0
 private void p_StdOutDataReceived(object sender, DataReceivedEventArgs e)
 {
     _gsdxLogger.Information(e.Data);
 }
Пример #43
0
 internal void OnDataReceived(DataReceivedEventArgs e) {
   if (DataReceived != null)
     DataReceived(this, e);
 }
Пример #44
0
 private void p_StdErrDataReceived(object sender, DataReceivedEventArgs e)
 {
     _gsdxLogger.Error(e.Data);
 }
Пример #45
0
 /// <summary>
 /// The master data received event.
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 private static void MasterDataReceivedEvent(DataReceivedEventArgs args)
 {
     // 在此处解析页面,可以用类似于 HtmlAgilityPack(页面解析组件)的东东、也可以用正则表达式、还可以自己进行字符串分析
 }
Пример #46
0
 private static void proc_ErrorDataReceived(object sender, DataReceivedEventArgs e)
 {
     throw new Exception(e.Data);
 }
Пример #47
0
 public static void process_SyncStreams_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     if (e.Data != null)
     {
         Assert.Equal(e.Data, "This string should come as output");
     }
 }
Пример #48
0
 private void Proc_ErrorDataReceived(object sender, DataReceivedEventArgs e) => Log.Error("SSH Error: {error}", e.Data);
Пример #49
0
 static void process_AsyncOutputStream_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     s_process_AsyncOutputStream_sb.Append(e.Data);
 }
Пример #50
0
 static void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     Console.WriteLine(Thread.CurrentThread.ManagedThreadId + ":" + e.Data);
 }
Пример #51
0
 protected virtual void OnDataReceived(DataReceivedEventArgs e)
 {
     if (DataReceived != null) DataReceived(this, e);
 }
Пример #52
0
 private static void ErrorHandler(object sendingProcess, DataReceivedEventArgs outLine)
 {
     Debug.WriteLine("{0}", outLine.Data);
 }
Пример #53
0
 protected virtual void OnEnterPinReceived(DataReceivedEventArgs e)
 {
     if (EnterPinReceived != null)
     {
         EnterPinReceived(this, e);
     }
 }
Пример #54
0
 private void OnDataReceived(DataReceivedEventArgs e)
 {
     DataChanged?.Invoke(e);
 }
Пример #55
0
 protected virtual void OnPhoneFunctionalityReceived(DataReceivedEventArgs e)
 {
     if (PhoneFunctionalityReceived != null)
     {
         PhoneFunctionalityReceived(this, e);
     }
 }
Пример #56
0
 static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
 {
     //* Do your stuff with the output (write to console/log/StringBuilder)
     //Console.WriteLine("error> " + outLine.Data);
     ErrorText.AppendLine(outLine.Data);
 }
Пример #57
0
 protected virtual void OnTextEncodingCharacterSetReceived(DataReceivedEventArgs e)
 {
     if (TextEncodingCharacterSetReceived != null)
     {
         TextEncodingCharacterSetReceived(this, e);
     }
 }
Пример #58
0
        protected override void ProcOutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
        {
            // Collect the process command output.
            if (string.IsNullOrEmpty(outLine.Data))
            {
                return;
            }
            var lineMatch = RegexLoudnesslProgress.Match(outLine.Data);

            if (lineMatch.Success)
            {
                var valueMatch = RegexLoudnessProgress.Match(lineMatch.Value);
                if (!valueMatch.Success)
                {
                    return;
                }
                var totalSeconds = Source.Duration.TotalSeconds;
                if (Math.Abs(totalSeconds) > double.Epsilon &&
                    double.TryParse(valueMatch.Value.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var currentPos))
                {
                    Progress = (int)((currentPos * 100) / totalSeconds);
                }
            }
            else
            {
                var luFsLineMatch = RegexlLufs.Match(outLine.Data);
                if (luFsLineMatch.Success)
                {
                    var regexLufs  = new Regex(LufsPattern, RegexOptions.None);
                    var valueMatch = regexLufs.Match(luFsLineMatch.Value);
                    if (valueMatch.Success)
                    {
                        _loudnessMeasured = (double.TryParse(valueMatch.Value.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out _loudness));
                    }
                }
                if (!_samplePeakMeasured)
                {
                    var truePeakLineMatch = RegexlPeak.Match(outLine.Data);
                    if (truePeakLineMatch.Success)
                    {
                        var regexLufs  = new Regex(LufsPattern, RegexOptions.None);
                        var valueMatch = regexLufs.Match(truePeakLineMatch.Value);
                        if (valueMatch.Success)
                        {
                            _samplePeakMeasured = double.TryParse(valueMatch.Value.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out _samplePeak);
                        }
                        else
                        {
                            _loudnessMeasured = false;
                        }
                    }
                }
                if (_samplePeakMeasured && _loudnessMeasured)
                {
                    var volume = -Math.Max(_loudness - OwnerFileManager.ReferenceLoudness, _samplePeak); // prevents automatic amplification over 0dBFS
                    var h      = AudioVolumeMeasured;
                    if (h == null)
                    {
                        Source.AudioLevelIntegrated = _loudness;
                        Source.AudioLevelPeak       = _samplePeak;
                        Source.AudioVolume          = volume;
                        (Source as PersistentMedia)?.Save();
                    }
                    else
                    {
                        h(this, new AudioVolumeEventArgs(volume));
                    }
                }
                AddOutputMessage(outLine.Data);
            }
        }
Пример #59
0
 private static void OnDataReceived(DataReceivedEventArgs e)
 {
     var eventHandler = _DataReceived;
     if (eventHandler == null)
     {
         return;
     }
     eventHandler(null, e);
 }
Пример #60
0
 private static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
 {
     writer.WriteLine(outLine.Data);
 }