internal static void Deserialize(ProtoBufInspectorControl @this, string filename = TempFile) { var file = Path.Combine(Path.GetTempPath(), filename); if (File.Exists(file)) { using (var fs = File.OpenRead(file)) { var ds = new DataContractSerializer(typeof(ProtoMiddlerState)); var state = ds.ReadObject(fs) as ProtoMiddlerState; if (state != null) { @this.ProtoFile = state.LastUsedPath; if (state.LastUsedTypes != null) { foreach (var pair in state.LastUsedTypes) { if (!@this._lastUsedTypes.ContainsKey(pair.Key)) { @this._lastUsedTypes[pair.Key] = pair.Value; } } } } } } }
public override void AddToTab(TabPage o) { _entityBody = new byte[2048]; _myControl = new ProtoBufInspectorControl(); o.Text = "ProtoBuf"; o.Controls.Add(_myControl); o.Controls[0].Dock = DockStyle.Fill; }
public override void AddToTab(TabPage o) { _entityBody = new byte[2048]; _myControl = new ProtoBufInspectorControl(); o.Text = "ProtoBuf"; o.Controls.Add(_myControl); o.Controls[0].Dock = DockStyle.Fill; }
internal static void Serialize(ProtoBufInspectorControl @this, string filename = TempFile) { var state = new ProtoMiddlerState { LastUsedPath = @this.ProtoFile, LastUsedTypes = @this._lastUsedTypes, }; var file = Path.GetTempFileName(); using (var fs = File.OpenWrite(file)) { var ds = new DataContractSerializer(typeof(ProtoMiddlerState)); ds.WriteObject(fs, state); } File.Replace(file, Path.Combine(Path.GetTempPath(), filename), null); }
internal static void Serialize(ProtoBufInspectorControl @this, string filename = TempFile) { var state = new ProtoMiddlerState { LastUsedPath = @this.ProtoFile, LastUsedTypes = @this._lastUsedTypes, }; var file = Path.GetTempFileName(); using (var fs = File.OpenWrite(file)) { var ds = new DataContractSerializer(typeof (ProtoMiddlerState)); ds.WriteObject(fs, state); } File.Replace(file, Path.Combine(Path.GetTempPath(), filename), null); }
internal static void Deserialize(ProtoBufInspectorControl @this, string filename = TempFile) { var file = Path.Combine(Path.GetTempPath(), filename); if (File.Exists(file)) { using (var fs = File.OpenRead(file)) { var ds = new DataContractSerializer(typeof (ProtoMiddlerState)); var state = ds.ReadObject(fs) as ProtoMiddlerState; if (state != null) { @this.ProtoFile = state.LastUsedPath; if (state.LastUsedTypes != null) { foreach (var pair in state.LastUsedTypes) { if (!@this._lastUsedTypes.ContainsKey(pair.Key)) { @this._lastUsedTypes[pair.Key] = pair.Value; } } } } } } }