Ejemplo n.º 1
0
 protected override void ConvertSymbolicExpressionTree(SymbolicExpressionTree tree, string name, SolutionMessage.Builder builder)
 {
     using (MemoryStream memoryStream = new MemoryStream()) {
         Persistence.Default.Xml.XmlGenerator.Serialize(tree, memoryStream);
         byte[] byteRep = memoryStream.ToArray();
         SolutionMessage.Types.RawVariable.Builder rawVariable = SolutionMessage.Types.RawVariable.CreateBuilder();
         rawVariable.SetName(name).SetData(ByteString.CopyFrom(byteRep));
         builder.AddRawVars(rawVariable.Build());
     }
 }
 protected override void ConvertSymbolicExpressionTree(SymbolicExpressionTree tree, string name, SolutionMessage.Builder builder)
 {
     using (MemoryStream memoryStream = new MemoryStream()) {
         var ser = new ProtoBufSerializer();
         ser.Serialize(tree, memoryStream, disposeStream: false);
         memoryStream.Flush();
         byte[] byteRep = memoryStream.ToArray();
         SolutionMessage.Types.RawVariable.Builder rawVariable = SolutionMessage.Types.RawVariable.CreateBuilder();
         rawVariable.SetName(name).SetData(ByteString.CopyFrom(byteRep));
         builder.AddRawVars(rawVariable.Build());
     }
 }