first commit

This commit is contained in:
mikx 2023-12-31 15:07:23 -05:00
commit 986e9d6900
21 changed files with 1920 additions and 0 deletions

261
.gitignore vendored Normal file
View File

@ -0,0 +1,261 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

73
LICENSE Normal file
View File

@ -0,0 +1,73 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

25
PoEcoDB.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33403.182
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoEcoDB", "PoEcoDB\PoEcoDB.csproj", "{D31F52D5-ABAE-435B-A4EF-CC33D6BACB6E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D31F52D5-ABAE-435B-A4EF-CC33D6BACB6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D31F52D5-ABAE-435B-A4EF-CC33D6BACB6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D31F52D5-ABAE-435B-A4EF-CC33D6BACB6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D31F52D5-ABAE-435B-A4EF-CC33D6BACB6E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {16E8F99C-6356-4503-867A-BC13D66006F0}
EndGlobalSection
EndGlobal

18
PoEcoDB/App.config Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

133
PoEcoDB/DB/ClassGen.cs Normal file
View File

@ -0,0 +1,133 @@
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace PoEcoDB.DB
{
internal class ClassGen
{
public static MySqlConnection MxPoEDB()
{
MySqlConnection conn;
string myConnectionString;
myConnectionString = $"server={JSON.Settings.GetdbHost()};port={JSON.Settings.GetdbPort()};uid={JSON.Settings.GetdbUser()};pwd={JSON.Settings.GetdbPass()};database={JSON.Settings.GetdbName()};";
conn = new MySqlConnection();
conn.ConnectionString = myConnectionString;
return conn;
}
public static void AddClass(int id, string name)
{
MySqlConnection con = MxPoEDB();
string cmdText = $"INSERT INTO poeco_classes(cid, name) VALUES ('{id}','{name}')";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
public static void AddBase(string querycmd)
{
MySqlConnection con = MxPoEDB();
//string cmdText = $"INSERT INTO poeco_bases(bid, cid, name) VALUES ('{bid}', '{cid}', '{MySql.Data.MySqlClient.MySqlHelper.EscapeString(name)}')";
string cmdText = querycmd;
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
public static void AddImplicit(string querycmd)
{
MySqlConnection con = MxPoEDB();
//string cmdText = $"INSERT INTO poeco_implicit(bid, imp) VALUES ('{bid}', '{MySql.Data.MySqlClient.MySqlHelper.EscapeString(imp)}')";
string cmdText = querycmd;
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
public static void DeleteClass()
{
MySqlConnection con = MxPoEDB();
string cmdText = $"DELETE FROM poeco_classes";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
public static void DeleteBase()
{
MySqlConnection con = MxPoEDB();
string cmdText = $"DELETE FROM poeco_bases";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
public static void DeleteImplicit()
{
MySqlConnection con = MxPoEDB();
string cmdText = $"DELETE FROM poeco_implicit";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
public static void GenClass()
{
DeleteClass();
DeleteBase();
DeleteImplicit();
DirectoryInfo dir = new DirectoryInfo("data/lua");
int cid = 1;
int bid = 1;
StringBuilder sCommandBase = new StringBuilder("INSERT INTO poeco_bases(bid, cid, name) VALUES ");
List<string> RowsBase = new List<string>();
StringBuilder sCommandImp = new StringBuilder("INSERT INTO poeco_implicit(bid, imp) VALUES ");
List<string> RowsImp = new List<string>();
foreach (var f in dir.GetFiles())
{
var fnp = Path.GetFileNameWithoutExtension(f.FullName);
var fnpUp = char.ToUpper(f.Name[0]) + fnp.Substring(1);
AddClass(cid, fnpUp);
Message.drawProgress(cid, dir.EnumerateFiles().Count());
foreach (var l in File.ReadLines(@"data/lua/" + f.Name))
{
int ll = l.Length;
if (l.Contains("itemBases["))
{
RowsBase.Add($"('{bid}','{cid}','{MySql.Data.MySqlClient.MySqlHelper.EscapeString(l.Split('"', '"')[1])}')");
}
if (l.Contains("\timplicit = \""))
{
RowsImp.Add($"('{bid}','{MySql.Data.MySqlClient.MySqlHelper.EscapeString(l.Split('"', '"')[1])}')");
bid++;
}
}
cid++;
}
sCommandBase.Append(string.Join(",", RowsBase));
sCommandBase.Append(";");
AddBase(sCommandBase.ToString());
sCommandImp.Append(string.Join(",", RowsImp));
sCommandImp.Append(";");
AddImplicit(sCommandImp.ToString());
sCommandBase.Clear();
sCommandImp.Clear();
}
}
}

80
PoEcoDB/DB/Stash.cs Normal file
View File

@ -0,0 +1,80 @@
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.DB
{
internal class Stash
{
public static MySqlConnection MxPoEDB()
{
MySqlConnection conn;
string myConnectionString;
myConnectionString = $"server={JSON.Settings.GetdbHost()};port={JSON.Settings.GetdbPort()};uid={JSON.Settings.GetdbUser()};pwd={JSON.Settings.GetdbPass()};database={JSON.Settings.GetdbName()};;max pool size=200";
conn = new MySqlConnection();
conn.ConnectionString = myConnectionString;
return conn;
}
public static int GetClassIDByBase(string ibase)
{
MySqlConnection con = MxPoEDB();
string cmdText = $"SELECT * FROM poeco_bases WHERE name LIKE '%{MySql.Data.MySqlClient.MySqlHelper.EscapeString(ibase)}%'";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
var row = cmd.ExecuteReader();
if (row.HasRows) { row.Read(); return row.GetInt32(1); } else { return 0; }
}
public static string GetClassByID(int iclass)
{
using (var con = MxPoEDB())
{
string cmdText = $"SELECT * FROM poeco_classes WHERE cid = '{iclass}'";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
var row = cmd.ExecuteReader();
if (row.HasRows) { row.Read(); return row.GetString(1); } else { return "null"; }
}
}
public static int GetBaseIDByName(string ibase)
{
using (var con = MxPoEDB())
{
string cmdText = $"SELECT * FROM poeco_bases WHERE name LIKE '%{MySql.Data.MySqlClient.MySqlHelper.EscapeString(ibase)}%'";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
var row = cmd.ExecuteReader();
if (row.HasRows) { row.Read(); return row.GetInt32(0); } else { return 0; }
}
}
public static void AddItemTable(string cmdlist)
{
using (var con = MxPoEDB())
{
//string cmdText = $"INSERT INTO poeco_items(uid, cid, bid, uiid, img, txt, b64, ctype, min, max) VALUES ('{uid}','{cid}','{bid}','{uiid}','{img}','{txt}','{b64}','{ctype}','{min}','{max}')";
MySqlCommand cmd = new MySqlCommand(cmdlist, con);
con.Open();
var row = cmd.ExecuteNonQuery();
con.Close();
}
}
public static void DeleteItems(int userid)
{
MySqlConnection con = MxPoEDB();
string cmdText = $"DELETE FROM poeco_items WHERE uid = '{userid}'";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}

65
PoEcoDB/DB/User.cs Normal file
View File

@ -0,0 +1,65 @@
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.DB
{
internal class User
{
public static MySqlConnection MxPoEDB()
{
MySqlConnection conn;
string myConnectionString;
myConnectionString = $"server={JSON.Settings.GetdbHost()};port={JSON.Settings.GetdbPort()};uid={JSON.Settings.GetdbUser()};pwd={JSON.Settings.GetdbPass()};database={JSON.Settings.GetdbName()};";
conn = new MySqlConnection();
conn.ConnectionString = myConnectionString;
return conn;
}
public static bool CheckUserExists(string user)
{
MySqlConnection con = MxPoEDB();
string cmdText = $"SELECT * FROM poeco_user WHERE account = '{user}'";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
var row = cmd.ExecuteReader();
if (row.HasRows) { con.Close(); return true; } else { con.Close(); return false; }
}
public static int GetUserID(string user)
{
using (var con = MxPoEDB())
{
string cmdText = $"SELECT * FROM poeco_user WHERE account = '{user}'";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
var row = cmd.ExecuteReader();
if (row.HasRows) { row.Read(); return row.GetInt32(0); } else { return 0; }
}
}
public static string GetUserSessionID(string user)
{
MySqlConnection con = MxPoEDB();
string cmdText = $"SELECT * FROM poeco_user WHERE account = '{user}'";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
var row = cmd.ExecuteReader();
if (row.HasRows) { row.Read(); return row.GetString(3); } else { return "null"; }
}
public static int GetUserTabIndex(string user)
{
MySqlConnection con = MxPoEDB();
string cmdText = $"SELECT * FROM poeco_user WHERE account = '{user}'";
MySqlCommand cmd = new MySqlCommand(cmdText, con);
con.Open();
var row = cmd.ExecuteReader();
if (row.HasRows) { row.Read(); return row.GetInt32(2); } else { return 0; }
}
}
}

3
PoEcoDB/FodyWeavers.xml Normal file
View File

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>

141
PoEcoDB/FodyWeavers.xsd Normal file
View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

44
PoEcoDB/JSON/Settings.cs Normal file
View File

@ -0,0 +1,44 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.JSON
{
internal class Settings
{
public class SETTINGS
{
public string dbHost { get; set; }
public string dbPort { get; set; }
public string dbName { get; set; }
public string dbUser { get; set; }
public string dbPass { get; set; }
public string league { get; set; }
}
public static string GetdbHost() => JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("data/settings.json")).dbHost;
public static string GetdbPort() => JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("data/settings.json")).dbPort;
public static string GetdbName() => JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("data/settings.json")).dbName;
public static string GetdbUser() => JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("data/settings.json")).dbUser;
public static string GetdbPass() => JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("data/settings.json")).dbPass;
public static string GetLeague() => JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("data/settings.json")).league;
public static void WriteSection(string section)
{
SETTINGS settings = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("data/settings.json"));
File.WriteAllText("data/settings.json", JsonConvert.SerializeObject((object)new SETTINGS()
{
dbHost = settings.dbHost,
dbPort = settings.dbPort,
dbName = settings.dbName,
dbUser = settings.dbUser,
dbPass = settings.dbPass,
league = settings.league
}, Formatting.Indented));
}
}
}

369
PoEcoDB/JSON/Stash.cs Normal file
View File

@ -0,0 +1,369 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.JSON
{
internal class Stash
{
public static void GenItemTable(string user)
{
List<string> stringItemTxt = new List<string>();
List<string> stringItemMod = new List<string>();
StashRoot stash = JsonConvert.DeserializeObject<StashRoot>(File.ReadAllText($@"data\stash\{user}.json"));
int curitem = 1;
DB.Stash.DeleteItems(DB.User.GetUserID(user));
var tmpfiles = Directory.GetFiles("tmp");
StringBuilder sCommand = new StringBuilder("INSERT INTO poeco_items(uid, tabindex, tabname, tabrgb, cid, bid, uiid, imod, var, img, txt, b64, ctype, min, max) VALUES ");
List<string> Rows = new List<string>();
foreach ( var file in tmpfiles ) { File.Delete(file); }
foreach (Item obj in stash.items)
{
if (obj.typeLine != "" && obj.frameType == 2 && obj.identified)
{
Message.drawProgress(curitem, stash.items.Count());
int icid = DB.Stash.GetClassIDByBase(obj.typeLine);
string itemclass = DB.Stash.GetClassByID(icid);
stringItemTxt.Add($"Item Class: {char.ToUpper(itemclass[0]) + itemclass.Substring(1)}");
stringItemTxt.Add("Rarity: Rare");
stringItemTxt.Add(obj.name ?? "");
stringItemTxt.Add(obj.typeLine ?? "");
stringItemTxt.Add("--------");
if (obj.properties != null && obj.properties.Count<Property>() > 0)
{
foreach (Property property in obj.properties)
{
if (property.name == "Quality")
stringItemTxt.Add(string.Format("Quality: {0}", property.values[0][0]));
if (property.name == "Armour")
stringItemTxt.Add(string.Format("Armour: {0}", property.values[0][0]));
if (property.name == "Energy Shield")
stringItemTxt.Add(string.Format("Energy Shield: {0}", property.values[0][0]));
if (property.name == "Evasion Rating")
stringItemTxt.Add(string.Format("Evasion Rating: {0}", property.values[0][0]));
if (property.values.Count<List<object>>() == 0)
stringItemTxt.Add(property.name ?? "");
if (property.name == "Physical Damage")
stringItemTxt.Add(string.Format("Physical Damage: {0}", property.values[0][0]));
if (property.name == "Elemental Damage")
stringItemTxt.Add(string.Format("Elemental Damage: {0}", property.values[0][0]));
if (property.name == "Critical Strike Chance")
stringItemTxt.Add(string.Format("Critical Strike Chance: {0}", property.values[0][0]));
if (property.name == "Attacks per Second")
stringItemTxt.Add(string.Format("Attacks per Second: {0}", property.values[0][0]));
if (property.name == "Weapon Range")
stringItemTxt.Add(string.Format("Weapon Range: {0}", property.values[0][0]));
}
stringItemTxt.Add("--------");
}
stringItemTxt.Add("Requirements:");
if (obj.requirements != null)
{
foreach (Requirement requirement in obj.requirements)
{
if (requirement.name == "Level")
stringItemTxt.Add(string.Format("Level: {0}", requirement.values[0][0]));
if (requirement.name == "Str")
stringItemTxt.Add(string.Format("Str: {0}", requirement.values[0][0]));
if (requirement.name == "Dex")
stringItemTxt.Add(string.Format("Dex: {0}", requirement.values[0][0]));
if (requirement.name == "Int")
stringItemTxt.Add(string.Format("Int: {0}", requirement.values[0][0]));
}
}
stringItemTxt.Add("--------");
if (obj.sockets != null)
{
List<string> stringList2 = new List<string>();
List<string> stringList3 = new List<string>();
List<string> stringList4 = new List<string>();
List<string> stringList5 = new List<string>();
List<string> stringList6 = new List<string>();
List<string> stringList7 = new List<string>();
foreach (Socket socket in obj.sockets)
{
if (socket.group == 0)
stringList2.Add(socket.sColour.ToString());
if (socket.group == 1)
stringList3.Add(socket.sColour.ToString());
if (socket.group == 2)
stringList4.Add(socket.sColour.ToString());
if (socket.group == 3)
stringList5.Add(socket.sColour.ToString());
if (socket.group == 4)
stringList6.Add(socket.sColour.ToString());
if (socket.group == 5)
stringList7.Add(socket.sColour.ToString());
}
string str1 = string.Join("-", (IEnumerable<string>)stringList2);
string str2 = string.Join("-", (IEnumerable<string>)stringList3);
string str3 = string.Join("-", (IEnumerable<string>)stringList4);
string str4 = string.Join("-", (IEnumerable<string>)stringList5);
string str5 = string.Join("-", (IEnumerable<string>)stringList6);
string str6 = string.Join("-", (IEnumerable<string>)stringList7);
stringItemTxt.Add("Sockets: " + str1 + " " + str2 + " " + str3 + " " + str4 + " " + str5 + " " + str6);
}
stringItemTxt.Add("--------");
stringItemTxt.Add(string.Format("Item Level: {0}", (object)obj.ilvl));
stringItemTxt.Add("--------");
if (obj.implicitMods != null)
{
foreach (string implicitMod in obj.implicitMods)
{
stringItemTxt.Add(implicitMod ?? "");
stringItemMod.Add(implicitMod + "/n");
}
stringItemTxt.Add("--------");
stringItemMod.Add("--------/n");
}
if (obj.explicitMods != null)
{
foreach (string explicitMod in obj.explicitMods)
{
stringItemTxt.Add(explicitMod ?? "");
stringItemMod.Add(explicitMod + "/n");
}
}
File.WriteAllLines("tmp/" + obj.id + ".txt", (IEnumerable<string>)stringItemTxt);
File.WriteAllLines("tmp/" + obj.id + ".mod.txt", (IEnumerable<string>)stringItemMod);
string ib64 = Convert.ToBase64String(File.ReadAllBytes("tmp/" + obj.id + ".txt"));
Web.PoEPrices.GetItemJson(obj.id, ib64);
int tabindex = DB.User.GetUserTabIndex(user);
Rows.Add(
$"(" +
$"'{DB.User.GetUserID(user)}'," +
$"'{stash.tabs[tabindex].i}'," +
$"'{stash.tabs[tabindex].n}'," +
$"'{stash.tabs[tabindex].colour.r}:{stash.tabs[tabindex].colour.g}:{stash.tabs[tabindex].colour.b}'," +
$"'{icid}'," +
$"'{DB.Stash.GetBaseIDByName(obj.typeLine)}'," +
$"'{obj.id}'," +
$"'{MySql.Data.MySqlClient.MySqlHelper.EscapeString(File.ReadAllText("tmp/" + obj.id + ".mod.txt"))}'," +
$"'{DB.Stash.GetClassByID(icid)}:{MySql.Data.MySqlClient.MySqlHelper.EscapeString(obj.typeLine)}:{MySql.Data.MySqlClient.MySqlHelper.EscapeString(obj.name)}:{obj.ilvl}'," +
$"'{obj.icon}'," +
$"'{MySql.Data.MySqlClient.MySqlHelper.EscapeString(File.ReadAllText("tmp/" + obj.id + ".txt"))}'," +
$"'{ib64}'," +
$"'{Web.PoEPrices.GetCurType(obj.id)}'," +
$"'{Web.PoEPrices.GetMin(obj.id)}'," +
$"'{Web.PoEPrices.GetMax(obj.id)}'" +
$")");
stringItemTxt.Clear();
stringItemMod.Clear();
curitem++;
}
}
sCommand.Append(string.Join(",", Rows));
//Message.CMW(sCommand.ToString(),true,3);
sCommand.Append(";");
DB.Stash.AddItemTable(sCommand.ToString());
}
public class Colour
{
public int r { get; set; }
public int g { get; set; }
public int b { get; set; }
}
public class Tab
{
public string n { get; set; }
public int i { get; set; }
public string id { get; set; }
public string type { get; set; }
public bool selected { get; set; }
public Colour colour { get; set; }
public string srcL { get; set; }
public string srcC { get; set; }
public string srcR { get; set; }
}
public class Socket
{
public int group { get; set; }
public string attr { get; set; }
public string sColour { get; set; }
}
public class Property
{
public string name { get; set; }
public List<List<object>> values { get; set; }
public int displayMode { get; set; }
public int? type { get; set; }
}
public class Requirement
{
public string name { get; set; }
public List<List<object>> values { get; set; }
public int displayMode { get; set; }
public string suffix { get; set; }
}
public class AdditionalProperty
{
public string name { get; set; }
public List<List<object>> values { get; set; }
public int displayMode { get; set; }
public double progress { get; set; }
public int type { get; set; }
}
public class NextLevelRequirement
{
public string name { get; set; }
public List<List<object>> values { get; set; }
public int displayMode { get; set; }
}
public class SocketedItem
{
public bool verified { get; set; }
public int w { get; set; }
public int h { get; set; }
public string icon { get; set; }
public bool support { get; set; }
public string id { get; set; }
public string name { get; set; }
public string typeLine { get; set; }
public bool identified { get; set; }
public int ilvl { get; set; }
public List<Property> properties { get; set; }
public List<Requirement> requirements { get; set; }
public List<AdditionalProperty> additionalProperties { get; set; }
public List<NextLevelRequirement> nextLevelRequirements { get; set; }
public string secDescrText { get; set; }
public List<string> explicitMods { get; set; }
public string descrText { get; set; }
public int frameType { get; set; }
public int socket { get; set; }
public string colour { get; set; }
}
public class Item
{
public bool verified { get; set; }
public int w { get; set; }
public int h { get; set; }
public string icon { get; set; }
public string league { get; set; }
public string id { get; set; }
public List<Socket> sockets { get; set; }
public string name { get; set; }
public string typeLine { get; set; }
public bool identified { get; set; }
public int ilvl { get; set; }
public bool corrupted { get; set; }
public int frameType { get; set; }
public int x { get; set; }
public int y { get; set; }
public string inventoryId { get; set; }
public List<SocketedItem> socketedItems { get; set; }
public List<Property> properties { get; set; }
public List<Requirement> requirements { get; set; }
public List<string> implicitMods { get; set; }
public List<string> explicitMods { get; set; }
public List<string> craftedMods { get; set; }
public bool? support { get; set; }
public List<AdditionalProperty> additionalProperties { get; set; }
public string secDescrText { get; set; }
public string descrText { get; set; }
public List<string> flavourText { get; set; }
public bool? fractured { get; set; }
public List<string> fracturedMods { get; set; }
public List<string> enchantMods { get; set; }
public int? talismanTier { get; set; }
}
public class StashRoot
{
public int numTabs { get; set; }
public List<Tab> tabs { get; set; }
public bool quadLayout { get; set; }
public List<Item> items { get; set; }
}
}
}

151
PoEcoDB/Message.cs Normal file
View File

@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB
{
internal class Message
{
public static void CMW(string msg, bool time, int color)
{
DateTime now;
string str1;
int num;
if (DateTime.Now.Second < 10)
{
now = DateTime.Now;
str1 = string.Format("0{0}", (object)now.Second);
}
else
{
num = DateTime.Now.Second;
str1 = num.ToString();
}
now = DateTime.Now;
string str2;
if (now.Minute < 10)
{
now = DateTime.Now;
str2 = string.Format("0{0}", (object)now.Minute);
}
else
{
now = DateTime.Now;
num = now.Minute;
str2 = num.ToString();
}
now = DateTime.Now;
string str3;
if (now.Hour < 10)
{
now = DateTime.Now;
str3 = string.Format("0{0}", (object)now.Hour);
}
else
{
now = DateTime.Now;
num = now.Hour;
str3 = num.ToString();
}
string str4 = string.Format("{0}:{1}:{2}", (object)str3, (object)str2, (object)str1);
File.AppendAllText("mxfiltergen.logs", string.Format("[{0}] {1}", (object)str4, (object)msg) + Environment.NewLine);
ConsoleColor consoleColor = ConsoleColor.White;
switch (color)
{
case 1:
consoleColor = ConsoleColor.Cyan;
break;
case 2:
consoleColor = ConsoleColor.Green;
break;
case 3:
consoleColor = ConsoleColor.Red;
break;
}
if (time)
{
Console.ForegroundColor = consoleColor;
Console.WriteLine(string.Format("[{0}] {1}", (object)str4, (object)msg));
}
else
{
Console.ForegroundColor = consoleColor;
Console.WriteLine(string.Format(""));
}
Console.ForegroundColor = ConsoleColor.White;
}
public static void drawProgress(int progress, int total)
{
DateTime now;
string str1;
int num;
if (DateTime.Now.Second < 10)
{
now = DateTime.Now;
str1 = string.Format("0{0}", (object)now.Second);
}
else
{
num = DateTime.Now.Second;
str1 = num.ToString();
}
now = DateTime.Now;
string str2;
if (now.Minute < 10)
{
now = DateTime.Now;
str2 = string.Format("0{0}", (object)now.Minute);
}
else
{
now = DateTime.Now;
num = now.Minute;
str2 = num.ToString();
}
now = DateTime.Now;
string str3;
if (now.Hour < 10)
{
now = DateTime.Now;
str3 = string.Format("0{0}", (object)now.Hour);
}
else
{
now = DateTime.Now;
num = now.Hour;
str3 = num.ToString();
}
string str4 = string.Format("[{0}] [", (object)string.Format("{0}:{1}:{2}", (object)str3, (object)str2, (object)str1));
Console.ForegroundColor = ConsoleColor.Cyan;
if (progress == 1)
{
Console.Write(str4);
Console.CursorLeft = total + str4.Length;
Console.Write("]");
}
Console.CursorLeft = progress + str4.Length - 1;
Console.Write("#");
Console.CursorLeft = str4.Length + total + 2;
Console.Write(string.Format("{0}/{1}", (object)progress, (object)total));
if (progress != total)
return;
Console.WriteLine();
}
public static void Splash(string progname, string dev)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("");
Console.WriteLine($"#### {progname}");
Console.WriteLine(string.Format("#### VERSION: {0}", (object)Program.version));
Console.WriteLine($"#### DEV: {dev}");
Console.WriteLine("#### POWERED BY: poe.ninja / poeprices.info");
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.White;
}
}
}

262
PoEcoDB/PoEcoDB.csproj Normal file
View File

@ -0,0 +1,262 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D31F52D5-ABAE-435B-A4EF-CC33D6BACB6E}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>PoEcoDB</RootNamespace>
<AssemblyName>PoEcoDB</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.2.1\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=5.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.21.9.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.9\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.3.5\lib\net462\K4os.Compression.LZ4.dll</HintPath>
</Reference>
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.5.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.5\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
</Reference>
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data, Version=8.2.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.2.0\lib\net48\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.AppContext, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.ConfigurationManager, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Configuration.ConfigurationManager.4.4.1\lib\net461\System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.7.0.2\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.Tracing, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Linq, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Linq.Expressions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Linq.Expressions.4.3.0\lib\net463\System.Linq.Expressions.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Reflection, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="ZstdSharp, Version=0.7.1.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
<HintPath>..\packages\ZstdSharp.Port.0.7.1\lib\net461\ZstdSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DB\ClassGen.cs" />
<Compile Include="DB\Stash.cs" />
<Compile Include="DB\User.cs" />
<Compile Include="JSON\Settings.cs" />
<Compile Include="JSON\Stash.cs" />
<Compile Include="Message.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\Encode.cs" />
<Compile Include="Web\PoBLua.cs" />
<Compile Include="Web\PoEPrices.cs" />
<Compile Include="Web\Stash.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.6.5.5\build\Fody.targets" Condition="Exists('..\packages\Fody.6.5.5\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.6.5.5\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.5.5\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets'))" />
</Target>
<Import Project="..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" />
</Project>

