private void method_2(string string_0, global::System.IO.MemoryStream memoryStream_0, global::System.IO.MemoryStream memoryStream_1) { using (global::System.IO.BinaryWriter binaryWriter = new global::System.IO.BinaryWriter(global::System.IO.File.Open(string_0, global::System.IO.FileMode.Create))) { binaryWriter.Write(memoryStream_0.ToArray()); binaryWriter.Write(memoryStream_1.ToArray()); } }
// Token: 0x06000506 RID: 1286 RVA: 0x00019AEC File Offset: 0x00017CEC public override void Serialize(global::System.IO.BinaryWriter aWriter) { aWriter.Write(1); aWriter.Write(this.m_List.Count); for (int i = 0; i < this.m_List.Count; i++) { this.m_List[i].Serialize(aWriter); } }
// Token: 0x06000516 RID: 1302 RVA: 0x0001A0A8 File Offset: 0x000182A8 public override void Serialize(global::System.IO.BinaryWriter aWriter) { aWriter.Write(2); aWriter.Write(this.m_Dict.Count); foreach (string text in this.m_Dict.Keys) { aWriter.Write(text); this.m_Dict[text].Serialize(aWriter); } }
public override void SaveModel(DslModeling::SerializationResult serializationResult, MetaModel modelRoot, string fileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { base.SaveModel(serializationResult, modelRoot, fileName, encoding, writeOptionalPropertiesWithDefaultValue); System.IO.FileInfo info = new System.IO.FileInfo(fileName); string fileNameDiagram = info.DirectoryName + "\\" + info.Name.Remove(info.Name.Length - info.Extension.Length, info.Extension.Length) + DiagramExtension; // save view information using (global::System.IO.MemoryStream newFileContent = new global::System.IO.MemoryStream()) { DslModeling::DomainXmlSerializerDirectory directory = this.GetDirectory(modelRoot.Store); DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(directory, fileName, serializationResult); this.InitializeSerializationContext(modelRoot.Partition, serializationContext, false); // MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here. serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = LanguageDSLSerializationHelper.Instance.CreateXmlWriterSettings(serializationContext, false, encoding); using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(newFileContent, settings)) { ViewSerializer serializer = directory.GetSerializer(View.DomainClassId) as ViewSerializer; serializer.Write(serializationContext, modelRoot.View, writer); } if (!serializationResult.Failed && newFileContent != null) { // Only write the content if there's no error encountered during serialization. using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(fileNameDiagram, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(newFileContent.ToArray()); } } } } }
public static void WriteFile(byte[] bytes, string filename) { using (global::System.IO.BinaryWriter binaryWriter = new global::System.IO.BinaryWriter(global::System.IO.File.Open(filename, global::System.IO.FileMode.Create))) { binaryWriter.Write(bytes); } }
// Token: 0x06000522 RID: 1314 RVA: 0x0001A2A8 File Offset: 0x000184A8 public override void Serialize(global::System.IO.BinaryWriter aWriter) { global::VRGIN.Helpers.JSONData jsondata = new global::VRGIN.Helpers.JSONData(""); jsondata.AsInt = this.AsInt; bool flag = jsondata.m_Data == this.m_Data; if (flag) { aWriter.Write(4); aWriter.Write(this.AsInt); } else { jsondata.AsFloat = this.AsFloat; bool flag2 = jsondata.m_Data == this.m_Data; if (flag2) { aWriter.Write(7); aWriter.Write(this.AsFloat); } else { jsondata.AsDouble = this.AsDouble; bool flag3 = jsondata.m_Data == this.m_Data; if (flag3) { aWriter.Write(5); aWriter.Write(this.AsDouble); } else { jsondata.AsBool = this.AsBool; bool flag4 = jsondata.m_Data == this.m_Data; if (flag4) { aWriter.Write(6); aWriter.Write(this.AsBool); } else { aWriter.Write(3); aWriter.Write(this.m_Data); } } } } }
public static void WriteFile(global::System.IO.MemoryStream stream, string filename) { using (global::System.IO.BinaryWriter binaryWriter = new global::System.IO.BinaryWriter(global::System.IO.File.Open(filename, global::System.IO.FileMode.Create))) { byte[] buffer = stream.ToArray(); binaryWriter.Write(buffer); } }
/// <summary> /// Save options. /// </summary> /// <param name="filePath">File name to save options to.</param> public void Serialize(string filePath) { System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); global::System.IO.MemoryStream newFileContent = null; try { newFileContent = new global::System.IO.MemoryStream(); global::System.Xml.XmlTextWriter xmlWriter = new System.Xml.XmlTextWriter(newFileContent, encoding); xmlWriter.Formatting = System.Xml.Formatting.Indented; xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("ViewModelOptions"); // write attributes xmlWriter.WriteAttributeString("errorCategoryVisible", this.ErrorCategoryVisible.ToString()); xmlWriter.WriteAttributeString("warningCategoryVisible", this.WarningCategoryVisible.ToString()); xmlWriter.WriteAttributeString("infoCategoryVisible", this.InfoCategoryVisible.ToString()); xmlWriter.WriteAttributeString("filteredCategoryVisible", this.FilteredCategoryVisible.ToString()); SerializeElements(xmlWriter); xmlWriter.WriteEndElement(); xmlWriter.Flush(); if (newFileContent != null) { // Only write the content if there's no error encountered during serialization. global::System.IO.FileStream fileStream = null; try { fileStream = new global::System.IO.FileStream(filePath, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None); using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { try { writer.Write(newFileContent.ToArray()); } finally { fileStream = null; } } } finally { if (fileStream != null) { fileStream.Dispose(); } } } } finally { if (newFileContent != null) { newFileContent.Dispose(); } } }
public static void smethod_7(global::System.IO.BinaryWriter writer, uint value, global::ARC_Studio.Workers.ARC.FileUtils.ByteOrder byteOrder) { byte[] array = global::System.BitConverter.GetBytes(value); if (byteOrder == global::ARC_Studio.Workers.ARC.FileUtils.ByteOrder.BigEndian) { array = array.Reverse <byte>().ToArray <byte>(); } writer.Write(array); }
/// <summary> /// Saves the diagram. /// </summary> /// <typeparam name="TModel">The type of the model.</typeparam> /// <param name="serializationResult">The serialization result.</param> /// <param name="modelRoot">The model root.</param> /// <param name="modelFileName">Name of the model file.</param> /// <param name="diagram">The diagram.</param> /// <param name="diagramFileName">Name of the diagram file.</param> /// <param name="encoding">The encoding.</param> /// <param name="writeOptionalPropertiesWithDefaultValue">if set to <c>true</c> [write optional properties with default value].</param> public void SaveDiagram <TModel>(DslModeling::SerializationResult serializationResult, TModel modelRoot, string modelFileName, ComponentModelDiagram diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) where TModel : ModelElement { if (serializationResult.Failed) { return; } // MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here. using (global::System.IO.MemoryStream diagramFileContent = new global::System.IO.MemoryStream()) { DslModeling::DomainClassXmlSerializer diagramSerializer = this.Directory.GetSerializer(diagram.GetDomainClass().Id); global::System.Diagnostics.Debug.Assert(diagramSerializer != null, "Cannot find serializer for " + diagram.GetDomainClass().Name + "!"); if (diagramSerializer != null) { DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(this.Directory, diagramFileName, serializationResult); serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = new global::System.Xml.XmlWriterSettings(); settings.Indent = true; settings.Encoding = encoding; using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(diagramFileContent, encoding)) { using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(streamWriter, settings)) { diagramSerializer.WriteRootElement(serializationContext, diagram, writer); } } } if (!serializationResult.Failed) { // Only write the contents if there's no error encountered during serialization. if (diagramFileContent != null) { IVsQueryEditQuerySave2 scc = ServiceLocator.Instance.GetService <IVsQueryEditQuerySave2>(typeof(SVsQueryEditQuerySave)); if (scc != null) { uint result; if (scc.QuerySaveFile(diagramFileName, 0, null, out result) != (int)tagVSQuerySaveResult.QSR_SaveOK) { return; } } using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(diagramFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(diagramFileContent.ToArray()); } } } } } }
public virtual void TemporarlySaveModelVModell(DslModeling::SerializationResult serializationResult, global::Tum.VModellXT.VModell modelRoot, string fileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters if (serializationResult == null) throw new global::System.ArgumentNullException("serializationResult"); if (modelRoot == null) throw new global::System.ArgumentNullException("modelRoot"); if (string.IsNullOrEmpty(fileName)) throw new global::System.ArgumentNullException("fileName"); #endregion if (serializationResult.Failed) return; //DslEditorModeling::DomainModelStore dStore = (DslEditorModeling::DomainModelStore)modelRoot.Store; //if( dStore == null) // throw new global::System.ArgumentNullException("dStore"); //dStore.WaitForWritingLockRelease(); global::System.IO.MemoryStream newFileContent = null; try { newFileContent = new global::System.IO.MemoryStream(); DslModeling::DomainXmlSerializerDirectory directory = this.GetDirectory(modelRoot.Store); DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(directory, fileName, serializationResult); this.InitializeSerializationContext(modelRoot.Partition, serializationContext, false); serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = VModellXTSerializationHelper.Instance.CreateXmlWriterSettings(serializationContext, false, encoding); global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(newFileContent, settings); DslEditorModeling::SerializationOptions options = new DslEditorModeling.SerializationOptions(); options.SerializationMode = DslEditorModeling.SerializationMode.Temporarly; this.WriteRootElementVModell(serializationContext, modelRoot, writer, options); writer.Flush(); if (!serializationResult.Failed && newFileContent != null) { // Only write the content if there's no error encountered during serialization. global::System.IO.FileStream fileStream = null; try { fileStream = new global::System.IO.FileStream(fileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None); using (global::System.IO.BinaryWriter writerBin = new global::System.IO.BinaryWriter(fileStream, encoding)) { try { writerBin.Write(newFileContent.ToArray()); fileStream.Dispose(); } finally { fileStream = null; } } } finally { if( fileStream != null ) fileStream.Dispose(); } } } finally { if( newFileContent != null ) newFileContent.Dispose(); } }
/// <summary> /// Save options. /// </summary> /// <param name="filePath">File name to save options to.</param> public void Serialize(string filePath) { System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); global::System.IO.MemoryStream newFileContent = null; try { newFileContent = new global::System.IO.MemoryStream(); global::System.Xml.XmlTextWriter xmlWriter = new System.Xml.XmlTextWriter(newFileContent, encoding); xmlWriter.Formatting = System.Xml.Formatting.Indented; xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("ViewModelOptions"); // write attributes xmlWriter.WriteAttributeString("errorCategoryVisible", this.ErrorCategoryVisible.ToString()); xmlWriter.WriteAttributeString("warningCategoryVisible", this.WarningCategoryVisible.ToString()); xmlWriter.WriteAttributeString("infoCategoryVisible", this.InfoCategoryVisible.ToString()); xmlWriter.WriteAttributeString("filteredCategoryVisible", this.FilteredCategoryVisible.ToString()); SerializeElements(xmlWriter); xmlWriter.WriteEndElement(); xmlWriter.Flush(); if (newFileContent != null) { // Only write the content if there's no error encountered during serialization. global::System.IO.FileStream fileStream = null; try { fileStream = new global::System.IO.FileStream(filePath, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None); using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { try { writer.Write(newFileContent.ToArray()); } finally { fileStream = null; } } } finally { if (fileStream != null) fileStream.Dispose(); } } } finally { if (newFileContent != null) newFileContent.Dispose(); } }
public virtual void SaveModelAndDiagram(DslModeling::SerializationResult serializationResult, HostDesignerModel modelRoot, string modelFileName, HostDesignerDiagram diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters if (serializationResult == null) throw new global::System.ArgumentNullException("serializationResult"); if (string.IsNullOrEmpty(modelFileName)) throw new global::System.ArgumentNullException("modelFileName"); if (diagram == null) throw new global::System.ArgumentNullException("diagram"); if (string.IsNullOrEmpty(diagramFileName)) throw new global::System.ArgumentNullException("diagramFileName"); #endregion if (serializationResult.Failed) return; // Save the model file first using (global::System.IO.MemoryStream modelFileContent = this.InternalSaveModel(serializationResult, modelRoot, modelFileName, encoding, writeOptionalPropertiesWithDefaultValue)) { if (serializationResult.Failed) return; using (global::System.IO.MemoryStream diagramFileContent = this.InternalSaveDiagram(serializationResult, diagram, diagramFileName, encoding, writeOptionalPropertiesWithDefaultValue)) { if (!serializationResult.Failed) { // Only write the contents if there's no error encountered during serialization. if (modelFileContent != null) { using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(modelFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(modelFileContent.ToArray()); } } } if (diagramFileContent != null) { using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(diagramFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(diagramFileContent.ToArray()); } } } } } } }
public virtual void SaveModelAndDiagram(DslModeling::SerializationResult serializationResult, Model modelRoot, string modelFileName, ActiveRecordMapping diagram, string diagramFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters if (serializationResult == null) throw new global::System.ArgumentNullException("serializationResult"); if (string.IsNullOrEmpty(modelFileName)) throw new global::System.ArgumentNullException("modelFileName"); if (diagram == null) throw new global::System.ArgumentNullException("diagram"); if (string.IsNullOrEmpty(diagramFileName)) throw new global::System.ArgumentNullException("diagramFileName"); #endregion if (serializationResult.Failed) return; // Save the model file first using (global::System.IO.MemoryStream modelFileContent = this.InternalSaveModel(serializationResult, modelRoot, modelFileName, encoding, writeOptionalPropertiesWithDefaultValue)) { if (serializationResult.Failed) return; using (global::System.IO.MemoryStream diagramFileContent = new global::System.IO.MemoryStream()) { DslModeling::DomainClassXmlSerializer diagramSerializer = this.Directory.GetSerializer(diagram.GetDomainClass().Id); global::System.Diagnostics.Debug.Assert(diagramSerializer != null, "Cannot find serializer for " + diagram.GetDomainClass().Name + "!"); if (diagramSerializer != null) { DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(this.Directory, diagramFileName, serializationResult); // MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here. serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = new global::System.Xml.XmlWriterSettings(); settings.Indent = true; settings.Encoding = encoding; using (global::System.IO.StreamWriter streamWriter = new global::System.IO.StreamWriter(diagramFileContent, encoding)) { using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(streamWriter, settings)) { diagramSerializer.WriteRootElement(serializationContext, diagram, writer); } } } if (!serializationResult.Failed) { // Only write the contents if there's no error encountered during serialization. if (modelFileContent != null) { using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(modelFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(modelFileContent.ToArray()); } } } if (diagramFileContent != null) { using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(diagramFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(diagramFileContent.ToArray()); } } } } } } }
public virtual void SaveModel(DslModeling::SerializationResult serializationResult, ExampleModel modelRoot, string fileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters if (serializationResult == null) throw new global::System.ArgumentNullException("serializationResult"); if (modelRoot == null) throw new global::System.ArgumentNullException("modelRoot"); if (string.IsNullOrEmpty(fileName)) throw new global::System.ArgumentNullException("fileName"); #endregion if (serializationResult.Failed) return; using (global::System.IO.MemoryStream newFileContent = this.InternalSaveModel(serializationResult, modelRoot, fileName, encoding, writeOptionalPropertiesWithDefaultValue)) { if (!serializationResult.Failed && newFileContent != null) { // Only write the content if there's no error encountered during serialization. using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(fileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(newFileContent.ToArray()); } } } } }
internal virtual void SaveModel(DslModeling::SerializationResult serializationResult, ProductState modelRoot, string fileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters if (serializationResult == null) throw new global::System.ArgumentNullException("serializationResult"); if (modelRoot == null) throw new global::System.ArgumentNullException("modelRoot"); if (string.IsNullOrEmpty(fileName)) throw new global::System.ArgumentNullException("fileName"); #endregion if (serializationResult.Failed) return; using (global::System.IO.MemoryStream newFileContent = new global::System.IO.MemoryStream()) { DslModeling::DomainXmlSerializerDirectory directory = this.GetDirectory(modelRoot.Store); DslModeling::SerializationContext serializationContext = new DslModeling::SerializationContext(directory, fileName, serializationResult); this.InitializeSerializationContext(modelRoot.Partition, serializationContext, false); // MonikerResolver shouldn't be required in Save operation, so not calling SetupMonikerResolver() here. serializationContext.WriteOptionalPropertiesWithDefaultValue = writeOptionalPropertiesWithDefaultValue; global::System.Xml.XmlWriterSettings settings = ProductStateStoreSerializationHelper.Instance.CreateXmlWriterSettings(serializationContext, false, encoding); using (global::System.Xml.XmlWriter writer = global::System.Xml.XmlWriter.Create(newFileContent, settings)) { this.WriteRootElement(serializationContext, modelRoot, writer); } if (!serializationResult.Failed && newFileContent != null) { // Only write the content if there's no error encountered during serialization. using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(fileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(newFileContent.ToArray()); } } } } }
public virtual void SaveModelAndDiagrams(DslModeling::SerializationResult serializationResult, ModelRoot modelRoot, string modelFileName, DslDiagrams::Diagram[] diagrams, string diagramsFileName, global::System.Text.Encoding encoding, bool writeOptionalPropertiesWithDefaultValue) { #region Check Parameters if (serializationResult == null) { throw new global::System.ArgumentNullException("serializationResult"); } if (string.IsNullOrEmpty(modelFileName)) { throw new global::System.ArgumentNullException("modelFileName"); } if (diagrams == null) { throw new global::System.ArgumentNullException("diagrams"); } if (string.IsNullOrEmpty(diagramsFileName)) { throw new global::System.ArgumentNullException("diagramsFileName"); } #endregion if (serializationResult.Failed) { return; } // Save the model file first var modelFileContent = this.InternalSaveModel(serializationResult, modelRoot, modelFileName, encoding, writeOptionalPropertiesWithDefaultValue); if (serializationResult.Failed) { modelFileContent.Close(); return; } var memoryStreamDictionary = new Dictionary <global::System.IO.MemoryStream, string>(); foreach (var diagram in diagrams) { if (string.IsNullOrEmpty(diagram.Name)) { throw new ArgumentException("Each diagram must have a name", "diagrams"); } memoryStreamDictionary.Add(this.InternalSaveDiagram(serializationResult, diagram, diagramsFileName, encoding, writeOptionalPropertiesWithDefaultValue), diagram.Name); if (serializationResult.Failed) { modelFileContent.Close(); memoryStreamDictionary.Keys.ToList <global::System.IO.MemoryStream>().ForEach(memoryStream => memoryStream.Close()); return; } } // Only write the contents if there's no error encountered during serialization. if (modelFileContent != null) { using (global::System.IO.FileStream fileStream = new global::System.IO.FileStream(modelFileName, global::System.IO.FileMode.Create, global::System.IO.FileAccess.Write, global::System.IO.FileShare.None)) { using (global::System.IO.BinaryWriter writer = new global::System.IO.BinaryWriter(fileStream, encoding)) { writer.Write(modelFileContent.ToArray()); } } } WriteDiagramFile(diagramsFileName, memoryStreamDictionary); }