예제 #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);
        }
예제 #2
0
파일: BugxHost.cs 프로젝트: mbsky/bugx
        /// <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);
        }
예제 #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());
     }
 }
예제 #4
0
파일: MainForm.cs 프로젝트: mbsky/bugx
        /// <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;
        }
예제 #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);
        }
예제 #6
0
파일: MainForm.cs 프로젝트: mbsky/bugx
 /// <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;
 }
예제 #7
0
파일: BugxHost.cs 프로젝트: mbsky/bugx
 /// <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);
 }
예제 #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());
     }
 }
예제 #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;
 }