コード例 #1
0
ファイル: BootSys.cs プロジェクト: asheraryam/Unary_Common
        public override void InitMod(Mod Mod)
        {
            if (Bootables.ContainsKey(Mod.ModID))
            {
                Sys.Ref.ConsoleSys.Error("Tried to init twice " + Mod.ModID);
                return;
            }

            ModSys      ModSys      = Sys.Ref.Shared.GetObject <ModSys>();
            AssemblySys AssemblySys = Sys.Ref.Shared.GetNode <AssemblySys>();

            string BootTarget = ModSys.GetManifest(Mod).Boot;

            if (BootTarget == null)
            {
                Sys.Ref.ConsoleSys.Error("Tried to init " + Mod.ModID + " without Boot target");
                return;
            }

            Type BootType = AssemblySys.GetType(BootTarget);

            if (BootType == null)
            {
                Sys.Ref.ConsoleSys.Error("Tried to init " + Mod.ModID + " with invalid Boot target");
                return;
            }

            IBoot NewBoot = (IBoot)Activator.CreateInstance(BootType);

            Bootables[Mod.ModID] = NewBoot;
            Bootables[Mod.ModID].AddShared();
        }
コード例 #2
0
ファイル: BootSys.cs プロジェクト: asheraryam/Unary_Common
 public void Add(string ModID, IBoot Bootable)
 {
     if (!Bootables.ContainsKey(ModID))
     {
         Bootables[ModID] = Bootable;
     }
     else
     {
         Sys.Ref.ConsoleSys.Error("Tried to add already registered bootable " + ModID);
     }
 }
コード例 #3
0
        public void Start(string inAssemblyFile)
        {
            if (string.IsNullOrEmpty(inAssemblyFile))
            {
                throw new ArgumentNullException("inAssemblyFile");
            }

            var assembly = Assembly.LoadFile(inAssemblyFile);
            var bootType = assembly.GetTypes().First(i => i.GetInterface(typeof(IBoot).FullName) == typeof(IBoot));
            this._bootInstance = (IBoot)Activator.CreateInstance(bootType);
            this._bootInstance.Start();
        }
コード例 #4
0
        public void Start(string inAssemblyFile)
        {
            if (string.IsNullOrEmpty(inAssemblyFile))
            {
                throw new ArgumentNullException("inAssemblyFile");
            }

            var assembly = Assembly.LoadFile(inAssemblyFile);
            var bootType = assembly.GetTypes().First(i => i.GetInterface(typeof(IBoot).FullName) == typeof(IBoot));

            this._bootInstance = (IBoot)Activator.CreateInstance(bootType);
            this._bootInstance.Start();
        }