Jump to content
  • changewowpath error


    Pudge
    • Product: Relogger Type: Bug Status: Unconfirmed

    We are talking about a relogger profile that is running and has many tasks and was running before the problems appeared. If at some point changewowpath of pofile changes (in my case, the disk volume with wow  folder simply disappeared due to a malfunction), the profile will not stop and will not throw an exception, but will continue to execute tasks, but instead of running the changewowpath task, before each Run Task, it will run wow.exe from the general relogger settings.
    I think that the relogger should throw an exception if the wow path from the ChangeWowPath task is not found, even if there were no problems when starting the profile. That is, the check for the existence of the path should be not only at startup, but also inside the profile task loop.



    User Feedback

    Recommended Comments

    Droidz

    Posted

    Hi,

    your use case is not common, the relogger checks at startup if the paths are good.

    Here is a plugin (to test) that should do what you want:

    using System;
    using System.Diagnostics;
    using System.IO;
    using System.Linq;
    using System.Windows.Forms;
    using Relogger.Classes;
    using robotManager.Helpful;
    
    namespace MyNamespace
    {
        public class MyPlugin : Relogger.ReloggerPlugin
        {
            public override string Name { get { return "Stop profile if wow path not found"; } }
    
            bool IsRunning { get; set; }
    
            public override void OnStart()
            {
                IsRunning = true;
                var timer = Stopwatch.StartNew();
                while (IsRunning)
                {
                    if (timer.ElapsedMilliseconds > 10000)
                    {
                        timer.Restart();
                        try
                        {
                            for (int i = 0; i < ReloggerGeneralSettings.CurrentSetting.Profiles.Count; i++)
                            {
                                var p = ReloggerGeneralSettings.CurrentSetting.Profiles[i];
                                if (p.Status == Relogger.Classes.Status.Running)
                                {
                                    var changeWowPathTasks = p.Settings.Tasks
                                        .Where(t => t.Task.TaskType == TaskType.ChangeWowPath).ToList();
                                    if (changeWowPathTasks.Any())
                                    {
                                        foreach (var task in changeWowPathTasks)
                                        {
                                            if (task.Task is ChangeWowPathReloggerTask taskTask)
                                            {
                                                if (!File.Exists(taskTask.WowPath))
                                                {
                                                    Logging.WriteError(Name + " > Wow path not found: " + taskTask.WowPath);
                                                    p.Stop();
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Logging.WriteError(Name + " > " + e);
                        }
                    }
    
                    System.Threading.Thread.Sleep(500);
                }
            }
            public override void OnStop()
            {
                IsRunning = false;
            }
    
            public override void OnButtonPress()
            {
                MessageBox.Show("No available.");
                base.OnButtonPress();
            }
        }
    }

     



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...