コード例 #1
0
        private void OnChanged(object source, FileSystemEventArgs e)
        {
            Console.WriteLine("SavedVariables file changed or created");
            SavedVariables.Exists = true;

            // wait 1 second here to avoid conflicts with file being busy
            Thread.Sleep(1000);

            try
            {
                string LuaCharacter = File.ReadAllText(e.FullPath);
                Discord.CurrentCharacter = SavedVariables.ParseLua(LuaCharacter);
                this._client.Enable();
                this._client.UpdatePresence(Discord.CurrentCharacter);
            }

            catch (System.IO.IOException error)
            {
                var errorResponse = MessageBox.Show($"Something happened while updating your game: {error.Message}", "File Read Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);

                if (errorResponse == DialogResult.Abort)
                {
                    Environment.Exit(1);
                }
                else if (errorResponse == DialogResult.Retry)
                {
                    this.OnChanged(source, e);
                }
            }
        }
コード例 #2
0
        public void Initialise()
        {
            this.Path = this.Main.Settings.CustomEsoLocation;
            this.EnsureSavedVarsExist();
            this.SetupWatcher();

            string LuaContents = File.ReadAllText(this.Path);

            Discord.CurrentCharacter = SavedVariables.ParseLua(LuaContents);
        }
コード例 #3
0
        private void Main_Load(object sender, EventArgs e)
        {
            this.Settings = new Settings();

            this.HandleDuplicateClient();

            this.DiscordClient = new Discord(this, DISCORD_CLIENT_ID, ESO_STEAM_APP_ID);
            this.SavedVars     = new SavedVariables(this, this.DiscordClient, this.FolderBrowser);

            this.CreateSteamAppIdForm();
            this.InitialiseSettings();
            this.SavedVars.Initialise();

            this.InitEsoTimer();
        }
コード例 #4
0
        public void Initialise()
        {
            SavedVariables.esoDir = (string)this.Main.Settings.Get("CustomEsoLocation");

            this.EnsureSavedVarsExist();
            this.SetupWatcher();

            if (!SavedVariables.Exists)
            {
                return;
            }

            string LuaContents = File.ReadAllText(this.Path);

            Discord.CurrentCharacter = SavedVariables.ParseLua(LuaContents);
        }