private void ProcessUpdateLines(byte[] data)
        {
            Dictionary <int, string> updateLines = BinaryFormatterHelper.FromByteArray <Dictionary <int, string> >(data);

            // foreach (KeyValuePair<int,string> keyValuePair in updateLines) {
            // Log("ProcessUpdateLines: " + keyValuePair);
            // }
            CommunicationWrapper.UpdateLines(updateLines);
        }
        private void ProcessSendCurrentBindings(byte[] data)
        {
            Dictionary <int, List <int> >       nativeBindings = BinaryFormatterHelper.FromByteArray <Dictionary <int, List <int> > >(data);
            Dictionary <HotkeyID, List <Keys> > bindings       =
                nativeBindings.ToDictionary(pair => (HotkeyID)pair.Key, pair => pair.Value.Cast <Keys>().ToList());

            foreach (var pair in bindings)
            {
                Log(pair.ToString());
            }

            CommunicationWrapper.SetBindings(bindings);
        }
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        if (reader.TokenType == JsonToken.Null)
        {
            return(null);
        }
        var data = serializer.Deserialize <BinaryData>(reader);

        if (data == null || data.binaryData == null)
        {
            return(null);
        }
        return(BinaryFormatterHelper.FromByteArray <T>(data.binaryData));
    }
 private void ProcessSendState(byte[] data)
 {
     try {
         StudioInfo studioInfo = StudioInfo.FromByteArray(data);
         CommunicationWrapper.StudioInfo = studioInfo;
     } catch (InvalidCastException) {
         string   studioVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(3);
         object[] objects       = BinaryFormatterHelper.FromByteArray <object[]>(data);
         string   modVersion    = objects.Length >= 10 ? objects[9].ToString() : "Unknown";
         MessageBox.Show(
             $"Studio v{studioVersion} and CelesteTAS v{modVersion} do not match. Please manually extract the studio from the \"game_path\\Mods\\CelesteTAS.zip\" file.",
             "Communication Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
 }