コード例 #1
0
ファイル: UserSettings.cs プロジェクト: ywjb/Honorbuddy-434
        public ConfigDescriptor(string backingPropertyName,
                                Styx.Helpers.Settings backingInstance,
                                Constraint constraint)
        {
            // We are a bit aggressive in our error checking here--
            // The most likely source of errors will be people that maintain the code in the future,
            // and we want to weed out as many newbie mistakes as possible.
            if (string.IsNullOrEmpty(backingPropertyName))
            {
                throw (new ArgumentException(string.Format("For configurable '{0}',"
                                                           + " Null or Empty backingPropertyName not permitted",
                                                           "")));
            }

            _backingInstance = backingInstance;
            if (_backingInstance == null)
            {
                throw (new ArgumentException(string.Format("For configurable '{0}',"
                                                           + " Null backingInstance not permitted",
                                                           backingPropertyName)));
            }

            _backingPropertyInfo = backingInstance.GetType().GetProperty(backingPropertyName);
            if (_backingPropertyInfo == null)
            {
                throw (new ArgumentException(string.Format("For configurable '{0}',"
                                                           + " unable to locate Property in instance '{1}'",
                                                           backingPropertyName,
                                                           backingInstance.GetType().FullName)));
            }

            Constraint = constraint;
        }
コード例 #2
0
        public void LogSettings(string desc, Styx.Helpers.Settings set)
        {
            if (set == null)
            {
                return;
            }

            Logging.Write("====== {0} Settings ======", desc);
            foreach (var kvp in set.GetSettings())
            {
                Logging.Write("  {0}: {1}", kvp.Key, kvp.Value.ToString());
            }

            Logging.Write("");
        }
コード例 #3
0
        private void ConfigurationForm_Load(object sender, EventArgs e)
        {
            lblVersion.Text = string.Format("v{0}", Assembly.GetExecutingAssembly().GetName().Version) + " [$Revision: 362 $]";
            //HealTargeting.Instance.OnTargetListUpdateFinished += new Styx.Logic.TargetListUpdateFinishedDelegate(Instance_OnTargetListUpdateFinished);
            pgGeneral.SelectedObject = SingularSettings.Instance;
            SingularSettings main = SingularSettings.Instance;

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

            case WoWClass.Paladin:
                toSelect = main.Paladin;
                break;

            case WoWClass.Hunter:
                toSelect = main.Hunter;
                break;

            case WoWClass.Rogue:
                toSelect = main.Rogue;
                break;

            case WoWClass.Priest:
                toSelect = main.Priest;
                break;

            case WoWClass.DeathKnight:
                toSelect = main.DeathKnight;
                break;

            case WoWClass.Shaman:
                toSelect = main.Shaman;
                break;

            case WoWClass.Mage:
                toSelect = main.Mage;
                break;

            case WoWClass.Warlock:
                toSelect = main.Warlock;
                break;

            case WoWClass.Druid:
                toSelect = main.Druid;
                break;

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

            if (!timer1.Enabled)
            {
                timer1.Start();
            }
        }