예제 #1
0
파일: Form1.cs 프로젝트: Maxiaozhe/CodeBank
        /// <summary>
        /// Propertyを出力する
        /// </summary>
        /// <param name="xls"></param>
        /// <param name="sheet"></param>
        /// <param name="type"></param>
        /// <param name="row"></param>
        /// <returns></returns>
        private int WriteProperties(ExcelHelp xls, Excel.Worksheet sheet, Type type, int row)
        {
            bool   isWriteAttribute = false;
            string tableName        = "";

            if (type.Namespace.Equals("DenshowDataAccessInterface.Dto") ||
                type.Namespace.Equals("DenshowDataAccessInterface.Entity"))
            {
                isWriteAttribute = true;
                tableName        = getAttribute(type.GetTypeInfo());
            }

            var props = type.GetProperties(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static)
                        .Where(x => x.DeclaringType == type)
                        .OrderBy(x => x.Name);

            foreach (var prop in props)
            {
                if (prop.IsSpecialName)
                {
                    string name = prop.Name;
                }
                string attr = getAttribute(prop);

                WriteClassHeader(xls, sheet, type, row, false);
                //TypeKind
                xls.WriteValue(sheet, Definition.TypeKind, row, GetMemberType(prop.MemberType));
                //TypeName
                xls.WriteValue(sheet, Definition.TypeName, row, getTypeName(prop.PropertyType));
                //BingAttibute
                xls.WriteValue(sheet, Definition.BingAttibute, row, prop.CanRead ? "+" : "-");
                //Name
                xls.WriteValue(sheet, Definition.MemberName, row, prop.Name);
                //Paramter
                xls.WriteValue(sheet, Definition.MethodParams, row, "-");
                //summary
                string summary = GetSummary(prop);
                if (!string.IsNullOrEmpty(summary))
                {
                    xls.WriteValue(sheet, Definition.MemberSummary, row, summary);
                }
                //TableName
                if (isWriteAttribute)
                {
                    xls.WriteValue(sheet, Definition.TableName, row, tableName);
                    xls.WriteValue(sheet, Definition.ColumName, row, getAttribute(prop));
                }

                row++;
            }
            return(row);
        }
예제 #2
0
파일: Form1.cs 프로젝트: Maxiaozhe/CodeBank
        /// <summary>
        /// コンストラクタを出力する
        /// </summary>
        /// <param name="xls"></param>
        /// <param name="sheet"></param>
        /// <param name="type"></param>
        /// <param name="row"></param>
        /// <returns></returns>
        private int WriteConstructor(ExcelHelp xls, Excel.Worksheet sheet, Type type, int row)
        {
            var ctors = type.GetConstructors();

            foreach (var ctor in ctors)
            {
                WriteClassHeader(xls, sheet, type, row, false);
                //TypeKind
                xls.WriteValue(sheet, Definition.TypeKind, row, GetMemberType(ctor.MemberType));
                //TypeName
                xls.WriteValue(sheet, Definition.TypeName, row, "-");
                //BingAttibute
                xls.WriteValue(sheet, Definition.BingAttibute, row, ctor.IsPublic ? "+" : "-");
                //Name
                xls.WriteValue(sheet, Definition.MemberName, row, type.Name);
                var    pms  = ctor.GetParameters();
                string buff = "";
                foreach (var param in pms)
                {
                    if (!string.IsNullOrEmpty(buff))
                    {
                        buff += ", ";
                    }
                    buff += string.Format("{0} : {1}", param.Name, getTypeName(param.ParameterType));
                }
                //Paramter
                xls.WriteValue(sheet, Definition.MethodParams, row, string.IsNullOrEmpty(buff) ? "-" : buff);
                //Static
                if (ctor.IsStatic)
                {
                    xls.WriteValue(sheet, Definition.Memo, row, "static");
                }
                //summary
                string summary = GetSummary(ctor);
                if (!string.IsNullOrEmpty(summary))
                {
                    xls.WriteValue(sheet, Definition.MemberSummary, row, summary);
                }
                else
                {
                    xls.WriteValue(sheet, Definition.MemberSummary, row, "コンストラクタ");
                }
                row++;
            }
            return(row);
        }
