Пример #1
0
        public static void WriteLogInformation(this ILogger logger, ComponentLayer componentLayer, string className, string methodName, MethodLine methodLine, string message, params object[] args)
        {
            var layer = string.Empty;

            switch (componentLayer)
            {
            case ComponentLayer.API:

                break;

            case ComponentLayer.REPOSITORY:
                logger.LogInformation("REPOSITORYLAYER", className, methodName, message, args);
                break;

            default:
                break;
            }

            var line = string.Empty;

            switch (methodLine)
            {
            case MethodLine.BEGIN:
                line = "BEGIN";
                break;

            case MethodLine.END:
                line = "END";
                break;

            default:
                break;
            }

            logger.LogInformation(layer, line, className, methodName, message, args);
        }
 private LineInfo ProcessTaskItem(DesignerActionList list, DesignerActionItem item)
 {
     Line line = null;
     if (item is DesignerActionMethodItem)
     {
         line = new MethodLine(this._serviceProvider, this);
     }
     else if (item is DesignerActionPropertyItem)
     {
         DesignerActionPropertyItem item2 = (DesignerActionPropertyItem) item;
         PropertyDescriptor propDesc = TypeDescriptor.GetProperties(list)[item2.MemberName];
         if (propDesc == null)
         {
             throw new InvalidOperationException(System.Design.SR.GetString("DesignerActionPanel_CouldNotFindProperty", new object[] { item2.MemberName, list.GetType().FullName }));
         }
         TypeDescriptorContext context = new TypeDescriptorContext(this._serviceProvider, propDesc, list);
         UITypeEditor editor = (UITypeEditor) propDesc.GetEditor(typeof(UITypeEditor));
         bool standardValuesSupported = propDesc.Converter.GetStandardValuesSupported(context);
         if (editor == null)
         {
             if (propDesc.PropertyType == typeof(bool))
             {
                 if (IsReadOnlyProperty(propDesc))
                 {
                     line = new TextBoxPropertyLine(this._serviceProvider, this);
                 }
                 else
                 {
                     line = new CheckBoxPropertyLine(this._serviceProvider, this);
                 }
             }
             else if (standardValuesSupported)
             {
                 line = new EditorPropertyLine(this._serviceProvider, this);
             }
             else
             {
                 line = new TextBoxPropertyLine(this._serviceProvider, this);
             }
         }
         else
         {
             line = new EditorPropertyLine(this._serviceProvider, this);
         }
     }
     else
     {
         if (!(item is DesignerActionTextItem))
         {
             return null;
         }
         if (item is DesignerActionHeaderItem)
         {
             line = new HeaderLine(this._serviceProvider, this);
         }
         else
         {
             line = new TextLine(this._serviceProvider, this);
         }
     }
     return new LineInfo(list, item, line);
 }
Пример #3
0
        private static IEnumerable <AssemblyLine> ParseInputFile(string inputFile)
        {
            var currentLineCount = 0;
            var typeLines        = new List <TypeLine>();
            var assemblyLines    = new List <AssemblyLine>();

            using (var reader = new StreamReader(inputFile))
            {
                while (!reader.EndOfStream)
                {
                    currentLineCount++;
                    var currentLine = reader.ReadLine();

                    if (string.IsNullOrEmpty(currentLine))
                    {
                        continue;
                    }
                    if (currentLine.Trim() == "")
                    {
                        continue;
                    }
                    if (currentLine.ToLower().Trim().Equals("break;"))
                    {
                        break;
                    }
                    if (currentLine.ToLower().Trim().Equals("return;"))
                    {
                        return(assemblyLines);
                    }
                    if (!currentLine.ToLower().Trim().StartsWith("//"))
                    {
                        if (AssemblyLine.IsAssembly(currentLine))
                        {
                            var assemblyLine = new AssemblyLine(currentLineCount, currentLine);
                            assemblyLines.Add(assemblyLine);
                        }
                        else if (TypeLine.IsType(currentLine))
                        {
                            if (assemblyLines.Count == 0)
                            {
                                "CryoAOP -> Error:{0}! Could not find matching assembly tag for type ... ".Error(
                                    currentLineCount.ToString());
                                "CryoAOP -> '{0}'".Error(currentLine.Trim());
                                WriteUsage();
                                return(assemblyLines);
                            }

                            var typeLine = new TypeLine(currentLineCount, currentLine);
                            assemblyLines.Last().Types.Add(typeLine);
                            typeLines.Add(typeLine);
                        }
                        else if (MethodLine.IsMethod(currentLine))
                        {
                            if (assemblyLines.Count == 0 && typeLines.Count == 0)
                            {
                                "CryoAOP -> Error:{0}! Could not find matching type tag for method ... ".Error(
                                    currentLineCount.ToString());
                                "CryoAOP -> '{0}'".Error(currentLine.Trim());
                                WriteUsage();
                                return(assemblyLines);
                            }

                            var methodLine = new MethodLine(currentLineCount, currentLine);
                            typeLines.Last().Methods.Add(methodLine);
                        }
                        else if (PropertyLine.IsProperty(currentLine))
                        {
                            if (assemblyLines.Count == 0 && typeLines.Count == 0)
                            {
                                "CryoAOP -> Error:{0}! Could not find matching type tag for property ... ".Error(
                                    currentLineCount.ToString());
                                "CryoAOP -> '{0}'".Error(currentLine.Trim());
                                WriteUsage();
                                return(assemblyLines);
                            }

                            var propertyLine = new PropertyLine(currentLineCount, currentLine);
                            typeLines.Last().Properties.Add(propertyLine);
                        }
                        else
                        {
                            "CryoAOP -> Warning:{0}! Ignoring line because entry appears to be invalid ... ".Warn(
                                currentLineCount);
                            "CryoAOP -> '{0}'".Warn(currentLine.Trim());
                        }
                    }
                }
            }
            return(assemblyLines);
        }