void InitializeLastUsedTypes() { if (initialized) { return; } try { ProtoMiddlerState.Deserialize(this); // cannot set values before OnLoad txtProtoFile.Text = ProtoFile; UpdateTypeList(); Application.ApplicationExit += (sender, e) => { try { // cannot use values from UI while exiting ProtoMiddlerState.Serialize(this); } catch { } }; } catch { } initialized = true; }
void bnDecodeAs_Click(object sender, EventArgs e) { MessageType = (string)cbType.SelectedItem; ProtoFile = txtProtoFile.Text; if (!string.IsNullOrWhiteSpace(ProtoFile) && !string.IsNullOrWhiteSpace(MessageType)) { Data = ProtoBufUtil.DecodeWithProto(ProtobufBytes, MessageType, ProtoFile); } ProtoMiddlerState.Serialize(this); }