예제 #3
0
파일: Form1.cs 프로젝트: Maxiaozhe/CodeBank
        /// <summary>
        /// メソッドを出力する
        /// </summary>
        /// <param name="xls"></param>
        /// <param name="sheet"></param>
        /// <param name="type"></param>
        /// <param name="row"></param>
        /// <returns></returns>
        private int WriteMethods(ExcelHelp xls, Excel.Worksheet sheet, Type type, int row)
        {
            var methods = type.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static)
                          .Where(x => x.DeclaringType == type && (!x.IsSpecialName) && (!x.Name.Contains("__")) && (!x.Name.Equals("InitializeComponent")))
                          .OrderBy(x => x.Name);

            foreach (var method in methods)
            {
                if (method.IsSpecialName || method.IsPrivate)
                {
                    string name = method.Name;
                }
                WriteClassHeader(xls, sheet, type, row, false);
                //TypeKind
                xls.WriteValue(sheet, Definition.TypeKind, row, GetMemberType(method.MemberType));
                //TypeName
                xls.WriteValue(sheet, Definition.TypeName, row, getTypeName(method.ReturnType));
                //BingAttibute
                xls.WriteValue(sheet, Definition.BingAttibute, row, method.IsPublic ? "+" : "-");
                //Name
                xls.WriteValue(sheet, Definition.MemberName, row, method.Name);
                var    pms  = method.GetParameters();
                string buff = "";
                foreach (var param in pms)
                {
                    if (!string.IsNullOrEmpty(buff))
                    {
                        buff += ", ";
                    }
                    buff += string.Format("{0} : {1}", param.Name, getTypeName(param.ParameterType));
                }
                //Paramter
                xls.WriteValue(sheet, Definition.MethodParams, row, string.IsNullOrEmpty(buff) ? "-" : buff);
                //Static
                if (method.IsStatic)
                {
                    xls.WriteValue(sheet, Definition.Memo, row, "static");
                }
                //summary
                string summary = GetSummary(method);
                if (!string.IsNullOrEmpty(summary))
                {
                    xls.WriteValue(sheet, Definition.MemberSummary, row, summary);
                }
                row++;
            }
            return(row);
        }
예제 #4
0
파일: Form1.cs 프로젝트: Maxiaozhe/CodeBank
        /// <summary>
        /// Fieldを出力
        /// </summary>
        /// <param name="xls"></param>
        /// <param name="sheet"></param>
        /// <param name="type"></param>
        /// <param name="row"></param>
        /// <returns></returns>
        private int WriteFields(ExcelHelp xls, Excel.Worksheet sheet, Type type, int row)
        {
            var flds = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static)
                       .Where(x => x.DeclaringType == type && !x.Name.Contains("__")).OrderBy(x => x.Name);

            foreach (var fld in flds)
            {
                if (fld.FieldType == typeof(EventHandler))
                {
                    string text = GetSummary(fld);
                    if (!string.IsNullOrEmpty(text))
                    {
                        xls.WriteValue(sheet, Definition.MemberSummary, row, text);
                    }
                }
                WriteClassHeader(xls, sheet, type, row, false);
                //TypeKind
                xls.WriteValue(sheet, Definition.TypeKind, row, GetMemberType(fld.MemberType));
                //TypeName
                xls.WriteValue(sheet, Definition.TypeName, row, getTypeName(fld.FieldType));
                //BingAttibute
                xls.WriteValue(sheet, Definition.BingAttibute, row, fld.IsPublic ? "+" : "-");
                //Name
                xls.WriteValue(sheet, Definition.MemberName, row, fld.Name);
                //Paramter
                xls.WriteValue(sheet, Definition.MethodParams, row, "-");
                //Static
                if (fld.IsStatic)
                {
                    xls.WriteValue(sheet, Definition.Memo, row, "static");
                }
                //summary
                string summary = GetSummary(fld);
                if (!string.IsNullOrEmpty(summary))
                {
                    xls.WriteValue(sheet, Definition.MemberSummary, row, summary);
                }
                row++;
            }
            return(row);
        }
