Example #1
0
        // This an entry point
        static PluginEntryPoint()
        {
            PluginSettings.InitLog();                         // init log before doing any logging
            ourLogEventCollector = new UnityEventCollector(); // start collecting Unity messages asap

            ourPluginSettings    = new PluginSettings();
            ourRiderPathProvider = new RiderPathProvider(ourPluginSettings);

            if (IsLoadedFromAssets()) // old mechanism, when EditorPlugin was copied to Assets folder
            {
                var riderPath = ourRiderPathProvider.GetActualRider(EditorPrefsWrapper.ExternalScriptEditor,
                                                                    RiderPathLocator.GetAllFoundPaths(ourPluginSettings.OperatingSystemFamilyRider));
                if (!string.IsNullOrEmpty(riderPath))
                {
                    AddRiderToRecentlyUsedScriptApp(riderPath);
                    if (IsRiderDefaultEditor() && PluginSettings.UseLatestRiderFromToolbox)
                    {
                        EditorPrefsWrapper.ExternalScriptEditor = riderPath;
                    }
                }

                if (!PluginSettings.RiderInitializedOnce)
                {
                    EditorPrefsWrapper.ExternalScriptEditor = riderPath;
                    PluginSettings.RiderInitializedOnce     = true;
                }

                InitForPluginLoadedFromAssets();
                Init();
            }
            else
            {
                Init();
            }
        }
Example #2
0
        // This an entry point
        static PluginEntryPoint()
        {
            PluginSettings.InitLog();                         // init log before doing any logging
            ourLogEventCollector = new UnityEventCollector(); // start collecting Unity messages asap

            ourPluginSettings   = new PluginSettings();
            ourRiderPathLocator = new RiderPathLocator(ourPluginSettings);
            var riderPath = ourRiderPathLocator.GetDefaultRiderApp(EditorPrefsWrapper.ExternalScriptEditor,
                                                                   RiderPathLocator.GetAllFoundPaths(ourPluginSettings.OperatingSystemFamilyRider));

            if (string.IsNullOrEmpty(riderPath))
            {
                return;
            }

            AddRiderToRecentlyUsedScriptApp(riderPath);
            if (!PluginSettings.RiderInitializedOnce)
            {
                EditorPrefsWrapper.ExternalScriptEditor = riderPath;
                PluginSettings.RiderInitializedOnce     = true;
            }

            if (Enabled)
            {
                Init();
            }
        }
Example #3
0
        private void ProcessQueue(UnityEventCollector collector)
        {
            RdLogEvent element;

            while ((element = collector.DelayedLogEvents.Dequeue()) != null)
            {
                SendLogEvent(element);
            }
        }
Example #4
0
        public UnityEventLogSender(UnityEventCollector collector)
        {
            ProcessQueue(collector);

            collector.ClearEvent();
            collector.AddEvent += (col, _) =>
            {
                ProcessQueue((UnityEventCollector)col);
            };
        }
        public UnityEventLogSender(UnityEventCollector collector, Lifetime connectionLifetime)
        {
            myConnectionLifetime = connectionLifetime;
            ProcessQueue(PluginEntryPoint.UnityModel.Maybe.Value, collector);

            collector.AddEvent += (col, _) =>
            {
                if (PluginEntryPoint.UnityModel.Maybe.HasValue && !myConnectionLifetime.IsTerminated)
                {
                    ProcessQueue(PluginEntryPoint.UnityModel.Maybe.Value, (UnityEventCollector)col);
                }
            };
        }
Example #6
0
        private void ProcessQueue(UnityEventCollector collector)
        {
            if (!collector.DelayedLogEvents.Any())
            {
                return;
            }

            var head = collector.DelayedLogEvents.First;

            while (head != null)
            {
                SendLogEvent(head.Value);
                head = head.Next;
            }
            collector.DelayedLogEvents.Clear();
        }
        private void ProcessQueue(EditorPluginModel model, UnityEventCollector collector)
        {
            if (!collector.myDelayedLogEvents.Any())
            {
                return;
            }

            var head = collector.myDelayedLogEvents.First;

            while (head != null)
            {
                if (myConnectionLifetime.IsTerminated)
                {
                    return;
                }

                SendLogEvent(model, head.Value);
                head = head.Next;
            }

            collector.myDelayedLogEvents.Clear();
        }