Browse Source

添加皮肤dll,添加日志等级策略

yuzhengyang 8 years ago
parent
commit
1f2b15a37a
91 changed files with 737 additions and 8 deletions
  1. BIN
      Fork.Net/Dlls/IrisSkin4/IrisSkin4.dll
  2. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Calmness.ssk
  3. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/CalmnessColor1.ssk
  4. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/CalmnessColor2.ssk
  5. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/DeepCyan.ssk
  6. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/DeepGreen.ssk
  7. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/DeepOrange.ssk
  8. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/DiamondBlue.ssk
  9. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/DiamondGreen.ssk
  10. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/DiamondOlive.ssk
  11. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/DiamondPurple.ssk
  12. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/DiamondRed.ssk
  13. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Eighteen.ssk
  14. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/EighteenColor1.ssk
  15. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/EighteenColor2.ssk
  16. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Emerald.ssk
  17. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/EmeraldColor1.ssk
  18. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/EmeraldColor2.ssk
  19. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/EmeraldColor3.ssk
  20. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/GlassBrown.ssk
  21. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/GlassGreen.ssk
  22. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/GlassOrange.ssk
  23. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Longhorn.ssk
  24. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/MSN.ssk
  25. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/MacOS.ssk
  26. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Midsummer.ssk
  27. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/MidsummerColor1.ssk
  28. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/MidsummerColor2.ssk
  29. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/MidsummerColor3.ssk
  30. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/OneBlue.ssk
  31. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/OneCyan.ssk
  32. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/OneGreen.ssk
  33. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/OneOrange.ssk
  34. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Page.ssk
  35. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/PageColor1.ssk
  36. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/PageColor2.ssk
  37. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/RealOne.ssk
  38. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Silver.ssk
  39. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SilverColor1.ssk
  40. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SilverColor2.ssk
  41. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SportsBlack.ssk
  42. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SportsBlue.ssk
  43. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SportsCyan.ssk
  44. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SportsGreen.ssk
  45. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SportsOrange.ssk
  46. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SteelBlack.ssk
  47. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/SteelBlue.ssk
  48. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color1.ssk
  49. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color2.ssk
  50. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color3.ssk
  51. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color4.ssk
  52. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color5.ssk
  53. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color6.ssk
  54. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color7.ssk
  55. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Warm.ssk
  56. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/WarmColor1.ssk
  57. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/WarmColor2.ssk
  58. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/WarmColor3.ssk
  59. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/Wave.ssk
  60. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/WaveColor1.ssk
  61. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/WaveColor2.ssk
  62. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/XPBlue.ssk
  63. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/XPGreen.ssk
  64. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/XPOrange.ssk
  65. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/XPSilver.ssk
  66. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/mp10.ssk
  67. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/mp10green.ssk
  68. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/mp10maroon.ssk
  69. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/mp10mulberry.ssk
  70. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/mp10pink.ssk
  71. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/mp10purple.ssk
  72. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/office2007.ssk
  73. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/vista1.ssk
  74. BIN
      Fork.Net/Dlls/IrisSkin4/Skins/vista1_green.ssk
  75. BIN
      Fork.Net/Dlls/LayeredSkin/LayeredSkin.dll
  76. 17 0
      Fork.Net/Y.DB/App.config
  77. 33 0
      Fork.Net/Y.DB/DAO/DbTable.cs
  78. 24 0
      Fork.Net/Y.DB/DAO/IDbContext.cs
  79. 160 0
      Fork.Net/Y.DB/DAO/Muse.cs
  80. 30 0
      Fork.Net/Y.DB/DAO/SuperDb.cs
  81. 19 0
      Fork.Net/Y.DB/Migrations/MigraConf.cs
  82. 36 0
      Fork.Net/Y.DB/Properties/AssemblyInfo.cs
  83. 81 0
      Fork.Net/Y.DB/Y.DB.csproj
  84. 4 0
      Fork.Net/Y.DB/packages.config
  85. 22 0
      Fork.Net/Y.Utils/AppUtils/AppUnique.cs
  86. 47 0
      Fork.Net/Y.Utils/FileUtils/FileTool.cs
  87. 199 0
      Fork.Net/Y.Utils/HttpUtils/HttpTool.cs
  88. 13 8
      Fork.Net/Y.Utils/LogUtils/Log.cs
  89. 20 0
      Fork.Net/Y.Utils/LogUtils/LogLevel.cs
  90. 28 0
      Fork.Net/Y.Utils/WindowsAPI/ScreenCapture.cs
  91. 4 0
      Fork.Net/Y.Utils/Y.Utils.csproj