예제 #5
0
파일: Form1.cs 프로젝트: Maxiaozhe/CodeBank
        private void WriteLayerName(ExcelHelp xls, Excel.Worksheet sheet, Type type, int row)
        {
            switch (type.Namespace)
            {
            case "DenshowBusinessComponent":
                //layer
                xls.WriteValue(sheet, Definition.LayerType, row, "ビジネスロジック層");
                xls.WriteValue(sheet, Definition.Category, row, "ロジック");
                break;

            case "DenshowBusinessInterface":
                xls.WriteValue(sheet, Definition.LayerType, row, "ビジネスロジック層");
                xls.WriteValue(sheet, Definition.Category, row, "ファクトリー");
                break;

            case "DenshowBusinessInterface.Component":
            case "DenshowBusinessInterface.Entity":
                xls.WriteValue(sheet, Definition.LayerType, row, "ビジネスロジック層");
                xls.WriteValue(sheet, Definition.Category, row, "エンティティ");
                break;

            case "DenshowDataAccessComponent":
                xls.WriteValue(sheet, Definition.LayerType, row, "データアクセス層");
                xls.WriteValue(sheet, Definition.Category, row, "データアクセス");
                break;

            case "DenshowDataAccessComponent.Dao":
                xls.WriteValue(sheet, Definition.LayerType, row, "データアクセス層");
                xls.WriteValue(sheet, Definition.Category, row, "データアクセス");
                break;

            case "DenshowDataAccessImpl.Dao":
                xls.WriteValue(sheet, Definition.LayerType, row, "データアクセス層");
                xls.WriteValue(sheet, Definition.Category, row, "管理");
                xls.GetRange(sheet, 2, 2, row, row).Font.Color = Excel.XlRgbColor.rgbRed;
                break;

            case "DenshowDataAccessComponent.Properties":
                xls.WriteValue(sheet, Definition.LayerType, row, "データアクセス層");
                xls.WriteValue(sheet, Definition.Category, row, "システム");
                break;

            case "DenshowDataAccessInterface":
                xls.WriteValue(sheet, Definition.LayerType, row, "データアクセス層");
                if (type.Name.EndsWith("Factory"))
                {
                    xls.WriteValue(sheet, Definition.Category, row, "ファクトリー");
                }
                break;

            case "DenshowDataAccessInterface.Dto":
            case "DenshowDataAccessInterface.Entity":
                xls.WriteValue(sheet, Definition.LayerType, row, "データアクセス層");
                xls.WriteValue(sheet, Definition.Category, row, "エンティティ");
                break;

            case "DenshowCommon":
                xls.WriteValue(sheet, Definition.LayerType, row, "各層共通");
                xls.WriteValue(sheet, Definition.Category, row, "共通");
                break;

            case "DenshowNativeCommon":
                xls.WriteValue(sheet, Definition.LayerType, row, "各層共通画像処理");
                xls.WriteValue(sheet, Definition.Category, row, "共通");
                break;

            case "ReportDefinition.Base":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "画面");
                break;

            case "ReportDefinition.Checklist":
            case "ReportDefinition.ControlDefinision":
            case "ReportDefinition.Menu":
            case "ReportDefinition.Monitoring":
            case "ReportDefinition.ReportForm":
            case "ReportDefinition.Template":
            case "ReportDefinition.User":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "画面");
                break;

            case "ReportDefinition.Process":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "プロセス");
                break;

            case "ReportDefinition.Properties":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "システム");
                break;

            case "ReportDefinitionControl.Button":
            case "ReportDefinitionControl.Cell":
            case "ReportDefinitionControl.ComboBoxItem":
            case "ReportDefinitionControl.Label":
            case "ReportDefinitionControl.Menu":
            case "ReportDefinitionControl.Picture2.ContextMenu.Menu":
            case "ReportDefinitionControl.Picture2.ContextMenu.MenuItem":
            case "ReportDefinitionControl.TextBox":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "共通コントロール");
                break;

            case "ReportDefinitionControl.Picture2":
            case "ReportDefinitionControl.Picture2.CustomControl":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "描画コントロール");
                break;

            case "ReportDefinitionControl.Picture2.Entity":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "管理");
                break;

            case "ReportDefinitionControl.Properties":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "システム");
                break;

            case "ReportService":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "システム");
                break;

            case "ReportServiceProto.Process":
                xls.GetRange(sheet, 2, 2, row, row).Font.Color = Excel.XlRgbColor.rgbRed;
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "プロセス");
                break;

            case "RecogResultCorrection":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                if (!type.Name.Equals("Global"))
                {
                    xls.WriteValue(sheet, Definition.Category, row, "Web画面");
                }
                else
                {
                    xls.WriteValue(sheet, Definition.Category, row, "メイン");
                }

                break;

            case "RecogResultCorrection.Process":
                xls.WriteValue(sheet, Definition.LayerType, row, "プレゼンテーション層");
                xls.WriteValue(sheet, Definition.Category, row, "プロセス");
                break;

            case "JocrSDKInterface":
            case "JocrSDKComponent":
            case "HocrSDKInterface":
            case "HocrSDKComponent":
            case "FormSDKInterface":
            case "FormSDKComponent":
            case "DocumentSDKInterface":
            case "DocumentSDKComponent":
            case "DocumentSDKCommon":
                xls.WriteValue(sheet, Definition.LayerType, row, "ビジネスロジック層(SDK)");
                if (type.Name.Equals(type.Namespace))
                {
                    xls.WriteValue(sheet, Definition.Category, row, "ロジック");
                }
                break;

            default:
                break;
            }
        }
