What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

save Settings

Looter

New Member
Joined
Apr 23, 2010
Messages
221
Reaction score
1
I have:
Code:
public class SettingLT: Settings
    {
        
        public static SettingLT Instance = new SettingLT();

        public SettingLT()
            : base(Path.Combine(Logging.ApplicationPath, string.Format(@"Plugins/LooterTools/LooterTools-Settings-{0}.xml", StyxWoW.Me.Name)))
        {
            Logging.Write("Настройки сохранены");
        }

        [Setting, DefaultValue(false)]
        public bool oreCheck { get; set; }
        [Setting, DefaultValue(false)]
        public bool gemCheck { get; set; }
        [Setting, DefaultValue(false)]
        public bool sellCheck { get; set; }
        [Setting, DefaultValue("ore")]
        public string[] oreArray { get; set; }
        [Setting, DefaultValue("gem")]
        public string[] gemArray { get; set; }
          
    }

how to use the array in this structure?
If i using:
Code:
[Setting, DefaultValue("gem")]
 public string[] gemArray { get; set; }
I get an error
 
I have:
Code:
public class SettingLT: Settings
    {
        
        public static SettingLT Instance = new SettingLT();

        public SettingLT()
            : base(Path.Combine(Logging.ApplicationPath, string.Format(@"Plugins/LooterTools/LooterTools-Settings-{0}.xml", StyxWoW.Me.Name)))
        {
            Logging.Write("Настройки сохранены");
        }

        [Setting, DefaultValue(false)]
        public bool oreCheck { get; set; }
        [Setting, DefaultValue(false)]
        public bool gemCheck { get; set; }
        [Setting, DefaultValue(false)]
        public bool sellCheck { get; set; }
        [Setting, DefaultValue("ore")]
        public string[] oreArray { get; set; }
        [Setting, DefaultValue("gem")]
        public string[] gemArray { get; set; }
          
    }

how to use the array in this structure?
If i using:
Code:
[Setting, DefaultValue("gem")]
 public string[] gemArray { get; set; }
I get an error
you cant. thats why i dont have the item list for Mr.ItemRemover in the settings file
 
I have:
Code:
public class SettingLT: Settings
    {
        
        public static SettingLT Instance = new SettingLT();

        public SettingLT()
            : base(Path.Combine(Logging.ApplicationPath, string.Format(@"Plugins/LooterTools/LooterTools-Settings-{0}.xml", StyxWoW.Me.Name)))
        {
            Logging.Write("Настройки сохранены");
        }

        [Setting, DefaultValue(false)]
        public bool oreCheck { get; set; }
        [Setting, DefaultValue(false)]
        public bool gemCheck { get; set; }
        [Setting, DefaultValue(false)]
        public bool sellCheck { get; set; }
        [Setting, DefaultValue("ore")]
        public string[] oreArray { get; set; }
        [Setting, DefaultValue("gem")]
        public string[] gemArray { get; set; }
          
    }
how to use the array in this structure?
If i using:
Code:
[Setting, DefaultValue("gem")]
 public string[] gemArray { get; set; }
I get an error

you need to do something like this..

PHP:
    public class ArraySettingsExample : Settings
    {
        public ArraySettingsExample(string settingsPath)
            : base(settingsPath)
        {
            Load();
        }
        [Setting, DefaultValue(null)]
        public string[] exampleStringArray { get; set; }
    }

then you can do something like this.

PHP:
            if (MySettings.exampleStringArray == null)
            {
                MySettings.exampleStringArray = new string[] { "This", "really", "works", };
                MySettings.Save();
            }
</pre>
 
you cant. thats why i dont have the item list for Mr.ItemRemover in the settings file

Yes you can.
Code:
[Setting, DefaultValue(new string[] { "Index 0", "Index 1" })]
public string[] SomeArray { get; set; }
 
Back
Top