public SharedDictionaryWriter(SharedDictionaryImpl dic, IStructuredWriter writer) { _dic = dic; _writer = writer; _alreadyWritten = new HashSet <object>(); _writer.Current.ObjectWriteExData += new EventHandler <ObjectWriteExDataEventArgs>(_writer_ObjectWriteExData); }
void IStructuredSerializable.WriteContent(IStructuredWriter sw) { sw.Xml.WriteAttributeString("Version", "1.0.0.0"); sw.WriteInlineObjectStructuredElement("PluginStatusCollection", PluginStatusCollection); sw.WriteInlineObjectStructuredElement(UriHistoryCollection.EntryName + "Collection", UriHistoryCollection); sw.GetService <ISharedDictionaryWriter>(true).WritePluginsDataElement("Plugins", this); }
/// <summary> /// Internal: Output this request. Can't use the Abstract Subscription Request because it needs to append two separate subscriptions. /// </summary> /// <param name="writer">The destination for the request content</param> public void WriteTo(IStructuredWriter writer) { writer.StartElement("req").StartElement("body"); writer.StartElement("subscription"); writer.ValueOrEmpty("type", "historicMarketData"); writer.EndElement("subscription").EndElement("body").EndElement("req"); }
public SharedDictionaryWriter( SharedDictionaryImpl dic, IStructuredWriter writer ) { _dic = dic; _writer = writer; _alreadyWritten = new HashSet<object>(); _writer.Current.ObjectWriteExData += new EventHandler<ObjectWriteExDataEventArgs>( _writer_ObjectWriteExData ); }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the content of this request</param> public void WriteTo(IStructuredWriter writer) { writer. StartElement("req"). WriteEmptyTag("body"). EndElement("req"); }
public void BugBinaryTooBigContent() { string xmlPath = TestBase.GetTestFilePath("Storage", "BugBinaryTooBigContent"); SerializableObject original = new SerializableObject() { Name = "coucou", Power = 20 }; using (Stream wrt = new FileStream(xmlPath, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("data", original); } } LoadAndModifyXml(xmlPath, d => { var e = d.Root.Element("data"); e.SetValue(e.Value.Insert(e.Value.Length / 2, "00FF00FF")); }); using (Stream str = new FileStream(xmlPath, FileMode.Open)) { SimpleServiceContainer s = new SimpleServiceContainer(); s.Add(typeof(ISimpleTypeFinder), SimpleTypeFinder.WeakDefault, null); using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, s)) { object obj = reader.ReadObjectElement("data"); } } }
public void BugUnexisting() { string xmlPath = TestBase.GetTestFilePath("Storage", "BugUnexistingEnum"); using (Stream wrt = new FileStream(xmlPath, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("data", UnexistingTestEnumValues.First); writer.WriteObjectElement("After", 3712 * 2); writer.WriteObjectElement("data", new MayBeUnexistingButValidXmlObject()); writer.WriteObjectElement("After2", 3712 * 3); } } TestBase.DumpFileToConsole(xmlPath); using (Stream str = new FileStream(xmlPath, FileMode.Open)) { SimpleServiceContainer s = new SimpleServiceContainer(); s.Add <ISimpleTypeFinder>(new UnexistingTypeFinder()); using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, s)) { Assert.Throws <TypeLoadException>(() => reader.ReadObjectElement("data")); // An exception does not break the reader. Assert.That(reader.ReadObjectElement("After"), Is.EqualTo(3712 * 2)); Assert.Throws <TypeLoadException>(() => reader.ReadObjectElement("data")); // An exception does not break the reader. Assert.That(reader.ReadObjectElement("After2"), Is.EqualTo(3712 * 3)); } } }
public void TestIntegers() { string test = TestBase.GetTestFilePath("Storage", "TestIntegers"); using (Stream wrt = new FileStream(test, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("data", (int)10); writer.WriteObjectElement("data", (SByte)(-8)); writer.WriteObjectElement("data", (Int16)(-16)); writer.WriteObjectElement("data", (Int32)(-32)); writer.WriteObjectElement("data", (Int64)(-64)); writer.WriteObjectElement("data", (Byte)8); writer.WriteObjectElement("data", (UInt16)16); writer.WriteObjectElement("data", (UInt32)32); writer.WriteObjectElement("data", (UInt64)64); } } using (Stream str = new FileStream(test, FileMode.Open)) { using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, null)) { CheckExactTypeAndValue(typeof(int), 10, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(SByte), -8, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(Int16), -16, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(Int32), -32, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(Int64), -64, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(Byte), 8, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(UInt16), 16, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(UInt32), 32, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(UInt64), 64, reader.ReadObjectElement("data")); } } }
public void GenericListOfString() { string xmlPath = TestBase.GetTestFilePath("Storage", "TestGenericListOfString"); List <string> list = new List <string>(); list.Add("content1"); list.Add("content2"); list.Add("content3"); using (Stream wrt = new FileStream(xmlPath, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("Before", 3712); writer.WriteObjectElement("data", list); writer.WriteObjectElement("After", 3712 * 2); } } using (Stream str = new FileStream(xmlPath, FileMode.Open)) { SimpleServiceContainer s = new SimpleServiceContainer(); s.Add <ISimpleTypeFinder>(SimpleTypeFinder.WeakDefault); using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, s)) { Assert.That(reader.ReadObjectElement("Before"), Is.EqualTo(3712)); CheckExactTypeAndValue(typeof(List <string>), list, reader.ReadObjectElement("data")); Assert.That(reader.ReadObjectElement("After"), Is.EqualTo(3712 * 2)); } } }
public void BinarySerializableObject() { string xmlPath = TestBase.GetTestFilePath("Storage", "TestBinarySerializableObject"); SerializableObject o = new SerializableObject(); o.Name = "TestName"; o.Power = 20; using (Stream wrt = new FileStream(xmlPath, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("Before", 3712); writer.WriteObjectElement("data", o); writer.WriteObjectElement("After", 3712 * 2); } } using (Stream str = new FileStream(xmlPath, FileMode.Open)) { SimpleServiceContainer s = new SimpleServiceContainer(); s.Add(typeof(ISimpleTypeFinder), SimpleTypeFinder.WeakDefault, null); using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, s)) { Assert.That(reader.ReadObjectElement("Before"), Is.EqualTo(3712)); SerializableObject o2 = (SerializableObject)reader.ReadObjectElement("data"); Assert.AreEqual(o.Name, o2.Name); Assert.AreEqual(o.Power, o2.Power); Assert.That(reader.ReadObjectElement("After"), Is.EqualTo(3712 * 2)); } } }
public void BugBinarySizeDiffer() { string xmlPath = TestBase.GetTestFilePath("Storage", "BugBinarySizeDiffer"); SerializableObject original = new SerializableObject() { Name = "coucou", Power = 20 }; using (Stream wrt = new FileStream(xmlPath, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("data", original); } } LoadAndModifyXml(xmlPath, d => d.Root.Element("data").Attribute("size").SetValue("1")); using (Stream str = new FileStream(xmlPath, FileMode.Open)) { SimpleServiceContainer s = new SimpleServiceContainer(); s.Add(typeof(ISimpleTypeFinder), SimpleTypeFinder.WeakDefault, null); using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, s)) { Assert.Throws <CKException>(() => reader.ReadObjectElement("data")); } } }
void IStructuredSerializable.WriteContent( IStructuredWriter sw ) { sw.Xml.WriteAttributeString( "Version", "1.0.0.0" ); sw.WriteInlineObjectStructuredElement( "PluginStatusCollection", PluginStatusCollection ); sw.WriteInlineObjectStructuredElement( UriHistoryCollection.EntryName + "Collection", UriHistoryCollection ); sw.GetService<ISharedDictionaryWriter>( true ).WritePluginsDataElement( "Plugins", this ); }
private void DoTestEnum(Action <XDocument> docModifier) { string test = TestBase.GetTestFilePath("Storage", "TestEnum"); using (Stream wrt = new FileStream(test, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("data", TestEnumValues.First); writer.WriteObjectElement("data", TestEnumValues.Second); writer.WriteObjectElement("After", 3712 * 2); } } LoadAndModifyXml(test, docModifier); using (Stream str = new FileStream(test, FileMode.Open)) { SimpleServiceContainer s = new SimpleServiceContainer(); s.Add(typeof(ISimpleTypeFinder), SimpleTypeFinder.WeakDefault, null); using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, s)) { TestEnumValues value1 = (TestEnumValues)reader.ReadObjectElement("data"); TestEnumValues value2 = (TestEnumValues)reader.ReadObjectElement("data"); Assert.That(value1, Is.EqualTo(TestEnumValues.First)); Assert.That(value2, Is.EqualTo(TestEnumValues.Second)); Assert.That(reader.ReadObjectElement("After"), Is.EqualTo(3712 * 2)); } } }
public void ColorStruct() { string xmlPath = TestBase.GetTestFilePath("Storage", "TestColor"); using (Stream wrt = new FileStream(xmlPath, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("data", Color.Red); writer.WriteObjectElement("data", Color.Blue); writer.WriteObjectElement("After", 3712 * 2); } } using (Stream str = new FileStream(xmlPath, FileMode.Open)) { SimpleServiceContainer s = new SimpleServiceContainer(); //s.Add( typeof( ISimpleTypeFinder ), SimpleTypeFinder.WeakDefault, null ); using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, s)) { CheckExactTypeAndValue(typeof(Color), Color.Red, reader.ReadObjectElement("data")); CheckExactTypeAndValue(typeof(Color), Color.Blue, reader.ReadObjectElement("data")); Assert.That(reader.ReadObjectElement("After"), Is.EqualTo(3712 * 2)); } } }
private void DoWriteEnd(IStructuredWriter wSub, object o) { ObjectWriteExDataEventArgs e = new ObjectWriteExDataEventArgs(wSub, o); RaiseWriteEvent(e); Xml.WriteEndElement(); }
private void TestXmlSerializableObject(string path, XmlRawObjectBase original) { using (Stream wrt = new FileStream(path, FileMode.Create)) { using (IStructuredWriter writer = SimpleStructuredWriter.CreateWriter(wrt, new SimpleServiceContainer())) { writer.WriteObjectElement("Before", 3712); writer.WriteObjectElement("data", original); writer.WriteObjectElement("After", 3712 * 2); } } using (Stream str = new FileStream(path, FileMode.Open)) { using (IStructuredReader reader = SimpleStructuredReader.CreateReader(str, null)) { Assert.That(reader.ReadObjectElement("Before"), Is.EqualTo(3712)); if (original.BugWhileReading == BugRead.ThrowApplicationException) { Assert.Throws <ApplicationException>(() => reader.ReadObjectElement("data")); // Even if an exception is thrown, we can continue to read the data. } else if (original.BugWhileReading == BugRead.None) { CheckExactTypeAndValue(original.GetType(), original, reader.ReadObjectElement("data")); } else { XmlRawObjectBase read = (XmlRawObjectBase)reader.ReadObjectElement("data"); Assert.That(read.BugWhileReading == original.BugWhileReading); } Assert.That(reader.ReadObjectElement("After"), Is.EqualTo(3712 * 2), "Whatever happens above, one can continue to read."); } } }
public void SaveSystemConfig(IStructuredWriter writer) { using (var dw = _dic.RegisterWriter(writer)) { writer.WriteInlineObjectStructuredElement("System", _systemConfiguration); } IsSystemConfigDirty = false; }
public void SaveContext(Uri address) { using (IStructuredWriter sw = OpenWrite(address)) { _ctx.SaveContext(sw); _ctx.ConfigManager.UserConfiguration.CurrentContextProfile = _ctx.ConfigManager.UserConfiguration.ContextProfiles.FindOrCreate(address); } }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the content of this request</param> public void WriteTo(IStructuredWriter writer) { writer. StartElement("req"). StartElement("body"). ValueOrNone("token", _token). EndElement("body"). EndElement("req"); }
public void WriteTo(IStructuredWriter writer) { writer.StartElement("req").StartElement("body").ValueUTF8("username", this._username).ValueUTF8("password", this._password); if (this._checkProtocolVersion) { writer.ValueOrNone("protocolVersion", "1.8"); } writer.ValueOrNone("productType", this._productType.ToString()).EndElement("body").EndElement("req"); }
public void Dispose() { if (_writer != null) { _writer.ServiceContainer.Remove(typeof(ISharedDictionaryWriter)); _writer = null; _dic = null; } }
/// <summary> /// Atomically saves the changes and dispose the <see cref="StructuredWriter"/> (this method /// must be called only once, any subsequent calls are ignored). /// </summary> public void SaveChanges() { if( StructuredWriter != null ) { StructuredWriter.Dispose(); StructuredWriter = null; if( _pathNew != _path ) File.Replace( _pathNew, _path, _path + ".bak" ); } }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the content of this request</param> public void WriteTo(IStructuredWriter writer) { writer. StartElement("req"). StartElement("body"). ValueOrEmpty("instructionId", _instructionId). ValueOrEmpty("instrumentId", _instrumentId). ValueOrEmpty("originalInstructionId", _originalInstructionId). EndElement("body"). EndElement("req"); }
public ISharedDictionaryWriter RegisterWriter(IStructuredWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } ISharedDictionaryWriter wrt = new SharedDictionaryWriter(this, writer); writer.ServiceContainer.Add <ISharedDictionaryWriter>(wrt, Util.ActionDispose); return(wrt); }
public virtual void SaveUserConfig(Uri address, bool setAdressAsCurrent) { using (IStructuredWriter sw = OpenWrite(address)) { _ctx.ConfigManager.Extended.SaveUserConfig(sw); if (setAdressAsCurrent) { _ctx.ConfigManager.SystemConfiguration.CurrentUserProfile = _ctx.ConfigManager.SystemConfiguration.UserProfiles.FindOrCreate(address); } } }
void IStructuredSerializable.WriteContent(IStructuredWriter sw) { XmlWriter w = sw.Xml; foreach (UriHistory profile in this) { w.WriteStartElement(EntryName); w.WriteAttributeString("DisplayName", profile.DisplayName); w.WriteAttributeString("Uri", profile.Address.ToString()); w.WriteFullEndElement(); } }
public void WriteContent(IStructuredWriter sw) { XmlWriter w = sw.Xml; foreach (IPluginStatus p in this) { w.WriteStartElement("PluginStatus"); w.WriteAttributeString("Guid", p.PluginId.ToString()); w.WriteAttributeString("Status", p.Status.ToString()); w.WriteFullEndElement(); } }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the content of this request</param> public void WriteTo(IStructuredWriter writer) { writer. StartElement("req"). StartElement("body"). ValueUTF8("username", _username). ValueUTF8("password", _password). ValueOrNone("protocolVersion", ProtocolVersion). ValueOrNone("productType", _productType.ToString()). EndElement("body"). EndElement("req"); }
/// <summary> /// Atomically saves the changes and dispose the <see cref="StructuredWriter"/> (this method /// must be called only once, any subsequent calls are ignored). /// </summary> public void SaveChanges() { if (StructuredWriter != null) { StructuredWriter.Dispose(); StructuredWriter = null; if (_pathNew != _path) { File.Replace(_pathNew, _path, _path + ".bak"); } } }
private IStructuredWriter WriteOptions(IStructuredWriter writer) { if (_options.Length <= 0) { return(writer); } writer.StartElement("options"); foreach (Option option in _options) { writer.ValueOrNone("option", Convert.ToString(option).ToUpper()); } writer.EndElement("options"); return(writer); }
public void WriteInlineContent(IStructuredWriter sw, Dog o) { // This is an independant scope... sw.ServiceContainer.Add <UniqueService>(new UniqueService()); XmlWriter w = sw.Xml; w.WriteAttributeString("Name", o.Name); foreach (Paw paw in o.Paws) { w.WriteStartElement("Paw"); sw.WriteInlineObjectStructured(paw); } }
public void WriteInlineContent(IStructuredWriter sw, Paw o) { // This is an independant scope... sw.ServiceContainer.Add <UniqueService>(new UniqueService()); XmlWriter w = sw.Xml; w.WriteAttributeString("fingerCount", o.FingerCount.ToString(CultureInfo.InvariantCulture)); if ((o.FingerCount % 1) == 0) { w.WriteStartElement("ExtraInfo"); w.WriteString("Content of the ExtraInfo"); w.WriteEndElement(); } }
public void SaveContext(IStructuredWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } using (ISharedDictionaryWriter dw = _dic.RegisterWriter(writer)) { XmlWriter w = writer.Xml; w.WriteStartElement("CKContext"); writer.WriteInlineObjectStructuredElement("RequirementLayer", _reqLayer); dw.WritePluginsDataElement("PluginData", _proxifiedContext); w.WriteEndElement(); } }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the content of this request</param> public virtual void WriteTo(IStructuredWriter writer) { writer. StartElement("req"). StartElement("body"). StartElement("order"). ValueOrNone("instrumentId", _instrumentId). ValueOrNone("instructionId", _instructionId). ValueOrNone("price", GetPrice()). ValueOrNone("quantity", _quantity). ValueOrNone("timeInForce", Enum.GetName(TimeInForce.GetType(), _timeInForce)). ValueOrNone("stopLossOffset", _stopLossPriceOffset). ValueOrNone("stopProfitOffset", _stopProfitPriceOffset). EndElement("order"). EndElement("body"). EndElement("req"); }
public void WriteContent( IStructuredWriter sw ) { sw.Xml.WriteStartElement( "Value" ); sw.Xml.WriteValue( Value ); sw.Xml.WriteEndElement(); }
public void WriteContent( IStructuredWriter sw ) { XmlWriter w = sw.Xml; foreach( IPluginStatus p in this ) { w.WriteStartElement( "PluginStatus" ); w.WriteAttributeString( "Guid", p.PluginId.ToString() ); w.WriteAttributeString( "Status", p.Status.ToString() ); w.WriteFullEndElement(); } }
void IStructuredSerializable.WriteContent( IStructuredWriter sw ) { XmlWriter w = sw.Xml; w.WriteStartElement( "KeyModes" ); foreach( KeyMode vk in KeyModes ) { sw.WriteInlineObjectStructuredElement( "KeyMode", vk ); } w.WriteFullEndElement(); }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the request content</param> public void WriteTo(IStructuredWriter writer) { writer.StartElement("req").StartElement("body").StartElement("subscription"); WriteSubscriptionBodyTo(writer); writer.EndElement("subscription").EndElement("body").EndElement("req"); }
public void Dispose() { if( _writer != null ) { _writer.ServiceContainer.Remove( typeof( ISharedDictionaryWriter ) ); _writer = null; _dic = null; } }
protected abstract void WriteSubscriptionBodyTo(IStructuredWriter writer);
/// <summary> /// Initializes a new <see cref="ObjectWriteExDataEventArgs"/>. /// </summary> /// <param name="w">Structured writer.</param> /// <param name="o">Object written.</param> public ObjectWriteExDataEventArgs( IStructuredWriter w, object o ) { Obj = o; Writer = w; }
private void DoWriteEnd( IStructuredWriter wSub, object o ) { ObjectWriteExDataEventArgs e = new ObjectWriteExDataEventArgs( wSub, o ); RaiseWriteEvent( e ); Xml.WriteEndElement(); }
void IStructuredSerializable.WriteContent( IStructuredWriter sw ) { XmlWriter w = sw.Xml; w.WriteAttributeString( "Index", XmlConvert.ToString( _key.Index ) ); foreach( LayoutKeyMode vk in this ) { sw.Xml.WriteStartElement( "LayoutKeyMode" ); sw.WriteInlineObjectStructured( vk ); } }
void IStructuredSerializable.WriteContent( IStructuredWriter sw ) { XmlWriter w = sw.Xml; w.WriteAttributeString( "Name", Name ); if( _keys.Count > 0 ) { w.WriteStartElement( "Keys" ); foreach( Key k in _keys ) { sw.WriteInlineObjectStructuredElement( "Key", k ); } w.WriteFullEndElement(); } }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the content of this request</param> public void WriteTo(IStructuredWriter writer) { }
protected override void WriteSubscriptionBodyTo(IStructuredWriter writer) { writer.ValueOrEmpty("orderBookStatus", _instrumentId); }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the content of this request</param> public void WriteTo(IStructuredWriter writer) { throw new InvalidOperationException("This is a GET request and it does not generate a body."); }
public void WriteBack( IStructuredWriter w ) { w.Xml.WriteRaw( _skippedFragment ); }
void IStructuredSerializable.WriteContent( IStructuredWriter sw ) { XmlWriter w = sw.Xml; w.WriteAttributeString( "Name", Name ); if( _keyboards.Current == this ) w.WriteAttributeString( "IsCurrent", "1" ); sw.WriteInlineObjectStructuredElement( "RequirementLayer", _reqLayer ); w.WriteStartElement( "Modes" ); w.WriteAttributeString( "Current", CurrentMode.ToString() ); foreach( IKeyboardMode m in AvailableMode.AtomicModes ) w.WriteElementString( "Mode", m.ToString() ); w.WriteEndElement(); sw.WriteInlineObjectStructuredElement( "Zones", Zones ); sw.WriteInlineObjectStructuredElement( "Layouts", Layouts ); }
void IStructuredSerializable.WriteContent( IStructuredWriter sw ) { XmlWriter w = sw.Xml; if( _layouts != null ) { foreach( Layout l in _layouts.Values ) { sw.WriteInlineObjectStructuredElement( "Layout", l ); } } else { sw.WriteInlineObjectStructuredElement( "Layout", _defaultLayout ); } }
protected override void WriteSubscriptionBodyTo(IStructuredWriter writer) { writer.ValueOrEmpty("type", "position"); }
internal void WriteInlineContent( IStructuredWriter sw ) { foreach( Keyboard k in _keyboards.Values ) { sw.WriteInlineObjectStructuredElement( "Keyboard", k ); } }
public void WriteContent( IStructuredWriter sw ) { XmlWriter w = sw.Xml; w.WriteStartElement( "Bindings" ); foreach( var b in Bindings ) sw.WriteInlineObjectStructuredElement( "Bind", b ); w.WriteFullEndElement(); }
void IStructuredSerializable.WriteContent( IStructuredWriter sw ) { WriteInlineContent( sw.Xml ); }
public void WriteContent( IStructuredWriter sw ) { XmlWriter w = sw.Xml; w.WriteAttributeString( "Master", Target ); w.WriteAttributeString( "Slave", Origin ); w.WriteAttributeString( "Position", Position.ToString() ); }
/// <summary> /// Internal: Output this request. /// </summary> /// <param name="writer">The destination for the content of this request</param> public void WriteTo(IStructuredWriter writer) { writer. StartElement("req"). StartElement("body"). StartElement("order"). ValueOrNone("instrumentId", _instrumentId). ValueOrNone("instructionId", _instructionId). ValueOrNone("price", GetPrice()). ValueOrNone("quantity", _quantity). ValueOrNone("timeInForce", Enum.GetName(TimeInForce.GetType(), _timeInForce)). ValueOrNone("stopLossOffset", _stopLossPriceOffset). ValueOrNone("stopProfitOffset", _stopProfitPriceOffset). EndElement("order"). EndElement("body"). EndElement("req"); }