提交记录修改Core/Core.csproj+1 −0看文件
新增Core/Librarys/FileHelper.cs+24 −0看文件
修改Core/Librarys/SQLite/TaiDbContext.cs+4 −10看文件
修改UI/Controls/Window/DefaultWindow.cs+2 −2看文件
修改UI/Librays/Image/Imager.cs+7 −1看文件
| @@ -150,6 +150,7 @@ | ||
| 150 | 150 | <Compile Include="Librarys\Browser\Favicon\ChromeFaviconManager.cs" /> |
| 151 | 151 | <Compile Include="Librarys\Browser\Favicon\IFaviconManager.cs" /> |
| 152 | 152 | <Compile Include="Librarys\Browser\UrlHelper.cs" /> |
| 153 | 新增: <Compile Include="Librarys\FileHelper.cs" /> | |
| 153 | 154 | <Compile Include="Librarys\ProcessHelper.cs" /> |
| 154 | 155 | <Compile Include="Librarys\RegexHelper.cs" /> |
| 155 | 156 | <Compile Include="Librarys\Shortcut.cs" /> |
| @@ -0,0 +1,24 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.IO; | |
| 4 | 新增:using System.Linq; | |
| 5 | 新增:using System.Text; | |
| 6 | 新增:using System.Threading.Tasks; | |
| 7 | 新增: | |
| 8 | 新增:namespace Core.Librarys | |
| 9 | 新增:{ | |
| 10 | 新增: /// <summary> | |
| 11 | 新增: /// 文件操作帮助类 | |
| 12 | 新增: /// </summary> | |
| 13 | 新增: public class FileHelper | |
| 14 | 新增: { | |
| 15 | 新增: /// <summary> | |
| 16 | 新增: /// 获取根目录 | |
| 17 | 新增: /// </summary> | |
| 18 | 新增: /// <returns></returns> | |
| 19 | 新增: public static string GetRootDirectory() | |
| 20 | 新增: { | |
| 21 | 新增: return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); | |
| 22 | 新增: } | |
| 23 | 新增: } | |
| 24 | 新增:} | |
| @@ -5,6 +5,7 @@ using System.Collections.Generic; | ||
| 5 | 5 | using System.Data.Entity; |
| 6 | 6 | using System.Data.SQLite; |
| 7 | 7 | using System.Diagnostics; |
| 8 | 新增:using System.IO; | |
| 8 | 9 | using System.Linq; |
| 9 | 10 | using System.Text; |
| 10 | 11 | using System.Threading.Tasks; |
| @@ -29,7 +30,7 @@ namespace Core.Librarys.SQLite | ||
| 29 | 30 | /// <summary> |
| 30 | 31 | /// 网站 |
| 31 | 32 | /// </summary> |
| 32 | 删除: public DbSet<WebSiteModel> WebSites{ get; set; } | |
| 33 | 新增: public DbSet<WebSiteModel> WebSites { get; set; } | |
| 33 | 34 | /// <summary> |
| 34 | 35 | /// 网站分类 |
| 35 | 36 | /// </summary> |
| @@ -43,18 +44,11 @@ namespace Core.Librarys.SQLite | ||
| 43 | 44 | /// </summary> |
| 44 | 45 | public DbSet<WebUrlModel> WebUrls { get; set; } |
| 45 | 46 | |
| 46 | 删除: | |
| 47 | 删除: // public StatisticContext(string n) | |
| 48 | 删除: //: base("StatisticContext") | |
| 49 | 删除: // { | |
| 50 | 删除: // DbConfiguration.SetConfiguration(new SQLiteConfiguration()); | |
| 51 | 删除: // } | |
| 52 | 删除: | |
| 53 | 删除: | |
| 47 | 新增: private static string _dbFilePath = Path.Combine(FileHelper.GetRootDirectory(), "Data", "data.db"); | |
| 54 | 48 | public TaiDbContext() |
| 55 | 49 | : base(new SQLiteConnection() |
| 56 | 50 | { |
| 57 | 删除: ConnectionString = "Data Source=.\\Data\\data.db" | |
| 51 | 新增: ConnectionString = $"Data Source={_dbFilePath}" | |
| 58 | 52 | }, true) |
| 59 | 53 | { |
| 60 | 54 | DbConfiguration.SetConfiguration(new SQLiteConfiguration()); |
| @@ -204,8 +204,8 @@ namespace UI.Controls.Window | ||
| 204 | 204 | // 获取程序图标 |
| 205 | 205 | if (Icon == null) |
| 206 | 206 | { |
| 207 | 删除: Icon = ToImageSource(System.Drawing.Icon.ExtractAssociatedIcon( | |
| 208 | 删除: System.Reflection.Assembly.GetEntryAssembly().ManifestModule.Name)); | |
| 207 | 新增: string exeFilePath = System.Reflection.Assembly.GetExecutingAssembly().Location; | |
| 208 | 新增: Icon = ToImageSource(System.Drawing.Icon.ExtractAssociatedIcon(exeFilePath)); | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | Loaded += window_Loaded; |
| @@ -38,9 +38,15 @@ namespace Core.Librarys.Image | ||
| 38 | 38 | } |
| 39 | 39 | else |
| 40 | 40 | { |
| 41 | 新增: if (filePath.IndexOf(":") == -1) | |
| 42 | 新增: { | |
| 43 | 新增: // 不是绝对路径 | |
| 44 | 新增: filePath = Path.Combine(FileHelper.GetRootDirectory(), filePath); | |
| 45 | 新增: } | |
| 46 | 新增: | |
| 41 | 47 | if (!File.Exists(filePath)) |
| 42 | 48 | { |
| 43 | 删除: return null; | |
| 49 | 新增: throw new FileNotFoundException(filePath); | |
| 44 | 50 | } |
| 45 | 51 | byte[] imageData; |
| 46 | 52 | using (var fileStream = new FileStream(@filePath, FileMode.Open, FileAccess.Read)) |

