懒得勤快 пре 5 година
родитељ
комит
23068ff7f8

+ 0 - 70
Masuit.Tools.Core/Database/DataTableBuilder.cs

@@ -1,70 +0,0 @@
-using System;
-using System.Data;
-using System.Reflection;
-using System.Reflection.Emit;
-
-namespace Masuit.Tools.Core.Database
-{
-    internal class DataTableBuilder<T>
-    {
-        private static readonly MethodInfo GetValueMethod = typeof(DataRow).GetMethod("get_Item", new[]
-        {
-            typeof(int)
-        });
-
-        private static readonly MethodInfo IsDbNullMethod = typeof(DataRow).GetMethod("IsNull", new[]
-        {
-            typeof(int)
-        });
-
-        private delegate T Load(DataRow dataRecord);
-
-        private Load _handler;
-
-        private DataTableBuilder()
-        {
-        }
-
-        public T Build(DataRow dataRecord)
-        {
-            return _handler(dataRecord);
-        }
-
-        public static DataTableBuilder<T> CreateBuilder(DataRow dataRecord)
-        {
-            DataTableBuilder<T> dynamicBuilder = new DataTableBuilder<T>();
-            DynamicMethod method = new DynamicMethod("DynamicCreateEntity", typeof(T), new Type[]
-            {
-                typeof(DataRow)
-            }, typeof(T), true);
-            ILGenerator generator = method.GetILGenerator();
-            LocalBuilder result = generator.DeclareLocal(typeof(T));
-            generator.Emit(OpCodes.Newobj, typeof(T).GetConstructor(Type.EmptyTypes));
-            generator.Emit(OpCodes.Stloc, result);
-            for (int i = 0; i < dataRecord.ItemArray.Length; i++)
-            {
-                PropertyInfo propertyInfo = typeof(T).GetProperty(dataRecord.Table.Columns[i].ColumnName);
-                Label endIfLabel = generator.DefineLabel();
-                if (propertyInfo != null && propertyInfo.GetSetMethod() != null)
-                {
-                    generator.Emit(OpCodes.Ldarg_0);
-                    generator.Emit(OpCodes.Ldc_I4, i);
-                    generator.Emit(OpCodes.Callvirt, IsDbNullMethod);
-                    generator.Emit(OpCodes.Brtrue, endIfLabel);
-                    generator.Emit(OpCodes.Ldloc, result);
-                    generator.Emit(OpCodes.Ldarg_0);
-                    generator.Emit(OpCodes.Ldc_I4, i);
-                    generator.Emit(OpCodes.Callvirt, GetValueMethod);
-                    generator.Emit(OpCodes.Unbox_Any, propertyInfo.PropertyType);
-                    generator.Emit(OpCodes.Callvirt, propertyInfo.GetSetMethod());
-                    generator.MarkLabel(endIfLabel);
-                }
-            }
-
-            generator.Emit(OpCodes.Ldloc, result);
-            generator.Emit(OpCodes.Ret);
-            dynamicBuilder._handler = (Load)method.CreateDelegate(typeof(Load));
-            return dynamicBuilder;
-        }
-    }
-}

+ 0 - 257
Masuit.Tools.Core/Database/DataTableHelper.cs

@@ -1,257 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Linq;
-using System.Reflection;
-
-namespace Masuit.Tools.Core.Database
-{
-    /// <summary>
-    /// DataTable帮助类
-    /// </summary>
-    public static class DataTableHelper
-    {
-        /// <summary>
-        /// 给DataTable增加一个自增列
-        /// 如果DataTable 存在 identityid 字段  则 直接返回DataTable 不做任何处理
-        /// </summary>
-        /// <param name="dt">DataTable</param>
-        /// <returns>返回Datatable 增加字段 identityid </returns>
-        public static DataTable AddIdentityColumn(this DataTable dt)
-        {
-            if (!dt.Columns.Contains("identityid"))
-            {
-                dt.Columns.Add("identityid");
-                for (int i = 0; i < dt.Rows.Count; i++)
-                {
-                    dt.Rows[i]["identityid"] = (i + 1).ToString();
-                }
-            }
-
-            return dt;
-        }
-
-        /// <summary>
-        /// 检查DataTable 是否有数据行
-        /// </summary>
-        /// <param name="dt">DataTable</param>
-        /// <returns>是否有数据行</returns>
-        public static bool HasRows(this DataTable dt)
-        {
-            return dt.Rows.Count > 0;
-        }
-
-        /// <summary>
-        /// datatable转List
-        /// </summary>
-        /// <typeparam name="T"></typeparam>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        public static List<T> ToList<T>(this DataTable dt) where T : class, new()
-        {
-            List<T> list = new List<T>();
-            if (dt == null || dt.Rows.Count == 0)
-            {
-                return list;
-            }
-
-            list.AddRange(dt.Rows.Cast<DataRow>().Select(info => DataTableBuilder<T>.CreateBuilder(dt.Rows[0]).Build(info)));
-
-            return list;
-        }
-
-        /// <summary>
-        /// 将泛型集合类转换成DataTable
-        /// </summary>
-        /// <typeparam name="T">集合项类型</typeparam>
-        /// <param name="list">集合</param>
-        /// <param name="tableName">表名</param>
-        /// <returns>数据集(表)</returns>
-        public static DataTable ToDataTable<T>(this IEnumerable<T> list, string tableName = null)
-        {
-            return ToDataTable(list.ToList(), tableName);
-        }
-
-        /// <summary>
-        /// 将泛型集合类转换成DataTable
-        /// </summary>
-        /// <typeparam name="T">集合项类型</typeparam>
-        /// <param name="list">集合</param>
-        /// <param name="tableName">表名</param>
-        /// <returns>数据集(表)</returns>
-        public static DataTable ToDataTable<T>(this IList<T> list, string tableName = null)
-        {
-            DataTable result = new DataTable(tableName);
-            if (list.Count <= 0)
-            {
-                return result;
-            }
-
-            var properties = list[0].GetType().GetProperties();
-            result.Columns.AddRange(properties.Select(p => new DataColumn(p.GetCustomAttribute<DescriptionAttribute>()?.Description ?? p.Name, p.PropertyType)).ToArray());
-            list.ForEach(item => result.LoadDataRow(properties.Select(p => p.GetValue(item)).ToArray(), true));
-            return result;
-        }
-
-        /// <summary>
-        /// 根据nameList里面的字段创建一个表格,返回该表格的DataTable
-        /// </summary>
-        /// <param name="nameList">包含字段信息的列表</param>
-        /// <returns>DataTable</returns>
-        public static DataTable CreateTable(this List<string> nameList)
-        {
-            if (nameList.Count <= 0)
-            {
-                return null;
-            }
-
-            var myDataTable = new DataTable();
-            foreach (string columnName in nameList)
-            {
-                myDataTable.Columns.Add(columnName, typeof(string));
-            }
-
-            return myDataTable;
-        }
-
-        /// <summary>
-        /// 通过字符列表创建表字段,字段格式可以是:<br/>
-        /// 1) a,b,c,d,e<br/>
-        /// 2) a|int,b|string,c|bool,d|decimal<br/>
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <param name="nameString">字符列表</param>
-        /// <returns>内存表</returns>
-        public static DataTable CreateTable(this DataTable dt, string nameString)
-        {
-            string[] nameArray = nameString.Split(',', ';');
-            foreach (string item in nameArray)
-            {
-                if (!string.IsNullOrEmpty(item))
-                {
-                    string[] subItems = item.Split('|');
-                    if (subItems.Length == 2)
-                    {
-                        dt.Columns.Add(subItems[0], ConvertType(subItems[1]));
-                    }
-                    else
-                    {
-                        dt.Columns.Add(subItems[0]);
-                    }
-                }
-            }
-
-            return dt;
-        }
-
-        /// <summary>
-        /// 根据类型名返回一个Type类型
-        /// </summary>
-        /// <param name="typeName">类型的名称</param>
-        /// <returns>Type对象</returns>
-        private static Type ConvertType(string typeName)
-        {
-            typeName = typeName.ToLower().Replace("system.", "");
-            Type newType = typeof(string);
-            switch (typeName)
-            {
-                case "boolean":
-                case "bool":
-                    newType = typeof(bool);
-                    break;
-                case "int16":
-                case "short":
-                    newType = typeof(short);
-                    break;
-                case "int32":
-                case "int":
-                    newType = typeof(int);
-                    break;
-                case "long":
-                case "int64":
-                    newType = typeof(long);
-                    break;
-                case "uint16":
-                case "ushort":
-                    newType = typeof(ushort);
-                    break;
-                case "uint32":
-                case "uint":
-                    newType = typeof(uint);
-                    break;
-                case "uint64":
-                case "ulong":
-                    newType = typeof(ulong);
-                    break;
-                case "single":
-                case "float":
-                    newType = typeof(float);
-                    break;
-                case "string":
-                    newType = typeof(string);
-                    break;
-                case "guid":
-                    newType = typeof(Guid);
-                    break;
-                case "decimal":
-                    newType = typeof(decimal);
-                    break;
-                case "double":
-                    newType = typeof(double);
-                    break;
-                case "datetime":
-                    newType = typeof(DateTime);
-                    break;
-                case "byte":
-                    newType = typeof(byte);
-                    break;
-                case "char":
-                    newType = typeof(char);
-                    break;
-            }
-
-            return newType;
-        }
-
-        /// <summary>
-        /// 获得从DataRowCollection转换成的DataRow数组
-        /// </summary>
-        /// <param name="drc">DataRowCollection</param>
-        /// <returns>DataRow数组</returns>
-        public static DataRow[] GetDataRowArray(this DataRowCollection drc)
-        {
-            int count = drc.Count;
-            var drs = new DataRow[count];
-            for (int i = 0; i < count; i++)
-            {
-                drs[i] = drc[i];
-            }
-
-            return drs;
-        }
-
-        /// <summary>
-        /// 将DataRow数组转换成DataTable,注意行数组的每个元素须具有相同的数据结构,
-        /// 否则当有元素长度大于第一个元素时,抛出异常
-        /// </summary>
-        /// <param name="rows">行数组</param>
-        /// <returns>将内存行组装成内存表</returns>
-        public static DataTable GetTableFromRows(this DataRow[] rows)
-        {
-            if (rows.Length <= 0)
-            {
-                return new DataTable();
-            }
-
-            DataTable dt = rows[0].Table.Clone();
-            dt.DefaultView.Sort = rows[0].Table.DefaultView.Sort;
-            foreach (var t in rows)
-            {
-                dt.LoadDataRow(t.ItemArray, true);
-            }
-
-            return dt;
-        }
-    }
-}

+ 0 - 1559
Masuit.Tools.Core/DateTimeExt/ChineseCalendar.cs