BIN
Fork.Net/Dlls/IrisSkin4/IrisSkin4.dll


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Calmness.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/CalmnessColor1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/CalmnessColor2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/DeepCyan.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/DeepGreen.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/DeepOrange.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/DiamondBlue.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/DiamondGreen.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/DiamondOlive.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/DiamondPurple.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/DiamondRed.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Eighteen.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/EighteenColor1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/EighteenColor2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Emerald.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/EmeraldColor1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/EmeraldColor2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/EmeraldColor3.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/GlassBrown.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/GlassGreen.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/GlassOrange.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Longhorn.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/MSN.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/MacOS.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Midsummer.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/MidsummerColor1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/MidsummerColor2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/MidsummerColor3.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/OneBlue.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/OneCyan.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/OneGreen.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/OneOrange.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Page.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/PageColor1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/PageColor2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/RealOne.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Silver.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SilverColor1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SilverColor2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SportsBlack.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SportsBlue.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SportsCyan.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SportsGreen.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SportsOrange.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SteelBlack.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/SteelBlue.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color3.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color4.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color5.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color6.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Vista2_color7.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Warm.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/WarmColor1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/WarmColor2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/WarmColor3.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/Wave.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/WaveColor1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/WaveColor2.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/XPBlue.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/XPGreen.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/XPOrange.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/XPSilver.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/mp10.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/mp10green.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/mp10maroon.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/mp10mulberry.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/mp10pink.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/mp10purple.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/office2007.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/vista1.ssk


BIN
Fork.Net/Dlls/IrisSkin4/Skins/vista1_green.ssk


BIN
Fork.Net/Dlls/LayeredSkin/LayeredSkin.dll


+ 17 - 0
Fork.Net/Y.DB/App.config

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <entityFramework>
+    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
+      <parameters>
+        <parameter value="mssqllocaldb" />
+      </parameters>
+    </defaultConnectionFactory>
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+    </providers>
+  </entityFramework>
+</configuration>

+ 33 - 0
Fork.Net/Y.DB/DAO/DbTable.cs

@@ -0,0 +1,33 @@
+using System.Data.Entity;
+using Waka.Model.Album;
+using Waka.Model.Marx;
+using Waka.Model.Support;
+using Waka.Model.Waka;
+
+namespace Y.DB.DAO
+{
+    class DbTable : SuperDb
+    {
+        public DbTable()
+            : base()
+        {
+        }
+
+        #region 数据库表
+        public DbSet<Users> Users { get; set; }
+        public DbSet<RequestAuths> RequestAuths { get; set; }
+
+        public DbSet<Heartbeats> Heartbeats { get; set; }
+        public DbSet<Photos> Photos { get; set; }
+        public DbSet<SupportHellos> SupportHellos { get; set; }
+        public DbSet<MarxDatas> MarxDatas { get; set; }
+        #endregion
+
+
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+            //一对一关系
+            //modelBuilder.Entity<Class1>().HasRequired(p => p.Users).WithOptional(p => p.Class1);
+        }
+    }
+}

+ 24 - 0
Fork.Net/Y.DB/DAO/IDbContext.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Y.DB.DAO
+{
+    /// <summary>
+    /// 数据通信接口
+    /// </summary>
+    public interface IDbContext : IDisposable
+    {
+        bool Add<T>(T EntityObj, bool isSave) where T : class;
+        bool Del<T>(T EntityObj, bool isSave) where T : class;
+        bool Update<T>(T EntityObj, bool isSave) where T : class;
+        bool Save();
+        T Get<T>(Expression<Func<T, bool>> expression, string[] include) where T : class;
+        IEnumerable<T> Gets<T>(Expression<Func<T, bool>> expression, string[] include) where T : class;
+        IEnumerable<T> GetAll<T>(string[] include,bool track) where T : class;
+        IEnumerable<T> ExecuteSqlCom<T, U>(string sql, U paramObjs) where T : class where U : class;
+    }
+}

