Exemple #1
0
        /// <summary>
        /// Main.
        /// </summary>
        /// <param name="args">args.</param>
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello!");
            IIndentedWriter iw = new TextIndentedWriter(Console.Out);

            // main
            MyInfo.outl_main(iw, null, null);
        }
Exemple #2
0
        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。Parameter
        /// 属性通常用于配置页。</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            StringBuilder   sb = new StringBuilder();
            IIndentedWriter iw = new TextIndentedWriter(new StringWriter(sb));

            MyInfo.outl_main(iw, null, null);
            txtInfo.Text = sb.ToString();
        }
Exemple #3
0
        private void btnOutput_Click(object sender, EventArgs e)
        {
            StringWriter strWriter = new StringWriter();
            //strWriter.WriteLine("Test);
            TextIndentedWriter iw = new TextIndentedWriter(strWriter);

            SysInfoUtil.OutputAll(iw, null, null);
            txtOutput.Text = strWriter.ToString();
        }
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            StringWriter strWriter = new StringWriter();
            //strWriter.WriteLine("Test);
            TextIndentedWriter iw = new TextIndentedWriter(strWriter);

            SysInfoUtil.OutputAll(iw, null, null);
            // WPF
            bool showWpf = true;

            if (showWpf)
            {
                iw.WriteLine("== WPF ==");
                iw.WriteLine(string.Format("WpfInfo.FrameworkDescription:\t{0}", WpfInfo.FrameworkDescription));
                WpfInfo.OutputAll(strWriter);
            }
            // done.
            txtOutput.Text = strWriter.ToString();
        }
Exemple #5
0
        private void cboMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            int idx = cboMode.SelectedIndex;

            if (idx < 0 || idx >= InfoData.NameProcs.Length)
            {
                return;
            }
            IndentedWriterObjectProc proc = InfoData.NameProcs[idx].Value;
            StringBuilder            sb   = new StringBuilder();
            IIndentedWriter          iw   = new TextIndentedWriter(new StringWriter(sb));

            try {
                proc(iw, null, null);
            }
            catch (Exception ex) {
                sb.AppendLine(ex.ToString());
            }
            txtInfo.Text = sb.ToString();
        }
Exemple #6
0
        /// <summary>
        /// main.
        /// </summary>
        /// <param name="args">args</param>
        static void Main(string[] args)
        {
            IIndentedWriter iw = new TextIndentedWriter(Console.Out);

            MyInfo.outl_main(iw, null, null);
        }
        /// <summary>
        /// 刷新信息.
        /// </summary>
        private void RefreshInfo()
        {
            string name = cboAssembly.SelectedItem as string;

            if (null == name)
            {
                return;
            }
            // 重新获取程序集.
            if (!name.Equals(m_OldAssemblyName, StringComparison.Ordinal))
            {
                try {
                    m_CurAssembly     = InfoAssembly.LoadAssembly(name);
                    m_OldAssemblyName = name;
                    RefreshModeList();
                }
                catch (Exception ex) {
                    m_OldAssemblyName = null;
                    txtInfo.Text      = ex.ToString();
                }
            }
            if (null == m_CurAssembly)
            {
                return;
            }
            // 计算显示方式.
            InfoMode mode   = 0;
            Type     tp     = null;
            bool     isshow = false;
            object   obj    = cboMode.SelectedItem;

            if (obj is Type)
            {
                tp     = obj as Type;
                isshow = true;
            }
            else if (obj is InfoMode)
            {
                mode   = (InfoMode)obj;
                isshow = true;
            }
            if (!isshow)
            {
                return;
            }
            // 显示信息.
            StringBuilder         sb      = new StringBuilder();
            IIndentedWriter       iw      = new TextIndentedWriter(new StringWriter(sb));
            IndentedWriterContext context = new IndentedWriterContext();

            context.VisitOnce = (bool)chkVisitOnce.IsChecked;
            //this.UseWaitCursor = true;
            this.Cursor = Cursors.Wait;
            //Application.DoEvents();
            try {
                if (null != tp)
                {
                    IndentedWriterMemberOptions options = IndentedWriterMemberOptions.OnlyStatic;
                    if (chkMethod.IsChecked != false)
                    {
                        options |= IndentedWriterMemberOptions.AllowMethod;
                    }
                    InfoAssembly.WriteTypeStatic(iw, context, tp, options);
                }
                else
                {
                    InfoAssembly.WriteInfo(iw, context, m_CurAssembly, mode);
                }
            }
            catch (Exception ex) {
                sb.AppendLine(ex.ToString());
            }
            //this.UseWaitCursor = false;
            this.Cursor  = null;
            txtInfo.Text = sb.ToString();
        }
