Example #1
0
        protected override LoadReturnCode OnLoad(ref string errorMessage)
        {
            string updateFeed = "https://ncfz.oss-cn-shanghai.aliyuncs.com/Noah/Plugin/Rhino/channel/";

            #if DEBUG
            string updateChannel = "dev";
            #else
            string updateChannel = "latest";
            #endif


            if (HostUtils.RunningOnOSX)
            {
                updateFeed += $"{updateChannel}-mac.xml";
                string cairo = Path.Combine(AssemblyDirectory, "runtimes", "win-x64", "native", "cairo.dll");
                if (!File.Exists(cairo))
                {
                    Rhino.RhinoApp.WriteLine(cairo);
                }
                else
                {
                    AssemblyResolver.AddSearchFile(cairo);
                }
            }
            else if (HostUtils.RunningOnWindows)
            {
                updateFeed += $"{updateChannel}-win.xml";
            }
            else
            {
                updateFeed = null;
            }

            #if DEBUG
            #else
            if (updateFeed != null)
            {
                AutoUpdater = new AutoUpdater
                {
                    Feed           = updateFeed,
                    CurrentVersion = Assembly.GetName().Version.ToString()
                };

                AutoUpdater.OnUpdateAva += Updater_OnUpdateAva;
                Rhino.RhinoApp.Closing  += RhinoApp_Closing;
            }
            #endif

            Rhino.UI.Panels.RegisterPanel(this, typeof(HistoryPanel), "Noah 时光机", null);
            Rhino.UI.Panels.RegisterPanel(this, typeof(LoggerPanel), "Noah 记录本", null);
            return(LoadReturnCode.Success);
        }