+ 160 - 0
Fork.Net/Y.DB/DAO/Muse.cs

@@ -0,0 +1,160 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Y.DB.DAO
+{
+    public class Muse : IDbContext
+    {
+        DbTable db;
+        public Muse()
+        {
+            db = new DbTable();
+        }
+
+        public bool Add<T>(T EntityObj, bool isSave = true) where T : class
+        {
+            try
+            {
+                this.db.Set<T>().Add(EntityObj);
+                if (isSave)
+                {
+                    return Save();
+                }
+            }
+            catch (Exception e) { }
+            return false;
+        }
+        public bool Del<T>(T EntityObj, bool isSave) where T : class
+        {
+            try
+            {
+                this.db.Set<T>().Remove(EntityObj);
+                if (isSave)
+                {
+                    return Save();
+                }
+                return false;
+            }
+            catch (Exception e) { }
+            return false;
+        }
+        public bool Update<T>(T EntityObj, bool isSave) where T : class
+        {
+            try
+            {
+                this.db.Entry(EntityObj).State = EntityState.Modified;
+                if (isSave)
+                {
+                    return Save();
+                }
+                return false;
+            }
+            catch (Exception e) { }
+            return false;
+        }
+        public bool Save()
+        {
+            return db.SaveChanges() > 0;
+        }
+
+        public T Get<T>(Expression<Func<T, bool>> expression, string[] include) where T : class
+        {
+            try
+            {
+                if (include != null && include.Count() > 0)
+                {
+                    DbQuery<T> query = GetInclude<T>(include);
+                    if (query != null)
+                        return query.FirstOrDefault(expression);
+                }
+                return this.db.Set<T>().FirstOrDefault(expression);
+            }
+            catch (Exception e)
+            {
+            }
+            return null;
+        }
+        public IEnumerable<T> Gets<T>(Expression<Func<T, bool>> expression, string[] include) where T : class
+        {
+            try
+            {
+                if (include != null && include.Count() > 0)
+                {
+                    DbQuery<T> query = GetInclude<T>(include);
+                    if (query != null)
+                        return query.Where(expression).ToList();
+                }
+            }
+            catch (Exception)
+            {
+                throw;
+            }
+            return db.Set<T>().Where(expression).ToList();
+        }
+        public IEnumerable<T> GetAll<T>(string[] include, bool track) where T : class
+        {
+            if (include != null && include.Count() > 0)
+            {
+                DbQuery<T> query = GetInclude<T>(include);
+                if (query != null)
+                    if (track)
+                        return query.ToList();
+                    else
+                        return query.AsNoTracking().ToList();
+            }
+            if (!track)
+                db.Set<T>().AsNoTracking().ToList();
+            return db.Set<T>().ToList();
+        }
+        private DbQuery<T> GetInclude<T>(string[] include) where T : class
+        {
+            DbQuery<T> searchCondition = null;
+            foreach (var item in include)
+            {
+                if (searchCondition == null)
+                    searchCondition = this.db.Set<T>().Include(item);
+                else
+                    searchCondition = searchCondition.Include(item);
+            }
+            return searchCondition;
+        }
+
+        public bool Any<T>(Expression<Func<T, bool>> expression, string[] include) where T : class
+        {
+            try
+            {
+                if (include != null && include.Count() > 0)
+                {
+                    DbQuery<T> query = GetInclude<T>(include);
+                    if (query != null)
+                        return query.Any(expression);
+                }
+                return this.db.Set<T>().Any(expression);
+            }
+            catch (Exception e)
+            {
+            }
+            return false;
+        }
+        public DbSet<T> Do<T>() where T : class
+        {
+            return db.Set<T>();
+        }
+        public void Dispose()
+        {
+            db.Dispose();
+        }
+        public IEnumerable<T> ExecuteSqlCom<T, U>(string sql, U paramObjs)
+            where U : class
+            where T : class
+        {
+            return db.Set<T>().SqlQuery(sql, paramObjs);
+        }
+    }
+}