@@ -1,1559 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Masuit.Tools.DateTimeExt
-{
-    /// <summary>
-    /// 中国农历类 支持 1900.1.31日起至 2069.12.31日止的数据
-    /// </summary>
-    /// <remarks>
-    /// 本程序使用数据来源于网上的万年历查询,并综合了一些其它数据
-    /// </remarks>
-    public class ChineseCalendar
-    {
-        private class ChineseCalendarException : Exception
-        {
-            public ChineseCalendarException(string msg) : base(msg)
-            {
-            }
-        }
-
-        #region 内部变量
-
-        private DateTime _date;
-        private readonly DateTime _datetime;
-        private readonly int _cYear;
-        private readonly int _cMonth;
-        private readonly int _cDay;
-
-        /// <summary>
-        /// 当月是否闰月
-        /// </summary>
-        private readonly bool _cIsLeapMonth;
-
-        /// <summary>
-        /// 当年是否有闰月
-        /// </summary>
-        private readonly bool _cIsLeapYear;
-
-        #endregion
-
-        #region 基础数据
-
-        private const int MinYear = 1900;
-        private const int MaxYear = 2050;
-        private static readonly DateTime MinDay = new DateTime(1900, 1, 30);
-        private static readonly DateTime MaxDay = new DateTime(2049, 12, 31);
-        private const int GanZhiStartYear = 1864; //干支计算起始年
-        private static readonly DateTime GanZhiStartDay = new DateTime(1899, 12, 22); //起始日
-        private const string HzNum = "零一二三四五六七八九";
-        private const int AnimalStartYear = 1900; //1900年为鼠年
-        private static readonly DateTime ChineseConstellationReferDay = new DateTime(2007, 9, 13); //28星宿参考值,本日为角
-
-        /// <summary>
-        /// 来源于网上的农历数据
-        /// </summary>
-        /// <remarks>
-        /// 数据结构如下,共使用17位数据
-        /// 第17位:表示闰月天数,0表示29天   1表示30天
-        /// 第16位-第5位(共12位)表示12个月,其中第16位表示第一月,如果该月为30天则为1,29天为0
-        /// 第4位-第1位(共4位)表示闰月是哪个月,如果当年没有闰月,则置0
-        ///</remarks>
-        private static readonly int[] LunarDateArray =
-        {
-            0x04BD8,
-            0x04AE0,
-            0x0A570,
-            0x054D5,
-            0x0D260,
-            0x0D950,
-            0x16554,
-            0x056A0,
-            0x09AD0,
-            0x055D2,
-            0x04AE0,
-            0x0A5B6,
-            0x0A4D0,
-            0x0D250,
-            0x1D255,
-            0x0B540,
-            0x0D6A0,
-            0x0ADA2,
-            0x095B0,
-            0x14977,
-            0x04970,
-            0x0A4B0,
-            0x0B4B5,
-            0x06A50,
-            0x06D40,
-            0x1AB54,
-            0x02B60,
-            0x09570,
-            0x052F2,
-            0x04970,
-            0x06566,
-            0x0D4A0,
-            0x0EA50,
-            0x06E95,
-            0x05AD0,
-            0x02B60,
-            0x186E3,
-            0x092E0,
-            0x1C8D7,
-            0x0C950,
-            0x0D4A0,
-            0x1D8A6,
-            0x0B550,
-            0x056A0,
-            0x1A5B4,
-            0x025D0,
-            0x092D0,
-            0x0D2B2,
-            0x0A950,
-            0x0B557,
-            0x06CA0,
-            0x0B550,
-            0x15355,
-            0x04DA0,
-            0x0A5B0,
-            0x14573,
-            0x052B0,
-            0x0A9A8,
-            0x0E950,
-            0x06AA0,
-            0x0AEA6,
-            0x0AB50,
-            0x04B60,
-            0x0AAE4,
-            0x0A570,
-            0x05260,
-            0x0F263,
-            0x0D950,
-            0x05B57,
-            0x056A0,
-            0x096D0,
-            0x04DD5,
-            0x04AD0,
-            0x0A4D0,
-            0x0D4D4,
-            0x0D250,
-            0x0D558,
-            0x0B540,
-            0x0B6A0,
-            0x195A6,
-            0x095B0,
-            0x049B0,
-            0x0A974,
-            0x0A4B0,
-            0x0B27A,
-            0x06A50,
-            0x06D40,
-            0x0AF46,
-            0x0AB60,
-            0x09570,
-            0x04AF5,
-            0x04970,
-            0x064B0,
-            0x074A3,
-            0x0EA50,
-            0x06B58,
-            0x055C0,
-            0x0AB60,
-            0x096D5,
-            0x092E0,
-            0x0C960,
-            0x0D954,
-            0x0D4A0,
-            0x0DA50,
-            0x07552,
-            0x056A0,
-            0x0ABB7,
-            0x025D0,
-            0x092D0,
-            0x0CAB5,
-            0x0A950,
-            0x0B4A0,
-            0x0BAA4,
-            0x0AD50,
-            0x055D9,
-            0x04BA0,
-            0x0A5B0,
-            0x15176,
-            0x052B0,
-            0x0A930,
-            0x07954,
-            0x06AA0,
-            0x0AD50,
-            0x05B52,
-            0x04B60,
-            0x0A6E6,
-            0x0A4E0,
-            0x0D260,
-            0x0EA65,
-            0x0D530,
-            0x05AA0,
-            0x076A3,
-            0x096D0,
-            0x04BD7,
-            0x04AD0,
-            0x0A4D0,
-            0x1D0B6,
-            0x0D250,
-            0x0D520,
-            0x0DD45,
-            0x0B5A0,
-            0x056D0,
-            0x055B2,
-            0x049B0,
-            0x0A577,
-            0x0A4B0,
-            0x0AA50,
-            0x1B255,
-            0x06D20,
-            0x0ADA0,
-            0x14B63
-        };
-
-        /// <summary>
-        /// 星座
-        /// </summary>
-        private static readonly string[] ConstellationName =
-        {
-            "白羊座",
-            "金牛座",
-            "双子座",
-            "巨蟹座",
-            "狮子座",
-            "处女座",
-            "天秤座",
-            "天蝎座",
-            "射手座",
-            "摩羯座",
-            "水瓶座",
-            "双鱼座"
-        };
-
-        /// <summary>
-        /// 二十四节气
-        /// </summary>
-        private static readonly string[] LunarHolidayName =
-        {
-            "小寒",
-            "大寒",
-            "立春",
-            "雨水",
-            "惊蛰",
-            "春分",
-            "清明",
-            "谷雨",
-            "立夏",
-            "小满",
-            "芒种",
-            "夏至",
-            "小暑",
-            "大暑",
-            "立秋",
-            "处暑",
-            "白露",
-            "秋分",
-            "寒露",
-            "霜降",
-            "立冬",
-            "小雪",
-            "大雪",
-            "冬至"
-        };
-
-        /// <summary>
-        /// 二十八星宿
-        /// </summary>
-        private static readonly string[] ChineseConstellationName =
-        {
-            //四        五      六         日        一      二      三  
-            "角木蛟",
-            "亢金龙",
-            "女土蝠",
-            "房日兔",
-            "心月狐",
-            "尾火虎",
-            "箕水豹",
-            "斗木獬",
-            "牛金牛",
-            "氐土貉",
-            "虚日鼠",
-            "危月燕",
-            "室火猪",
-            "壁水獝",
-            "奎木狼",
-            "娄金狗",
-            "胃土彘",
-            "昴日鸡",
-            "毕月乌",
-            "觜火猴",
-            "参水猿",
-            "井木犴",
-            "鬼金羊",
-            "柳土獐",
-            "星日马",
-            "张月鹿",
-            "翼火蛇",
-            "轸水蚓"
-        };
-
-        #region 节气数据
-
-        /// <summary>
-        /// 节气数据
-        /// </summary>
-        private static readonly string[] SolarTerm =
-        {
-            "小寒",
-            "大寒",
-            "立春",
-            "雨水",
-            "惊蛰",
-            "春分",
-            "清明",
-            "谷雨",
-            "立夏",
-            "小满",
-            "芒种",
-            "夏至",
-            "小暑",
-            "大暑",
-            "立秋",
-            "处暑",
-            "白露",
-            "秋分",
-            "寒露",
-            "霜降",
-            "立冬",
-            "小雪",
-            "大雪",
-            "冬至"
-        };
-
-        private static readonly int[] STermInfo =
-        {
-            0,
-            21208,
-            42467,
-            63836,
-            85337,
-            107014,
-            128867,
-            150921,
-            173149,
-            195551,
-            218072,
-            240693,
-            263343,
-            285989,
-            308563,
-            331033,
-            353350,
-            375494,
-            397447,
-            419210,
-            440795,
-            462224,
-            483532,
-            504758
-        };
-
-        #endregion
-
-        #region 农历相关数据
-
-        private const string GanStr = "甲乙丙丁戊己庚辛壬癸";
-        private const string ZhiStr = "子丑寅卯辰巳午未申酉戌亥";
-        private const string AnimalStr = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
-        private const string NStr1 = "日一二三四五六七八九";
-        private const string NStr2 = "初十廿卅";
-
-        private static readonly string[] MonthString =
-        {
-            "出错",
-            "正月",
-            "二月",
-            "三月",
-            "四月",
-            "五月",
-            "六月",
-            "七月",
-            "八月",
-            "九月",
-            "十月",
-            "十一月",
-            "腊月"
-        };
-
-        #endregion
-
-        #region 节日数据
-
-        /// <summary>
-        /// 自定义的工作日
-        /// </summary>
-        public static HashSet<DateTime> CustomWorkDays { get; } = new HashSet<DateTime>();
-
-        /// <summary>
-        /// 自定义的节假日
-        /// </summary>
-        public static Dictionary<DateTime, string> CustomHolidays { get; } = new Dictionary<DateTime, string>();
-
-        /// <summary>
-        /// 按公历计算的通用节假日
-        /// </summary>
-        private static HashSet<DateInfoStruct> SolarHolidayInfo { get; } = new HashSet<DateInfoStruct>
-        {
-            new DateInfoStruct(1, 1, 1, "元旦"),
-            new DateInfoStruct(2, 2, 0, "世界湿地日"),
-            new DateInfoStruct(2, 10, 0, "国际气象节"),
-            new DateInfoStruct(2, 14, 0, "情人节"),
-            new DateInfoStruct(3, 1, 0, "国际海豹日"),
-            new DateInfoStruct(3, 5, 0, "学雷锋纪念日"),
-            new DateInfoStruct(3, 8, 0, "妇女节"),
-            new DateInfoStruct(3, 12, 0, "植树节 孙中山逝世纪念日"),
-            new DateInfoStruct(3, 14, 0, "国际警察日"),
-            new DateInfoStruct(3, 15, 0, "消费者权益日"),
-            new DateInfoStruct(3, 17, 0, "中国国医节 国际航海日"),
-            new DateInfoStruct(3, 21, 0, "世界森林日 消除种族歧视国际日 世界儿歌日"),
-            new DateInfoStruct(3, 22, 0, "世界水日"),
-            new DateInfoStruct(3, 24, 0, "世界防治结核病日"),
-            new DateInfoStruct(4, 1, 0, "愚人节"),
-            new DateInfoStruct(4, 5, 1, "清明节"),
-            new DateInfoStruct(4, 7, 0, "世界卫生日"),
-            new DateInfoStruct(4, 22, 0, "世界地球日"),
-            new DateInfoStruct(5, 1, 1, "劳动节"),
-            new DateInfoStruct(5, 4, 0, "青年节"),
-            new DateInfoStruct(5, 8, 0, "世界红十字日"),
-            new DateInfoStruct(5, 12, 0, "国际护士节"),
-            new DateInfoStruct(5, 31, 0, "世界无烟日"),
-            new DateInfoStruct(6, 1, 0, "国际儿童节"),
-            new DateInfoStruct(6, 5, 0, "世界环境保护日"),
-            new DateInfoStruct(6, 26, 0, "国际禁毒日"),
-            new DateInfoStruct(7, 1, 0, "建党节 香港回归纪念 世界建筑日"),
-            new DateInfoStruct(7, 11, 0, "世界人口日"),
-            new DateInfoStruct(8, 1, 0, "建军节"),
-            new DateInfoStruct(8, 8, 0, "中国男子节 父亲节"),
-            new DateInfoStruct(8, 15, 0, "抗日战争胜利纪念"),
-            new DateInfoStruct(9, 9, 0, "  逝世纪念"),
-            new DateInfoStruct(9, 10, 0, "教师节"),
-            new DateInfoStruct(9, 18, 0, "九·一八事变纪念日"),
-            new DateInfoStruct(9, 20, 0, "国际爱牙日"),
-            new DateInfoStruct(9, 27, 0, "世界旅游日"),
-            new DateInfoStruct(9, 28, 0, "孔子诞辰"),
-            new DateInfoStruct(10, 1, 7, "国庆节 国际音乐日"),
-            new DateInfoStruct(10, 24, 0, "联合国日"),
-            new DateInfoStruct(11, 10, 0, "世界青年节"),
-            new DateInfoStruct(11, 12, 0, "孙中山诞辰纪念"),
-            new DateInfoStruct(12, 1, 0, "世界艾滋病日"),
-            new DateInfoStruct(12, 3, 0, "世界残疾人日"),
-            new DateInfoStruct(12, 20, 0, "澳门回归纪念"),
-            new DateInfoStruct(12, 24, 0, "平安夜"),
-            new DateInfoStruct(12, 25, 0, "圣诞节"),
-            new DateInfoStruct(12, 26, 0, " 诞辰纪念")
-        };
-
-        /// <summary>
-        /// 按农历计算的通用节假日
-        /// </summary>
-        private static HashSet<DateInfoStruct> LunarHolidayInfo { get; } = new HashSet<DateInfoStruct>
-        {
-            new DateInfoStruct(1, 1, 6, "春节"),
-            new DateInfoStruct(1, 15, 0, "元宵节"),
-            new DateInfoStruct(5, 5, 1, "端午节"),
-            new DateInfoStruct(7, 7, 0, "七夕情人节"),
-            new DateInfoStruct(7, 15, 0, "中元节 盂兰盆节"),
-            new DateInfoStruct(8, 15, 1, "中秋节"),
-            new DateInfoStruct(9, 9, 0, "重阳节"),
-            new DateInfoStruct(12, 8, 0, "腊八节"),
-            new DateInfoStruct(12, 23, 0, "北方小年(扫房)"),
-            new DateInfoStruct(12, 24, 0, "南方小年(掸尘)"),
-            //new HolidayStruct(12, 30, 0, "除夕")  //注意除夕需要其它方法进行计算
-        };
-
-
-        private static readonly WeekHolidayStruct[] WHolidayInfo =
-        {
-            new WeekHolidayStruct(5, 2, 1, "母亲节"),
-            new WeekHolidayStruct(5, 3, 1, "全国助残日"),
-            new WeekHolidayStruct(6, 3, 1, "父亲节"),
-            new WeekHolidayStruct(9, 3, 3, "国际和平日"),
-            new WeekHolidayStruct(9, 4, 1, "国际聋人节"),
-            new WeekHolidayStruct(10, 1, 2, "国际住房日"),
-            new WeekHolidayStruct(10, 1, 4, "国际减轻自然灾害日"),
-            new WeekHolidayStruct(11, 4, 5, "感恩节")
-        };
-
-        #endregion
-
-        #endregion
-
-        /// <summary>
-        /// 用一个标准的公历日期来初使化
-        /// </summary>
-        /// <param name="dt"></param>
-        public ChineseCalendar(DateTime dt)
-        {
-            int i;
-            _date = dt.Date;
-            _datetime = dt;
-            //农历日期计算部分
-            var temp = 0;
-            TimeSpan ts = _date - MinDay; //计算两天的基本差距
-            var offset = ts.Days;
-            for (i = MinYear; i <= MaxYear; i++)
-            {
-                temp = GetChineseYearDays(i); //求当年农历年天数
-                if (offset - temp < 1)
-                {
-                    break;
-                }
-
-                offset = offset - temp;
-            }
-
-            _cYear = i;
-            var leap = GetChineseLeapMonth(_cYear);
-            //设定当年是否有闰月
-            _cIsLeapYear = leap > 0;
-            _cIsLeapMonth = false;
-            for (i = 1; i <= 12; i++)
-            {
-                //闰月
-                if (leap > 0 && i == leap + 1 && _cIsLeapMonth == false)
-                {
-                    _cIsLeapMonth = true;
-                    i = i - 1;
-                    temp = GetChineseLeapMonthDays(_cYear); //计算闰月天数
-                }
-                else
-                {
-                    _cIsLeapMonth = false;
-                    temp = GetChineseMonthDays(_cYear, i); //计算非闰月天数
-                }
-
-                offset = offset - temp;
-                if (offset <= 0)
-                {
-                    break;
-                }
-            }
-
-            offset = offset + temp;
-            _cMonth = i;
-            _cDay = offset;
-        }
-
-        /// <summary>
-        /// 用农历的日期来初使化
-        /// </summary>
-        /// <param name="cy">农历年</param>
-        /// <param name="cm">农历月</param>
-        /// <param name="cd">农历日</param>
-        /// <param name="leapMonthFlag">闰月标志</param>
-        public ChineseCalendar(int cy, int cm, int cd, bool leapMonthFlag)
-        {
-            int i, temp;
-            CheckChineseDateLimit(cy, cm, cd, leapMonthFlag);
-            _cYear = cy;
-            _cMonth = cm;
-            _cDay = cd;
-            var offset = 0;
-            for (i = MinYear; i < cy; i++)
-            {
-                temp = GetChineseYearDays(i); //求当年农历年天数
-                offset = offset + temp;
-            }
-
-            var leap = GetChineseLeapMonth(cy);
-            _cIsLeapYear = leap != 0;
-            _cIsLeapMonth = cm == leap && leapMonthFlag;
-            if (_cIsLeapYear == false || cm < leap) //当年没有闰月||计算月份小于闰月     
-            {
-                for (i = 1; i < cm; i++)
-                {
-                    temp = GetChineseMonthDays(cy, i); //计算非闰月天数
-                    offset = offset + temp;
-                }
-
-                //检查日期是否大于最大天
-                if (cd > GetChineseMonthDays(cy, cm))
-                {
-                    throw new ChineseCalendarException("不合法的农历日期");
-                }
-
-                offset = offset + cd; //加上当月的天数
-            }
-            else //是闰年,且计算月份大于或等于闰月
-            {
-                for (i = 1; i < cm; i++)
-                {
-                    temp = GetChineseMonthDays(cy, i); //计算非闰月天数
-                    offset = offset + temp;
-                }
-
-                if (cm > leap) //计算月大于闰月
-                {
-                    temp = GetChineseLeapMonthDays(cy); //计算闰月天数
-                    offset = offset + temp; //加上闰月天数
-                    if (cd > GetChineseMonthDays(cy, cm))
-                    {
-                        throw new ChineseCalendarException("不合法的农历日期");
-                    }
-
-                    offset = offset + cd;
-                }
-                else //计算月等于闰月
-                {
-                    //如果需要计算的是闰月,则应首先加上与闰月对应的普通月的天数
-                    if (_cIsLeapMonth) //计算月为闰月
-                    {
-                        temp = GetChineseMonthDays(cy, cm); //计算非闰月天数
-                        offset = offset + temp;
-                    }
-
-                    if (cd > GetChineseLeapMonthDays(cy))
-                    {
-                        throw new ChineseCalendarException("不合法的农历日期");
-                    }
-
-                    offset = offset + cd;
-                }
-            }
-
-            _date = MinDay.AddDays(offset);
-        }
-
-        #region 私有函数
-
-        /// <summary>
-        /// 传回农历 y年m月的总天数
-        /// </summary>
-        /// <param name="year"></param>
-        /// <param name="month"></param>
-        /// <returns></returns>
-        private int GetChineseMonthDays(int year, int month)
-        {
-            if (BitTest32((LunarDateArray[year - MinYear] & 0x0000FFFF), (16 - month)))
-            {
-                return 30;
-            }
-
-            return 29;
-        }
-
-        /// <summary>
-        /// 传回农历 y年闰哪个月 1-12 , 没闰传回 0
-        /// </summary>
-        /// <param name="year"></param>
-        /// <returns></returns>
-        private int GetChineseLeapMonth(int year)
-        {
-            return LunarDateArray[year - MinYear] & 0xF;
-        }
-
-        /// <summary>
-        /// 传回农历 y年闰月的天数
-        /// </summary>
-        /// <param name="year"></param>
-        /// <returns></returns>
-        private int GetChineseLeapMonthDays(int year)
-        {
-            if (GetChineseLeapMonth(year) != 0)
-            {
-                return (LunarDateArray[year - MinYear] & 0x10000) != 0 ? 30 : 29;
-            }
-
-            return 0;
-        }
-
-        /// <summary>
-        /// 取农历年一年的天数
-        /// </summary>
-        /// <param name="year"></param>
-        /// <returns></returns>
-        private int GetChineseYearDays(int year)
-        {
-            var sumDay = 348;
-            var i = 0x8000;
-            var info = LunarDateArray[year - MinYear] & 0x0FFFF;
-            //计算12个月中有多少天为30天
-            for (int m = 0; m < 12; m++)
-            {
-                var f = info & i;
-                if (f != 0)
-                {
-                    sumDay++;
-                }
-
-                i = i >> 1;
-            }
-
-            return sumDay + GetChineseLeapMonthDays(year);
-        }
-
-        /// <summary>
-        /// 获得当前时间的时辰
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        /// 
-        private string GetChineseHour(DateTime dt)
-        {
-            //计算时辰的地支
-            var hour = dt.Hour;
-            var minute = dt.Minute;
-            if (minute != 0) hour += 1;
-            var offset = hour / 2;
-            if (offset >= 12) offset = 0;
-            //计算天干
-            TimeSpan ts = _date - GanZhiStartDay;
-            var i = ts.Days % 60;
-            var indexGan = ((i % 10 + 1) * 2 - 1) % 10 - 1;
-            var tmpGan = GanStr.Substring(indexGan) + GanStr.Substring(0, indexGan + 2);
-            return tmpGan[offset].ToString() + ZhiStr[offset];
-        }
-
-        /// <summary>
-        /// 检查农历日期是否合理
-        /// </summary>
-        /// <param name="year"></param>
-        /// <param name="month"></param>
-        /// <param name="day"></param>
-        /// <param name="leapMonth"></param>
-        private void CheckChineseDateLimit(int year, int month, int day, bool leapMonth)
-        {
-            if ((year < MinYear) || (year > MaxYear))
-            {
-                throw new ChineseCalendarException("非法农历日期");
-            }
-
-            if ((month < 1) || (month > 12))
-            {
-                throw new ChineseCalendarException("非法农历日期");
-            }
-
-            if ((day < 1) || (day > 30)) //中国的月最多30天
-            {
-                throw new ChineseCalendarException("非法农历日期");
-            }
-
-            int leap = GetChineseLeapMonth(year); // 计算该年应该闰哪个月
-            if (leapMonth && month != leap)
-            {
-                throw new ChineseCalendarException("非法农历日期");
-            }
-        }
-
-        /// <summary>
-        /// 将0-9转成汉字形式
-        /// </summary>
-        /// <param name="n"></param>
-        /// <returns></returns>
-        private string ConvertNumToChineseNum(char n)
-        {
-            if ((n < '0') || (n > '9')) return "";
-            switch (n)
-            {
-                case '0':
-                    return HzNum[0].ToString();
-                case '1':
-                    return HzNum[1].ToString();
-                case '2':
-                    return HzNum[2].ToString();
-                case '3':
-                    return HzNum[3].ToString();
-                case '4':
-                    return HzNum[4].ToString();
-                case '5':
-                    return HzNum[5].ToString();
-                case '6':
-                    return HzNum[6].ToString();
-                case '7':
-                    return HzNum[7].ToString();
-                case '8':
-                    return HzNum[8].ToString();
-                case '9':
-                    return HzNum[9].ToString();
-                default:
-                    return "";
-            }
-        }
-
-        /// <summary>
-        /// 测试某位是否为真
-        /// </summary>
-        /// <param name="num"></param>
-        /// <param name="bitpostion"></param>
-        /// <returns></returns>
-        private bool BitTest32(int num, int bitpostion)
-        {
-            if ((bitpostion > 31) || (bitpostion < 0))
-                throw new Exception("Error Param: bitpostion[0-31]:" + bitpostion.ToString());
-            int bit = 1 << bitpostion;
-            if ((num & bit) == 0)
-            {
-                return false;
-            }
-            else
-            {
-                return true;
-            }
-        }
-
-        /// <summary>
-        /// 将星期几转成数字表示
-        /// </summary>
-        /// <param name="dayOfWeek"></param>
-        /// <returns></returns>
-        private int ConvertDayOfWeek(DayOfWeek dayOfWeek)
-        {
-            switch (dayOfWeek)
-            {
-                case DayOfWeek.Sunday:
-                    return 1;
-                case DayOfWeek.Monday:
-                    return 2;
-                case DayOfWeek.Tuesday:
-                    return 3;
-                case DayOfWeek.Wednesday:
-                    return 4;
-                case DayOfWeek.Thursday:
-                    return 5;
-                case DayOfWeek.Friday:
-                    return 6;
-                case DayOfWeek.Saturday:
-                    return 7;
-                default:
-                    return 0;
-            }
-        }
-
-        /// <summary>
-        /// 比较当天是不是指定的第周几
-        /// </summary>
-        /// <param name="date"></param>
-        /// <param name="month"></param>
-        /// <param name="week"></param>
-        /// <param name="day"></param>
-        /// <returns></returns>
-        private bool CompareWeekDayHoliday(DateTime date, int month, int week, int day)
-        {
-            bool ret = false;
-            if (date.Month == month) //月份相同
-            {
-                if (ConvertDayOfWeek(date.DayOfWeek) == day) //星期几相同
-                {
-                    DateTime firstDay = new DateTime(date.Year, date.Month, 1); //生成当月第一天
-                    int i = ConvertDayOfWeek(firstDay.DayOfWeek);
-                    int firWeekDays = 7 - ConvertDayOfWeek(firstDay.DayOfWeek) + 1; //计算第一周剩余天数
-                    if (i > day)
-                    {
-                        if ((week - 1) * 7 + day + firWeekDays == date.Day)
-                        {
-                            ret = true;
-                        }
-                    }
-                    else
-                    {
-                        if (day + firWeekDays + (week - 2) * 7 == date.Day)
-                        {
-                            ret = true;
-                        }
-                    }
-                }
-            }
-
-            return ret;
-        }
-
-        #endregion
-
-        #region 节日
-
-        /// <summary>
-        /// 计算中国农历节日
-        /// </summary>
-        public string ChineseCalendarHoliday
-        {
-            get
-            {
-                string tempStr = "";
-                if (_cIsLeapMonth)
-                {
-                    return tempStr;
-                }
-
-                foreach (DateInfoStruct lh in LunarHolidayInfo)
-                {
-                    var end = lh.Recess > 0 ? lh.Day + lh.Recess - 1 : lh.Day + lh.Recess;
-                    if (lh.Month == _cMonth && _cDay >= lh.Day && _cDay <= end)
-                    {
-                        tempStr = lh.HolidayName;
-                        break;
-                    }
-                }
-
-                //对除夕进行特别处理
-                if (_cMonth != 12)
-                {
-                    return tempStr;
-                }
-
-                int i = GetChineseMonthDays(_cYear, 12); //计算当年农历12月的总天数
-                if (_cDay == i) //如果为最后一天
-                {
-                    tempStr = "除夕";
-                }
-
-                return tempStr;
-            }
-        }
-
-        /// <summary>
-        /// 按某月第几周第几日计算的节日
-        /// </summary>
-        public string WeekDayHoliday
-        {
-            get
-            {
-                string tempStr = "";
-                foreach (WeekHolidayStruct wh in WHolidayInfo)
-                {
-                    if (!CompareWeekDayHoliday(_date, wh.Month, wh.WeekAtMonth, wh.WeekDay))
-                    {
-                        continue;
-                    }
-
-                    tempStr = wh.HolidayName;
-                    break;
-                }
-
-                return tempStr;
-            }
-        }
-
-        /// <summary>
-        /// 按公历日计算的节日
-        /// </summary>
-        public string DateHoliday
-        {
-            get
-            {
-                string tempStr = "";
-                foreach (DateInfoStruct sh in SolarHolidayInfo)
-                {
-                    var end = sh.Recess > 0 ? sh.Day + sh.Recess - 1 : sh.Day + sh.Recess;
-                    if ((sh.Month == _date.Month) && _date.Day >= sh.Day && _date.Day <= end)
-                    {
-                        tempStr = sh.HolidayName;
-                        break;
-                    }
-
-                    if (CustomHolidays.Keys.Any(d => d.Date == _date))
-                    {
-                        tempStr = CustomHolidays[_date];
-                        break;
-                    }
-                }
-
-                return tempStr;
-            }
-        }
-
-        /// <summary>
-        /// 今天是否是假期
-        /// </summary>
-        public bool IsHoliday => !IsWorkDay;
-
-        /// <summary>
-        /// 今天是否是工作日
-        /// </summary>
-        public bool IsWorkDay
-        {
-            get
-            {
-                bool isHoliday = false;
-                foreach (DateInfoStruct sh in SolarHolidayInfo)
-                {
-                    var end = sh.Recess > 0 ? sh.Day + sh.Recess - 1 : sh.Day + sh.Recess;
-                    if ((sh.Month == _date.Month) && _date.Day >= sh.Day && _date.Day <= end && sh.Recess > 0)
-                    {
-                        isHoliday = true;
-                        break;
-                    }
-
-                    if (CustomHolidays.Keys.Any(d => d.Date == _date))
-                    {
-                        isHoliday = true;
-                        break;
-                    }
-                }
-
-                if (!isHoliday)
-                {
-                    foreach (DateInfoStruct lh in LunarHolidayInfo)
-                    {
-                        var end = lh.Recess > 0 ? lh.Day + lh.Recess - 1 : lh.Day + lh.Recess;
-                        if (lh.Month == _cMonth && _cDay >= lh.Day && _cDay <= end && lh.Recess > 0)
-                        {
-                            isHoliday = true;
-                            break;
-                        }
-                    }
-
-                    //对除夕进行特别处理
-                    if (_cMonth == 12)
-                    {
-                        int i = GetChineseMonthDays(_cYear, 12); //计算当年农历12月的总天数
-                        if (_cDay == i) //如果为最后一天
-                        {
-                            isHoliday = true;
-                        }
-                    }
-                }
-
-                return !isHoliday && !IsWeekend() || CustomWorkDays.Any(s => s.Date == _date);
-            }
-        }
-
-        /// <summary>
-        /// 是否是周末
-        /// </summary>
-        /// <returns></returns>
-        private bool IsWeekend()
-        {
-            return _date.DayOfWeek == DayOfWeek.Saturday || _date.DayOfWeek == DayOfWeek.Sunday;
-        }
-
-        #endregion
-
-        #region 公历日期
-
-        /// <summary>
-        /// 取对应的公历日期
-        /// </summary>
-        public DateTime Date
-        {
-            get => _date;
-            set => _date = value;
-        }
-
-        /// <summary>
-        /// 取星期几
-        /// </summary>
-        public DayOfWeek WeekDay => _date.DayOfWeek;
-
-        /// <summary>
-        /// 周几的字符
-        /// </summary>
-        public string WeekDayStr
-        {
-            get
-            {
-                switch (_date.DayOfWeek)
-                {
-                    case DayOfWeek.Sunday:
-                        return "星期日";
-                    case DayOfWeek.Monday:
-                        return "星期一";
-                    case DayOfWeek.Tuesday:
-                        return "星期二";
-                    case DayOfWeek.Wednesday:
-                        return "星期三";
-                    case DayOfWeek.Thursday:
-                        return "星期四";
-                    case DayOfWeek.Friday:
-                        return "星期五";
-                    default:
-                        return "星期六";
-                }
-            }
-        }
-
-        /// <summary>
-        /// 公历日期中文表示法 如一九九七年七月一日
-        /// </summary>
-        public string DateString => "公元" + _date.ToLongDateString();
-
-        /// <summary>
-        /// 当前是否公历闰年
-        /// </summary>
-        public bool IsLeapYear => DateTime.IsLeapYear(_date.Year);
-
-        /// <summary>
-        /// 28星宿计算
-        /// </summary>
-        public string ChineseConstellation
-        {
-            get
-            {
-                TimeSpan ts = _date - ChineseConstellationReferDay;
-                var offset = ts.Days;
-                var modStarDay = offset % 28;
-                return (modStarDay >= 0 ? ChineseConstellationName[modStarDay] : ChineseConstellationName[27 + modStarDay]);
-            }
-        }
-
-        /// <summary>
-        /// 时辰
-        /// </summary>
-        public string ChineseHour => GetChineseHour(_datetime);
-
-        #endregion
-
-        #region 农历日期
-
-        /// <summary>
-        /// 农历今天
-        /// </summary>
-        public static ChineseCalendar Today => new ChineseCalendar(DateTime.Today);
-
-        /// <summary>
-        /// 是否闰月
-        /// </summary>
-        public bool IsChineseLeapMonth => _cIsLeapMonth;
-
-        /// <summary>
-        /// 当年是否有闰月
-        /// </summary>
-        public bool IsChineseLeapYear => _cIsLeapYear;
-
-        /// <summary>
-        /// 农历日
-        /// </summary>
-        public int ChineseDay => _cDay;
-
-        /// <summary>
-        /// 农历日中文表示
-        /// </summary>
-        public string ChineseDayString
-        {
-            get
-            {
-                switch (_cDay)
-                {
-                    case 0:
-                        return "";
-                    case 10:
-                        return "初十";
-                    case 20:
-                        return "二十";
-                    case 30:
-                        return "三十";
-                    default:
-                        return NStr2[_cDay / 10] + NStr1[_cDay % 10].ToString();
-                }
-            }
-        }
-
-        /// <summary>
-        /// 农历的月份
-        /// </summary>
-        public int ChineseMonth => _cMonth;
-
-        /// <summary>
-        /// 农历月份字符串
-        /// </summary>
-        public string ChineseMonthString => MonthString[_cMonth];
-
-        /// <summary>
-        /// 取农历年份
-        /// </summary>
-        public int ChineseYear => _cYear;
-
-        /// <summary>
-        /// 取农历年字符串如,一九九七年
-        /// </summary>
-        public string ChineseYearString
-        {
-            get
-            {
-                string tempStr = "";
-                string num = _cYear.ToString();
-                for (int i = 0; i < 4; i++)
-                {
-                    tempStr += ConvertNumToChineseNum(num[i]);
-                }
-
-                return tempStr + "年";
-            }
-        }
-
-        /// <summary>
-        /// 取农历日期表示法:农历一九九七年正月初五
-        /// </summary>
-        public string ChineseDateString
-        {
-            get
-            {
-                if (_cIsLeapMonth)
-                {
-                    return ChineseYearString + "闰" + ChineseMonthString + ChineseDayString;
-                }
-
-                return ChineseYearString + ChineseMonthString + ChineseDayString;
-            }
-        }
-
-        /// <summary>
-        /// 定气法计算二十四节气,二十四节气是按地球公转来计算的,并非是阴历计算的
-        /// </summary>
-        /// <remarks>
-        /// 节气的定法有两种。古代历法采用的称为"恒气",即按时间把一年等分为24份,
-        /// 每一节气平均得15天有余,所以又称"平气"。现代农历采用的称为"定气",即
-        /// 按地球在轨道上的位置为标准,一周360°,两节气之间相隔15°。由于冬至时地
-        /// 球位于近日点附近,运动速度较快,因而太阳在黄道上移动15°的时间不到15天。
-        /// 夏至前后的情况正好相反,太阳在黄道上移动较慢,一个节气达16天之多。采用
-        /// 定气时可以保证春、秋两分必然在昼夜平分的那两天。
-        /// </remarks>
-        public string ChineseTwentyFourDay
-        {
-            get
-            {
-                DateTime baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
-                string tempStr = "";
-                var y = _date.Year;
-                for (int i = 1; i <= 24; i++)
-                {
-                    var num = 525948.76 * (y - 1900) + STermInfo[i - 1];
-                    var newDate = baseDateAndTime.AddMinutes(num);
-                    if (newDate.DayOfYear != _date.DayOfYear)
-                    {
-                        continue;
-                    }
-
-                    tempStr = SolarTerm[i - 1];
-                    break;
-                }
-
-                return tempStr;
-            }
-        }
-
-        /// <summary>
-        /// 当前日期前一个最近节气
-        /// </summary>
-        public string ChineseTwentyFourPrevDay
-        {
-            get
-            {
-                DateTime baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
-                string tempStr = "";
-                var y = _date.Year;
-                for (int i = 24; i >= 1; i--)
-                {
-                    var num = 525948.76 * (y - 1900) + STermInfo[i - 1];
-                    var newDate = baseDateAndTime.AddMinutes(num);
-                    if (newDate.DayOfYear < _date.DayOfYear)
-                    {
-                        tempStr = $"{SolarTerm[i - 1]}[{newDate:yyyy-MM-dd}]";
-                        break;
-                    }
-                }
-
-                return tempStr;
-            }
-        }
-
-        /// <summary>
-        /// 当前日期后一个最近节气
-        /// </summary>
-        public string ChineseTwentyFourNextDay
-        {
-            get
-            {
-                DateTime baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
-                string tempStr = "";
-                var y = _date.Year;
-                for (int i = 1; i <= 24; i++)
-                {
-                    var num = 525948.76 * (y - 1900) + STermInfo[i - 1];
-                    var newDate = baseDateAndTime.AddMinutes(num);
-                    if (newDate.DayOfYear > _date.DayOfYear)
-                    {
-                        tempStr = $"{SolarTerm[i - 1]}[{newDate:yyyy-MM-dd}]";
-                        break;
-                    }
-                }
-
-                return tempStr;
-            }
-        }
-
-        #endregion
-
-        #region 星座
-
-        /// <summary>
-        /// 计算指定日期的星座序号 
-        /// </summary>
-        /// <returns></returns>
-        public string Constellation
-        {
-            get
-            {
-                int index;
-                var m = _date.Month;
-                var d = _date.Day;
-                var y = m * 100 + d;
-                if (((y >= 321) && (y <= 419)))
-                {
-                    index = 0;
-                }
-                else if ((y >= 420) && (y <= 520))
-                {
-                    index = 1;
-                }
-                else if ((y >= 521) && (y <= 620))
-                {
-                    index = 2;
-                }
-                else if ((y >= 621) && (y <= 722))
-                {
-                    index = 3;
-                }
-                else if ((y >= 723) && (y <= 822))
-                {
-                    index = 4;
-                }
-                else if ((y >= 823) && (y <= 922))
-                {
-                    index = 5;
-                }
-                else if ((y >= 923) && (y <= 1022))
-                {
-                    index = 6;
-                }
-                else if ((y >= 1023) && (y <= 1121))
-                {
-                    index = 7;
-                }
-                else if ((y >= 1122) && (y <= 1221))
-                {
-                    index = 8;
-                }
-                else if ((y >= 1222) || (y <= 119))
-                {
-                    index = 9;
-                }
-                else if ((y >= 120) && (y <= 218))
-                {
-                    index = 10;
-                }
-                else if ((y >= 219) && (y <= 320))
-                {
-                    index = 11;
-                }
-                else
-                {
-                    index = 0;
-                }
-
-                return ConstellationName[index];
-            }
-        }
-
-        #endregion
-
-        #region 属相
-
-        /// <summary>
-        /// 计算属相的索引,注意虽然属相是以农历年来区别的,但是目前在实际使用中是按公历来计算的
-        /// 鼠年为1,其它类推
-        /// </summary>
-        public int Animal
-        {
-            get
-            {
-                int offset = _date.Year - AnimalStartYear;
-                return (offset % 12) + 1;
-            }
-        }
-
-        /// <summary>
-        /// 取属相字符串
-        /// </summary>
-        public string AnimalString
-        {
-            get
-            {
-                int offset = _date.Year - AnimalStartYear; //阳历计算
-                return AnimalStr[offset % 12].ToString();
-            }
-        }
-
-        #endregion
-
-        #region 天干地支
-
-        /// <summary>
-        /// 取农历年的干支表示法如 乙丑年
-        /// </summary>
-        public string GanZhiYearString
-        {
-            get
-            {
-                int i = (_cYear - GanZhiStartYear) % 60; //计算干支
-                var tempStr = GanStr[i % 10] + ZhiStr[i % 12].ToString() + "年";
-                return tempStr;
-            }
-        }
-
-        /// <summary>
-        /// 取干支的月表示字符串,注意农历的闰月不记干支
-        /// </summary>
-        public string GanZhiMonthString
-        {
-            get
-            {
-                //每个月的地支总是固定的,而且总是从寅月开始
-                int zhiIndex;
-                if (_cMonth > 10)
-                {
-                    zhiIndex = _cMonth - 10;
-                }
-                else
-                {
-                    zhiIndex = _cMonth + 2;
-                }
-
-                var zhi = ZhiStr[zhiIndex - 1].ToString();
-                //根据当年的干支年的干来计算月干的第一个
-                int ganIndex = 1;
-                int i = (_cYear - GanZhiStartYear) % 60; //计算干支
-                switch (i % 10)
-                {
-                    case 0: //甲
-                        ganIndex = 3;
-                        break;
-                    case 1: //乙
-                        ganIndex = 5;
-                        break;
-                    case 2: //丙
-                        ganIndex = 7;
-                        break;
-                    case 3: //丁
-                        ganIndex = 9;
-                        break;
-                    case 4: //戊
-                        ganIndex = 1;
-                        break;
-                    case 5: //己
-                        ganIndex = 3;
-                        break;
-                    case 6: //庚
-                        ganIndex = 5;
-                        break;
-                    case 7: //辛
-                        ganIndex = 7;
-                        break;
-                    case 8: //壬
-                        ganIndex = 9;
-                        break;
-                    case 9: //癸
-                        ganIndex = 1;
-                        break;
-                }
-
-                var gan = GanStr[(ganIndex + _cMonth - 2) % 10].ToString();
-                return gan + zhi + "月";
-            }
-        }
-
-        /// <summary>
-        /// 取干支日表示法
-        /// </summary>
-        public string GanZhiDayString
-        {
-            get
-            {
-                TimeSpan ts = _date - GanZhiStartDay;
-                var offset = ts.Days;
-                var i = offset % 60;
-                return GanStr[i % 10].ToString() + ZhiStr[i % 12] + "日";
-            }
-        }
-
-        /// <summary>
-        /// 取当前日期的干支表示法如 甲子年乙丑月丙庚日
-        /// </summary>
-        public string GanZhiDateString => GanZhiYearString + GanZhiMonthString + GanZhiDayString;
-
-        #endregion
-
-        /// <summary>
-        /// 取下一天
-        /// </summary>
-        /// <returns></returns>
-        public ChineseCalendar NextDay()
-        {
-            DateTime nextDay = _date.AddDays(1);
-            return new ChineseCalendar(nextDay);
-        }
-
-        /// <summary>
-        /// 取前一天
-        /// </summary>
-        /// <returns></returns>
-        public ChineseCalendar PervDay()
-        {
-            DateTime pervDay = _date.AddDays(-1);
-            return new ChineseCalendar(pervDay);
-        }
-
-        /// <summary>
-        /// 取下n天
-        /// </summary>
-        /// <returns></returns>
-        public ChineseCalendar AddDays(int days)
-        {
-            DateTime nextDay = _date.AddDays(days);
-            return new ChineseCalendar(nextDay);
-        }
-
-        /// <summary>
-        /// 取下n天
-        /// </summary>
-        /// <returns></returns>
-        public ChineseCalendar AddWorkDays(int days)
-        {
-            var cc = new ChineseCalendar(_date);
-            while (true)
-            {
-                cc = cc.AddDays(1);
-                if (cc.IsWorkDay)
-                {
-                    days--;
-                }
-                //else
-                //{
-                //    Console.WriteLine("阳历:" + cc.DateString);
-                //    Console.WriteLine("节日:" + cc.DateHoliday);
-                //    Console.WriteLine("农历节日:" + cc.ChineseCalendarHoliday);
-                //    Console.WriteLine("星期:" + cc.WeekDayStr);
-                //    Console.WriteLine("----------------------------");
-                //}
-
-                if (days == 0)
-                {
-                    return cc;
-                }
-            }
-        }
-
-        /// <summary>
-        /// 加n月
-        /// </summary>
-        /// <returns></returns>
-        public ChineseCalendar AddMonths(int months)
-        {
-            DateTime nextDay = _date.AddMonths(months);
-            return new ChineseCalendar(nextDay);
-        }
-    }
-}

