From f0fd4156bcbe71f8690fd10d7a77f546d86af22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=C2=B7=C3=A6?= <279202647@qq.com> Date: Tue, 25 May 2021 21:28:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=8D=E7=99=BB=E5=BD=95=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=EF=BC=8C=E8=87=AA=E5=8A=A8=E9=80=82=E9=85=8D=E6=97=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=9A=84db=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JdShopListener/JdShopListener/App.xaml.cs | 10 +- .../JdShopListener/JdShopListener.csproj | 15 +++ .../JdShopListener/MainWindowViewModel.cs | 1 + .../Properties/Resources.Designer.cs | 73 +++++++++++ .../JdShopListener/Properties/Resources.resx | 124 ++++++++++++++++++ 5 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 JdShopListener/JdShopListener/Properties/Resources.Designer.cs create mode 100644 JdShopListener/JdShopListener/Properties/Resources.resx diff --git a/JdShopListener/JdShopListener/App.xaml.cs b/JdShopListener/JdShopListener/App.xaml.cs index c0d1580..0157080 100644 --- a/JdShopListener/JdShopListener/App.xaml.cs +++ b/JdShopListener/JdShopListener/App.xaml.cs @@ -15,7 +15,15 @@ namespace JdShopListener { public App() { - + if (!System.IO.Directory.Exists("db")) + { + System.IO.Directory.CreateDirectory("db"); + } + if (!System.IO.File.Exists("db\\items.db")) + { + System.IO.File.WriteAllBytes("db\\items.db", JdShopListener.Properties.Resources.items); + } + } } } diff --git a/JdShopListener/JdShopListener/JdShopListener.csproj b/JdShopListener/JdShopListener/JdShopListener.csproj index 1153a9f..3b6f303 100644 --- a/JdShopListener/JdShopListener/JdShopListener.csproj +++ b/JdShopListener/JdShopListener/JdShopListener.csproj @@ -29,6 +29,21 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + PreserveNewest diff --git a/JdShopListener/JdShopListener/MainWindowViewModel.cs b/JdShopListener/JdShopListener/MainWindowViewModel.cs index f2f243d..c3a5b04 100644 --- a/JdShopListener/JdShopListener/MainWindowViewModel.cs +++ b/JdShopListener/JdShopListener/MainWindowViewModel.cs @@ -29,6 +29,7 @@ namespace JdShopListener public string JDCookie { get; set; } public MainWindowViewModel() { + ProList = new System.Collections.ObjectModel.ObservableCollection() { new ProModel(){ Name="价格" , Type= ProType.Price}, new ProModel(){ Name="活动" , Type= ProType.Active}, diff --git a/JdShopListener/JdShopListener/Properties/Resources.Designer.cs b/JdShopListener/JdShopListener/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0ac4940 --- /dev/null +++ b/JdShopListener/JdShopListener/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace JdShopListener.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JdShopListener.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Byte[] 类型的本地化资源。 + /// + internal static byte[] items { + get { + object obj = ResourceManager.GetObject("items", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/JdShopListener/JdShopListener/Properties/Resources.resx b/JdShopListener/JdShopListener/Properties/Resources.resx new file mode 100644 index 0000000..d914c05 --- /dev/null +++ b/JdShopListener/JdShopListener/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\db\items.db;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file