// save list to xml file
        public void Save(string sFilename = null)
        {
            if (string.IsNullOrEmpty(sFilename))
            {
                sFilename = Filename;
            }

            try
            {
                if (!Directory.Exists(Path.GetDirectoryName(sFilename)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(sFilename));
                }

                XmlSerializer ser = new XmlSerializer(typeof(SpellList), new Type[] { typeof(SpellEntry) });
                using (StreamWriter writer = new StreamWriter(sFilename))
                {
                    Version = SingularRoutine.GetSingularVersion().ToString();
                    ser.Serialize(writer, this);
                }
            }
            catch (Exception ex)
            {
                Styx.Common.Logging.WriteException(ex);
            }
        }
Beispiel #2
0
        private void ConfigurationForm_Load(object sender, EventArgs e)
        {
            // lblVersion.Text = string.Format("Version {0}", Assembly.GetExecutingAssembly().GetName().Version);
            lblVersion.Text   = string.Format("Version {0}", SingularRoutine.GetSingularVersion());
            lblBuildTime.Text = SingularRoutine.GetSingularBuildTime();

            //HealTargeting.Instance.OnTargetListUpdateFinished += new Styx.Logic.TargetListUpdateFinishedDelegate(Instance_OnTargetListUpdateFinished);
            pgGeneral.SelectedObject = SingularSettings.Instance;

            tabClass.Text = SingularRoutine.ClassName().Substring(1) + " Specific";

            Styx.Helpers.Settings toSelect = null;
            switch (StyxWoW.Me.Class)
            {
            case WoWClass.Warrior:
                toSelect = SingularSettings.Instance.Warrior();
                break;

            case WoWClass.Paladin:
                toSelect = SingularSettings.Instance.Paladin();
                break;

            case WoWClass.Hunter:
                toSelect = SingularSettings.Instance.Hunter();
                break;

            case WoWClass.Rogue:
                toSelect = SingularSettings.Instance.Rogue();
                break;

            case WoWClass.Priest:
                toSelect = SingularSettings.Instance.Priest();
                break;

            case WoWClass.DeathKnight:
                toSelect = SingularSettings.Instance.DeathKnight();
                break;

            case WoWClass.Shaman:
                toSelect = SingularSettings.Instance.Shaman();
                break;

            case WoWClass.Mage:
                toSelect = SingularSettings.Instance.Mage();
                break;

            case WoWClass.Warlock:
                toSelect = SingularSettings.Instance.Warlock();
                break;

            case WoWClass.Druid:
                toSelect = SingularSettings.Instance.Druid();
                break;

            case WoWClass.Monk:
                toSelect = SingularSettings.Instance.Monk();
                break;

            case WoWClass.DemonHunter:
                toSelect = SingularSettings.Instance.DemonHunter();
                break;

            default:
                break;
            }

            if (toSelect != null)
            {
                pgClass.SelectedObject = toSelect;
            }

            pgHotkeys.SelectedObject = SingularSettings.Instance.Hotkeys();

            InitializeDebugOutputDropdown();
            chkDebugCasting.Checked      = SingularSettings.Instance.EnableDebugSpellCasting;
            chkShowBehaviorFlags.Checked = SingularSettings.Instance.EnableShowBehaviorFlagChanges;
            chkDebugTrace.Checked        = SingularSettings.Instance.EnableDebugTrace;
            chkDebugTraceHeal.Checked    = SingularSettings.Instance.EnableDebugHealTrace;
            chkTraceBuffs.Checked        = SingularSettings.Instance.EnableDebugTraceBuffPresence;
            chkDebugLogging_CheckedChanged(this, new EventArgs());

            InitializeHealContextDropdown(StyxWoW.Me.Class);
            InitializeForceBehaviorsDropdown();

            Screen screen = Screen.FromHandle(this.Handle);

            if (this.Left.Between(0, screen.WorkingArea.Width) && this.Top.Between(0, screen.WorkingArea.Height))
            {
                int height = screen.WorkingArea.Height - this.Top;
                if (height > 200)
                {
                    this.Height = height;
                }
            }

            if (Logger.LogMarkIndex > 0)
            {
                btnLogMark.Text = "LOGMARK! " + Logger.LogMarkIndex;
            }

            tabControl1_SelectedIndexChanged(this, new EventArgs());
        }