+ 30 - 0
Fork.Net/Y.DB/DAO/SuperDb.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Data.Entity.ModelConfiguration.Conventions;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Y.DB.Migrations;
+
+namespace Y.DB.DAO
+{
+    /// <summary>
+    /// SuperDb 中完成数据库的配置
+    /// </summary>
+    public class SuperDb : DbContext
+    {
+        public SuperDb()
+            : base("SQLServerConnection")//SQLServerConnection//DefaultConnection
+        {
+            //设置数据迁移配置
+            Database.SetInitializer(new MigrateDatabaseToLatestVersion<DbTable, MigraConf>());
+        }
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+            //去掉复数映射
+            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
+            base.OnModelCreating(modelBuilder);
+        }
+    }
+}

+ 19 - 0
Fork.Net/Y.DB/Migrations/MigraConf.cs

@@ -0,0 +1,19 @@
+using System.Data.Entity.Migrations;
+using Y.DB.DAO;
+
+namespace Y.DB.Migrations
+{
+    internal sealed class MigraConf : DbMigrationsConfiguration<DbTable>
+    {
+        public MigraConf()
+        {
+            AutomaticMigrationsEnabled = true;
+            AutomaticMigrationDataLossAllowed = true;
+            //ContextKey = "ContextKey";
+        }
+
+        protected override void Seed(DbTable context)
+        {
+        }
+    }
+}

+ 36 - 0
Fork.Net/Y.DB/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("Y.DB")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Y.DB")]
+[assembly: AssemblyCopyright("Copyright ©  2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//将 ComVisible 设置为 false 将使此程序集中的类型
+//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("3eca2cc6-55c2-433f-a617-a7376e455f7c")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 81 - 0
Fork.Net/Y.DB/Y.DB.csproj

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <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>{3ECA2CC6-55C2-433F-A617-A7376E455F7C}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Y.DB</RootNamespace>
+    <AssemblyName>Y.DB</AssemblyName>
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <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' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="DAO\DbTable.cs" />
+    <Compile Include="DAO\IDbContext.cs" />
+    <Compile Include="DAO\Muse.cs" />
+    <Compile Include="DAO\SuperDb.cs" />
+    <Compile Include="Migrations\MigraConf.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Waka.Model\Waka.Model.csproj">
+      <Project>{147404dc-ed7d-454a-a7ad-a95c0ed39168}</Project>
+      <Name>Waka.Model</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\WakaTime.Model\WakaTime.Model.csproj">
+      <Project>{db1d10e6-1ed9-46d6-a13c-bf90fd611932}</Project>
+      <Name>WakaTime.Model</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 4 - 0
Fork.Net/Y.DB/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
+</packages>

+ 22 - 0
Fork.Net/Y.Utils/AppUtils/AppUnique.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+
+namespace Y.Utils.AppUtils
+{
+    public sealed class AppUnique
+    {
+        /// <summary>
+        /// 判断应用在当前系统实例下是否唯一
+        /// </summary>
+        /// <param name="appName"></param>
+        /// <returns></returns>
+        public static bool IsUnique(string appName)
+        {
+            bool unique;
+            Mutex run = new Mutex(true, appName, out unique);
+            return unique;
+        }
+    }
+}

+ 47 - 0
Fork.Net/Y.Utils/FileUtils/FileTool.cs

@@ -160,5 +160,52 @@ namespace Y.Utils.FileUtils
             }
             return result;
         }
+        public static long Size(string fileName)
+        {
+            FileInfo fi = new FileInfo(fileName);
+            return fi.Length;
+        }
+
+        public static string SizeFormat(string fileName)
+        {
+            return SizeFormat(Size(fileName));
+        }
+        public static string SizeFormat(long size)
+        {
+            string rs = "";
+            if (size > 1024 * 1024 * 1024)
+            {
+                rs = Math.Round((double)size / 1024 / 1024 / 1024, 2) + " GB";
+            }
+            else if (size > 1024 * 1024)
+            {
+                rs = Math.Round((double)size / 1024 / 1024, 2) + " MB";
+            }
+            else if (size > 1024)
+            {
+                rs = Math.Round((double)size / 1024, 2) + " KB";
+            }
+            else
+            {
+                rs = size + " B";
+            }
+            return rs;
+        }
+        public static string SizeConvert(string fileName, string unit)
+        {
+            return SizeConvert(Size(fileName), unit);
+        }
+        public static string SizeConvert(long size, string unit)
+        {
+            double rs = 0;
+            switch (unit)
+            {
+                case "B": rs = (double)size; break;
+                case "KB": rs = (double)size / 1024; break;
+                case "MB": rs = (double)size / 1024 / 1024; break;
+                case "GB": rs = (double)size / 1024 / 1024 / 1024; break;
+            }
+            return Math.Round(rs, 2).ToString();
+        }
     }
 }

