public static void Destroy(object sender = null, EventArgs e = null)
 {
     if (Instance != null)
     {
         Instance.Abort = true;
         Instance       = null;
     }
 }
 public static void Destroy()
 {
     if (instance != null)
     {
         instance.thread.Abort();
         instance = null;
     }
 }
        /// <summary>
        /// Do not use outside of multiplayer mods. Allows more than 2 processes to communicate.
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public static StudioCommunicationClient RunExternal(string target)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return(null);
            }
            var client = new StudioCommunicationClient(target);

            RunThread.Start(instance.UpdateLoop, "StudioCom Client_" + target);

            return(client);
        }
        public static bool Run()
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return(false);
            }
            instance = new StudioCommunicationClient();

#if DEBUG
            SetupDebugVariables();
#endif

            RunThread.Start(instance.UpdateLoop, "StudioCom Client");

            return(true);
        }
        public static bool Run()
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return(false);
            }
            instance = new StudioCommunicationClient();

#if DEBUG
            //SetupDebugVariables();
#endif

            RunThread.Start(Setup, "StudioCom Client");

            void Setup()
            {
                instance.thread = Thread.CurrentThread;
                Celeste.Celeste.Instance.Exiting += (o, e) => Destroy();
                instance.UpdateLoop();
            }

            return(true);
        }