/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + EnergyCubes.GetHashCode(); hashCode = hashCode * 59 + Health.GetHashCode(); hashCode = hashCode * 59 + Active.GetHashCode(); hashCode = hashCode * 59 + Virtual.GetHashCode(); hashCode = hashCode * 59 + Priority.GetHashCode(); hashCode = hashCode * 59 + OnTurn.GetHashCode(); hashCode = hashCode * 59 + IsMine.GetHashCode(); hashCode = hashCode * 59 + HandCards.GetHashCode(); hashCode = hashCode * 59 + Attitude.GetHashCode(); hashCode = hashCode * 59 + Type.GetHashCode(); return(hashCode); } }
public void BasicBeforeVirtualMethodStateful() { lock (Interception.Handle) { var _method = Metadata <Virtual> .Method(_Virtual => _Virtual.Method(Argument <int> .Value, Argument <int> .Value)); var _instance = new Virtual(); Interception.Initialize(); _instance.Method(2, 3); Assert.AreEqual(Interception.Done, false); Aspect.Weave <Before.Interceptor.Parameterized>(_method); Interception.Initialize(); var _return = _instance.Method(2, 3); Assert.AreEqual(_return, 1); Assert.AreEqual(Interception.Done, true); Assert.AreEqual(Interception.Instance, _instance); Assert.AreEqual(Interception.Arguments.Length, 2); Assert.AreEqual(Interception.Arguments[0], 2); Assert.AreEqual(Interception.Arguments[1], 3); Aspect.Release <Before.Interceptor.Parameterized>(_method); Interception.Initialize(); _instance.Method(2, 3); Assert.AreEqual(Interception.Done, false); } }
/// <summary> /// Returns true if RobotInfoAllOf instances are equal /// </summary> /// <param name="other">Instance of RobotInfoAllOf to be compared</param> /// <returns>Boolean</returns> public bool Equals(RobotInfoAllOf other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EnergyCubes == other.EnergyCubes || EnergyCubes.Equals(other.EnergyCubes) ) && ( Health == other.Health || Health.Equals(other.Health) ) && ( Active == other.Active || Active.Equals(other.Active) ) && ( Virtual == other.Virtual || Virtual.Equals(other.Virtual) ) && ( Priority == other.Priority || Priority.Equals(other.Priority) ) && ( OnTurn == other.OnTurn || OnTurn.Equals(other.OnTurn) ) && ( IsMine == other.IsMine || IsMine.Equals(other.IsMine) ) && ( HandCards == other.HandCards || HandCards.Equals(other.HandCards) ) && ( Attitude == other.Attitude || Attitude.Equals(other.Attitude) ) && ( Type == other.Type || Type.Equals(other.Type) )); }
public void BasicBeforeVirtualMethod() { lock (Interception.Handle) { var _method = Metadata <Virtual> .Method(_Instance => _Instance.Method(Argument <int> .Value, Argument <int> .Value)); var _instance = new Virtual(); Interception.Initialize(); _instance.Method(2, 3); Assert.AreEqual(Interception.Done, false); Aspect.Weave <Before.Interceptor>(_method); Interception.Initialize(); var _return = _instance.Method(2, 3); Assert.AreEqual(_return, 1); Assert.AreEqual(Interception.Done, true); Aspect.Release <Before.Interceptor>(_method); Interception.Initialize(); _instance.Method(2, 3); Assert.AreEqual(Interception.Done, false); } }
public override int GetHashCode() { unchecked { var hashCode = Attributes != null?Attributes.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (CatalogVisibility != null ? CatalogVisibility.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Categories != null ? Categories.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ExternalUrl != null ? ExternalUrl.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Featured.GetHashCode(); hashCode = (hashCode * 397) ^ Id; hashCode = (hashCode * 397) ^ (Images != null ? Images.GetHashCode() : 0); hashCode = (hashCode * 397) ^ InStock.GetHashCode(); hashCode = (hashCode * 397) ^ ManageStock.GetHashCode(); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ OnSale.GetHashCode(); hashCode = (hashCode * 397) ^ ParentId; hashCode = (hashCode * 397) ^ (Permalink != null ? Permalink.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Price != null ? Price.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PriceHtml != null ? PriceHtml.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Purchasable.GetHashCode(); hashCode = (hashCode * 397) ^ (RegularPrice != null ? RegularPrice.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (RelatedIds != null ? RelatedIds.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SalePrice != null ? SalePrice.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ShortDescription != null ? ShortDescription.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Sku != null ? Sku.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Slug != null ? Slug.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (StockQuantity != null ? StockQuantity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Tags != null ? Tags.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TaxClass != null ? TaxClass.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TaxStatus != null ? TaxStatus.GetHashCode() : 0); hashCode = (hashCode * 397) ^ TotalSales; hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Virtual.GetHashCode(); return(hashCode); } }
static SymbolDecl[] ParseSymbolInternal(string[] tokens, ref int index) { if (CppParser.Token(tokens, ref index, "public") || CppParser.Token(tokens, ref index, "protected") || CppParser.Token(tokens, ref index, "private")) { index--; return(null); } TemplateDecl templateDecl = null; if (CppParser.Token(tokens, ref index, "template")) { templateDecl = new TemplateDecl { TypeParameters = new List <TypeParameterDecl>(), Specialization = new List <TypeDecl>(), }; CppParser.EnsureToken(tokens, ref index, "<"); if (!CppParser.Token(tokens, ref index, ">")) { while (true) { string token = null; CppParser.SkipUntilInTemplate(tokens, ref index, out token, ",", ">", "="); index -= 2; templateDecl.TypeParameters.Add(new TypeParameterDecl { Name = CppParser.EnsureId(tokens, ref index), }); index++; if (token == "=") { CppParser.SkipUntilInTemplate(tokens, ref index, out token, ",", ">"); } if (token == ">") { break; } } } } if (CppParser.Token(tokens, ref index, "friend")) { int oldIndex = index - 1; string token = null; CppParser.SkipUntil(tokens, ref index, out token, ";", "{"); if (token == ";") { return(null); } else { index = oldIndex; tokens[index] = "static"; } } if (CppParser.Token(tokens, ref index, "namespace")) { if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } var decl = new NamespaceDecl(); decl.Name = CppParser.EnsureId(tokens, ref index); CppParser.EnsureToken(tokens, ref index, "{"); ParseSymbols(tokens, ref index, decl); CppParser.EnsureToken(tokens, ref index, "}"); return(new SymbolDecl[] { decl }); } else if (CppParser.Token(tokens, ref index, "using")) { if (CppParser.Token(tokens, ref index, "namespace")) { if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } var decl = new UsingNamespaceDecl(); decl.Path = new List <string>(); decl.Path.Add(CppParser.EnsureId(tokens, ref index)); while (!CppParser.Token(tokens, ref index, ";")) { CppParser.EnsureToken(tokens, ref index, ":"); CppParser.EnsureToken(tokens, ref index, ":"); decl.Path.Add(CppParser.EnsureId(tokens, ref index)); } return(new SymbolDecl[] { decl }); } else { string name = null; if (CppParser.Id(tokens, ref index, out name)) { if (templateDecl != null) { if (CppParser.Token(tokens, ref index, "<")) { while (true) { templateDecl.Specialization.Add(CppTypeParser.EnsureTypeWithoutName(tokens, ref index)); if (CppParser.Token(tokens, ref index, ">")) { break; } CppParser.EnsureToken(tokens, ref index, ","); } } } if (CppParser.Token(tokens, ref index, "=")) { SymbolDecl decl = new TypedefDecl { Name = name, Type = CppTypeParser.EnsureTypeWithoutName(tokens, ref index), }; CppParser.EnsureToken(tokens, ref index, ";"); if (templateDecl != null) { templateDecl.Element = decl; decl = templateDecl; } return(new SymbolDecl[] { decl }); } } if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } CppParser.SkipUntil(tokens, ref index, ";"); } } else if (CppParser.Token(tokens, ref index, "typedef")) { if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } string name = null; var type = CppTypeParser.EnsureTypeWithName(tokens, ref index, out name); CppParser.EnsureToken(tokens, ref index, ";"); var decl = new TypedefDecl(); decl.Name = name; decl.Type = type; return(new SymbolDecl[] { decl }); } else if (CppParser.Token(tokens, ref index, "enum")) { if (templateDecl != null) { throw new ArgumentException("Failed to parse."); } bool enumClass = CppParser.Token(tokens, ref index, "class"); string name = CppParser.EnsureId(tokens, ref index); if (CppParser.Token(tokens, ref index, ":")) { CppTypeParser.EnsureTypeWithoutName(tokens, ref index); } if (!CppParser.Token(tokens, ref index, ";")) { CppParser.EnsureToken(tokens, ref index, "{"); var decl = new EnumDecl { Name = name, EnumClass = enumClass, Children = new List <SymbolDecl>(), }; while (true) { if (CppParser.Token(tokens, ref index, "}")) { break; } while (index < tokens.Length && tokens[index].Length >= 3 && tokens[index].StartsWith("///")) { index++; } decl.Children.Add(new EnumItemDecl { Name = CppParser.EnsureId(tokens, ref index), }); string token = null; CppParser.SkipUntil(tokens, ref index, out token, ",", "}"); if (token == "}") { break; } } if (CppParser.Id(tokens, ref index, out name)) { var varDecl = new VarDecl { Static = false, Name = name, Type = new RefTypeDecl { Name = decl.Name, }, }; CppParser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl, varDecl }); } else { CppParser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl }); } } } else if (CppParser.Token(tokens, ref index, "struct") || CppParser.Token(tokens, ref index, "class") || CppParser.Token(tokens, ref index, "union")) { if (CppParser.Token(tokens, ref index, "{")) { if (tokens[index - 2] == "class") { throw new ArgumentException("Failed to parse."); } var decl = new GroupedFieldDecl { Grouping = tokens[index - 2] == "struct" ? Grouping.Struct : Grouping.Union, }; ParseSymbols(tokens, ref index, decl); CppParser.EnsureToken(tokens, ref index, "}"); CppParser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl }); } else { string name = CppParser.EnsureId(tokens, ref index); if (!CppParser.Token(tokens, ref index, ";")) { var classDecl = new ClassDecl { ClassType = tokens[index - 2] == "struct" ? ClassType.Struct : tokens[index - 2] == "class" ? ClassType.Class : ClassType.Union, BaseTypes = new List <BaseTypeDecl>(), Name = name, }; if (templateDecl != null) { if (CppParser.Token(tokens, ref index, "<")) { if (!CppParser.Token(tokens, ref index, ">")) { while (true) { int oldIndex = index; try { templateDecl.Specialization.Add(CppTypeParser.EnsureTypeWithoutName(tokens, ref index)); } catch (ArgumentException) { index = oldIndex; CppParser.SkipUntilInTemplate(tokens, ref index, ",", ">"); index--; templateDecl.Specialization.Add(new ConstantTypeDecl { Value = tokens .Skip(oldIndex) .Take(index - oldIndex) .Aggregate((a, b) => a + " " + b), }); } if (CppParser.Token(tokens, ref index, ">")) { break; } CppParser.EnsureToken(tokens, ref index, ","); } } } } CppParser.Token(tokens, ref index, "abstract"); if (CppParser.Token(tokens, ref index, ":")) { while (true) { Access access = classDecl.ClassType == ClassType.Class ? Access.Private : Access.Public; CppParser.Token(tokens, ref index, "virtual"); if (CppParser.Token(tokens, ref index, "private")) { access = Access.Private; } else if (CppParser.Token(tokens, ref index, "protected")) { access = Access.Protected; } else if (CppParser.Token(tokens, ref index, "public")) { access = Access.Public; } CppParser.Token(tokens, ref index, "virtual"); classDecl.BaseTypes.Add(new BaseTypeDecl { Access = access, Type = CppTypeParser.EnsureTypeWithoutName(tokens, ref index), }); if (!CppParser.Token(tokens, ref index, ",")) { break; } } } CppParser.EnsureToken(tokens, ref index, "{"); while (true) { if (CppParser.Token(tokens, ref index, "}")) { break; } Access access = classDecl.ClassType == ClassType.Class ? Access.Private : Access.Public; if (CppParser.Token(tokens, ref index, "private")) { access = Access.Private; CppParser.EnsureToken(tokens, ref index, ":"); } else if (CppParser.Token(tokens, ref index, "protected")) { access = Access.Protected; CppParser.EnsureToken(tokens, ref index, ":"); } else if (CppParser.Token(tokens, ref index, "public")) { access = Access.Public; CppParser.EnsureToken(tokens, ref index, ":"); } ParseSymbols(tokens, ref index, classDecl, access); } SymbolDecl decl = classDecl; if (templateDecl != null) { templateDecl.Element = decl; decl = templateDecl; } if (CppParser.Id(tokens, ref index, out name)) { var varDecl = new VarDecl { Static = false, Name = name, Type = new RefTypeDecl { Name = classDecl.Name, }, }; CppParser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl, varDecl }); } else { CppParser.EnsureToken(tokens, ref index, ";"); return(new SymbolDecl[] { decl }); } } } } else if (!CppParser.Token(tokens, ref index, ";")) { Function function = Function.Function; { int oldIndex = index; string name = null; if (CppParser.Id(tokens, ref index, out name)) { if (CppParser.Token(tokens, ref index, "(")) { CppParser.SkipUntil(tokens, ref index, ")"); if (CppParser.Token(tokens, ref index, ";") || CppParser.Token(tokens, ref index, "=") || CppParser.Token(tokens, ref index, ":") || CppParser.Token(tokens, ref index, "{")) { function = Function.Constructor; } } index = oldIndex; } else if (CppParser.Token(tokens, ref index, "~")) { function = Function.Destructor; } } if (function == Function.Function) { Virtual virtualFunction = Virtual.Normal; CppParser.Token(tokens, ref index, "extern"); CppParser.Token(tokens, ref index, "mutable"); if (CppParser.Token(tokens, ref index, "virtual")) { virtualFunction = Virtual.Virtual; } else if (CppParser.Token(tokens, ref index, "static")) { virtualFunction = Virtual.Static; } CppParser.Token(tokens, ref index, "inline"); CppParser.Token(tokens, ref index, "__forceinline"); if (CppParser.Token(tokens, ref index, "operator")) { TypeDecl returnType = null; { int oldIndex = index; CppParser.SkipUntilInTemplate(tokens, ref index, "("); int modify = --index; tokens[modify] = "$"; index = oldIndex; returnType = CppTypeParser.EnsureTypeWithoutName(tokens, ref index); if (index != modify) { throw new ArgumentException("Failed to parse."); } tokens[modify] = "("; } var decl = new FuncDecl { Virtual = Virtual.Normal, Name = "operator", Function = function, }; TypeDecl functionType = null; Action <TypeDecl> continuation = null; CallingConvention callingConvention = CallingConvention.Default; CppTypeParser.ParseTypeContinueAfterName(tokens, ref index, ref callingConvention, out functionType, out continuation); continuation(returnType); decl.Type = functionType; if (!CppParser.Token(tokens, ref index, ";")) { CppParser.EnsureToken(tokens, ref index, "{"); CppParser.SkipUntil(tokens, ref index, "}"); } if (templateDecl != null) { templateDecl.Element = decl; return(new SymbolDecl[] { templateDecl }); } else { return(new SymbolDecl[] { decl }); } } else { string name = null; TypeDecl type = null; if (CppTypeParser.ParseType(tokens, ref index, out type, out name)) { if (name == null) { throw new ArgumentException("Failed to parse."); } if (type is FunctionTypeDecl) { if (CppParser.Token(tokens, ref index, "=")) { if (CppParser.Token(tokens, ref index, "0")) { virtualFunction = Virtual.Abstract; } else { CppParser.EnsureToken(tokens, ref index, "default", "delete"); } } var decl = new FuncDecl { Virtual = virtualFunction, Name = name, Type = type, Function = Function.Function, }; if (!CppParser.Token(tokens, ref index, ";")) { CppParser.EnsureToken(tokens, ref index, "{"); CppParser.SkipUntil(tokens, ref index, "}"); } if (templateDecl != null) { templateDecl.Element = decl; return(new SymbolDecl[] { templateDecl }); } else { return(new SymbolDecl[] { decl }); } } else { if (virtualFunction != Virtual.Normal && virtualFunction != Virtual.Static) { throw new ArgumentException("Failed to parse."); } if (CppParser.Token(tokens, ref index, "=")) { CppParser.SkipUntil(tokens, ref index, ";"); } else { CppParser.EnsureToken(tokens, ref index, ";"); } if (!(type is ClassMemberTypeDecl)) { var decl = new VarDecl { Static = virtualFunction == Virtual.Static, Name = name, Type = type, }; return(new SymbolDecl[] { decl }); } } } } } else { var decl = new FuncDecl { Virtual = Virtual.Normal, Name = (function == Function.Constructor ? "" : "~") + CppParser.EnsureId(tokens, ref index), Function = function, }; TypeDecl functionType = null; Action <TypeDecl> continuation = null; CallingConvention callingConvention = CallingConvention.Default; CppTypeParser.ParseTypeContinueAfterName(tokens, ref index, ref callingConvention, out functionType, out continuation); continuation(new RefTypeDecl { Name = "void" }); decl.Type = functionType; if (CppParser.Token(tokens, ref index, "=")) { CppParser.EnsureToken(tokens, ref index, "default", "delete"); } if (!CppParser.Token(tokens, ref index, ";")) { if (CppParser.Token(tokens, ref index, ":")) { CppParser.SkipUntil(tokens, ref index, "{"); } else { CppParser.EnsureToken(tokens, ref index, "{"); } CppParser.SkipUntil(tokens, ref index, "}"); } if (templateDecl != null) { templateDecl.Element = decl; return(new SymbolDecl[] { templateDecl }); } else { return(new SymbolDecl[] { decl }); } } } return(null); }
private void Thread_ReadPipeMessage() { try { var buffer = new byte[2048]; while (this.Pipe.IsConnected) { var builder = new StringBuilder(); do { var ammount = this.Pipe.Read(buffer, 0, buffer.Length); for (int i = 0; i < ammount; i++) { builder.Append((char)buffer[i]); } } while (!this.Pipe.IsMessageComplete); if (builder.Length > 0) { var node = new JsonNode(builder.ToString(), true); Logger.Log(NLog.LogLevel.Info, string.Format("RECV {0}", node.ToString())); if (node.GetValue_Object().ContainsKey("exception")) { this.OnError?.Invoke(this, new OnErrorEventArgs() { Message = node.GetValue_Object()["exception"].GetValue_String() }); } else { switch ((ERecvCommands)node.GetValue_Object()["command"].GetValue_Number()) { case ERecvCommands.HaltBreakpointInfo: case ERecvCommands.HaltStep: { var callstack = this.LastCallstack = node.GetValue_Object()["callstack"]; var instruction = node.GetValue_Object()["instruction"]; var fileOffsetNode = instruction.GetValue_Object()["fileOffset"]; var line = (int)fileOffsetNode.GetValue_Array()[0].GetValue_Number(); var col = (int)fileOffsetNode.GetValue_Array()[2].GetValue_Number(); this.IsHalted = true; this.OnHalt?.Invoke(this, new OnHaltEventArgs(instruction.GetValue_Object()["filename"].GetValue_String(), null, line, col)); } break; case ERecvCommands.HaltError: { var callstack = this.LastCallstack = node.GetValue_Object()["callstack"]; var error = node.GetValue_Object()["error"]; var fileOffsetNode = error.GetValue_Object()["fileOffset"]; var errorMessage = error.GetValue_Object()["message"]; //ToDo: display to user var fileContent = error.GetValue_Object()["content"]; //File content in case we don't have that file var line = (int)fileOffsetNode.GetValue_Array()[0].GetValue_Number(); var col = (int)fileOffsetNode.GetValue_Array()[2].GetValue_Number(); this.IsHalted = true; this.OnHalt?.Invoke(this, new OnHaltEventArgs(error.GetValue_Object()["filename"].GetValue_String(), fileContent.GetValue_String(), line, col)); } break; case ERecvCommands.HaltScriptAssert: case ERecvCommands.HaltScriptHalt: { var callstack = this.LastCallstack = node.GetValue_Object()["callstack"]; var halt = node.GetValue_Object()["halt"]; var fileOffsetNode = halt.GetValue_Object()["fileOffset"]; var fileContent = halt.GetValue_Object()["content"]; //File content in case we don't have that file var line = (int)fileOffsetNode.GetValue_Array()[0].GetValue_Number(); var col = (int)fileOffsetNode.GetValue_Array()[2].GetValue_Number(); this.IsHalted = true; this.OnHalt?.Invoke(this, new OnHaltEventArgs(halt.GetValue_Object()["filename"].GetValue_String(), null, line, col)); } break; case ERecvCommands.ContinueExecution: { this.IsHalted = false; this.OnContinue?.Invoke(this, new OnContinueEventArgs() { }); } break; default: this.Messages.Add(node); break; } } } Thread.Sleep(10); } } catch (ObjectDisposedException) { } catch (Exception ex) { Virtual.ShowOperationFailedMessageBox(ex); } }
public ActionResult Virtual(Virtual virtua) { virtuales.Add(virtua); return(View()); }
/// <summary> /// Returns true if RobotInfo instances are equal /// </summary> /// <param name="other">Instance of RobotInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(RobotInfo other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Direction == other.Direction || Direction.Equals(other.Direction) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( Id == other.Id || Id.Equals(other.Id) ) && ( Location == other.Location || Location != null && Location.Equals(other.Location) ) && ( EnergyCubes == other.EnergyCubes || EnergyCubes.Equals(other.EnergyCubes) ) && ( Health == other.Health || Health.Equals(other.Health) ) && ( Active == other.Active || Active.Equals(other.Active) ) && ( Virtual == other.Virtual || Virtual.Equals(other.Virtual) ) && ( Priority == other.Priority || Priority.Equals(other.Priority) ) && ( OnTurn == other.OnTurn || OnTurn.Equals(other.OnTurn) ) && ( IsMine == other.IsMine || IsMine.Equals(other.IsMine) ) && ( HandCards == other.HandCards || HandCards.Equals(other.HandCards) ) && ( Attitude == other.Attitude || Attitude.Equals(other.Attitude) ) && ( Type == other.Type || Type.Equals(other.Type) )); }
private void Thread_ReadPipeMessage() { try { var buffer = new byte[2048]; while (this.Pipe.IsConnected) { var builder = new StringBuilder(); do { var ammount = this.Pipe.Read(buffer, 0, buffer.Length); builder.Append(Encoding.Default.GetString(buffer, 0, ammount)); }while (!this.Pipe.IsMessageComplete); if (builder.Length > 0) { var msg = builder.ToString(); Logger.Log(NLog.LogLevel.Info, String.Format("RECV {0}", msg)); dynamic token = Newtonsoft.Json.Linq.JToken.Parse(msg); ERecvCommands command = token.command; switch (command) { case ERecvCommands.VersionInfo: break; case ERecvCommands.ContinueExecution: this.IsHalted = false; this.OnContinue?.Invoke(this, new OnContinueEventArgs() { }); break; case ERecvCommands.Halt_breakpoint: case ERecvCommands.Halt_step: case ERecvCommands.Halt_error: case ERecvCommands.Halt_scriptAssert: case ERecvCommands.Halt_scriptHalt: { this.LastCallstack = token.callstack; string filename; try { filename = token.halt.filename; } catch { filename = string.Empty; } int line; try { line = token.halt.fileOffset[0]; } catch { line = 0; } int col; try { col = token.halt.fileOffset[2]; } catch { col = 0; } string sample; try { sample = token.halt.content; } catch { sample = string.Empty; } this.IsHalted = true; this.OnHalt?.Invoke(this, new OnHaltEventArgs(filename, sample, line, col)); } break; case ERecvCommands.Halt_placeholder: break; case ERecvCommands.VariableReturn: this.Messages.Add(token); break; } } Thread.Sleep(10); } } catch (ObjectDisposedException) { } catch (Exception ex) { Virtual.ShowOperationFailedMessageBox(ex); } }