Ejemplo n.º 1
0
        private void WriteToFile()
        {
            string data = JsonConvert.SerializeObject(items, Formatting.Indented);

            File.WriteAllText(LocalPluginDirectory.Replace("\\", "/") + backupFile, data);

            data = JsonConvert.SerializeObject(miscData, Formatting.Indented);
            File.WriteAllText(LocalPluginDirectory.Replace("\\", "/") + backupFile2, data);
        }
Ejemplo n.º 2
0
        public override void Initialise()
        {
            PluginName = "Drop Statistics";
            base.Initialise();
            switch (Settings.League.Value)
            {
            case 1:
                League = "Standard";
                break;

            case 2:
                League = "Hardcore";
                break;

            case 3:
                League = "Hardcore+Bestiary";
                break;

            default:
                League = "Bestiary";
                break;
            }
            currencyValue   = new CurrencyInChaos(League);
            TotalValue      = 0;
            isHideout       = false;
            isTown          = true;
            areaHash        = 0;
            imgDwn          = new PoeImageDownloader(LocalPluginDirectory.Replace("\\", "/"));
            background      = new RectangleF();
            itemsDublicates = new HashSet <long>();
            if (File.Exists(LocalPluginDirectory.Replace("\\", "/") + backupFile))
            {
                var data = File.ReadAllText(LocalPluginDirectory.Replace("\\", "/") + backupFile);
                items = JsonConvert.DeserializeObject <Dictionary <string, ItemInfo> >(data);
            }
            else
            {
                items = new Dictionary <string, ItemInfo>();
            }
            if (File.Exists(LocalPluginDirectory.Replace("\\", "/") + backupFile2))
            {
                var data = File.ReadAllText(LocalPluginDirectory.Replace("\\", "/") + backupFile2);
                miscData = JsonConvert.DeserializeObject <MiscTrackers>(data);
            }
            else
            {
                miscData = new MiscTrackers();
                miscData.NormalMiscItems.Add("SampleBaseName1", 0);
                miscData.NormalMiscItems.Add("SampleBaseName2", 0);
            }
            OnPluginToggle();
            Settings.Enable.OnValueChanged += OnPluginToggle;
        }