예제 #6
0
파일: Form1.cs 프로젝트: Maxiaozhe/CodeBank
        //Classを書き出す
        private void WriteClassHeader(ExcelHelp xls, Excel.Worksheet sheet, Type type, int row, bool isHeader)
        {
            //NameSpace
            xls.WriteValue(sheet, Definition.NameSpace, row, type.Namespace);
            //className
            xls.WriteValue(sheet, Definition.ClassName, row, type.Name);
            //baseclass
            string buff = "";

            if (type.BaseType != null && type.BaseType != typeof(object))
            {
                buff += type.BaseType.Name;
            }
            else
            {
                buff = GetInterfaces(type);
            }
            xls.WriteValue(sheet, Definition.BaseClass, row, string.IsNullOrEmpty(buff) ? "-" : buff);

            if (isHeader)
            {
                //Field Count
                int fldCount = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static)
                               .Where(x => x.DeclaringType == type && !x.Name.Contains("__")).Count();
                fldCount += type.GetProperties(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static)
                            .Where(x => x.DeclaringType == type).Count();
                xls.WriteValue(sheet, Definition.FieldCount, row, fldCount.ToString());
                //Method Count
                var Methods = type.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static)
                              .Where(x => x.DeclaringType == type && (!x.IsSpecialName) && (!x.Name.Contains("__")) && (!x.Name.Equals("InitializeComponent")));
                xls.WriteValue(sheet, Definition.MethodCount, row, Methods.Count().ToString());
                //TypeKind
                xls.WriteValue(sheet, Definition.TypeKind, row, GetMemberType(type.MemberType));
                //公開/非公開
                xls.WriteValue(sheet, Definition.BingAttibute, row, "-");
                //MemberName
                xls.WriteValue(sheet, Definition.MemberName, row, "-");
                //MethodParams
                xls.WriteValue(sheet, Definition.MethodParams, row, "-");
                //戻り値タイプ
                xls.WriteValue(sheet, Definition.TypeName, row, "-");
                //summary
                string summary = GetSummary(type.GetTypeInfo());
                if (!string.IsNullOrEmpty(summary))
                {
                    xls.WriteValue(sheet, Definition.ClassSummary, row, summary);
                }
            }
            WriteLayerName(xls, sheet, type, row);
        }