68
PoEcoDB/Program.cs Normal file
View File

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB
{
internal class Program
{
public static string version = "1.0.0";
static void Main(string[] args)
{
// Splash
Message.Splash("PoEcoDB", "mikx");
// Setup the base ecosystem
if (!Directory.Exists(@"data")) { Directory.CreateDirectory(@"data"); }
// Args Manager
if (args.Contains("--genclass"))
{
Message.CMW("Getting the latest PoB Community LUA...", true, 1);
Web.PoBLua.GetLatestLUA();
Message.CMW("Generating the latest classes and bases...", true, 1);
DB.ClassGen. ();
Message.CMW("Generation done.", true, 2);
return;
}
if (args.Contains("--user"))
{
if (args.Length > 1)
{
string user = args[1];
Message.CMW($"User \"{user}\" processing...", true, 1);
Message.CMW($"Checking the database for user \"{user}\"...", true, 1);
if (DB.User.CheckUserExists(user))
{
var uid = DB.User.GetUserID(user);
Message.CMW($"User \"{user}\" exists with ID \"{uid}\".", true, 2);
string sessionid = DB.User.GetUserSessionID(user);
int tabindex = 0;
if (args.Contains("--tabindex"))
{
tabindex = Convert.ToInt32(args[3]);
} else
{
tabindex = DB.User.GetUserTabIndex(user);
}
Web.Stash.DownloadStash(sessionid, $"https://www.pathofexile.com/character-window/get-stash-items?league={JSON.Settings.GetLeague()}&tabs=1&tabIndex={tabindex}&accountName={user}", $@"data\stash\{user}.json");
JSON.Stash.GenItemTable(user);
} else
{
Message.CMW($"User \"{ user}\" doesn't exists.", true, 3);
}
} else
{
Message.CMW($"You must specify a user with this argument.", true, 3);
Message.CMW($"Exemple: --user bob", true, 3);
Message.CMW($"Press any key to quit...", true, 1);
Console.ReadKey();
return;
}
return;
}
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("PoEcoDB")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PoEcoDB")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("d31f52d5-abae-435b-a4ef-cc33d6bacb6e")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.Utilities
{
internal class Encode
{
}
}

30
PoEcoDB/Web/PoBLua.cs Normal file
View File

@ -0,0 +1,30 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.Web
{
internal class PoBLua
{
public class LuaRoot
{
public List<string> lua { get; set; }
}
public static void GetLatestLUA()
{
if (!Directory.Exists(@"data\lua")) { Directory.CreateDirectory(@"data\lua"); }
WebClient wc = new WebClient();
LuaRoot lr = JsonConvert.DeserializeObject<LuaRoot>(File.ReadAllText(@"data\lua.json"));
foreach (var l in lr.lua)
{
if(File.Exists($@"data\lua\{l}.lua")) { File.Delete($@"data\lua\{l}.lua"); }
wc.DownloadFile($"https://github.com/PathOfBuildingCommunity/PathOfBuilding/raw/dev/src/Data/Bases/{l}.lua", $@"data\lua\{l}.lua");
}
}
}
}

44
PoEcoDB/Web/PoEPrices.cs Normal file
View File

@ -0,0 +1,44 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.Web
{
internal class PoEPrices
{
public static WebClient web = new WebClient();
public static void GetItemJson(string iid, string b64)
{
web.DownloadFile($"https://www.poeprices.info/api?l={JSON.Settings.GetLeague()}&i={b64}", "tmp/" + iid + ".json");
}
public static Decimal GetMin(string iid)
{
return JsonConvert.DeserializeObject<PoEPricesRoot>(File.ReadAllText("tmp/" + iid + ".json")).min;
}
public static Decimal GetMax(string iid)
{
return JsonConvert.DeserializeObject<PoEPricesRoot>(File.ReadAllText("tmp/" + iid + ".json")).max;
}
public static string GetCurType(string iid)
{
return JsonConvert.DeserializeObject<PoEPricesRoot>(File.ReadAllText("tmp/" + iid + ".json")).currency;
}
public class PoEPricesRoot
{
public Decimal min { get; set; }
public Decimal max { get; set; }
public string currency { get; set; }
}
}
}

34
PoEcoDB/Web/Stash.cs Normal file
View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.Web
{
internal class Stash
{
public static void DownloadStash(string sessionid, string url, string path)
{
WebClient webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
webClient.Headers.Add(HttpRequestHeader.Cookie, "POESESSID=" + sessionid);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
try
{
Uri address = new Uri(url);
webClient.DownloadFile(address, path);
}
catch (WebException ex)
{
Message.CMW(ex.Message, true, 3);
Message.CMW("URL: " + url, true, 3);
}
catch (Exception ex)
{
Message.CMW(ex.Message,true,3);
}
}
}
}

67
PoEcoDB/packages.config Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle.Cryptography" version="2.2.1" targetFramework="net481" />
<package id="Costura.Fody" version="5.7.0" targetFramework="net481" developmentDependency="true" />
<package id="Fody" version="6.5.5" targetFramework="net481" developmentDependency="true" />
<package id="Google.Protobuf" version="3.21.9" targetFramework="net481" />
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net481" />
<package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net481" />
<package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net481" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net481" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net481" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net481" />
<package id="MySql.Data" version="8.2.0" targetFramework="net481" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net481" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net481" />
<package id="System.AppContext" version="4.3.0" targetFramework="net481" />
<package id="System.Buffers" version="4.5.1" targetFramework="net481" />
<package id="System.Collections" version="4.3.0" targetFramework="net481" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net481" />
<package id="System.Configuration.ConfigurationManager" version="4.4.1" targetFramework="net481" />
<package id="System.Console" version="4.3.0" targetFramework="net481" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net481" />
<package id="System.Diagnostics.DiagnosticSource" version="7.0.2" targetFramework="net481" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net481" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net481" />
<package id="System.Globalization" version="4.3.0" targetFramework="net481" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net481" />
<package id="System.IO" version="4.3.0" targetFramework="net481" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net481" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net481" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net481" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net481" />
<package id="System.IO.Pipelines" version="5.0.2" targetFramework="net481" />
<package id="System.Linq" version="4.3.0" targetFramework="net481" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net481" />
<package id="System.Memory" version="4.5.5" targetFramework="net481" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net481" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net481" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net481" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net481" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net481" />
<package id="System.Reflection" version="4.3.0" targetFramework="net481" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net481" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net481" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net481" />
<package id="System.Runtime" version="4.3.0" targetFramework="net481" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net481" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net481" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net481" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net481" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net481" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net481" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net481" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net481" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net481" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net481" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net481" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net481" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net481" />
<package id="System.Threading" version="4.3.0" targetFramework="net481" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net481" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net481" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net481" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net481" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net481" />
<package id="ZstdSharp.Port" version="0.7.1" targetFramework="net481" />
</packages>

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# PoEcoDB
Path of Exile Economist - Database Generator