+ 199 - 0
Fork.Net/Y.Utils/HttpUtils/HttpTool.cs

@@ -0,0 +1,199 @@
+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;
+using System.Web;
+using Y.Utils.StringUtils;
+
+namespace Y.Utils.HttpUtils
+{
+    public class HttpTool
+    {
+        public static string Get(string url, string encoding = "utf-8")
+        {
+            string result = "";
+            try
+            {
+                Encoding myEncoding = Encoding.GetEncoding(encoding);
+                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
+                req.Method = "GET";
+                using (WebResponse wr = req.GetResponse())
+                {
+                    //在这里对接收到的页面内容进行处理
+                    result = new StreamReader(wr.GetResponseStream(), myEncoding).ReadToEnd();
+                }
+            }
+            catch (Exception e) { }
+            return result;
+        }
+        public static T Get<T>(string url, string encoding = "utf-8")
+        {
+            try
+            {
+                Encoding myEncoding = Encoding.GetEncoding(encoding);
+                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
+                req.Method = "GET";
+                using (WebResponse wr = req.GetResponse())
+                {
+                    //在这里对接收到的页面内容进行处理
+                    string response = new StreamReader(wr.GetResponseStream(), myEncoding).ReadToEnd();
+                    if (!StringTool.IsNullOrWhiteSpace(response))
+                    {
+                        T result = JsonConvert.DeserializeObject<T>(response);
+                        return result;
+                    }
+                }
+            }
+            catch (Exception e) { }
+            return default(T);
+        }
+        public static string Post(string url, string param, string encoding = "utf-8")
+        {
+            string result = string.Empty;
+            try
+            {
+                Encoding myEncoding = Encoding.GetEncoding(encoding);
+                byte[] byteArray = myEncoding.GetBytes(param); //转化
+                HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(url));
+                webReq.Method = "POST";
+                webReq.ContentType = "application/x-www-form-urlencoded";
+                webReq.ContentLength = byteArray.Length;
+                Stream newStream = webReq.GetRequestStream();
+                newStream.Write(byteArray, 0, byteArray.Length);//写入参数
+                newStream.Close();
+                HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
+                StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default);
+                result = sr.ReadToEnd();
+                sr.Close();
+                response.Close();
+                newStream.Close();
+            }
+            catch (Exception ex)
+            { }
+            return result;
+        }
+        //public static string PostJson(string url, string param)
+        //{
+        //    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+        //    request.Method = "POST";
+        //    request.ContentType = "application/json";
+        //    request.ContentLength = Encoding.UTF8.GetByteCount(param);
+        //    Stream myRequestStream = request.GetRequestStream();
+        //    StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312"));
+        //    myStreamWriter.Write(param);
+        //    myStreamWriter.Close();
+        //    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+        //    Stream myResponseStream = response.GetResponseStream();
+        //    StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
+        //    string retString = myStreamReader.ReadToEnd();
+        //    myStreamReader.Close();
+        //    myResponseStream.Close();
+        //    return retString;
+        //}
+        public static string PostJson(string url, string param)
+        {
+            string rs = null;
+            ServicePointManager.DefaultConnectionLimit = 300;
+            System.GC.Collect();
+            CookieContainer cookieContainer = new CookieContainer();
+            // 设置提交的相关参数
+            HttpWebRequest request = null;
+            HttpWebResponse SendSMSResponse = null;
+            Stream dataStream = null;
+            StreamReader SendSMSResponseStream = null;
+            try
+            {
+                request = WebRequest.Create(url) as HttpWebRequest;
+                request.Method = "POST";
+                request.KeepAlive = false;
+                request.ServicePoint.ConnectionLimit = 300;
+                request.AllowAutoRedirect = true;
+                request.Timeout = 10000;
+                request.ReadWriteTimeout = 10000;
+                request.ContentType = "application/json";
+                request.Accept = "application/xml";
+                request.Headers.Add("X-Auth-Token", HttpUtility.UrlEncode("OpenStack"));
+                string strContent = param;
+                byte[] bytes = Encoding.UTF8.GetBytes(strContent);
+                request.Proxy = null;
+                request.CookieContainer = cookieContainer;
+                using (dataStream = request.GetRequestStream())
+                {
+                    dataStream.Write(bytes, 0, bytes.Length);
+                }
+                SendSMSResponse = (HttpWebResponse)request.GetResponse();
+                if (SendSMSResponse.StatusCode == HttpStatusCode.RequestTimeout)
+                {
+                    if (SendSMSResponse != null)
+                    {
+                        SendSMSResponse.Close();
+                        SendSMSResponse = null;
+                    }
+                    if (request != null)
+                    {
+                        request.Abort();
+                    }
+                    return null;
+                }
+                SendSMSResponseStream = new StreamReader(SendSMSResponse.GetResponseStream(), Encoding.GetEncoding("utf-8"));
+                string strRespone = SendSMSResponseStream.ReadToEnd();
+
+                return strRespone;
+            }
+            catch (Exception ex)
+            {
+
+                if (dataStream != null)
+                {
+                    dataStream.Close();
+                    dataStream.Dispose();
+                    dataStream = null;
+                }
+                if (SendSMSResponseStream != null)
+                {
+                    SendSMSResponseStream.Close();
+                    SendSMSResponseStream.Dispose();
+                    SendSMSResponseStream = null;
+                }
+                if (SendSMSResponse != null)
+                {
+                    SendSMSResponse.Close();
+                    SendSMSResponse = null;
+                }
+                if (request != null)
+                {
+                    request.Abort();
+                }
+            }
+            finally
+            {
+                if (dataStream != null)
+                {
+                    dataStream.Close();
+                    dataStream.Dispose();
+                    dataStream = null;
+                }
+                if (SendSMSResponseStream != null)
+                {
+                    SendSMSResponseStream.Close();
+                    SendSMSResponseStream.Dispose();
+                    SendSMSResponseStream = null;
+                }
+                if (SendSMSResponse != null)
+                {
+                    SendSMSResponse.Close();
+                    SendSMSResponse = null;
+                }
+                if (request != null)
+                {
+                    request.Abort();
+                }
+            }
+            return rs;
+        }
+    }
+}

