diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx b/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx deleted file mode 100644 index c573253..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx b/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx deleted file mode 100644 index c573253..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx new file mode 100644 index 0000000..3a88d11 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx b/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx deleted file mode 100644 index c573253..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx new file mode 100644 index 0000000..3a88d11 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f236e9b..0f5aea6 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx b/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx deleted file mode 100644 index c573253..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx new file mode 100644 index 0000000..3a88d11 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f236e9b..0f5aea6 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index cb5532c..953c042 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -34,6 +34,10 @@ 4 + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + True + ..\packages\CommonServiceLocator.2.0.2\lib\net47\CommonServiceLocator.dll True @@ -50,11 +54,32 @@ ..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + True + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + True + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + True + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + True + ..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll True + + + ..\packages\MySql.Data.8.0.30\lib\net48\MySql.Data.dll + True + ..\packages\Newtonsoft.Json.13.0.2-beta1\lib\net45\Newtonsoft.Json.dll True @@ -80,8 +105,13 @@ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll True + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll True @@ -107,6 +137,7 @@ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll True + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll True @@ -119,9 +150,17 @@ 4.0 + + ..\packages\MySql.Data.8.0.30\lib\net48\Ubiety.Dns.Core.dll + True + + + ..\packages\MySql.Data.8.0.30\lib\net48\ZstdNet.dll + True + @@ -129,6 +168,7 @@ Designer + diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx b/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx deleted file mode 100644 index c573253..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx new file mode 100644 index 0000000..3a88d11 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f236e9b..0f5aea6 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index cb5532c..953c042 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -34,6 +34,10 @@ 4 + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + True + ..\packages\CommonServiceLocator.2.0.2\lib\net47\CommonServiceLocator.dll True @@ -50,11 +54,32 @@ ..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + True + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + True + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + True + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + True + ..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll True + + + ..\packages\MySql.Data.8.0.30\lib\net48\MySql.Data.dll + True + ..\packages\Newtonsoft.Json.13.0.2-beta1\lib\net45\Newtonsoft.Json.dll True @@ -80,8 +105,13 @@ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll True + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll True @@ -107,6 +137,7 @@ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll True + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll True @@ -119,9 +150,17 @@ 4.0 + + ..\packages\MySql.Data.8.0.30\lib\net48\Ubiety.Dns.Core.dll + True + + + ..\packages\MySql.Data.8.0.30\lib\net48\ZstdNet.dll + True + @@ -129,6 +168,7 @@ Designer + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs new file mode 100644 index 0000000..21137e1 --- /dev/null +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -0,0 +1,21 @@ +using MySql.Data.MySqlClient; + +namespace SubCabinetSolution.Utils +{ + public class DataBaseManager + { + private static DataBaseManager _dataBase; + + public static DataBaseManager GetInstance() + { + return _dataBase ?? (_dataBase = new DataBaseManager()); + } + + public MySqlConnection GetConnection() + { + MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + connection.Open(); + return connection; + } + } +} \ No newline at end of file diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx b/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx deleted file mode 100644 index c573253..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx new file mode 100644 index 0000000..3a88d11 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f236e9b..0f5aea6 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index cb5532c..953c042 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -34,6 +34,10 @@ 4 + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + True + ..\packages\CommonServiceLocator.2.0.2\lib\net47\CommonServiceLocator.dll True @@ -50,11 +54,32 @@ ..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + True + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + True + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + True + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + True + ..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll True + + + ..\packages\MySql.Data.8.0.30\lib\net48\MySql.Data.dll + True + ..\packages\Newtonsoft.Json.13.0.2-beta1\lib\net45\Newtonsoft.Json.dll True @@ -80,8 +105,13 @@ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll True + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll True @@ -107,6 +137,7 @@ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll True + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll True @@ -119,9 +150,17 @@ 4.0 + + ..\packages\MySql.Data.8.0.30\lib\net48\Ubiety.Dns.Core.dll + True + + + ..\packages\MySql.Data.8.0.30\lib\net48\ZstdNet.dll + True + @@ -129,6 +168,7 @@ Designer + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs new file mode 100644 index 0000000..21137e1 --- /dev/null +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -0,0 +1,21 @@ +using MySql.Data.MySqlClient; + +namespace SubCabinetSolution.Utils +{ + public class DataBaseManager + { + private static DataBaseManager _dataBase; + + public static DataBaseManager GetInstance() + { + return _dataBase ?? (_dataBase = new DataBaseManager()); + } + + public MySqlConnection GetConnection() + { + MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + connection.Open(); + return connection; + } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/Utils/LocalConstant.cs b/SubCabinetSolution/Utils/LocalConstant.cs index 3051ea5..5955060 100644 --- a/SubCabinetSolution/Utils/LocalConstant.cs +++ b/SubCabinetSolution/Utils/LocalConstant.cs @@ -3,5 +3,8 @@ public static class LocalConstant { public const string BaseHttpUrl = "http://111.198.10.15:11311"; + + public const string MysqlConfig = + "server=111.198.10.15;port=11336;Database=casic_mobile_shelter;username=root;password=Casic203;"; } } \ No newline at end of file diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx b/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx deleted file mode 100644 index c573253..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx new file mode 100644 index 0000000..3a88d11 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f236e9b..0f5aea6 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index cb5532c..953c042 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -34,6 +34,10 @@ 4 + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + True + ..\packages\CommonServiceLocator.2.0.2\lib\net47\CommonServiceLocator.dll True @@ -50,11 +54,32 @@ ..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + True + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + True + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + True + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + True + ..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll True + + + ..\packages\MySql.Data.8.0.30\lib\net48\MySql.Data.dll + True + ..\packages\Newtonsoft.Json.13.0.2-beta1\lib\net45\Newtonsoft.Json.dll True @@ -80,8 +105,13 @@ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll True + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll True @@ -107,6 +137,7 @@ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll True + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll True @@ -119,9 +150,17 @@ 4.0 + + ..\packages\MySql.Data.8.0.30\lib\net48\Ubiety.Dns.Core.dll + True + + + ..\packages\MySql.Data.8.0.30\lib\net48\ZstdNet.dll + True + @@ -129,6 +168,7 @@ Designer + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs new file mode 100644 index 0000000..21137e1 --- /dev/null +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -0,0 +1,21 @@ +using MySql.Data.MySqlClient; + +namespace SubCabinetSolution.Utils +{ + public class DataBaseManager + { + private static DataBaseManager _dataBase; + + public static DataBaseManager GetInstance() + { + return _dataBase ?? (_dataBase = new DataBaseManager()); + } + + public MySqlConnection GetConnection() + { + MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + connection.Open(); + return connection; + } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/Utils/LocalConstant.cs b/SubCabinetSolution/Utils/LocalConstant.cs index 3051ea5..5955060 100644 --- a/SubCabinetSolution/Utils/LocalConstant.cs +++ b/SubCabinetSolution/Utils/LocalConstant.cs @@ -3,5 +3,8 @@ public static class LocalConstant { public const string BaseHttpUrl = "http://111.198.10.15:11311"; + + public const string MysqlConfig = + "server=111.198.10.15;port=11336;Database=casic_mobile_shelter;username=root;password=Casic203;"; } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index a54218b..67a6f63 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -1,9 +1,9 @@ +using System.Data; using System.Diagnostics; using System.Windows; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; -using Newtonsoft.Json; -using SubCabinetSolution.Model; +using MySql.Data.MySqlClient; using SubCabinetSolution.Utils; namespace SubCabinetSolution.ViewModel @@ -43,12 +43,14 @@ public RelayCommand LoginToMainCommand { get; set; } public string VersionName { get; set; } + private MySqlConnection connection; + /// /// Initializes a new instance of the MainViewModel class. /// public MainViewModel() { - + this.connection = DataBaseManager.GetInstance().GetConnection(); this.LoginToMainCommand = new RelayCommand(Login); this.VersionName = "版本号 Ver " + Application.ResourceAssembly.GetName().Version; } @@ -72,8 +74,30 @@ // string publicKey = HttpRequestHandler.GetPublicKey(LocalConstant.BaseHttpUrl + "/config/baseConfig"); // PublicKeyModel keyModel = JsonConvert.DeserializeObject(publicKey); // Debug.WriteLine(keyModel.data.publicKey); - - + + if (connection.State == ConnectionState.Open) + { + string selectUser = "select * from sys_user"; + MySqlCommand cmd = new MySqlCommand(selectUser, connection); + MySqlDataReader reader = cmd.ExecuteReader(); + while (reader.Read()) + { + string account = reader.GetString("ACCOUNT"); + string secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码 + // 解码得到密码 + if (account != userName || secretKey != userPassword) continue; + MessageBox.Show("登录成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information); + reader.Close(); + return; + } + + MessageBox.Show("账号或者密码错误,无法登录", "错误", MessageBoxButton.OK, MessageBoxImage.Error); + reader.Close(); + } + else + { + MessageBox.Show("数据库连接异常,请检查数据库配置", "错误", MessageBoxButton.OK, MessageBoxImage.Error); + } } } } \ No newline at end of file diff --git a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx b/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx deleted file mode 100644 index 8215540..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/60f96239-a4ce-4baf-8c6c-4ec562af8357.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx new file mode 100644 index 0000000..5c61392 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/8ce3bcd5-2fdb-4151-a4a8-35cef80a5d18.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx b/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx deleted file mode 100644 index c573253..0000000 --- a/.vs/SubCabinetSolution/FileContentIndex/9e0e7f83-5214-44fe-a97a-f4e7901c523c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx new file mode 100644 index 0000000..3a88d11 --- /dev/null +++ b/.vs/SubCabinetSolution/FileContentIndex/d1c96c45-6c51-4d35-80c0-eb2b9c43ed44.vsidx Binary files differ diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f236e9b..0f5aea6 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index cb5532c..953c042 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -34,6 +34,10 @@ 4 + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + True + ..\packages\CommonServiceLocator.2.0.2\lib\net47\CommonServiceLocator.dll True @@ -50,11 +54,32 @@ ..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + True + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + True + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + True + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + True + ..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll True + + + ..\packages\MySql.Data.8.0.30\lib\net48\MySql.Data.dll + True + ..\packages\Newtonsoft.Json.13.0.2-beta1\lib\net45\Newtonsoft.Json.dll True @@ -80,8 +105,13 @@ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll True + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll True @@ -107,6 +137,7 @@ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll True + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll True @@ -119,9 +150,17 @@ 4.0 + + ..\packages\MySql.Data.8.0.30\lib\net48\Ubiety.Dns.Core.dll + True + + + ..\packages\MySql.Data.8.0.30\lib\net48\ZstdNet.dll + True + @@ -129,6 +168,7 @@ Designer + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs new file mode 100644 index 0000000..21137e1 --- /dev/null +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -0,0 +1,21 @@ +using MySql.Data.MySqlClient; + +namespace SubCabinetSolution.Utils +{ + public class DataBaseManager + { + private static DataBaseManager _dataBase; + + public static DataBaseManager GetInstance() + { + return _dataBase ?? (_dataBase = new DataBaseManager()); + } + + public MySqlConnection GetConnection() + { + MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + connection.Open(); + return connection; + } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/Utils/LocalConstant.cs b/SubCabinetSolution/Utils/LocalConstant.cs index 3051ea5..5955060 100644 --- a/SubCabinetSolution/Utils/LocalConstant.cs +++ b/SubCabinetSolution/Utils/LocalConstant.cs @@ -3,5 +3,8 @@ public static class LocalConstant { public const string BaseHttpUrl = "http://111.198.10.15:11311"; + + public const string MysqlConfig = + "server=111.198.10.15;port=11336;Database=casic_mobile_shelter;username=root;password=Casic203;"; } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index a54218b..67a6f63 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -1,9 +1,9 @@ +using System.Data; using System.Diagnostics; using System.Windows; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; -using Newtonsoft.Json; -using SubCabinetSolution.Model; +using MySql.Data.MySqlClient; using SubCabinetSolution.Utils; namespace SubCabinetSolution.ViewModel @@ -43,12 +43,14 @@ public RelayCommand LoginToMainCommand { get; set; } public string VersionName { get; set; } + private MySqlConnection connection; + /// /// Initializes a new instance of the MainViewModel class. /// public MainViewModel() { - + this.connection = DataBaseManager.GetInstance().GetConnection(); this.LoginToMainCommand = new RelayCommand(Login); this.VersionName = "版本号 Ver " + Application.ResourceAssembly.GetName().Version; } @@ -72,8 +74,30 @@ // string publicKey = HttpRequestHandler.GetPublicKey(LocalConstant.BaseHttpUrl + "/config/baseConfig"); // PublicKeyModel keyModel = JsonConvert.DeserializeObject(publicKey); // Debug.WriteLine(keyModel.data.publicKey); - - + + if (connection.State == ConnectionState.Open) + { + string selectUser = "select * from sys_user"; + MySqlCommand cmd = new MySqlCommand(selectUser, connection); + MySqlDataReader reader = cmd.ExecuteReader(); + while (reader.Read()) + { + string account = reader.GetString("ACCOUNT"); + string secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码 + // 解码得到密码 + if (account != userName || secretKey != userPassword) continue; + MessageBox.Show("登录成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information); + reader.Close(); + return; + } + + MessageBox.Show("账号或者密码错误,无法登录", "错误", MessageBoxButton.OK, MessageBoxImage.Error); + reader.Close(); + } + else + { + MessageBox.Show("数据库连接异常,请检查数据库配置", "错误", MessageBoxButton.OK, MessageBoxImage.Error); + } } } } \ No newline at end of file diff --git a/SubCabinetSolution/packages.config b/SubCabinetSolution/packages.config index a7b6845..30fa433 100644 --- a/SubCabinetSolution/packages.config +++ b/SubCabinetSolution/packages.config @@ -1,10 +1,16 @@  + + + + + +