+ 0 - 43
Masuit.Tools.Core/DateTimeExt/DateInfoStruct.cs

@@ -1,43 +0,0 @@
-namespace Masuit.Tools.DateTimeExt
-{
-    /// <summary>
-    /// 日期信息
-    /// </summary>
-    public struct DateInfoStruct
-    {
-        /// <summary>
-        /// 月
-        /// </summary>
-        public readonly int Month;
-
-        /// <summary>
-        /// 日
-        /// </summary>
-        public readonly int Day;
-
-        /// <summary>
-        /// 假期长度
-        /// </summary>
-        public readonly int Recess;
-
-        /// <summary>
-        /// 节假日名
-        /// </summary>
-        public readonly string HolidayName;
-
-        /// <summary>
-        /// 日期信息
-        /// </summary>
-        /// <param name="month"></param>
-        /// <param name="day"></param>
-        /// <param name="recess"></param>
-        /// <param name="name"></param>
-        public DateInfoStruct(int month, int day, int recess, string name)
-        {
-            Month = month;
-            Day = day;
-            Recess = recess;
-            HolidayName = name;
-        }
-    }
-}

+ 0 - 124
Masuit.Tools.Core/DateTimeExt/DateTimeHelper.cs

@@ -1,124 +0,0 @@
-using System;
-using System.Globalization;
-using System.Runtime.InteropServices;
-
-namespace Masuit.Tools.DateTimeExt
-{
-    /// <summary>
-    /// 日期时间帮助类
-    /// </summary>
-    public static class DateTimeHelper
-    {
-        /// <summary>
-        /// 获取某一年有多少周
-        /// </summary>
-        /// <param name="_"></param>
-        /// <param name="year">年份</param>
-        /// <returns>该年周数</returns>
-        public static int GetWeekAmount(this DateTime _, int year)
-        {
-            var end = new DateTime(year, 12, 31); //该年最后一天
-            var gc = new GregorianCalendar();
-            return gc.GetWeekOfYear(end, CalendarWeekRule.FirstDay, DayOfWeek.Monday); //该年星期数
-        }
-
-        /// <summary>
-        /// 返回年度第几个星期   默认星期日是第一天
-        /// </summary>
-        /// <param name="date">时间</param>
-        /// <returns>第几周</returns>
-        public static int WeekOfYear(this DateTime date)
-        {
-            var gc = new GregorianCalendar();
-            return gc.GetWeekOfYear(date, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
-        }
-
-        /// <summary>
-        /// 返回年度第几个星期
-        /// </summary>
-        /// <param name="date">时间</param>
-        /// <param name="week">一周的开始日期</param>
-        /// <returns>第几周</returns>
-        public static int WeekOfYear(this DateTime date, DayOfWeek week)
-        {
-            var gc = new GregorianCalendar();
-            return gc.GetWeekOfYear(date, CalendarWeekRule.FirstDay, week);
-        }
-
-        /// <summary>
-        /// 得到一年中的某周的起始日和截止日
-        /// 年 nYear
-        /// 周数 nNumWeek
-        /// 周始 out dtWeekStart
-        /// 周终 out dtWeekeEnd
-        /// </summary>
-        /// <param name="_"></param>
-        /// <param name="nYear">年份</param>
-        /// <param name="nNumWeek">第几周</param>
-        /// <param name="dtWeekStart">开始日期</param>
-        /// <param name="dtWeekeEnd">结束日期</param>
-        public static void GetWeekTime(this DateTime _, int nYear, int nNumWeek, out DateTime dtWeekStart, out DateTime dtWeekeEnd)
-        {
-            var dt = new DateTime(nYear, 1, 1);
-            dt += new TimeSpan((nNumWeek - 1) * 7, 0, 0, 0);
-            dtWeekStart = dt.AddDays(-(int)dt.DayOfWeek + (int)DayOfWeek.Monday);
-            dtWeekeEnd = dt.AddDays((int)DayOfWeek.Saturday - (int)dt.DayOfWeek + 1);
-        }
-
-        /// <summary>
-        /// 得到一年中的某周的起始日和截止日    周一到周五  工作日
-        /// </summary>
-        /// <param name="_"></param>
-        /// <param name="nYear">年份</param>
-        /// <param name="nNumWeek">第几周</param>
-        /// <param name="dtWeekStart">开始日期</param>
-        /// <param name="dtWeekeEnd">结束日期</param>
-        public static void GetWeekWorkTime(this DateTime _, int nYear, int nNumWeek, out DateTime dtWeekStart, out DateTime dtWeekeEnd)
-        {
-            var dt = new DateTime(nYear, 1, 1);
-            dt += new TimeSpan((nNumWeek - 1) * 7, 0, 0, 0);
-            dtWeekStart = dt.AddDays(-(int)dt.DayOfWeek + (int)DayOfWeek.Monday);
-            dtWeekeEnd = dt.AddDays((int)DayOfWeek.Saturday - (int)dt.DayOfWeek + 1).AddDays(-2);
-        }
-
-        #region P/Invoke 设置本地时间
-
-        [DllImport("kernel32.dll")]
-        private static extern bool SetLocalTime(ref SystemTime time);
-
-        [StructLayout(LayoutKind.Sequential)]
-        private struct SystemTime
-        {
-            public short year;
-            public short month;
-            public short dayOfWeek;
-            public short day;
-            public short hour;
-            public short minute;
-            public short second;
-            public short milliseconds;
-        }
-
-        /// <summary>
-        /// 设置本地计算机时间
-        /// </summary>
-        /// <param name="dt">DateTime对象</param>
-        public static void SetLocalTime(this DateTime dt)
-        {
-            SystemTime st;
-
-            st.year = (short)dt.Year;
-            st.month = (short)dt.Month;
-            st.dayOfWeek = (short)dt.DayOfWeek;
-            st.day = (short)dt.Day;
-            st.hour = (short)dt.Hour;
-            st.minute = (short)dt.Minute;
-            st.second = (short)dt.Second;
-            st.milliseconds = (short)dt.Millisecond;
-
-            SetLocalTime(ref st);
-        }
-
-        #endregion
-    }
-}

+ 0 - 329
Masuit.Tools.Core/DateTimeExt/DateUtil.cs

@@ -1,329 +0,0 @@
-using System;
-using System.Diagnostics;
-
-namespace Masuit.Tools.DateTimeExt
-{
-    /// <summary>
-    /// 日期操作工具类
-    /// </summary>
-    public static class DateUtil
-    {
-        private static readonly DateTime Start1970 = DateTime.Parse("1970-01-01 00:00:00");
-
-        /// <summary>
-        /// 返回相对于当前时间的相对天数
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <param name="relativeday">相对天数</param>
-        public static string GetDateTime(this DateTime dt, int relativeday)
-        {
-            return dt.AddDays(relativeday).ToString("yyyy-MM-dd HH:mm:ss");
-        }
-
-        /// <summary>
-        /// 返回标准时间格式string
-        /// </summary>
-        public static string GetDateTimeF(this DateTime dt) => dt.ToString("yyyy-MM-dd HH:mm:ss:fffffff");
-
-        /// <summary>
-        /// 返回标准时间 
-        /// </summary>
-        /// <param name="fDateTime">日期时间字符串</param>
-        /// <param name="formatStr">格式</param>
-        public static string GetStandardDateTime(this string fDateTime, string formatStr)
-        {
-            if (fDateTime == "0000-0-0 0:00:00")
-            {
-                return fDateTime;
-            }
-
-            var s = Convert.ToDateTime(fDateTime);
-            return s.ToString(formatStr);
-        }
-
-        /// <summary>
-        /// 返回标准时间 yyyy-MM-dd HH:mm:ss
-        /// </summary>
-        /// <param name="fDateTime">日期时间字符串</param>
-        public static string GetStandardDateTime(this string fDateTime)
-        {
-            return GetStandardDateTime(fDateTime, "yyyy-MM-dd HH:mm:ss");
-        }
-
-        /// <summary>
-        /// 获取该时间相对于1970-01-01 00:00:00的秒数
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        public static double GetTotalSeconds(this DateTime dt) => (dt - Start1970).TotalSeconds;
-
-        /// <summary>
-        /// 获取该时间相对于1970-01-01 00:00:00的毫秒数
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        public static double GetTotalMilliseconds(this DateTime dt) => (dt - Start1970).TotalMilliseconds;
-
-        /// <summary>
-        /// 获取该时间相对于1970-01-01 00:00:00的微秒时间戳
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        public static long GetTotalMicroseconds(this DateTime dt) => (dt - Start1970).Ticks / 10;
-
-        /// <summary>
-        /// 获取该时间相对于1970-01-01 00:00:00的纳秒时间戳
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        public static long GetTotalNanoseconds(this DateTime dt) => (dt - Start1970).Ticks * 100 + Stopwatch.GetTimestamp() % 100;
-
-        /// <summary>
-        /// 获取该时间相对于1970-01-01 00:00:00的分钟数
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        public static double GetTotalMinutes(this DateTime dt) => (dt - Start1970).TotalMinutes;
-
-        /// <summary>
-        /// 获取该时间相对于1970-01-01 00:00:00的小时数
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        public static double GetTotalHours(this DateTime dt) => (dt - Start1970).TotalHours;
-
-        /// <summary>
-        /// 获取该时间相对于1970-01-01 00:00:00的天数
-        /// </summary>
-        /// <param name="dt"></param>
-        /// <returns></returns>
-        public static double GetTotalDays(this DateTime dt) => (dt - Start1970).TotalDays;
-
-        /// <summary>
-        /// 返回本年有多少天
-        /// </summary>
-        /// <param name="_"></param>
-        /// <param name="iYear">年份</param>
-        /// <returns>本年的天数</returns>
-        public static int GetDaysOfYear(this DateTime _, int iYear)
-        {
-            return IsRuYear(iYear) ? 366 : 365;
-        }
-
-        /// <summary>本年有多少天</summary>
-        /// <param name="dt">日期</param>
-        /// <returns>本天在当年的天数</returns>
-        public static int GetDaysOfYear(this DateTime dt)
-        {
-            //取得传入参数的年份部分,用来判断是否是闰年
-            int n = dt.Year;
-            if (IsRuYear(n))
-            {
-                //闰年多 1 天 即:2 月为 29 天
-                return 366;
-            }
-            else
-            {
-                //--非闰年少1天 即:2 月为 28 天
-                return 365;
-            }
-        }
-
-        /// <summary>本月有多少天</summary>
-        /// <param name="_"></param>
-        /// <param name="iYear">年</param>
-        /// <param name="month">月</param>
-        /// <returns>天数</returns>
-        public static int GetDaysOfMonth(this DateTime _, int iYear, int month)
-        {
-            int days = 0;
-            switch (month)
-            {
-                case 1:
-                    days = 31;
-                    break;
-                case 2:
-                    days = IsRuYear(iYear) ? 29 : 28;
-                    break;
-                case 3:
-                    days = 31;
-                    break;
-                case 4:
-                    days = 30;
-                    break;
-                case 5:
-                    days = 31;
-                    break;
-                case 6:
-                    days = 30;
-                    break;
-                case 7:
-                case 8:
-                    days = 31;
-                    break;
-                case 9:
-                    days = 30;
-                    break;
-                case 10:
-                    days = 31;
-                    break;
-                case 11:
-                    days = 30;
-                    break;
-                case 12:
-                    days = 31;
-                    break;
-            }
-
-            return days;
-        }
-
-        /// <summary>本月有多少天</summary>
-        /// <param name="dt">日期</param>
-        /// <returns>天数</returns>
-        public static int GetDaysOfMonth(this DateTime dt)
-        {
-            int days = 0;
-            var year = dt.Year;
-            var month = dt.Month;
-
-            //--利用年月信息,得到当前月的天数信息。
-            switch (month)
-            {
-                case 1:
-                    days = 31;
-                    break;
-                case 2:
-                    days = IsRuYear(year) ? 29 : 28;
-                    break;
-                case 3:
-                    days = 31;
-                    break;
-                case 4:
-                    days = 30;
-                    break;
-                case 5:
-                    days = 31;
-                    break;
-                case 6:
-                    days = 30;
-                    break;
-                case 7:
-                    days = 31;
-                    break;
-                case 8:
-                    days = 31;
-                    break;
-                case 9:
-                    days = 30;
-                    break;
-                case 10:
-                    days = 31;
-                    break;
-                case 11:
-                    days = 30;
-                    break;
-                case 12:
-                    days = 31;
-                    break;
-            }
-
-            return days;
-        }
-
-        /// <summary>返回当前日期的星期名称</summary>
-        /// <param name="idt">日期</param>
-        /// <returns>星期名称</returns>
-        public static string GetWeekNameOfDay(this DateTime idt)
-        {
-            string week = "";
-
-            var dt = idt.DayOfWeek.ToString();
-            switch (dt)
-            {
-                case "Mondy":
-                    week = "星期一";
-                    break;
-                case "Tuesday":
-                    week = "星期二";
-                    break;
-                case "Wednesday":
-                    week = "星期三";
-                    break;
-                case "Thursday":
-                    week = "星期四";
-                    break;
-                case "Friday":
-                    week = "星期五";
-                    break;
-                case "Saturday":
-                    week = "星期六";
-                    break;
-                case "Sunday":
-                    week = "星期日";
-                    break;
-            }
-
-            return week;
-        }
-
-        /// <summary>返回当前日期的星期编号</summary>
-        /// <param name="idt">日期</param>
-        /// <returns>星期数字编号</returns>
-        public static string GetWeekNumberOfDay(this DateTime idt)
-        {
-            string week = "";
-
-            var dt = idt.DayOfWeek.ToString();
-            switch (dt)
-            {
-                case "Mondy":
-                    week = "1";
-                    break;
-                case "Tuesday":
-                    week = "2";
-                    break;
-                case "Wednesday":
-                    week = "3";
-                    break;
-                case "Thursday":
-                    week = "4";
-                    break;
-                case "Friday":
-                    week = "5";
-                    break;
-                case "Saturday":
-                    week = "6";
-                    break;
-                case "Sunday":
-                    week = "7";
-                    break;
-            }
-
-            return week;
-        }
-
-        /// <summary>判断当前年份是否是闰年,私有函数</summary>
-        /// <param name="iYear">年份</param>
-        /// <returns>是闰年:True ,不是闰年:False</returns>
-        private static bool IsRuYear(int iYear)
-        {
-            //形式参数为年份
-            //例如:2003
-            var n = iYear;
-
-            return n % 400 == 0 || n % 4 == 0 && n % 100 != 0;
-        }
-
-        /// <summary>
-        /// 判断是否为合法日期,必须大于1800年1月1日
-        /// </summary>
-        /// <param name="strDate">输入日期字符串</param>
-        /// <returns>True/False</returns>
-        public static bool IsDateTime(this string strDate)
-        {
-            DateTime.TryParse(strDate, out var result);
-            return result.CompareTo(DateTime.Parse("1800-1-1")) > 0;
-        }
-    }
-}

+ 0 - 416
Masuit.Tools.Core/DateTimeExt/TimeHelper.cs

@@ -1,416 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace Masuit.Tools.DateTimeExt
-{
-    /// <summary>
-    /// 时间相关操作帮助类
-    /// </summary>
-    public static class TimeHelper
-    {
-        #region 返回每月的第一天和最后一天
-
-        /// <summary>
-        ///  返回每月的第一天和最后一天
-        /// </summary>
-        /// <param name="_"></param>
-        /// <param name="month">月份</param>
-        /// <param name="firstDay">第一天</param>
-        /// <param name="lastDay">最后一天</param>
-        public static void ReturnDateFormat(this DateTime _, int month, out string firstDay, out string lastDay)
-        {
-            int year = DateTime.Now.Year + month / 12;
-            if (month != 12) month %= 12;
-            switch (month)
-            {
-                case 1:
-                    firstDay = DateTime.Now.ToString($"{year}-0{month}-01");
-                    lastDay = DateTime.Now.ToString($"{year}-0{month}-31");
-                    break;
-                case 2:
-                    firstDay = DateTime.Now.ToString(year + "-0" + month + "-01");
-                    lastDay = DateTime.IsLeapYear(DateTime.Now.Year) ? DateTime.Now.ToString(year + "-0" + month + "-29") : DateTime.Now.ToString(year + "-0" + month + "-28");
-                    break;
-                case 3:
-                    firstDay = DateTime.Now.ToString(year + "-0" + month + "-01");
-                    lastDay = DateTime.Now.ToString("yyyy-0" + month + "-31");
-                    break;
-                case 4:
-                    firstDay = DateTime.Now.ToString(year + "-0" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-0" + month + "-30");
-                    break;
-                case 5:
-                    firstDay = DateTime.Now.ToString(year + "-0" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-0" + month + "-31");
-                    break;
-                case 6:
-                    firstDay = DateTime.Now.ToString(year + "-0" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-0" + month + "-30");
-                    break;
-                case 7:
-                    firstDay = DateTime.Now.ToString(year + "-0" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-0" + month + "-31");
-                    break;
-                case 8:
-                    firstDay = DateTime.Now.ToString(year + "-0" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-0" + month + "-31");
-                    break;
-                case 9:
-                    firstDay = DateTime.Now.ToString(year + "-0" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-0" + month + "-30");
-                    break;
-                case 10:
-                    firstDay = DateTime.Now.ToString(year + "-" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-" + month + "-31");
-                    break;
-                case 11:
-                    firstDay = DateTime.Now.ToString(year + "-" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-" + month + "-30");
-                    break;
-                default:
-                    firstDay = DateTime.Now.ToString(year + "-" + month + "-01");
-                    lastDay = DateTime.Now.ToString(year + "-" + month + "-31");
-                    break;
-            }
-        }
-
-        #endregion
-
-        #region  将时间格式化成 年月日 的形式,如果时间为null,返回当前系统时间
-
-        /// <summary>
-        /// 将时间格式化成 年月日 的形式,如果时间为null,返回当前系统时间
-        /// </summary>
-        /// <param name="dt">年月日分隔符</param>
-        /// <param name="separator">分隔符</param>
-        /// <returns>xxxx年xx月xx日</returns>
-        public static string GetFormatDate(this DateTime dt, char separator)
-        {
-            if (dt.Equals(DBNull.Value))
-            {
-                return GetFormatDate(DateTime.Now, separator);
-            }
-
-            string tem = $"yyyy{separator}MM{separator}dd";
-            return dt.ToString(tem);
-
-        }
-
-        #endregion
-
-        #region 将时间格式化成 时分秒 的形式,如果时间为null,返回当前系统时间
-
-        /// <summary>
-        /// 将时间格式化成 时分秒 的形式,如果时间为null,返回当前系统时间
-        /// </summary>
-        /// <param name="dt">当前日期时间对象</param>
-        /// <param name="separator">分隔符</param>
-        /// <returns> xx时xx分xx秒 </returns>
-        public static string GetFormatTime(this DateTime dt, char separator)
-        {
-            if (dt.Equals(DBNull.Value))
-            {
-                return GetFormatDate(DateTime.Now, separator);
-            }
-
-            string tem = $"hh{separator}mm{separator}ss";
-            return dt.ToString(tem);
-
-        }
-
-        #endregion
-
-        #region  把秒转换成分钟
-
-        /// <summary>
-        /// 把秒转换成分钟
-        /// </summary>
-        /// <param name="_"></param>
-        /// <param name="second">秒数</param>
-        /// <returns>分钟数</returns>
-        public static int SecondToMinute(this DateTime _, int second)
-        {
-            decimal mm = second / (decimal)60;
-            return Convert.ToInt32(Math.Ceiling(mm));
-        }
-
-        #endregion
-
-        #region 返回某年某月最后一天
-
-        /// <summary>
-        /// 返回某年某月最后一天
-        /// </summary>
-        /// <param name="_"></param>
-        /// <param name="year">年份</param>
-        /// <param name="month">月份</param>
-        /// <returns>日</returns>
-        public static int GetMonthLastDate(this DateTime _, int year, int month)
-        {
-            DateTime lastDay = new DateTime(year, month, new GregorianCalendar().GetDaysInMonth(year, month));
-            int day = lastDay.Day;
-            return day;
-        }
-
-        #endregion
-
-        #region 获得两个日期的间隔
-
-        /// <summary>
-        /// 获得两个日期的间隔
-        /// </summary>
-        /// <param name="dateTime1">日期一。</param>
-        /// <param name="dateTime2">日期二。</param>
-        /// <returns>日期间隔TimeSpan。</returns>
-        /// <exception cref="OverflowException">The return value is less than <see cref="F:System.TimeSpan.MinValue" /> or greater than <see cref="F:System.TimeSpan.MaxValue" />. </exception>
-        public static TimeSpan DateDiff2(this DateTime dateTime1, DateTime dateTime2)
-        {
-            TimeSpan ts1 = new TimeSpan(dateTime1.Ticks);
-            TimeSpan ts2 = new TimeSpan(dateTime2.Ticks);
-            TimeSpan ts = ts1.Subtract(ts2).Duration();
-            return ts;
-        }
-
-        #endregion
-
-        #region 得到随机日期
-
-        /// <summary>
-        /// 得到随机日期
-        /// </summary>
-        /// <param name="time1">起始日期</param>
-        /// <param name="time2">结束日期</param>
-        /// <returns>间隔日期之间的 随机日期</returns>
-        public static DateTime GetRandomTime(this DateTime time1, DateTime time2)
-        {
-            Random random = new Random();
-            DateTime minTime;
-            TimeSpan ts = new TimeSpan(time1.Ticks - time2.Ticks);
-            // 获取两个时间相隔的秒数
-            double dTotalSecontds = ts.TotalSeconds;
-            int iTotalSecontds;
-            if (dTotalSecontds > int.MaxValue) iTotalSecontds = int.MaxValue;
-            else if (dTotalSecontds < int.MinValue) iTotalSecontds = int.MinValue;
-            else iTotalSecontds = (int)dTotalSecontds;
-            if (iTotalSecontds > 0)
-            {
-                minTime = time2;
-            }
-            else if (iTotalSecontds < 0)
-            {
-                minTime = time1;
-            }
-            else
-            {
-                return time1;
-            }
-
-            int maxValue = iTotalSecontds;
-            if (iTotalSecontds <= int.MinValue) maxValue = int.MinValue + 1;
-            int i = random.Next(Math.Abs(maxValue));
-            return minTime.AddSeconds(i);
-        }
-
-        #endregion
-
-        #region Rss日期时间转换,将时间全部转换为GMT时间
-
-        /// <summary> 
-        /// Rss日期时间转换,将时间全部转换为GMT时间 
-        /// </summary> 
-        /// <param name="strDateTime">Rss中读取的时间</param> 
-        /// <returns>处理后的标准时间格式</returns> 
-        public static string DateConvert(this string strDateTime)
-        {
-            strDateTime = strDateTime.Replace("+0000", "GMT");
-            strDateTime = strDateTime.Replace("+0100", "GMT");
-            strDateTime = strDateTime.Replace("+0200", "GMT");
-            strDateTime = strDateTime.Replace("+0300", "GMT");
-            strDateTime = strDateTime.Replace("+0400", "GMT");
-            strDateTime = strDateTime.Replace("+0500", "GMT");
-            strDateTime = strDateTime.Replace("+0600", "GMT");
-            strDateTime = strDateTime.Replace("+0700", "GMT");
-            strDateTime = strDateTime.Replace("+0800", "GMT");
-            strDateTime = strDateTime.Replace("-0000", "GMT");
-            strDateTime = strDateTime.Replace("-0100", "GMT");
-            strDateTime = strDateTime.Replace("-0200", "GMT");
-            strDateTime = strDateTime.Replace("-0300", "GMT");
-            strDateTime = strDateTime.Replace("-0400", "GMT");
-            strDateTime = strDateTime.Replace("-0500", "GMT");
-            strDateTime = strDateTime.Replace("-0600", "GMT");
-            strDateTime = strDateTime.Replace("-0700", "GMT");
-            strDateTime = strDateTime.Replace("-0800", "GMT");
-            DateTime dt = DateTime.Parse(strDateTime, null, DateTimeStyles.AdjustToUniversal);
-            return dt.ToString();
-        }
-
-        #endregion
-
-        #region 时间相关操作类
-
-        /// <summary>
-        /// 获得一段时间内有多少小时
-        /// </summary>
-        /// <param name="dtStar">起始时间</param>
-        /// <param name="dtEnd">终止时间</param>
-        /// <returns>小时差</returns>
-        public static string GetTimeDelay(this DateTime dtStar, DateTime dtEnd)
-        {
-            long lTicks = (dtEnd.Ticks - dtStar.Ticks) / 10000000;
-            string sTemp = (lTicks / 3600).ToString().PadLeft(2, '0') + ":";
-            sTemp += (lTicks % 3600 / 60).ToString().PadLeft(2, '0') + ":";
-            sTemp += (lTicks % 3600 % 60).ToString().PadLeft(2, '0');
-            return sTemp;
-        }
-
-        /// <summary>
-        /// 获得8位时间整型数字
-        /// </summary>
-        /// <param name="dt">当前的日期时间对象</param>
-        /// <returns>8位时间整型数字</returns>
-        public static string GetDateString(this DateTime dt)
-        {
-            return dt.Year + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0');
-        }
-
-        #endregion
-
-        #region 返回时间差
-
-        /// <summary>
-        /// 返回时间差
-        /// </summary>
-        /// <param name="dateTime1">时间1</param>
-        /// <param name="dateTime2">时间2</param>
-        /// <returns>时间差</returns>
-        public static string DateDiff(this DateTime dateTime1, DateTime dateTime2)
-        {
-            string dateDiff;
-            TimeSpan ts = dateTime2 - dateTime1;
-            if (ts.Days >= 1)
-            {
-                dateDiff = dateTime1.Month + "月" + dateTime1.Day + "日";
-            }
-            else
-            {
-                if (ts.Hours > 1) dateDiff = ts.Hours + "小时前";
-                else dateDiff = ts.Minutes + "分钟前";
-            }
-
-            return dateDiff;
-        }
-
-        /// <summary>
-        /// 时间差
-        /// </summary>
-        /// <param name="beginTime">开始时间</param>
-        /// <param name="endTime">结束时间</param>
-        /// <returns>时间差</returns>
-        public static string GetDiffTime(this DateTime beginTime, DateTime endTime)
-        {
-            int i = 0;
-            return GetDiffTime(beginTime, endTime, ref i);
-        }
-
-        /// <summary>
-        /// 计算2个时间差
-        /// </summary>
-        /// <param name="beginTime">开始时间</param>
-        /// <param name="endTime">结束时间</param>
-        /// <param name="mindTime">中间的时间</param>
-        /// <returns>时间差</returns>
-        public static string GetDiffTime(this DateTime beginTime, DateTime endTime, ref int mindTime)
-        {
-            string strResout = string.Empty;
-            //获得2时间的时间间隔秒计算
-            TimeSpan span = endTime.Subtract(beginTime);
-            int iTatol = Convert.ToInt32(span.TotalSeconds);
-            int iMinutes = 1 * 60;
-            int iHours = iMinutes * 60;
-            int iDay = iHours * 24;
-            int iMonth = iDay * 30;
-            int iYear = iMonth * 12;
-
-            //提醒时间,到了返回1,否则返回0
-            if (mindTime > iTatol && iTatol > 0) mindTime = 1;
-            else mindTime = 0;
-
-            if (iTatol > iYear)
-            {
-                strResout += iTatol / iYear + "年";
-                iTatol %= iYear; //剩余
-            }
-
-            if (iTatol > iMonth)
-            {
-                strResout += iTatol / iMonth + "月";
-                iTatol %= iMonth;
-            }
-
-            if (iTatol > iDay)
-            {
-                strResout += iTatol / iDay + "天";
-                iTatol %= iDay;
-            }
-
-            if (iTatol > iHours)
-            {
-                strResout += iTatol / iHours + "小时";
-                iTatol %= iHours;
-            }
-
-            if (iTatol > iMinutes)
-            {
-                strResout += iTatol / iMinutes + "分";
-                iTatol %= iMinutes;
-            }
-
-            strResout += iTatol + "秒";
-            return strResout;
-        }
-
-        #endregion
-
-        #region 时间其他转换静态方法
-
-        /// <summary>
-        /// C#的时间到Javascript的时间的转换
-        /// </summary>
-        /// <param name="theDate">C#的时间</param>
-        /// <returns>Javascript的时间</returns>
-        public static long CsharpTime2JavascriptTime(this DateTime theDate)
-        {
-            DateTime d1 = new DateTime(1970, 1, 1);
-            DateTime d2 = theDate.ToUniversalTime();
-            TimeSpan ts = new TimeSpan(d2.Ticks - d1.Ticks);
-            return (long)ts.TotalMilliseconds;
-        }
-
-        /// <summary>
-        /// PHP的时间转换成C#中的DateTime
-        /// </summary>
-        /// <param name="_"></param>
-        /// <param name="time">php的时间</param>
-        /// <returns>C#的时间</returns>
-        public static DateTime PhpTime2CsharpTime(this DateTime _, long time)
-        {
-            DateTime timeStamp = new DateTime(1970, 1, 1); //得到1970年的时间戳
-            long t = (time + 8 * 60 * 60) * 10000000 + timeStamp.Ticks;
-            return new DateTime(t);
-        }
-
-        /// <summary>
-        ///  C#中的DateTime转换成PHP的时间
-        /// </summary>
-        /// <param name="time">C#时间</param>
-        /// <returns>php时间</returns>
-        public static long CsharpTime2PhpTime(this DateTime time)
-        {
-            DateTime timeStamp = new DateTime(1970, 1, 1); //得到1970年的时间戳
-            //注意这里有时区问题,用now就要减掉8个小时
-            return (DateTime.UtcNow.Ticks - timeStamp.Ticks) / 10000000;
-        }
-
-        #endregion
-    }
-}

+ 0 - 43
Masuit.Tools.Core/DateTimeExt/WeekHolidayStruct.cs

@@ -1,43 +0,0 @@
-namespace Masuit.Tools.DateTimeExt
-{
-    /// <summary>
-    /// 节假日信息
-    /// </summary>
-    public struct WeekHolidayStruct
-    {
-        /// <summary>
-        /// 月
-        /// </summary>
-        public readonly int Month;
-
-        /// <summary>
-        /// 这个月第几周
-        /// </summary>
-        public readonly int WeekAtMonth;
-
-        /// <summary>
-        /// 周末日
-        /// </summary>
-        public readonly int WeekDay;
-
-        /// <summary>
-        /// 假日名
-        /// </summary>
-        public readonly string HolidayName;
-
-        /// <summary>
-        /// 节假日信息
-        /// </summary>
-        /// <param name="month"></param>
-        /// <param name="weekAtMonth"></param>
-        /// <param name="weekDay"></param>
-        /// <param name="name"></param>
-        public WeekHolidayStruct(int month, int weekAtMonth, int weekDay, string name)
-        {
-            Month = month;
-            WeekAtMonth = weekAtMonth;
-            WeekDay = weekDay;
-            HolidayName = name;
-        }
-    }
-}

+ 0 - 54
Masuit.Tools.Core/Files/ClassZip.cs

@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Masuit.Tools.Files
-{
-    /// <summary>
-    /// ClassZip
-    /// </summary>
-    [Obsolete("该类已过时,请使用SevenZipCompressor替代")]
-    public static class ClassZip
-    {
-        #region 压缩
-
-        /// <summary>
-        /// 压缩
-        /// </summary>
-        /// <param name="fileToZip">待压缩的文件目录或文件</param>
-        /// <param name="zipedFile">生成的目标文件</param>
-        /// <param name="level">压缩级别,默认值6</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Zip方法替代")]
-        public static bool Zip(string fileToZip, string zipedFile, int level = 6)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Zip方法替代");
-        }
-
-        /// <summary>
-        /// 将多个文件压缩到一个文件流中,可保存为zip文件,方便于web方式下载
-        /// </summary>
-        /// <param name="files">多个文件路径,文件或文件夹</param>
-        /// <returns>文件流</returns>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.ZipStream方法替代")]
-        public static byte[] ZipStream(List<string> files)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.ZipStream方法替代");
-        }
-
-        #endregion
-
-        #region 解压
-
-        /// <summary>
-        /// 解压
-        /// </summary>
-        /// <param name="fileToUpZip">待解压的文件</param>
-        /// <param name="zipedFolder">解压目标存放目录</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Decompress方法替代")]
-        public static void UnZip(string fileToUpZip, string zipedFolder)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Decompress方法替代");
-        }
-
-        #endregion
-    }
-}

+ 0 - 66
Masuit.Tools.Core/Files/SharpZip.cs

@@ -1,66 +0,0 @@
-using System;
-using System.Threading.Tasks;
-
-namespace Masuit.Tools.Files
-{
-    /// <summary>
-    /// SharpZip
-    /// </summary>
-    [Obsolete("该类已过时,请使用SevenZipCompressor替代")]
-    public static class SharpZip
-    {
-        #region 文件压缩
-
-        /// <summary>
-        /// 文件压缩
-        /// </summary> 
-        /// <param name="filename"> 压缩后的文件名(包含物理路径)</param>
-        /// <param name="directory">待压缩的文件夹(包含物理路径)</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Zip方法替代")]
-        public static void PackFiles(string filename, string directory)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Zip方法替代");
-        }
-
-        /// <summary>
-        /// 文件压缩
-        /// </summary> 
-        /// <param name="filename"> 压缩后的文件名(包含物理路径)</param>
-        /// <param name="directory">待压缩的文件夹(包含物理路径)</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Zip方法替代")]
-        public static async void PackFilesAsync(string filename, string directory)
-        {
-            await Task.Delay(0);
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Zip方法替代");
-        }
-
-        #endregion
-
-        #region 文件解压缩
-
-        /// <summary>
-        /// 文件解压缩
-        /// </summary>
-        /// <param name="file">待解压文件名(包含物理路径)</param>
-        /// <param name="dir"> 解压到哪个目录中(包含物理路径)</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Decompress方法替代")]
-        public static bool UnpackFiles(string file, string dir)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Decompress方法替代");
-        }
-
-        /// <summary>
-        /// 文件解压缩
-        /// </summary>
-        /// <param name="file">待解压文件名(包含物理路径)</param>
-        /// <param name="dir"> 解压到哪个目录中(包含物理路径)</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Decompress方法替代")]
-        public static async Task<bool> UnpackFilesAsync(string file, string dir)
-        {
-            await Task.Delay(0);
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Decompress方法替代");
-        }
-
-        #endregion
-    }
-}

+ 9 - 0
Masuit.Tools.Core/Masuit.Tools.Core.csproj

@@ -32,6 +32,14 @@ github:https://github.com/ldqk/Masuit.Tools</Description>
   </PropertyGroup>
 
   <ItemGroup>
+    <Compile Include="..\Masuit.Tools\Database\DataTableBuilder.cs" Link="Database\DataTableBuilder.cs" />
+    <Compile Include="..\Masuit.Tools\Database\DataTableHelper.cs" Link="Database\DataTableHelper.cs" />
+    <Compile Include="..\Masuit.Tools\DateTimeExt\ChineseCalendar.cs" Link="DateTimeExt\ChineseCalendar.cs" />
+    <Compile Include="..\Masuit.Tools\DateTimeExt\DateInfoStruct.cs" Link="DateTimeExt\DateInfoStruct.cs" />
+    <Compile Include="..\Masuit.Tools\DateTimeExt\DateTimeHelper.cs" Link="DateTimeExt\DateTimeHelper.cs" />
+    <Compile Include="..\Masuit.Tools\DateTimeExt\DateUtil.cs" Link="DateTimeExt\DateUtil.cs" />
+    <Compile Include="..\Masuit.Tools\DateTimeExt\TimeHelper.cs" Link="DateTimeExt\TimeHelper.cs" />
+    <Compile Include="..\Masuit.Tools\DateTimeExt\WeekHolidayStruct.cs" Link="DateTimeExt\WeekHolidayStruct.cs" />
     <Compile Include="..\Masuit.Tools\Extensions.cs" Link="Extensions.cs" />
     <Compile Include="..\Masuit.Tools\RandomSelector\Algorithm\BinarySearchOptimizer.cs" Link="RandomSelector\Algorithm\BinarySearchOptimizer.cs" />
     <Compile Include="..\Masuit.Tools\RandomSelector\Algorithm\MultipleSelector.cs" Link="RandomSelector\Algorithm\MultipleSelector.cs" />
@@ -64,6 +72,7 @@ github:https://github.com/ldqk/Masuit.Tools</Description>
   </ItemGroup>
 
   <ItemGroup>
+    <Folder Include="DateTimeExt\" />
     <Folder Include="RandomSelector\Algorithm\" />
   </ItemGroup>
 

+ 0 - 54
Masuit.Tools/Files/ClassZip.cs

@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Masuit.Tools.Files
-{
-    /// <summary>
-    /// ClassZip
-    /// </summary>
-    [Obsolete("该类已过时,请使用SevenZipCompressor替代")]
-    public static class ClassZip
-    {
-        #region 压缩
-
-        /// <summary>
-        /// 压缩
-        /// </summary>
-        /// <param name="fileToZip">待压缩的文件目录或文件</param>
-        /// <param name="zipedFile">生成的目标文件</param>
-        /// <param name="level">压缩级别,默认值6</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Zip方法替代")]
-        public static bool Zip(string fileToZip, string zipedFile, int level = 6)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Zip方法替代");
-        }
-
-        /// <summary>
-        /// 将多个文件压缩到一个文件流中,可保存为zip文件,方便于web方式下载
-        /// </summary>
-        /// <param name="files">多个文件路径,文件或文件夹</param>
-        /// <returns>文件流</returns>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.ZipStream方法替代")]
-        public static byte[] ZipStream(List<string> files)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.ZipStream方法替代");
-        }
-
-        #endregion
-
-        #region 解压
-
-        /// <summary>
-        /// 解压
-        /// </summary>
-        /// <param name="fileToUpZip">待解压的文件</param>
-        /// <param name="zipedFolder">解压目标存放目录</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Decompress方法替代")]
-        public static void UnZip(string fileToUpZip, string zipedFolder)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Decompress方法替代");
-        }
-
-        #endregion
-    }
-}

+ 0 - 143
Masuit.Tools/Files/DocumentConvert.cs

@@ -1,143 +0,0 @@
-using System.IO;
-using System.Threading.Tasks;
-using Aspose.Words;
-using Masuit.Tools.Models;
-
-namespace Masuit.Tools.Files
-{
-    /// <summary>
-    /// 文档转换操作
-    /// </summary>
-    public static class DocumentConvert
-    {
-        static DocumentConvert()
-        {
-            AsposeLicense.ActivateMemoryPatching();
-        }
-
-        #region doc转html
-
-        /// <summary>
-        /// doc转html
-        /// </summary>
-        /// <param name="docPath">doc文件路径</param>
-        /// <param name="htmlDir">生成的html所在目录,由于生成html后会将图片都放到同级的目录下,所以用文件夹保存,默认的html文件名为index.html</param>
-        /// <param name="index">默认文档名为index.html</param>
-        public static void Doc2Html(string docPath, string htmlDir, string index = "index.html")
-        {
-            Document doc = new Document(docPath);
-            doc.Save(Path.Combine(htmlDir, index), SaveFormat.Html);
-        }
-
-        /// <summary>
-        /// doc转html
-        /// </summary>
-        /// <param name="docPath">doc文件路径</param>
-        /// <param name="htmlDir">生成的html所在目录,由于生成html后会将图片都放到同级的目录下,所以用文件夹保存,默认的html文件名为index.html</param>
-        /// <param name="index">默认文档名为index.html</param>
-        public static async void Doc2HtmlAsync(string docPath, string htmlDir, string index = "index.html")
-        {
-            Document doc = new Document(docPath);
-            await Task.Run(() => doc.Save(Path.Combine(htmlDir, index), SaveFormat.Html)).ConfigureAwait(true);
-        }
-
-        #endregion
-
-        #region doc转pdf
-
-        /// <summary>
-        /// doc转pdf
-        /// </summary>
-        /// <param name="docPath">doc源文件</param>
-        /// <param name="pdfPath">目标pdf文件</param>
-        /// <param name="paperSize">纸张大小</param>
-        /// <param name="leftMargin">左边距</param>
-        /// <param name="rightMargin">右边距</param>
-        /// <param name="topMargin">上边距</param>
-        /// <param name="bottomMargin">下边距</param>
-        public static void Doc2Pdf(string docPath, string pdfPath, PaperSize paperSize = PaperSize.A4, double leftMargin = 20, double rightMargin = 20, double topMargin = 20, double bottomMargin = 20)
-        {
-            Document doc = new Document(docPath);
-            PageSetup pageSetup = new DocumentBuilder(doc).PageSetup;
-            pageSetup.PaperSize = paperSize;
-            pageSetup.LeftMargin = leftMargin;
-            pageSetup.RightMargin = rightMargin;
-            pageSetup.TopMargin = topMargin;
-            pageSetup.BottomMargin = bottomMargin;
-            doc.Save(pdfPath, SaveFormat.Pdf);
-        }
-
-        /// <summary>
-        /// doc转pdf
-        /// </summary>
-        /// <param name="docPath">doc源文件</param>
-        /// <param name="pdfPath">目标pdf文件</param>
-        /// <param name="paperSize">纸张大小</param>
-        /// <param name="leftMargin">左边距</param>
-        /// <param name="rightMargin">右边距</param>
-        /// <param name="topMargin">上边距</param>
-        /// <param name="bottomMargin">下边距</param>
-        public static async void Doc2PdfAsync(string docPath, string pdfPath, PaperSize paperSize = PaperSize.A4, double leftMargin = 20, double rightMargin = 20, double topMargin = 20, double bottomMargin = 20)
-        {
-            Document doc = new Document(docPath);
-            PageSetup pageSetup = new DocumentBuilder(doc).PageSetup;
-            pageSetup.PaperSize = paperSize;
-            pageSetup.LeftMargin = leftMargin;
-            pageSetup.RightMargin = rightMargin;
-            pageSetup.TopMargin = topMargin;
-            pageSetup.BottomMargin = bottomMargin;
-            await Task.Run(() => doc.Save(pdfPath, SaveFormat.Pdf)).ConfigureAwait(false);
-        }
-
-        #endregion
-
-        #region html转Word
-
-        /// <summary>
-        /// html转Word
-        /// </summary>
-        /// <param name="htmlPath">html源文件</param>
-        /// <param name="docPath">目标doc文件</param>
-        /// <param name="paperSize">纸张大小,默认A4纸</param>
-        /// <param name="leftMargin">左边距,默认10</param>
-        /// <param name="rightMargin">右边距,默认10</param>
-        /// <param name="topMargin">上边距,默认10</param>
-        /// <param name="bottomMargin">下边距,默认10</param>
-        public static void Html2Word(string htmlPath, string docPath, PaperSize paperSize = PaperSize.A4, double leftMargin = 20, double rightMargin = 20, double topMargin = 20, double bottomMargin = 20)
-        {
-            Document doc = new Document(htmlPath);
-            PageSetup pageSetup = new DocumentBuilder(doc).PageSetup;
-            pageSetup.PaperSize = paperSize;
-            pageSetup.LeftMargin = leftMargin;
-            pageSetup.RightMargin = rightMargin;
-            pageSetup.TopMargin = topMargin;
-            pageSetup.BottomMargin = bottomMargin;
-            doc.Save(docPath, SaveFormat.Doc);
-        }
-
-        /// <summary>
-        /// html转Word
-        /// </summary>
-        /// <param name="htmlPath">html源文件</param>
-        /// <param name="docPath">目标doc文件</param>
-        /// <param name="paperSize">纸张大小,默认A4纸</param>
-        /// <param name="leftMargin">左边距,默认10</param>
-        /// <param name="rightMargin">右边距,默认10</param>
-        /// <param name="topMargin">上边距,默认10</param>
-        /// <param name="bottomMargin">下边距,默认10</param>
-        public static async void Html2WordAsync(string htmlPath, string docPath, PaperSize paperSize = PaperSize.A4, double leftMargin = 20, double rightMargin = 20, double topMargin = 20, double bottomMargin = 20)
-        {
-            Document doc = new Document(htmlPath);
-            PageSetup pageSetup = new DocumentBuilder(doc).PageSetup;
-            pageSetup.PaperSize = paperSize;
-            pageSetup.LeftMargin = leftMargin;
-            pageSetup.RightMargin = rightMargin;
-            pageSetup.TopMargin = topMargin;
-            pageSetup.BottomMargin = bottomMargin;
-            await Task.Run(() => doc.Save(docPath, SaveFormat.Doc)).ConfigureAwait(false);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 66
Masuit.Tools/Files/SharpZip.cs

@@ -1,66 +0,0 @@
-using System;
-using System.Threading.Tasks;
-
-namespace Masuit.Tools.Files
-{
-    /// <summary>
-    /// SharpZip
-    /// </summary>
-    [Obsolete("该类已过时,请使用SevenZipCompressor替代")]
-    public static class SharpZip
-    {
-        #region 文件压缩
-
-        /// <summary>
-        /// 文件压缩
-        /// </summary> 
-        /// <param name="filename"> 压缩后的文件名(包含物理路径)</param>
-        /// <param name="directory">待压缩的文件夹(包含物理路径)</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Zip方法替代")]
-        public static void PackFiles(string filename, string directory)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Zip方法替代");
-        }
-
-        /// <summary>
-        /// 文件压缩
-        /// </summary> 
-        /// <param name="filename"> 压缩后的文件名(包含物理路径)</param>
-        /// <param name="directory">待压缩的文件夹(包含物理路径)</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Zip方法替代")]
-        public static async void PackFilesAsync(string filename, string directory)
-        {
-            await Task.Delay(0);
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Zip方法替代");
-        }
-
-        #endregion
-
-        #region 文件解压缩
-
-        /// <summary>
-        /// 文件解压缩
-        /// </summary>
-        /// <param name="file">待解压文件名(包含物理路径)</param>
-        /// <param name="dir"> 解压到哪个目录中(包含物理路径)</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Decompress方法替代")]
-        public static bool UnpackFiles(string file, string dir)
-        {
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Decompress方法替代");
-        }
-
-        /// <summary>
-        /// 文件解压缩
-        /// </summary>
-        /// <param name="file">待解压文件名(包含物理路径)</param>
-        /// <param name="dir"> 解压到哪个目录中(包含物理路径)</param>
-        [Obsolete("该方法已过时,请使用SevenZipCompressor.Decompress方法替代")]
-        public static async Task<bool> UnpackFilesAsync(string file, string dir)
-        {
-            await Task.Delay(0);
-            throw new NotImplementedException("该方法已过时,请使用SevenZipCompressor.Decompress方法替代");
-        }
-
-        #endregion
-    }
-}

+ 0 - 2
Masuit.Tools/Masuit.Tools.csproj

@@ -112,8 +112,6 @@
     <Compile Include="DateTimeExt\DateInfoStruct.cs" />
     <Compile Include="DateTimeExt\TimeHelper.cs" />
     <Compile Include="DateTimeExt\WeekHolidayStruct.cs" />
-    <Compile Include="Files\ClassZip.cs" />
-    <Compile Include="Files\SharpZip.cs" />
     <Compile Include="Files\WinrarHelper.cs" />
     <Compile Include="Extensions.cs" />
     <Compile Include="Files\SevenZipCompressor.cs" />