Exemple #8
0
        /// <summary>
        /// Output all.
        /// </summary>
        /// <param name="writer">Output writer.</param>
        /// <param name="indent">The indent.</param>
        public static void OutputAll(TextWriter writer, string indent)
        {
            IIndentedWriter iw = new TextIndentedWriter(writer);

            OutputAll(iw, null, null);
        }
Exemple #9
0
        /// <summary>
        /// 刷新信息.
        /// </summary>
        private void RefreshInfo()
        {
            if (null == cboAssembly)
            {
                return;
            }
            string name = cboAssembly.SelectedItem as string;

            if (null == name)
            {
                return;
            }
            // 重新获取程序集.
            if (!name.Equals(m_OldAssemblyName, StringComparison.Ordinal))
            {
                try {
                    m_CurAssembly     = InfoAssembly.LoadAssembly(name);
                    m_OldAssemblyName = name;
                    RefreshModeList();
                }
                catch (Exception ex) {
                    m_OldAssemblyName = null;
                    txtInfo.Text      = ex.ToString();
                    return;
                }
            }
            if (null == m_CurAssembly)
            {
                return;
            }
            // 计算显示方式.
            InfoMode mode   = 0;
            Type     tp     = null;
            bool     isshow = false;
            object   obj    = cboMode.SelectedItem;

            if (obj is Type)
            {
                tp     = obj as Type;
                isshow = true;
            }
            else if (obj is InfoMode)
            {
                mode   = (InfoMode)obj;
                isshow = true;
            }
            if (!isshow)
            {
                return;
            }
            // 显示信息.
            StringBuilder         sb      = new StringBuilder();
            IIndentedWriter       iw      = new TextIndentedWriter(new StringWriter(sb));
            IndentedWriterContext context = new IndentedWriterContext();

            context.VisitOnce = (bool)chkVisitOnce.IsChecked;
            //this.UseWaitCursor = true;
            //this.Cursor = Cursors.Wait;
            //Application.DoEvents();
            try {
                // test
                //if (false) {
                //	sb.AppendFormat("{0}:\n", m_CurAssembly.FullName);
                //	//IndentedObjectFunctor.CommonProc(iw, m_CurAssembly, null);
                //	Type tp1 = m_CurAssembly.GetType();
                //	foreach (PropertyInfo pi in tp1.GetRuntimeProperties()) {
                //		if (pi.CanRead && pi.GetIndexParameters().Length <= 0) {
                //			try {
                //				object o = pi.GetValue(m_CurAssembly);
                //				sb.AppendFormat("{0}:\t{1}\n", pi.Name, o);
                //			}
                //			catch (Exception ex) {
                //				sb.AppendFormat("{0}\n", ex);
                //			}
                //		}
                //	}
                //}
                // show
                if (true)
                {
                    if (null != tp)
                    {
                        IndentedWriterMemberOptions options = IndentedWriterMemberOptions.OnlyStatic;
                        if (chkMethod.IsChecked != false)
                        {
                            options |= IndentedWriterMemberOptions.AllowMethod;
                        }
                        InfoAssembly.WriteTypeStatic(iw, context, tp, options);
                    }
                    else
                    {
                        InfoAssembly.WriteInfo(iw, context, m_CurAssembly, mode);
                    }
                }
            }
            catch (Exception ex) {
                sb.AppendLine(ex.ToString());
            }
            //this.UseWaitCursor = false;
            //this.Cursor = null;
            txtInfo.Text = sb.ToString();
        }