public LibraryElement(IdElement Name, ImplementationElement Implementation, ExportsElement Exports, CompoundElement Compound) { name = Name; implementation = Implementation; exports = Exports; compound = Compound; }
public ProgramElement(IdElement Name, IdListElement Params, ImplementationElement Implementation, CompoundElement Compound) { name = Name; pparams = Params; implementation = Implementation; compound = Compound; }
public UnitElement(IdElement Name, InterfaceSecElement Interface, ImplementationElement Implementation, InitializationElement Initialization, FinalizationElement Finalization) { name = Name; uinterface = Interface; implementation = Implementation; initialization = Initialization; finalization = Finalization; }
private static void ApplyInterfaceToClass(Shape end, ClassElement startElement) { var endInterface = end as UmlInterface; var endElement = (endInterface.DataSource as UmlInterfaceData).Owner.Type as InterfaceElement; bool exists = false; foreach (ImplementationElement existingImpl in startElement.GetChildren <ImplementationElement>()) { if (existingImpl.InterfaceName == endElement.Name) { exists = true; break; } } if (!exists) { var implementation = new ImplementationElement(); implementation.InterfaceName = endElement.Name; startElement.AddChild(implementation); } }
/// <summary> /// 按配置元素创建IAppLoggerImpl日志实现类对象。 /// </summary> /// <param name="element">配置元素。</param> /// <returns>日志实现类对象。</returns> /// <remarks> /// 配置元素:USe.Common.AppLogger/appLoggers/appLogger/implementation。 /// </remarks> private static IAppLoggerImpl CreateImplementationObject(ImplementationElement element) { USe.Common.AppLogger.EventFormatter.IEventFormatter formatter = null; IAppLoggerImpl logger = null; switch (element.EventFormatter) { case "EventStringFormatter": formatter = new USe.Common.AppLogger.EventFormatter.EventStringFormatter(); break; case "FriendlyEventStringFormatter": formatter = new USe.Common.AppLogger.EventFormatter.FriendlyEventStringFormatter(); break; default: throw new ArgumentException("Invalid [appLogger/implementation] configuration element."); } switch (element.LoggerType) { case "NullLogger": { string name = element.GetCustomAttribute("nullName") as string; if (String.IsNullOrEmpty(name)) { name = USe.Common.AppLogger.Implementation.NullLogger.GetDefaultName(); } logger = new USe.Common.AppLogger.Implementation.NullLogger(name, formatter); break; } case "ConsoleLogger": { string name = element.GetCustomAttribute("consoleName") as string; if (String.IsNullOrEmpty(name)) { name = USe.Common.AppLogger.Implementation.ConsoleLogger.GetDefaultConsoleName(); } logger = new USe.Common.AppLogger.Implementation.ConsoleLogger(name, element.Encoding, formatter); break; } case "FileLogger": { string name = element.GetCustomAttribute("fileName") as string; if (String.IsNullOrEmpty(name)) { name = USe.Common.AppLogger.Implementation.FileLogger.GetDefaultFileName(element.IsCheckUAC); } else { name = FormatFileName(name); } logger = new USe.Common.AppLogger.Implementation.FileLogger(name, element.Encoding, formatter); break; } case "FileLogger2": { string name = element.GetCustomAttribute("fileName") as string; if (String.IsNullOrEmpty(name)) { name = USe.Common.AppLogger.Implementation.FileLogger2.GetDefaultFileName(element.IsCheckUAC); } else { name = FormatFileName(name); } logger = new USe.Common.AppLogger.Implementation.FileLogger2(name, element.Encoding, formatter); break; } case "DailyFileLogger": { string name = element.GetCustomAttribute("fileName") as string; if (String.IsNullOrEmpty(name)) { name = USe.Common.AppLogger.Implementation.DailyFileLogger.GetDefaultFileName(element.IsCheckUAC); } else { name = FormatFileName(name); } logger = new USe.Common.AppLogger.Implementation.DailyFileLogger(name, element.Encoding, formatter); break; } case "DailyFileLogger2": { string name = element.GetCustomAttribute("fileName") as string; if (String.IsNullOrEmpty(name)) { name = USe.Common.AppLogger.Implementation.DailyFileLogger2.GetDefaultFileName(element.IsCheckUAC); } else { name = FormatFileName(name); } logger = new USe.Common.AppLogger.Implementation.DailyFileLogger2(name, element.Encoding, formatter); break; } default: throw new ArgumentException("Invalid [appLogger/implementation] configuration element."); } Debug.Assert(logger != null); return(logger); }