From 67d31a7ee3667ade5290b8bb7b5b1c8c13d7288b Mon Sep 17 00:00:00 2001 From: Nemesh Date: Sun, 28 Mar 2021 01:54:51 +0200 Subject: [PATCH] x5 search speed --- .vs/FloatToolGUI/v16/.suo | Bin 87552 -> 119296 bytes FloatToolGUI/App.config | 12 ++ FloatToolGUI/FloatToolGUI.csproj | 1 + FloatToolGUI/Main.Designer.cs | 120 ++++++++------ FloatToolGUI/Main.cs | 159 +++++++++++++++---- FloatToolGUI/Main.resx | 103 ++++++++++-- FloatToolGUI/Properties/Settings.Designer.cs | 39 +++-- FloatToolGUI/Properties/Settings.settings | 14 +- FloatToolGUI/Skin.cs | 29 ++++ 9 files changed, 366 insertions(+), 111 deletions(-) create mode 100644 FloatToolGUI/Skin.cs diff --git a/.vs/FloatToolGUI/v16/.suo b/.vs/FloatToolGUI/v16/.suo index 36cfa86035c3879b3fa8f85a8ccc81e9671458c6..65ea8e697963ea63071bd2ac6c14f3d36356f7a7 100644 GIT binary patch delta 3796 zcmeH}3s6+&702(ny9>KKcf$fp0C~e!7uj6|G$nFfH!-y!EGSj55)Ddt1Rt>0q$az{ zj5Td%%I-<|Y~vVQ#rSNMo4Urvc%^M(8kHEuSS1Ei`xu&}I?bj@o4P$0h!4y-lRl?2 zJv+bqz0UXDd(ZiQ_gnW~m3w>W{uW+!wL-P79#`@m5P<>S1$F3DxKt9yaqr?MiYgeu zGUYend3;UjQqH4Zu~d}`s;h&8YiU-<=gtbPf}e?H>KuShbZVNFkJB`~qA|s)fa5}l zP~v(p7}QW1h6!OoF*E!P-V#nt9r?6Q==;Yj-pfRf|oHs*CV1+=i(t; z48*vU<3|#Le8@psKO+{ONcsz`MrX1M+A)ya!5hbQr37IS22x${b#$h=U?B$5f>4Wr zbQdf@XNC*rV<2Okj~K`bDsMVX8gZhlT6CI%AQzLjDYT*V0P;(H1{$q)NW#VWG3vCj zA>3#^p{pL}S3@rGxHi93+cq}h94p21`Nh0)1GUglcm=gqWpB}kJiH_Zrco%qhR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y zW*GjrE2s1OUx$mmal8gqcARpVvN;xu&2BGVLHw_(sTZL({pw%NYya|l^i?CuiE6yg zOBbM8ej?T=3l#pi2GyKc0DVGUmZHe3xD@mFW_ZEFVR(4aAxvg0m+KAj&}Q7nEf1lF z-|N7!v~LHh%jKaZ!I}KK<VeU-^liml-aLq2KDHY!)3F0yn`7shA$j@2b}Z($hf$Y3@ltXb zi6}bweN8WIM|31I@g|U#^1zg$;)Efun)Pczm7w!KZyigXp-bliSp;4y1Bj^ zUT*p!CUEpMJkP~H#%zExXJqm0LF8usv+R!_FP(DWZsUCK`8_{*d>GuY8#iQ(H}lW| z6qv{RQI9WU(bUTubK5b@pDjc zMXvn6Vhmuh6~WI&P;-R?&n^^Nyt)HvqeS><#}^R60=R}fw+I|}yak6@B%qBj;q*BC aO~HRP_{>}I)A6P}YM5DVuDb;Tw*LUM(2DQ? diff --git a/FloatToolGUI/App.config b/FloatToolGUI/App.config index 92691b0..03a0a75 100644 --- a/FloatToolGUI/App.config +++ b/FloatToolGUI/App.config @@ -1,5 +1,10 @@  + + +
+ + @@ -11,4 +16,11 @@ + + + + + + + \ No newline at end of file diff --git a/FloatToolGUI/FloatToolGUI.csproj b/FloatToolGUI/FloatToolGUI.csproj index 24470ee..5f41963 100644 --- a/FloatToolGUI/FloatToolGUI.csproj +++ b/FloatToolGUI/FloatToolGUI.csproj @@ -121,6 +121,7 @@ + About.cs diff --git a/FloatToolGUI/Main.Designer.cs b/FloatToolGUI/Main.Designer.cs index 9af38d5..a2ddbf9 100644 --- a/FloatToolGUI/Main.Designer.cs +++ b/FloatToolGUI/Main.Designer.cs @@ -80,7 +80,6 @@ private void InitializeComponent() this.weaponQualityBox = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.weaponTypeBox = new System.Windows.Forms.ComboBox(); this.label2 = new System.Windows.Forms.Label(); this.fullSkinName = new System.Windows.Forms.TextBox(); this.weaponSkinBox = new System.Windows.Forms.ComboBox(); @@ -111,6 +110,9 @@ private void InitializeComponent() this.WorkStatusUpdater = new System.Windows.Forms.Timer(this.components); this.openGithubButton = new System.Windows.Forms.ToolStripMenuItem(); this.soundBtnSwitch = new System.Windows.Forms.Button(); + this.outcomeSelectorComboBox = new System.Windows.Forms.ComboBox(); + this.label11 = new System.Windows.Forms.Label(); + this.weaponTypeBox = new System.Windows.Forms.ComboBox(); this.downloadProgressBar = new FloatToolGUI.CustomProgressBar(); this.panel1.SuspendLayout(); this.panel8.SuspendLayout(); @@ -348,10 +350,12 @@ private void InitializeComponent() this.panel6.Controls.Add(this.stattrackCheckBox); this.panel6.Controls.Add(this.checkPossibilityBtn); this.panel6.Controls.Add(this.label3); + this.panel6.Controls.Add(this.outcomeSelectorComboBox); this.panel6.Controls.Add(this.weaponQualityBox); this.panel6.Controls.Add(this.label1); this.panel6.Controls.Add(this.label4); this.panel6.Controls.Add(this.weaponTypeBox); + this.panel6.Controls.Add(this.label11); this.panel6.Controls.Add(this.label2); this.panel6.Controls.Add(this.fullSkinName); this.panel6.Controls.Add(this.weaponSkinBox); @@ -412,51 +416,6 @@ private void InitializeComponent() this.label4.ForeColor = System.Drawing.Color.White; this.label4.Name = "label4"; // - // weaponTypeBox - // - resources.ApplyResources(this.weaponTypeBox, "weaponTypeBox"); - this.weaponTypeBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32))))); - this.weaponTypeBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.weaponTypeBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(150)))), ((int)(((byte)(150)))), ((int)(((byte)(150))))); - this.weaponTypeBox.FormattingEnabled = true; - this.weaponTypeBox.Items.AddRange(new object[] { - resources.GetString("weaponTypeBox.Items"), - resources.GetString("weaponTypeBox.Items1"), - resources.GetString("weaponTypeBox.Items2"), - resources.GetString("weaponTypeBox.Items3"), - resources.GetString("weaponTypeBox.Items4"), - resources.GetString("weaponTypeBox.Items5"), - resources.GetString("weaponTypeBox.Items6"), - resources.GetString("weaponTypeBox.Items7"), - resources.GetString("weaponTypeBox.Items8"), - resources.GetString("weaponTypeBox.Items9"), - resources.GetString("weaponTypeBox.Items10"), - resources.GetString("weaponTypeBox.Items11"), - resources.GetString("weaponTypeBox.Items12"), - resources.GetString("weaponTypeBox.Items13"), - resources.GetString("weaponTypeBox.Items14"), - resources.GetString("weaponTypeBox.Items15"), - resources.GetString("weaponTypeBox.Items16"), - resources.GetString("weaponTypeBox.Items17"), - resources.GetString("weaponTypeBox.Items18"), - resources.GetString("weaponTypeBox.Items19"), - resources.GetString("weaponTypeBox.Items20"), - resources.GetString("weaponTypeBox.Items21"), - resources.GetString("weaponTypeBox.Items22"), - resources.GetString("weaponTypeBox.Items23"), - resources.GetString("weaponTypeBox.Items24"), - resources.GetString("weaponTypeBox.Items25"), - resources.GetString("weaponTypeBox.Items26"), - resources.GetString("weaponTypeBox.Items27"), - resources.GetString("weaponTypeBox.Items28"), - resources.GetString("weaponTypeBox.Items29"), - resources.GetString("weaponTypeBox.Items30"), - resources.GetString("weaponTypeBox.Items31"), - resources.GetString("weaponTypeBox.Items32"), - resources.GetString("weaponTypeBox.Items33")}); - this.weaponTypeBox.Name = "weaponTypeBox"; - this.weaponTypeBox.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); - // // label2 // resources.ApplyResources(this.label2, "label2"); @@ -515,6 +474,7 @@ private void InitializeComponent() this.searchmodeGreater_btn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56))))); this.searchmodeGreater_btn.Cursor = System.Windows.Forms.Cursors.Default; this.searchmodeGreater_btn.FlatAppearance.BorderSize = 0; + this.searchmodeGreater_btn.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.WindowFrame; this.searchmodeGreater_btn.ForeColor = System.Drawing.Color.White; this.searchmodeGreater_btn.Name = "searchmodeGreater_btn"; this.searchmodeGreater_btn.UseVisualStyleBackColor = false; @@ -524,6 +484,7 @@ private void InitializeComponent() // resources.ApplyResources(this.searchmodeEqual_btn, "searchmodeEqual_btn"); this.searchmodeEqual_btn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56))))); + this.searchmodeEqual_btn.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.WindowFrame; this.searchmodeEqual_btn.ForeColor = System.Drawing.Color.White; this.searchmodeEqual_btn.Name = "searchmodeEqual_btn"; this.searchmodeEqual_btn.UseVisualStyleBackColor = false; @@ -534,6 +495,7 @@ private void InitializeComponent() resources.ApplyResources(this.searchmodeLess_btn, "searchmodeLess_btn"); this.searchmodeLess_btn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56))))); this.searchmodeLess_btn.FlatAppearance.BorderSize = 0; + this.searchmodeLess_btn.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.WindowFrame; this.searchmodeLess_btn.ForeColor = System.Drawing.Color.White; this.searchmodeLess_btn.Name = "searchmodeLess_btn"; this.searchmodeLess_btn.UseVisualStyleBackColor = false; @@ -746,6 +708,70 @@ private void InitializeComponent() this.soundBtnSwitch.UseVisualStyleBackColor = false; this.soundBtnSwitch.Click += new System.EventHandler(this.SoundSwitchButton_Click); // + // outcomeSelectorComboBox + // + resources.ApplyResources(this.outcomeSelectorComboBox, "outcomeSelectorComboBox"); + this.outcomeSelectorComboBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32))))); + this.outcomeSelectorComboBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.outcomeSelectorComboBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(150)))), ((int)(((byte)(150)))), ((int)(((byte)(150))))); + this.outcomeSelectorComboBox.FormattingEnabled = true; + this.outcomeSelectorComboBox.Items.AddRange(new object[] { + resources.GetString("outcomeSelectorComboBox.Items"), + resources.GetString("outcomeSelectorComboBox.Items1"), + resources.GetString("outcomeSelectorComboBox.Items2")}); + this.outcomeSelectorComboBox.Name = "outcomeSelectorComboBox"; + // + // label11 + // + resources.ApplyResources(this.label11, "label11"); + this.label11.ForeColor = System.Drawing.Color.White; + this.label11.Name = "label11"; + // + // weaponTypeBox + // + resources.ApplyResources(this.weaponTypeBox, "weaponTypeBox"); + this.weaponTypeBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32))))); + this.weaponTypeBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.weaponTypeBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(150)))), ((int)(((byte)(150)))), ((int)(((byte)(150))))); + this.weaponTypeBox.FormattingEnabled = true; + this.weaponTypeBox.Items.AddRange(new object[] { + resources.GetString("weaponTypeBox.Items"), + resources.GetString("weaponTypeBox.Items1"), + resources.GetString("weaponTypeBox.Items2"), + resources.GetString("weaponTypeBox.Items3"), + resources.GetString("weaponTypeBox.Items4"), + resources.GetString("weaponTypeBox.Items5"), + resources.GetString("weaponTypeBox.Items6"), + resources.GetString("weaponTypeBox.Items7"), + resources.GetString("weaponTypeBox.Items8"), + resources.GetString("weaponTypeBox.Items9"), + resources.GetString("weaponTypeBox.Items10"), + resources.GetString("weaponTypeBox.Items11"), + resources.GetString("weaponTypeBox.Items12"), + resources.GetString("weaponTypeBox.Items13"), + resources.GetString("weaponTypeBox.Items14"), + resources.GetString("weaponTypeBox.Items15"), + resources.GetString("weaponTypeBox.Items16"), + resources.GetString("weaponTypeBox.Items17"), + resources.GetString("weaponTypeBox.Items18"), + resources.GetString("weaponTypeBox.Items19"), + resources.GetString("weaponTypeBox.Items20"), + resources.GetString("weaponTypeBox.Items21"), + resources.GetString("weaponTypeBox.Items22"), + resources.GetString("weaponTypeBox.Items23"), + resources.GetString("weaponTypeBox.Items24"), + resources.GetString("weaponTypeBox.Items25"), + resources.GetString("weaponTypeBox.Items26"), + resources.GetString("weaponTypeBox.Items27"), + resources.GetString("weaponTypeBox.Items28"), + resources.GetString("weaponTypeBox.Items29"), + resources.GetString("weaponTypeBox.Items30"), + resources.GetString("weaponTypeBox.Items31"), + resources.GetString("weaponTypeBox.Items32"), + resources.GetString("weaponTypeBox.Items33")}); + this.weaponTypeBox.Name = "weaponTypeBox"; + this.weaponTypeBox.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); + // // downloadProgressBar // resources.ApplyResources(this.downloadProgressBar, "downloadProgressBar"); @@ -861,6 +887,8 @@ private void InitializeComponent() private System.Windows.Forms.Label searchModeLabel; private System.Windows.Forms.Button MaximizeButton; private CustomProgressBar downloadProgressBar; + private System.Windows.Forms.ComboBox outcomeSelectorComboBox; + private System.Windows.Forms.Label label11; } } diff --git a/FloatToolGUI/Main.cs b/FloatToolGUI/Main.cs index da09381..5f6364c 100644 --- a/FloatToolGUI/Main.cs +++ b/FloatToolGUI/Main.cs @@ -22,6 +22,16 @@ namespace FloatToolGUI { + public enum Quality + { + Consumer, + Industrial, + MilSpec, + Restricted, + Classified, + Covert + } + public partial class FloatTool : Form { Thread thread1; @@ -88,17 +98,16 @@ static public decimal craft(double[] ingridients, float minFloat, float maxFloat avgFloat /= 10; return ((decimal)(maxFloat - minFloat) * avgFloat) + (decimal)minFloat; } - static public string craftF(string[] ingridients, float minFloat, float maxFloat) + static public string craftF(double[] ingridients, float minFloat, float maxFloat) { float avgFloat = 0; float[] arrInput = new float[10]; for (int i = 0; i < 10; i++) { - arrInput[i] = Convert.ToSingle(ingridients[i].Replace(".", ",")); + arrInput[i] = Convert.ToSingle(ingridients[i]); } foreach (float f in arrInput) { - avgFloat += Convert.ToSingle(f); } avgFloat /= 10; @@ -152,7 +161,7 @@ static public string getSkinData(string name) } - public void parseCraft(double[] inputs, List outputs, string want, bool wasSort, bool asc) + public void parseCraft(double[] inputs, List outputs, string want, bool wasSort, bool asc) { //List results = new List(); decimal wantFloat; @@ -160,24 +169,9 @@ public void parseCraft(double[] inputs, List outputs, string want, bool foreach (var item in outputs) { - //want = want.Replace(".", ","); - float minWear = item["minWear"]; - float maxWear = item["maxWear"]; - decimal flotOrigin = Math.Round(craft(inputs.ToArray(), minWear, maxWear), 14); + decimal flotOrigin = Math.Round(craft(inputs.ToArray(), item.MinFloat, item.MaxFloat), 14); + string flot = craftF(inputs, item.MinFloat, item.MaxFloat); - string[] inputStr = new string[10]; - for(int i = 0; i < 10; i++) - { - inputStr[i] = "" + inputs[i]; - } - - string flot = craftF(inputStr, minWear, maxWear); - //Console.WriteLine(flotOrigin + " | " + flot); - //Debug.WriteLine("[DEBUG] flot = " + flot); - // if (wasSort && ((!asc && (double.Parse(flot) > double.Parse(want))) || (asc && (double.Parse(flot) < double.Parse(want))))) { - // okSort = true; - //} - /*flot.StartsWith(want.Replace(".", ",")) ||*/ if ( ((flotOrigin.ToString(CultureInfo.InvariantCulture).StartsWith(want)) && CurrentSearchMode == SearchMode.Equal) || ((flotOrigin < wantFloat) && CurrentSearchMode == SearchMode.Less) || @@ -240,9 +234,45 @@ public void SwitchEnabled() sortCheckBox.Enabled = !sortCheckBox.Enabled; ascendingCheckBox.Enabled = !ascendingCheckBox.Enabled; multithreadCheckBox.Enabled = !multithreadCheckBox.Enabled; + outcomeSelectorComboBox.Enabled = !outcomeSelectorComboBox.Enabled; if (threadCountInput.Enabled && !multithreadCheckBox.Enabled) threadCountInput.Enabled = false; } + + public void UpdateOutcomes() + { + string skin = $"{weaponTypeBox.Text} | {weaponSkinBox.Text}"; + outcomeSelectorComboBox.Items.Clear(); + List craftList = new List(); + using (StreamReader r = new StreamReader("itemData.json")) + { + string json = r.ReadToEnd(); + dynamic items = JsonConvert.DeserializeObject(json); + foreach (var skn in items) + { + if (skn["name"].ToString() == skin) + { + foreach (var skin2 in items) + if (skn["case"].ToString() == skin2["case"].ToString()) + { + if (skin2["rarity"].ToString().Split(' ')[0] == getNextRarity(skn["rarity"].ToString().Split(' ')[0])) + craftList.Add(skin2); + } + } + } + int totalSkins = 0; + foreach (var skinRange in GroupOutcomes(craftList)) + totalSkins += skinRange.Count; + foreach (var skinRange in GroupOutcomes(craftList)) + { + string tmp = (skinRange.Count > 1) ? $" + {(skinRange.Count - 1)}" : ""; + outcomeSelectorComboBox.Items.Add($"{((float)skinRange.Count) / totalSkins * 100}% ({skinRange[0].Name}{tmp})"); + } + outcomeSelectorComboBox.Items.Add("* Искать всё *"); + outcomeSelectorComboBox.SelectedIndex = 0; + } + } + public void updateSearchStr() { string search = ""; @@ -255,6 +285,7 @@ public void updateSearchStr() search += weaponSkinBox.Text; search += " (" + weaponQualityBox.Text + ")"; fullSkinName.Text = search; + UpdateOutcomes(); } public FloatTool() { @@ -283,6 +314,7 @@ private void Form1_Load(object sender, EventArgs e) } } updateSearchStr(); + darkModeSwitchBtn.Text = darkTheme ? "🌙" : "☀"; client = new DiscordRpcClient("824349399688937543"); @@ -404,7 +436,7 @@ private static IEnumerable Combinations(IEnumerable elements, int k, int s } while (NextCombination(numbers, size, k)); } - public void secndThread(List craftList, string wanted, double[] pool, int start, int skip) + public void secndThread(List craftList, string wanted, double[] pool, int start, int skip) { foreach (IEnumerable pair in Combinations(pool, 10, start, skip)) { @@ -458,6 +490,7 @@ private void StartCalculation() string q = fullSkinName.Text; string url = "https://steamcommunity.com/market/listings/730/" + q + "/render/?query=&language=russian&count=" + count + "&start=" + start + "¤cy=5"; Console.WriteLine(url); + this.Invoke((MethodInvoker)(() => { outputConsoleBox.AppendText( "Загрузка скинов с торговой площадки..." + Environment.NewLine); @@ -560,11 +593,28 @@ private void StartCalculation() } } } + + int outcomeIndex = 0; + Invoke((MethodInvoker)(() => { outcomeIndex = outcomeSelectorComboBox.SelectedIndex; } )); + + var allOutcomes = GroupOutcomes(craftList); + List outcomes = new List(); + + if(allOutcomes.Length > outcomeIndex) { + outcomes.Add(allOutcomes[outcomeIndex][0]); + } + else + { + foreach (var i in allOutcomes) + outcomes.Add(i[0]); + } + this.Invoke((MethodInvoker)(() => { - outputConsoleBox.AppendText( "Ауткамы найдены! Начинаю подбор..." + Environment.NewLine + Environment.NewLine); + outputConsoleBox.AppendText( "Ауткамы найдены! Начинаю подбор..." + Environment.NewLine + "Выбрано для поиска:" + Environment.NewLine + String.Join(Environment.NewLine, outcomes) + Environment.NewLine + Environment.NewLine); fullSkinName.SelectionStart = fullSkinName.Text.Length; outputConsoleBox.ScrollToCaret(); + downloadProgressBar.Value = 0; downloadProgressBar.Maximum = 1000; } )); @@ -581,7 +631,7 @@ private void StartCalculation() { for (int i = 1; i < threads; i++) { - Thread newThread = new Thread(() => secndThread(craftList, wanted, pool, i, threads)); + Thread newThread = new Thread(() => secndThread(outcomes, wanted, pool, i, threads)); newThread.Start(); t2.Add(newThread); } @@ -594,7 +644,7 @@ private void StartCalculation() foreach (IEnumerable pair in Combinations(pool, 10, 0, threads)) { - parseCraft(pair.ToArray(), craftList, wanted, sortCheckBox.Checked, ascendingCheckBox.Checked); + parseCraft(pair.ToArray(), outcomes, wanted, sortCheckBox.Checked, ascendingCheckBox.Checked); currComb++; } Console.WriteLine("Next group"); @@ -686,6 +736,27 @@ private void button1_Click(object sender, EventArgs e) { if (skn["name"].ToString() == skin) { + #region Float ranges + /* + List craftList = new List(); + + foreach (var skin2 in items) + if (skn["case"].ToString() == skin2["case"].ToString()) + { + if (skin2["rarity"].ToString().Split(' ')[0] == getNextRarity(skn["rarity"].ToString().Split(' ')[0])) + craftList.Add(skin2); + } + + + foreach (var skinRange in GroupOutcomes(craftList)) + { + ConsoleBuffer.Append($"{Environment.NewLine}--------Length: {skinRange.Count}--------"); + foreach (var skinObj in skinRange) + ConsoleBuffer.Append(Environment.NewLine+skinObj.ToString()); + } + */ + #endregion + if (skn["highestRarity"] == "False") { if (floatRangeText(weaponQualityBox.Text, skn["minWear"].ToString(), skn["maxWear"].ToString())) @@ -707,7 +778,6 @@ private void button1_Click(object sender, EventArgs e) } } } - MessageBox.Show("Такого скина не существует! Перепроверьте настройки.", "FloatTool", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -719,6 +789,40 @@ bool testOverlap(float x1, float x2, float y1, float y2) (y2 >= x1 && y2 <= x2); } + private Quality FromString(string value) + { + if (value == "Consumer") return Quality.Consumer; + else if (value == "Industrial") return Quality.Industrial; + else if (value == "Mil-Spec") return Quality.MilSpec; + else if (value == "Restricted") return Quality.Restricted; + else if (value == "Classified") return Quality.Classified; + else return Quality.Covert; + } + + private List[] GroupOutcomes(List skins) + { + var allList = new List>(); //List with all outcomes + float[] currIter = { 0f, 1f }; //Last iteration wear range + List floatRanges = new List(); //List of all ranges that has been parsed + + foreach(var skin in skins) + { + float[] curr = { skin["maxWear"], skin["minWear"] }; + List list = new List(); + if (curr.SequenceEqual(currIter) || floatRanges.Any(x => (x.SequenceEqual(curr)))) continue; //If range already exists + else { + currIter = curr; + floatRanges.Add(currIter); + } + foreach (var skin1 in skins) + if ((skin["maxWear"] == skin1["maxWear"]) && (skin["minWear"] == skin1["minWear"])) + list.Add(new Skin(skin1["name"].ToString(), float.Parse(skin1["minWear"].ToString().Replace('.', ',')), float.Parse(skin1["maxWear"].ToString().Replace('.', ',')), FromString(skin1["rarity"].ToString().Split(' ')[0]))); + allList.Add(list); + } + + return allList.ToArray(); + } + private bool floatRangeText(string text, string minVal, string maxVal) { Console.WriteLine(text + " in float range [" + minVal + ", " + maxVal + "]"); @@ -790,7 +894,7 @@ private const int HTBOTTOMLEFT = 16, HTBOTTOMRIGHT = 17; - const int _ = 10; // you can rename this variable if you like + const int _ = 16; Rectangle TopCursor { get { return new Rectangle(0, 0, this.ClientSize.Width, _); } } Rectangle LeftCursor { get { return new Rectangle(0, 0, _, this.ClientSize.Height); } } @@ -1145,7 +1249,6 @@ private void gpuSearch_btn_Click(object sender, EventArgs e) private void timer2_Tick(object sender, EventArgs e) { var hundrMilsCount = currComb - last; - //Console.WriteLine($"{hundrMilsCount} in last {timer2.Interval} ms"); var speed = (double)(hundrMilsCount) * 1000 / WorkStatusUpdater.Interval; speedStatusLabel.Text = $"Текущая скорость: {speed} комбинаций/сек"; last = currComb; diff --git a/FloatToolGUI/Main.resx b/FloatToolGUI/Main.resx index 8f19771..c9278cb 100644 --- a/FloatToolGUI/Main.resx +++ b/FloatToolGUI/Main.resx @@ -725,7 +725,7 @@ NoControl - 216, 20 + 207, 20 64, 15 @@ -818,7 +818,7 @@ NoControl - 8, 63 + 9, 64 Yes @@ -863,7 +863,7 @@ 150, 90 - 274, 24 + 267, 24 10 @@ -919,6 +919,48 @@ 2 + + None + + + Flat + + + Microsoft JhengHei Light, 9pt + + + 80% (AK-47 | Safari Mesh + 3) + + + 20% (Tec-9 | Varicamo) + + + * Искать всё * + + + 186, 61 + + + 231, 24 + + + 6 + + + 80% (AK-47 | Safari Mesh + 3) + + + outcomeSelectorComboBox + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel6 + + + 3 + None @@ -947,7 +989,7 @@ 288, 31 - 130, 24 + 129, 24 6 @@ -965,7 +1007,7 @@ panel6 - 3 + 4 None @@ -1001,7 +1043,7 @@ panel6 - 4 + 5 Bottom, Left @@ -1040,7 +1082,7 @@ panel6 - 5 + 6 None @@ -1175,7 +1217,43 @@ panel6 - 6 + 7 + + + None + + + True + + + Microsoft JhengHei Light, 10pt + + + NoControl + + + 108, 65 + + + 68, 18 + + + 4 + + + Ауткамы: + + + label11 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel6 + + + 8 None @@ -1211,7 +1289,7 @@ panel6 - 7 + 9 Bottom @@ -1250,7 +1328,7 @@ panel6 - 8 + 10 None @@ -1283,7 +1361,7 @@ panel6 - 9 + 11 Top @@ -2347,9 +2425,6 @@ lcEgDkWiqA6FUR2O4OL8XLzY1sG2H8tA/j8A3hg1hV1H6QAAAABJRU5ErkJggg== - - NoControl - 900, 460 diff --git a/FloatToolGUI/Properties/Settings.Designer.cs b/FloatToolGUI/Properties/Settings.Designer.cs index 73c373d..e1c20db 100644 --- a/FloatToolGUI/Properties/Settings.Designer.cs +++ b/FloatToolGUI/Properties/Settings.Designer.cs @@ -1,30 +1,35 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. // //------------------------------------------------------------------------------ -namespace FloatToolGUI.Properties -{ - - +namespace FloatToolGUI.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string Nova { + get { + return ((string)(this["Nova"])); + } + } } } diff --git a/FloatToolGUI/Properties/Settings.settings b/FloatToolGUI/Properties/Settings.settings index 3964565..17c701c 100644 --- a/FloatToolGUI/Properties/Settings.settings +++ b/FloatToolGUI/Properties/Settings.settings @@ -1,7 +1,9 @@  - - - - - - + + + + + + + + \ No newline at end of file diff --git a/FloatToolGUI/Skin.cs b/FloatToolGUI/Skin.cs new file mode 100644 index 0000000..ee358f1 --- /dev/null +++ b/FloatToolGUI/Skin.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FloatToolGUI +{ + public class Skin + { + public string Name { get; set; } + public float MinFloat { get; set; } + public float MaxFloat { get; set; } + public Quality Rarity { get; set; } + + public Skin(string name, float minWear, float maxWear, Quality rarity) + { + Name = name; + MinFloat = minWear; + MaxFloat = maxWear; + Rarity = rarity; + } + + public override string ToString() + { + return $"{Name} ({Rarity.ToString()}) | {MinFloat}-{MaxFloat}"; + } + } +}