Exemple #1
0
        public static void LoadDll(string name)
        {
            if (dll != null)
            {
                Log.WriteLine("dll already loaded! be careful!", Log.MessageType.Error);
                return;
            }

            var p = Filesystem.GetPath(name);

            if (p == null)
            {
                Log.ThrowFatal("could not find " + name);
            }
            var tempDll = Assembly.LoadFile(p);

            Log.WriteLine("loaded prog " + name + "..");

            dll = (Dll)tempDll.CreateInstance("game.GameDLL");
            try
            {
                if (dll == null)
                {
                    throw new Exception();
                }
                dll?.Init();
            }
            catch
            {
                Log.ThrowFatal("an error occured when initializing the game dll.");
                return;
            }

            Log.WriteLine(dll.title + " loaded successfully", Log.MessageType.Good);

            if (dll.title != DEF_GAME_TITLE)
            {
                Log.WriteLine("Game module is modified. Please only continue if you are aware and trust the author. In order to maximise modularity, game modules have *full access* to your system. BE VERY CAREFUL!!", Log.MessageType.Warning);
            }
            Engine.SetTitle(dll.title);
            Engine.SetIcon("icon.png");
        }