Exemplo n.º 1
0
        static PropertyDescriptorCollection GetPropertiesForContext(ReBugContext context)
        {
            PropertyDescriptorCollection result = new PropertyDescriptorCollection(null);

            foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(context))
            {
                if (descriptor.PropertyType.IsValueType || descriptor.PropertyType == typeof(string))
                {
                    result.Add(descriptor);
                }
                else
                {
                    object data = descriptor.GetValue(context);
                    if (data == null)
                    {
                        continue;
                    }
                    IDictionary dictionary = data as IDictionary;
                    if (dictionary != null && dictionary.Count == 0)
                    {
                        continue;
                    }
                    ICollection collection = data as ICollection;
                    if (collection != null && collection.Count == 0)
                    {
                        continue;
                    }
                    result.Add(new PropertyGridPropertyDescriptor(descriptor));
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Process(ReBugContext context)
        {
            ErrorModule.IsReBug = true;
            HttpWorkerRequest swr = new BugxWorkerRequest(context, Console.Out);

            HttpRuntime.ProcessRequest(swr);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BugxWorkerRequest"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="output">The output.</param>
 public BugxWorkerRequest(ReBugContext context, TextWriter output)
     : base(context.Url.AbsolutePath.Substring(1), context.QueryString.ToString(), output)
 {
     _Context = context;
     if (context.Form.Count > 0)
     {
         PostedData = Encoding.UTF8.GetBytes(context.Form.ToString());
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Loads the bug.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        void LoadBug(string fileName)
        {
            BugFile.Text = fileName;
            BugDocument xml = new BugDocument();

            xml.Load(fileName);
            CurrentContext = ReBugContext.Create(xml);
            ContextExplorer.SelectedObject = new PropertyGridInspector(CurrentContext);
            ReBug.Enabled = true;
        }
Exemplo n.º 5
0
        public PropertyDescriptorCollection GetProperties()
        {
            ReBugContext context = _Data as ReBugContext;

            if (context != null)
            {
                return(GetPropertiesForContext(context));
            }
            NameValueCollection nameValue = _Data as NameValueCollection;

            if (nameValue != null)
            {
                return(GetVirtualPropertiesForNameValue(nameValue));
            }
            IDictionary nameObject = _Data as IDictionary;

            if (nameObject != null)
            {
                return(GetVirtualPropertiesForNameObject(nameObject));
            }
            IList list = _Data as IList;

            if (list != null)
            {
                return(GetVirtualPropertiesForList(list));
            }
            ICollection collection = _Data as ICollection;

            if (collection != null)
            {
                return(GetVirtualPropertiesForCollection(collection));
            }
            PropertyDescriptorCollection result = new PropertyDescriptorCollection(null);

            foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(_Data))
            {
                if (descriptor.PropertyType.IsValueType || descriptor.PropertyType == typeof(string))
                {
                    result.Add(descriptor);
                }
                else
                {
                    result.Add(new PropertyGridPropertyDescriptor(descriptor));
                }
            }
            return(result);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Loads the bug.
 /// </summary>
 /// <param name="fileName">Name of the file.</param>
 void LoadBug(string fileName)
 {
     BugFile.Text = fileName;
     BugDocument xml = new BugDocument();
     xml.Load(fileName);
     CurrentContext = ReBugContext.Create(xml);
     ContextExplorer.SelectedObject = new PropertyGridInspector(CurrentContext);
     ReBug.Enabled = true;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Processes the specified context.
 /// </summary>
 /// <param name="context">The context.</param>
 public void Process(ReBugContext context)
 {
     ErrorModule.IsReBug = true;
     HttpWorkerRequest swr = new BugxWorkerRequest(context, Console.Out);
     HttpRuntime.ProcessRequest(swr);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BugxWorkerRequest"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="output">The output.</param>
 public BugxWorkerRequest(ReBugContext context, TextWriter output)
     : base(context.Url.AbsolutePath.Substring(1), context.QueryString.ToString(), output)
 {
     _Context = context;
     if (context.Form.Count > 0)
     {
         PostedData = Encoding.UTF8.GetBytes(context.Form.ToString());
     }
 }
Exemplo n.º 9
0
 static PropertyDescriptorCollection GetPropertiesForContext(ReBugContext context)
 {
     PropertyDescriptorCollection result = new PropertyDescriptorCollection(null);
     foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(context))
     {
         if (descriptor.PropertyType.IsValueType || descriptor.PropertyType == typeof(string))
         {
             result.Add(descriptor);
         }
         else
         {
             object data = descriptor.GetValue(context);
             if (data == null)
             {
                 continue;
             }
             IDictionary dictionary = data as IDictionary;
             if (dictionary != null && dictionary.Count == 0)
             {
                 continue;
             }
             ICollection collection = data as ICollection;
             if (collection != null && collection.Count == 0)
             {
                 continue;
             }
             result.Add(new PropertyGridPropertyDescriptor(descriptor));
         }
     }
     return result;
 }