+ 13 - 8
Fork.Net/Y.Utils/LogUtils/Log.cs

@@ -23,9 +23,9 @@ namespace Y.Utils.LogUtils
         const string LogFormat = "{0}  {1}  {2}";
         const string TimeFormat = "HH:mm:ss.fff";
 
-        public static bool IsWriteFile = true;
-
-        private static object LogFileLock = new object();
+        public static bool IsWriteFile = true;//是否写日志文件
+        private static object LogFileLock = new object();//写日志文件锁
+        private static LogLevel LogLevel = LogLevel.All;//日志输出等级
 
         #region Console 开启/关闭 API
         [DllImport("kernel32.dll")]
@@ -90,7 +90,8 @@ namespace Y.Utils.LogUtils
         /// <param name="tag">可选:标记</param>
         public static void v<T>(T msg)
         {
-            Write(LogType.v, msg.ToString());
+            if ((LogLevel & LogLevel.Verbose) == LogLevel.Verbose)
+                Write(LogType.v, msg.ToString());
         }
         /// <summary>
         /// 输出 Debug (调试信息)
@@ -99,7 +100,8 @@ namespace Y.Utils.LogUtils
         /// <param name="tag">可选:标记</param>
         public static void d<T>(T msg)
         {
-            Write(LogType.d, msg.ToString());
+            if ((LogLevel & LogLevel.Debug) == LogLevel.Debug)
+                Write(LogType.d, msg.ToString());
         }
         /// <summary>
         /// 输出 Information (重要信息)
@@ -108,7 +110,8 @@ namespace Y.Utils.LogUtils
         /// <param name="tag">可选:标记</param>
         public static void i<T>(T msg)
         {
-            Write(LogType.i, msg.ToString());
+            if ((LogLevel & LogLevel.Information) == LogLevel.Information)
+                Write(LogType.i, msg.ToString());
         }
         /// <summary>
         /// 输出 Warning (警告信息)
