Exemplo n.º 1
0
        public override void Init()
        {
            ConsoleSys = Sys.Ref.ConsoleSys;

            try
            {
                Client = new Discord.Discord(670224014903345182, (ulong)CreateFlags.NoRequireDiscord);

                var activity = new Activity
                {
                    State      = "Playing",
                    Details    = "Playing the game",
                    Timestamps = { Start = 0 },
                    Assets     = { LargeImage = "logo" },
                    Instance   = true,
                };

                Client.GetActivityManager().UpdateActivity(activity, (result) =>
                {
                    if (result == Result.Ok)
                    {
                        ConsoleSys.Message("Updated Discord presence.");
                    }
                    else
                    {
                        ConsoleSys.Message("Could not update Discord presence.");
                    }
                });
            }
            catch (Exception Exception)
            {
                ConsoleSys.Error("Failed to init Discord");
                ConsoleSys.Error(Exception.Message);
            }
        }
Exemplo n.º 2
0
        public override void Init()
        {
            ConsoleSys = Shared.Sys.Ref.ConsoleSys;

            Entries = new Dictionary <string, Binds>();

            Load("Unary.Common", ".");
        }
Exemplo n.º 3
0
        public override void Init()
        {
            ConsoleSys = Sys.Ref.ConsoleSys;

            if (!FilesystemUtil.GD.FileExists("res://Unary.Common/Locales/Locales.json"))
            {
                ConsoleSys.Error("Failed to find Locales.json, LocaleSys will likely crash everything");
                return;
            }

            string LocalesManifest = FilesystemUtil.GD.FileRead("res://Unary.Common/Locales/Locales.json");

            if (LocalesManifest == null)
            {
                ConsoleSys.Error("Failed to read Locales.json, LocaleSys will likely crash everything");
                return;
            }

            try
            {
                LocaleList = JsonConvert.DeserializeObject <Dictionary <string, string> >(LocalesManifest);
            }
            catch (Exception Exception)
            {
                ConsoleSys.Error("Failed to parse Locales.json, LocaleSys will likely crash everything");
                ConsoleSys.Error(Exception.Message);
                return;
            }

            SelectedLocaleEntries = new Dictionary <string, string>();
            FallbackLocaleEntries = new Dictionary <string, string>();

            SelectedLocale = Sys.Ref.Shared.GetObject <ConfigSys>().Shared.Get <string>("Unary.Common.Locale");
            FallbackLocale = Sys.Ref.Shared.GetObject <ConfigSys>().Shared.Get <string>("Unary.Common.Locale.Fallback");

            if (SelectedLocale == FallbackLocale)
            {
                SelectedIsFallback = true;
            }

            if (!LocaleList.ContainsKey(SelectedLocale))
            {
                SelectedLocale = "en";
            }

            if (!LocaleList.ContainsKey(FallbackLocale))
            {
                FallbackLocale = "en";
            }

            LoadLocale("Unary.Common", SelectedLocale, true);
            if (!SelectedIsFallback)
            {
                LoadLocale("Unary.Common", FallbackLocale, false);
            }
        }
        public void TestConsoleSysTargetAndMsg()
        {
            //Arrange
            var app       = new ApiInterface();
            var targetSys = new ConsoleSys();

            //Act
            app.setTarget(new ConsoleSys());
            app.GetMsg("Hello World");

            //Assert
            Assert.AreEqual("Hello World", app.GetMsg("Hello World"));
            Assert.IsInstanceOfType(targetSys, typeof(ConsoleSys));
        }