Ejemplo n.º 1
0
        public override void Init()
        {
            if (!FilesystemUtil.Sys.FileExists("steam_appid.txt"))
            {
                ConsoleSys.Panic("steam_appid.txt does not exist, could not get AppID.");
                return;
            }

            ConsoleSys = Sys.Ref.ConsoleSys;
            EventSys   = Sys.Ref.Shared.GetNode <EventSys>();

            try
            {
                AppID = uint.Parse(FilesystemUtil.Sys.FileRead("steam_appid.txt"));

                if (!Packsize.Test())
                {
                    ConsoleSys.Panic("Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.");
                    return;
                }

                if (!DllCheck.Test())
                {
                    ConsoleSys.Panic("DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.");
                    return;
                }

                if (SteamAPI.RestartAppIfNecessary(new AppId_t(AppID)))
                {
                    ConsoleSys.Panic("Steam requested us to restart app");
                    return;
                }
            }
            catch (Exception Exception)
            {
                ConsoleSys.Panic(Exception.Message);
                return;
            }

            if (!SteamAPI.Init())
            {
                ConsoleSys.Panic("SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.");
                return;
            }
            else
            {
                m_SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);
                SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook);

                ExistingItems = GetModFolders();

                DownloadList         = new List <ulong>();
                DownloadItemResponse = Callback <DownloadItemResult_t> .Create(OnDownloadedItem);
            }
        }
Ejemplo n.º 2
0
        public override void InitCore(Mod Mod)
        {
            if (!FilesystemUtil.Sys.DirContainsFiles(Mod.Path, Mod.ModID + ".dll"))
            {
                ConsoleSys.Panic("Core mod cant exist without assembly");
            }
            else
            {
                if (!Assemblies.ContainsKey(Mod.ModID))
                {
                    try
                    {
                        Assemblies[Mod.ModID] = Assembly.LoadFrom(Mod.Path + '/' + Mod.ModID + ".dll");
                    }
                    catch (Exception Exception)
                    {
                        ConsoleSys.Error(Exception.Message);
                    }

                    AddTypes(Assemblies[Mod.ModID]);
                }
                else
                {
                    ConsoleSys.Error("Tried to init Core twice in AssemblySys");
                }
            }
        }
Ejemplo n.º 3
0
        public override void Init()
        {
            ExistingMods = new Dictionary <Mod, ModManifest>();
            LoadOrder    = new List <Mod>();

            ConsoleSys = Sys.Ref.ConsoleSys;
            SteamSys   = Sys.Ref.Shared.GetNode <SteamSys>();

            List <string> ModFolders = new List <string>();

            ModFolders.AddRange(SteamSys.GetModFolders());

            ModFolders.AddRange(FilesystemUtil.Sys.DirGetDirsTop("Mods"));

            foreach (var Folder in ModFolders)
            {
                ParseMod(Folder.Replace('\\', '/'));
            }

            if (Core.Mod.ModID == null)
            {
                ConsoleSys.Panic("We could not find any mod assigned as a Core. Quitting...");
                return;
            }
        }
Ejemplo n.º 4
0
        public override void _Ready()
        {
            Ref = this;

            Debug = OS.IsDebugBuild();

            Shared = new SysManager();
            Server = new SysManager();
            Client = new SysManager();

            AddChild(Shared);
            AddChild(Server);
            AddChild(Client);

            LaunchArguments = OS.GetCmdlineArgs().ToList();

            AppType = new SysAppType();

            if (LaunchArguments.Contains("server"))
            {
                AppType.SetServer(true);
            }
            else
            {
                AppType.SetClient(true);
            }

            try
            {
                Shared.AddUI(new ConsoleSys(), "Console");

                ConsoleSys = Shared.GetUI <ConsoleSys>();

                Main NewCommon = new Main();
                NewCommon.AddShared();

                Shared.AddObject(new BootSys());

                Shared.GetObject <BootSys>().Add("Unary.Common", NewCommon);

                if (AppType.IsServer())
                {
                    Shared.GetObject <BootSys>().AddServer("Unary.Common");
                }
                else
                {
                    Shared.GetObject <BootSys>().AddClient("Unary.Common");
                }

                Shared.AddObject(new ModSys());

                Mod CoreMod = Shared.GetObject <ModSys>().Core.Mod;

                Shared.InitCore(CoreMod);

                if (AppType.IsServer())
                {
                    Server.InitCore(CoreMod);
                }
                else
                {
                    Client.InitCore(CoreMod);
                }

                Shared.GetObject <BootSys>().AddShared(CoreMod.ModID);

                if (AppType.IsServer())
                {
                    Shared.GetObject <BootSys>().AddServer(CoreMod.ModID);
                }
                else
                {
                    Shared.GetObject <BootSys>().AddClient(CoreMod.ModID);
                }
            }
            catch (Exception Exception)
            {
                ConsoleSys.Panic(Exception.Message);
            }
        }