Example #1
0
        private bool FilterDataUpdates(string path)
        {
            bool success = false;

            // 마우스 훜시 프로그램에 딜레이가 생겨 쓰레드 처리
            Thread thread = new Thread(() =>
            {
                bool isKR     = false;
                string[] urls = { "https://poe.game.daum.net/api/trade/data/stats", "https://www.pathofexile.com/api/trade/data/stats" };
                foreach (string u in urls)
                {
                    isKR           = !isKR;
                    string sResult = SendHTTP(null, u, 5);
                    if ((sResult ?? "") != "")
                    {
                        FilterData rootClass = Json.Deserialize <FilterData>(sResult);

                        for (int i = 0; i < rootClass.Result.Length; i++)
                        {
                            if (
                                rootClass.Result[i].Entries.Length > 0 &&
                                RS.lFilterType.ContainsKey(rootClass.Result[i].Entries[0].Type)
                                )
                            {
                                rootClass.Result[i].Label = RS.lFilterType[rootClass.Result[i].Entries[0].Type];
                            }

                            if (rootClass.Result[i].Entries[0].Type == "monster")
                            {
                                for (int j = 0; j < rootClass.Result[i].Entries.Length; j++)
                                {
                                    rootClass.Result[i].Entries[j].Text = rootClass.Result[i].Entries[j].Text.Replace(" (×#)", "");
                                }
                            }
                        }

                        string local = isKR ? "(특정)" : " (Local)";

                        foreach (KeyValuePair <string, byte> itm in RS.lParticular)
                        {
                            for (int i = 0; i < rootClass.Result.Length; i++)
                            {
                                int index = Array.FindIndex(rootClass.Result[i].Entries, x => x.ID.Substring(x.ID.IndexOf(".") + 1) == itm.Key);
                                if (index > -1)
                                {
                                    rootClass.Result[i].Entries[index].Text = rootClass.Result[i].Entries[index].Text.Replace(local, "");
                                    rootClass.Result[i].Entries[index].Part = itm.Value == 1 ? "Weapons" : "Armours";
                                }
                            }
                        }

                        foreach (KeyValuePair <string, bool> itm in RS.lDisable)
                        {
                            for (int i = 0; i < rootClass.Result.Length; i++)
                            {
                                int index = Array.FindIndex(rootClass.Result[i].Entries, x => x.ID.Substring(x.ID.IndexOf(".") + 1) == itm.Key);
                                if (index > -1)
                                {
                                    rootClass.Result[i].Entries[index].Text = "__DISABLE__";
                                    rootClass.Result[i].Entries[index].Part = "Disable";
                                }
                            }
                        }

                        using (StreamWriter writer = new StreamWriter(path + (isKR ? "FiltersKO.txt" : "FiltersEN.txt"), false, Encoding.UTF8))
                        {
                            writer.Write(Json.Serialize <FilterData>(rootClass));
                        }

                        success = true;
                    }
                }
            });

            thread.Start();
            thread.Join();

            return(success);
        }
Example #2
0
        private void tbOpt0_2_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            int index = ((string)(sender as CheckBox).Tag).ToInt();

            if ((FilterEntrie)(FindName("cbOpt" + index) as ComboBox).SelectedItem == null)
            {
                return;
            }

            if ((sender as CheckBox).BorderBrush == Brushes.DarkRed)
            {
                return;
            }

            (sender as CheckBox).IsChecked       = (sender as CheckBox).BorderThickness.Left == 1;
            (sender as CheckBox).BorderThickness = new Thickness((sender as CheckBox).IsChecked == true ? 2 : 1);

            string stat = ((FilterEntrie)(FindName("cbOpt" + index) as ComboBox).SelectedItem).Stat;
            string key  = ((FilterEntrie)(FindName("cbOpt" + index) as ComboBox).SelectedItem).Key;

            int iii = mChecked.Entries.FindIndex(x => x.Id == stat);

            if (iii == -1 && (sender as CheckBox).IsChecked == true)
            {
                mChecked.Entries.Add(new CheckedDictItem()
                {
                    Id = stat, Key = key + "/"
                });
            }
            else if (iii != -1)
            {
                string   tmp  = "";
                string[] keys = mChecked.Entries[iii].Key.Split('/');
                foreach (string k in keys)
                {
                    // 빈값 같은값 걸러냄
                    if (k.IsEmpty() || k.Equals(key))
                    {
                        continue;
                    }
                    tmp += k + "/";
                }

                if ((sender as CheckBox).IsChecked == true)
                {
                    mChecked.Entries[iii].Key = tmp + key + "/";
                }
                else
                {
                    if (tmp.IsEmpty())
                    {
                        mChecked.Entries.RemoveAt(iii);
                    }
                    else
                    {
                        mChecked.Entries[iii].Key = tmp;
                    }
                }
            }

            string path = (string)Application.Current.Properties["DataPath"];

            using (StreamWriter writer = new StreamWriter(path + "Checked.txt", false, Encoding.UTF8))
            {
                writer.Write(Json.Serialize <CheckedDict>(mChecked, true));
                writer.Close();
            }
        }
