Exemplo n.º 1
0
        private void Awake()
        {
            try
            {
                using (KSPe.Util.SystemTools.Assembly.Loader a = new KSPe.Util.SystemTools.Assembly.Loader(KSPE_ROOT_DIR))
                {
                    {
                        int target = KSPe.Util.UnityTools.UnityVersion;
                        target = (0 == target) ? 2019 : target;
                        Log.dbg("Trying to load KSPe.Unity.{0}...", target);
                        a.LoadAndStartup(string.Format("KSPe.Unity.{0}", target));
                    }

                    for (int i = KSPe.Util.KSP.Version.Current.MINOR; i > 0; --i)
                    {
                        if (KSPe.Util.KSP.Version.Current >= KSPe.Util.KSP.Version.GetVersion(1, i, 0))
                        {
                            Log.dbg("Trying to load KSPe.KSP.1{0}...", i);
                            if (null != a.LoadAndStartup(string.Format("KSPe.KSP.1{0}", i)))
                            {
                                break;
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                FatalErrors.CriticalComponentsAbsent.Show(e);
            }
        }
 private void Awake()
 {
     if (KSPe.Util.SystemTools.TypeFinder.ExistsByQualifiedName("Waterfall.Waterfall"))
     {
         using (KSPe.Util.SystemTools.Assembly.Loader a = new KSPe.Util.SystemTools.Assembly.Loader(typeof(Startup).Namespace.Replace(".", KSPe.IO.Path.DirectorySeparatorStr)))
         {
             a.LoadAndStartup("TweakScalerWaterfallFXIntegrator");
             OK_TO_GO = true;
         }
     }
 }
Exemplo n.º 3
0
 private void Awake()
 {
     using (KSPe.Util.SystemTools.Assembly.Loader a = new KSPe.Util.SystemTools.Assembly.Loader("000_KSPAPIExtensions"))
     {
         // There can be only one! #highlanderFeelings
         if (KSPe.Util.KSP.Version.Current >= KSPe.Util.KSP.Version.GetVersion(1, 4, 0))
         {
             if (KSPe.Util.SystemTools.Assembly.Finder.ExistsByName("ClickThroughBlocker"))
             {
                 a.LoadAndStartup("KSPe.UI.14");
             }
             else
             {
                 LOG.warn("ClickThroughBlocker, dependency on KSP >= 1.4, was not found! Falling back to KSP.UI.12 instead!");
                 a.LoadAndStartup("KSPe.UI.12");
             }
         }
         else if (KSPe.Util.KSP.Version.Current >= KSPe.Util.KSP.Version.GetVersion(1, 2, 0))
         {
             a.LoadAndStartup("KSPe.UI.12");
         }
     }
 }
Exemplo n.º 4
0
        private void Start()
        {
            Log.force("Version {0}", Version.Text);

            try                 // Check for critical artefacts first!
            {
                using (KSPe.Util.SystemTools.Assembly.Loader <TweakScale> a = new KSPe.Util.SystemTools.Assembly.Loader <TweakScale>())
                {
                    if (KSPe.Util.KSP.Version.Current < KSPe.Util.KSP.Version.GetVersion(1, 4, 0))
                    {
                        a.LoadAndStartup("Scale.PartDB.13x");
                    }
                    else if (KSPe.Util.KSP.Version.Current < KSPe.Util.KSP.Version.GetVersion(1, 4, 4))
                    {
                        a.LoadAndStartup("Scale.PartDB.14x");
                    }
                    else if (KSPe.Util.KSP.Version.Current < KSPe.Util.KSP.Version.GetVersion(1, 8, 0))
                    {
                        a.LoadAndStartup("Scale.PartDB.15x");
                    }
                    else
                    {
                        a.LoadAndStartup("Scale.PartDB.18x");
                    }
                }

                // Check if the needed Classes are available...
                KSPe.Util.SystemTools.TypeFinder.FindByQualifiedName("TweakScale.PartDB.StandardPartScaler");
                if (KSPe.Util.KSP.Version.Current >= KSPe.Util.KSP.Version.GetVersion(1, 4, 0))
                {
                    KSPe.Util.SystemTools.TypeFinder.FindByQualifiedName("TweakScale.PartDB.VariantPartScaler");
                }
            }
            catch (System.Exception e)
            {
                Log.error(e.ToString());
                GUI.MissingDLLAlertBox.Show(e.Message);
            }

            try
            {
                KSPe.Util.Compatibility.Check <Startup>(typeof(Version), typeof(Configuration));
                KSPe.Util.Installation.Check <Startup>("Scale", "TweakScale", null, true);

                if (KSPe.Util.KSP.Version.Current >= KSPe.Util.KSP.Version.FindByVersion(1, 9, 0))
                {
                    Type calledType = Type.GetType("KSP_Recall.Version, KSP-Recall", false, false);
                    if (null == calledType)
                    {
                        GUI.NoRecallAlertBox.Show();
                        return;
                    }
                }

                if (KSPe.Util.KSP.Version.Current > KSPe.Util.KSP.Version.FindByVersion(1, 12, 3))
                {
                    GUI.UnsupportedKSPAdviseBox.Show(KSPe.Util.KSP.Version.Current.ToString());
                    return;
                }
            }
            catch (KSPe.Util.InstallmentException e)
            {
                Log.error(e.ToShortMessage());
                KSPe.Common.Dialogs.ShowStopperAlertBox.Show(e);
            }
        }