Exemplo n.º 1
0
        void WriteType(FrameworkVersion version, TypeWrapper type)
        {
            var writer = new ClassWriter(this, version, type);

            writer.Write();

            foreach (var item in type.GetConstructors().Where(x => x.IsPublic))
            {
                var itemWriter = new ConstructorWriter(this, version, item);
                itemWriter.Write();
            }

            foreach (var item in type.GetMethodsToDocument())
            {
                // If a method is in another namespace, it is inherited and should not be overwritten
                if (item.DeclaringType.Namespace == type.Namespace)
                {
                    var itemWriter = new MethodWriter(this, version, item);
                    itemWriter.Write();
                }
            }

            foreach (var item in type.GetEvents())
            {
                // If an event is in another namespace, it is inherited and should not be overwritten
                if (item.DeclaringType.Namespace == type.Namespace)
                {
                    var itemWriter = new EventWriter(this, version, item);
                    itemWriter.Write();
                }
            }
        }
Exemplo n.º 2
0
        private void Write(Dictionary <string, object> requestProperties)
        {
            List <TypedItem> list = requestProperties.ToTypedItems();

            if (eXtensibleWebApiConfig.LogTo.Equals(LoggingStrategyOption.Datastore))
            {
                try
                {
                    ApiRequest request = new ApiRequest(requestProperties);
                    RequestProvider.Post(request);
                    //ApiRequestSqlAccess.Post(request);
                }
                catch (Exception ex)
                {
                    EventWriter.Write(EventTypeOption.Custom, list);
                    string message    = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                    var    properties = eXtensibleConfig.GetProperties();
                    properties.Add("xf.explanation", "An error occurred while trying to POST an ApiRequest to a SqlServer datastore. " +
                                   " Ensure that a valid SqlServer database exists with the proper schema, and that a valid connectionstring and connectionstring key");
                    EventWriter.WriteError(message, SeverityType.Error, "eXtensibleMessageHandler", properties);
                }
            }
            else if (eXtensibleWebApiConfig.LogTo.Equals(LoggingStrategyOption.WindowsEventLog))
            {
                EventWriter.Write(EventTypeOption.Custom, list);
            }
        }
Exemplo n.º 3
0
        private void Write(Dictionary <string, object> requestProperties)
        {
            List <TypedItem> list = requestProperties.ToTypedItems();

            if (eXtensibleWebApiConfig.LogTo.Equals(LoggingStrategyOption.WindowsEventLog))
            {
                EventWriter.Write(EventTypeOption.Custom, list);
            }
            else if (RequestProvider != null)
            {
                try
                {
                    ApiRequest request = new ApiRequest(requestProperties);
                    RequestProvider.Post(request);
                }
                catch (Exception ex)
                {
                    EventWriter.Write(EventTypeOption.Custom, list);
                    string message    = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                    var    properties = eXtensibleConfig.GetProperties();
                    properties.Add("xf.explanation", "An error occurred while trying to POST an ApiRequest to the configured ApiRequestProvider");
                    EventWriter.WriteError(message, SeverityType.Error, "eXtensibleMessageHandler", properties);
                }
            }
            else
            {
                EventWriter.Write(EventTypeOption.Custom, list);
            }
        }
Exemplo n.º 4
0
        public void Basics()
        {
            var ev = new EventWriter {
                Name = "MyEvent", IsPublic = true, EventType = new TypeReferenceWriter("EventHandler")
            };

            var sw     = new StringWriter();
            var writer = new CodeWriter(sw);

            ev.Write(writer);

            var expected = @"public event EventHandler MyEvent;
";

            Assert.AreEqual(expected, sw.ToString());
        }
Exemplo n.º 5
0
        void WriteType(FrameworkVersion version, TypeWrapper type)
        {
            var writer = new ClassWriter(this, version, type);

            writer.Write();

            foreach (var item in type.GetConstructors().Where(x => x.IsPublic))
            {
                var itemWriter = new ConstructorWriter(this, version, item);
                itemWriter.Write();
            }

            foreach (var item in type.GetMethodsToDocument())
            {
                var itemWriter = new MethodWriter(this, version, item);
                itemWriter.Write();
            }

            foreach (var item in type.GetEvents())
            {
                var itemWriter = new EventWriter(this, version, item);
                itemWriter.Write();
            }
        }
Exemplo n.º 6
0
 public static void Write(IDictionary <string, object> items)
 {
     EventWriter.Write(EventTypeOption.Custom, items.ToTypedItems());
 }