Example #3
0
        // 데이터 CSV 파일은 POE 클라이언트를 VisualGGPK.exe (libggpk) 를 통해 추출할 수 있다.
        private bool BaseDataUpdates(string path)
        {
            bool success = false;

            if (File.Exists(path + "csv/ko/BaseItemTypes.dat.csv") && File.Exists(path + "csv/ko/Words.dat.csv"))
            {
                try
                {
                    List <string[]> oCsvEnList = new List <string[]>();
                    List <string[]> oCsvKoList = new List <string[]>();

                    using (StreamReader oStreamReader = new StreamReader(File.OpenRead(path + "csv/en/BaseItemTypes.dat.csv")))
                    {
                        string   sEnContents = oStreamReader.ReadToEnd();
                        string[] sEnLines    = sEnContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string sLine in sEnLines)
                        {
                            //oCsvEnList.Add(sLine.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries));
                            oCsvEnList.Add(Regex.Split(sLine, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"));
                        }
                    }

                    using (StreamReader oStreamReader = new StreamReader(File.OpenRead(path + "csv/ko/BaseItemTypes.dat.csv")))
                    {
                        string   sKoContents = oStreamReader.ReadToEnd();
                        string[] sKoLines    = sKoContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string sLine in sKoLines)
                        {
                            //oCsvKoList.Add(sLine.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries));
                            oCsvKoList.Add(Regex.Split(sLine, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"));
                        }
                    }

                    List <BaseResultData> datas = new List <BaseResultData>();

                    for (int i = 1; i < oCsvEnList.Count; i++)
                    {
                        if (
                            oCsvEnList[i][6] == "Metadata/Items/Currency/AbstractMicrotransaction" ||
                            oCsvEnList[i][6] == "Metadata/Items/HideoutDoodads/AbstractHideoutDoodad"
                            )
                        {
                            continue;
                        }

                        BaseResultData baseResultData = new BaseResultData();
                        baseResultData.ID           = oCsvEnList[i][1].Replace("Metadata/Items/", "");
                        baseResultData.InheritsFrom = oCsvEnList[i][6].Replace("Metadata/Items/", "");
                        baseResultData.NameEn       = Regex.Replace(oCsvEnList[i][5], "^\"(.+)\"$", "$1");
                        baseResultData.NameKo       = Regex.Replace(oCsvKoList[i][5], "^\"(.+)\"$", "$1");
                        baseResultData.Detail       = "";

                        if (datas.Find(x => x.NameEn == baseResultData.NameEn) == null)
                        {
                            datas.Add(baseResultData);
                        }
                    }

                    BaseData rootClass = Json.Deserialize <BaseData>("{\"result\":[{\"data\":[]}]}");
                    rootClass.Result[0].Data = datas.ToArray();

                    using (StreamWriter writer = new StreamWriter(path + "Bases.txt", false, Encoding.UTF8))
                    {
                        writer.Write(Json.Serialize <BaseData>(rootClass));
                    }

                    //-----------------------------

                    oCsvEnList = new List <string[]>();
                    oCsvKoList = new List <string[]>();

                    using (StreamReader oStreamReader = new StreamReader(File.OpenRead(path + "csv/en/Words.dat.csv")))
                    {
                        string   sEnContents = oStreamReader.ReadToEnd();
                        string[] sEnLines    = sEnContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string sLine in sEnLines)
                        {
                            oCsvEnList.Add(Regex.Split(sLine, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"));
                        }
                    }

                    using (StreamReader oStreamReader = new StreamReader(File.OpenRead(path + "csv/ko/Words.dat.csv")))
                    {
                        string   sKoContents = oStreamReader.ReadToEnd();
                        string[] sKoLines    = sKoContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string sLine in sKoLines)
                        {
                            oCsvKoList.Add(Regex.Split(sLine, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"));
                        }
                    }

                    List <WordeResultData> wdatas = new List <WordeResultData>();

                    for (int i = 1; i < oCsvEnList.Count; i++)
                    {
                        WordeResultData wordeResultData = new WordeResultData();
                        wordeResultData.Key    = oCsvEnList[i][1];
                        wordeResultData.NameEn = Regex.Replace(oCsvEnList[i][6], "^\"(.+)\"$", "$1");
                        wordeResultData.NameKo = Regex.Replace(oCsvKoList[i][6], "^\"(.+)\"$", "$1");
                        wdatas.Add(wordeResultData);
                    }

                    WordData wordClass = Json.Deserialize <WordData>("{\"result\":[{\"data\":[]}]}");
                    wordClass.Result[0].Data = wdatas.ToArray();

                    using (StreamWriter writer = new StreamWriter(path + "Words.txt", false, Encoding.UTF8))
                    {
                        writer.Write(Json.Serialize <WordData>(wordClass));
                    }

                    //-----------------------------

                    oCsvEnList = new List <string[]>();
                    oCsvKoList = new List <string[]>();

                    using (StreamReader oStreamReader = new StreamReader(File.OpenRead(path + "csv/en/Prophecies.dat.csv")))
                    {
                        string   sEnContents = oStreamReader.ReadToEnd();
                        string[] sEnLines    = sEnContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string sLine in sEnLines)
                        {
                            oCsvEnList.Add(Regex.Split(sLine, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"));
                        }
                    }

                    using (StreamReader oStreamReader = new StreamReader(File.OpenRead(path + "csv/ko/Prophecies.dat.csv")))
                    {
                        string   sKoContents = oStreamReader.ReadToEnd();
                        string[] sKoLines    = sKoContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string sLine in sKoLines)
                        {
                            oCsvKoList.Add(Regex.Split(sLine, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"));
                        }
                    }

                    datas = new List <BaseResultData>();

                    for (int i = 1; i < oCsvEnList.Count; i++)
                    {
                        BaseResultData baseResultData = new BaseResultData();
                        baseResultData.ID           = "Prophecies/" + oCsvEnList[i][1];
                        baseResultData.InheritsFrom = "Prophecies/Prophecy";
                        baseResultData.NameEn       = Regex.Replace(oCsvEnList[i][4], "^\"(.+)\"$", "$1");
                        baseResultData.NameKo       = Regex.Replace(oCsvKoList[i][4], "^\"(.+)\"$", "$1");
                        baseResultData.Detail       = "";

                        datas.Add(baseResultData);
                    }

                    rootClass = Json.Deserialize <BaseData>("{\"result\":[{\"data\":[]}]}");
                    rootClass.Result[0].Data = datas.ToArray();

                    using (StreamWriter writer = new StreamWriter(path + "Prophecies.txt", false, Encoding.UTF8))
                    {
                        writer.Write(Json.Serialize <BaseData>(rootClass));
                    }

                    //-----------------------------

                    oCsvEnList = new List <string[]>();
                    oCsvKoList = new List <string[]>();

                    using (StreamReader oStreamReader = new StreamReader(File.OpenRead(path + "csv/en/MonsterVarieties.dat.csv")))
                    {
                        string   sEnContents = oStreamReader.ReadToEnd();
                        string[] sEnLines    = sEnContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string sLine in sEnLines)
                        {
                            oCsvEnList.Add(Regex.Split(sLine, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"));
                        }
                    }

                    using (StreamReader oStreamReader = new StreamReader(File.OpenRead(path + "csv/ko/MonsterVarieties.dat.csv")))
                    {
                        string   sKoContents = oStreamReader.ReadToEnd();
                        string[] sKoLines    = sKoContents.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string sLine in sKoLines)
                        {
                            oCsvKoList.Add(Regex.Split(sLine, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"));
                        }
                    }

                    datas = new List <BaseResultData>();

                    for (int i = 1; i < oCsvEnList.Count; i++)
                    {
                        BaseResultData baseResultData = new BaseResultData();
                        baseResultData.ID           = oCsvEnList[i][1].Replace("Metadata/Monsters/", "");
                        baseResultData.InheritsFrom = oCsvEnList[i][9].Replace("Metadata/Monsters/", "");
                        baseResultData.NameEn       = Regex.Replace(oCsvEnList[i][33], "^\"(.+)\"$", "$1");
                        baseResultData.NameKo       = Regex.Replace(oCsvKoList[i][33], "^\"(.+)\"$", "$1");
                        baseResultData.Detail       = "";

                        if (datas.Find(x => x.NameEn == baseResultData.NameEn) == null)
                        {
                            datas.Add(baseResultData);
                        }
                    }

                    rootClass = Json.Deserialize <BaseData>("{\"result\":[{\"data\":[]}]}");
                    rootClass.Result[0].Data = datas.ToArray();

                    using (StreamWriter writer = new StreamWriter(path + "Monsters.txt", false, Encoding.UTF8))
                    {
                        writer.Write(Json.Serialize <BaseData>(rootClass));
                    }

                    success = true;
                }
                catch { }
            }

            return(success);
        }
Example #4
0
        private bool FilterDataUpdates(string path)
        {
            bool success = false;

            // 마우스 훜시 프로그램에 딜레이가 생겨 쓰레드 처리
            Thread thread = new Thread(() =>
            {
                string u       = "https://pathofexile.com/api/trade/data/stats";
                string sResult = SendHTTP(null, u, 5);
                if ((sResult ?? "") != "")
                {
                    FilterData rootClass = Json.Deserialize <FilterData>(sResult);

                    for (int i = 0; i < rootClass.Result.Length; i++)
                    {
                        if (
                            rootClass.Result[i].Entries.Length > 0 &&
                            Restr.lFilterTypeName.ContainsKey(rootClass.Result[i].Entries[0].Type)
                            )
                        {
                            rootClass.Result[i].Label = Restr.lFilterTypeName[rootClass.Result[i].Entries[0].Type];
                        }
                    }

                    foreach (KeyValuePair <string, byte> itm in Restr.lParticular)
                    {
                        for (int i = 0; i < rootClass.Result.Length; i++)
                        {
                            int index = Array.FindIndex(rootClass.Result[i].Entries, x => x.ID.Substring(x.ID.IndexOf(".") + 1) == itm.Key);
                            if (index > -1 && rootClass.Result[i].Entries[index].Text.IndexOf("(" + Restr.Local + ")") > 0)
                            {
                                rootClass.Result[i].Entries[index].Text = rootClass.Result[i].Entries[index].Text.Replace(" (" + Restr.Local + ")", "");
                                rootClass.Result[i].Entries[index].Part = itm.Value == 1 ? "Weapons" : "Armours";
                            }
                        }
                    }

                    foreach (KeyValuePair <string, bool> itm in Restr.lDisable)
                    {
                        for (int i = 0; i < rootClass.Result.Length; i++)
                        {
                            int index = Array.FindIndex(rootClass.Result[i].Entries, x => x.ID.Substring(x.ID.IndexOf(".") + 1) == itm.Key);
                            if (index > -1)
                            {
                                rootClass.Result[i].Entries[index].Text = "__DISABLE__";
                                rootClass.Result[i].Entries[index].Part = "Disable";
                            }
                        }
                    }

                    using (StreamWriter writer = new StreamWriter(path + "Filters.txt", false, Encoding.UTF8))
                    {
                        writer.Write(Json.Serialize <FilterData>(rootClass));
                    }

                    success = true;
                }
            });

            thread.Start();
            thread.Join();

            return(success);
        }