KLF.KLFManager.writePluginInterop C# (CSharp) Method

writePluginInterop() private method

private writePluginInterop ( ) : bool
return bool
        private bool writePluginInterop()
        {
            bool success = false;

            if (interopOutQueue.Count > 0 && !KSP.IO.File.Exists<KLFManager>(INTEROP_PLUGIN_FILENAME))
            {
                try
                {

                    KSP.IO.FileStream out_stream = null;
                    try
                    {
                        out_stream = KSP.IO.File.Create<KLFManager>(INTEROP_PLUGIN_FILENAME);

                        out_stream.Lock(0, long.MaxValue);

                        //Write file-format version
                        out_stream.Write(KLFCommon.intToBytes(KLFCommon.FILE_FORMAT_VERSION), 0, 4);

                        while (interopOutQueue.Count > 0)
                        {
                            byte[] message = interopOutQueue.Dequeue();
                            out_stream.Write(message, 0, message.Length);
                        }

                        out_stream.Unlock(0, long.MaxValue);
                        out_stream.Flush();

                        return true;
                    }
                    finally
                    {
                        if (out_stream != null)
                            out_stream.Dispose();
                    }

                }
                catch { }
            }

            return success;
        }