@@ -117,7 +120,8 @@ namespace Y.Utils.LogUtils
         /// <param name="tag">可选:标记</param>
         public static void w<T>(T msg)
         {
-            Write(LogType.w, msg.ToString());
+            if ((LogLevel & LogLevel.Warning) == LogLevel.Warning)
+                Write(LogType.w, msg.ToString());
         }
         /// <summary>
         /// 输出 Error (错误信息)
@@ -126,7 +130,8 @@ namespace Y.Utils.LogUtils
         /// <param name="tag">可选:标记</param>
         public static void e<T>(T msg)
         {
-            Write(LogType.e, msg.ToString());
+            if ((LogLevel & LogLevel.Error) == LogLevel.Error)
+                Write(LogType.e, msg.ToString());
         }
         #endregion
     }

+ 20 - 0
Fork.Net/Y.Utils/LogUtils/LogLevel.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Y.Utils.LogUtils
+{
+    [Flags]
+    public enum LogLevel
+    {
+        None = 0,
+        Verbose = 1,
+        Debug = 2,
+        Information = 4,
+        Warning = 8,
+        Error = 16,
+        All = Verbose | Debug | Information | Warning | Error,
+    }
+}

+ 28 - 0
Fork.Net/Y.Utils/WindowsAPI/ScreenCapture.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Drawing;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
@@ -102,5 +103,32 @@ namespace Y.Utils.WindowsAPI
             g.DrawImage(originalImage, new System.Drawing.Rectangle(0, 0, towidth, toheight), new System.Drawing.Rectangle(x, y, ow, oh), System.Drawing.GraphicsUnit.Pixel);
             return bitmap;
         }
+
+        [StructLayout(LayoutKind.Sequential)]
+        struct CURSORINFO
+        {
+            public int cbSize;
+            public int flags;
+            public IntPtr hCursor;
+            public Point ptScreenPos;
+        }
+        [DllImport("user32.dll")]
+        static extern bool GetCursorInfo(out CURSORINFO pci);
+        private const int CURSOR_SHOWING = 0x00000001;
+        /// <summary>  
+        /// 将鼠标指针形状绘制到屏幕截图上  
+        /// </summary>  
+        /// <param name="g"></param>  
+        public static void DrawCursorImageToScreenImage(ref Graphics g)
+        {
+            CURSORINFO vCurosrInfo;
+            vCurosrInfo.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
+            GetCursorInfo(out vCurosrInfo);
+            if ((vCurosrInfo.flags & CURSOR_SHOWING) != CURSOR_SHOWING) return;
+            Cursor vCursor = new Cursor(vCurosrInfo.hCursor);
+            Rectangle vRectangle = new Rectangle(new Point(vCurosrInfo.ptScreenPos.X - vCursor.HotSpot.X, vCurosrInfo.ptScreenPos.Y - vCursor.HotSpot.Y), vCursor.Size);
+
+            vCursor.Draw(g, vRectangle);
+        }
     }
 }

+ 4 - 0
Fork.Net/Y.Utils/Y.Utils.csproj

@@ -44,6 +44,7 @@
     <Reference Include="System.Core" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Management" />
+    <Reference Include="System.Web" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
@@ -53,6 +54,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="AppUtils\AppUnique.cs" />
     <Compile Include="AppUtils\UniqueTool.cs" />
     <Compile Include="AttributeUtils\AttributeTool.cs" />
     <Compile Include="AttributeUtils\CustomAttributeHelper.cs" />
@@ -63,6 +65,7 @@
     <Compile Include="EncryptUtils\DesTool.cs" />
     <Compile Include="EnumUtils\FlagsEnumTool.cs" />
     <Compile Include="HookUtils\UserActivityHook.cs" />
+    <Compile Include="HttpUtils\HttpTool.cs" />
     <Compile Include="ImageUtils\AffineTool.cs" />
     <Compile Include="ImageUtils\ThunbnailTool.cs" />
     <Compile Include="LogUtils\Log.cs" />
@@ -72,6 +75,7 @@
     <Compile Include="ImageUtils\BarCodeToHTML.cs" />
     <Compile Include="ComputerUtils\IPHelper.cs" />
     <Compile Include="FileUtils\FileCodeHelper.cs" />
+    <Compile Include="LogUtils\LogLevel.cs" />
     <Compile Include="LogUtils\LogType.cs" />
     <Compile Include="NetworkUtils\FTPHelper.cs" />
     <Compile Include="NetworkUtils\HttpHelper.cs" />