KLF.KLFManager.writePluginData C# (CSharp) Method

writePluginData() private method

private writePluginData ( ) : void
return void
        private void writePluginData()
        {
            //CurrentGameTitle
            String current_game_title = String.Empty;
            if (HighLogic.CurrentGame != null)
            {
                current_game_title = HighLogic.CurrentGame.Title;

                //Remove the (Sandbox) portion of the title
                const String remove = " (Sandbox)";
                if (current_game_title.Length > remove.Length)
                    current_game_title = current_game_title.Remove(current_game_title.Length - remove.Length);
            }

            byte[] title_bytes = encoder.GetBytes(current_game_title);

            //Build update byte array
            byte[] update_bytes = new byte[1 + 4 + title_bytes.Length];

            int index = 0;

            //Activity
            update_bytes[index] = isInFlight ? (byte)1 : (byte)0;
            index++;

            //Game title
            KLFCommon.intToBytes(title_bytes.Length).CopyTo(update_bytes, index);
            index += 4;

            title_bytes.CopyTo(update_bytes, index);
            index += title_bytes.Length;

            enqueuePluginInteropMessage(KLFCommon.PluginInteropMessageID.PLUGIN_DATA, update_bytes);
        }