using ICSharpCode.TextEditor.Document;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace 开发辅助工具.Tools
{
    public partial class FrmStrCount : DockContent
    {
        public FrmStrCount()
        {
            InitializeComponent();
            textEditorControl1.IsReadOnly = true;
        }

        private void TxtFromCode_TextChanged(object sender, EventArgs e)
        {
            Manager.TotalCount totalCount = new Manager.TotalCount();
            string fromText = TxtFromCode.Text;
            int iCount = totalCount.GetByteLength(fromText, out int HanziCount, out int engCount, out int NumCount);
            string resultStr = "";
            resultStr = "字节数:            " + iCount.ToString() + "个(汉字算两个字符)";
            resultStr += "\r\n字数:              " + fromText.Length.ToString() + "个(汉字算一个字符)";
            resultStr += "\r\n汉字数:            " + HanziCount.ToString() + "个(汉字算一个字符)";
            resultStr += "\r\n英文数量:          " + engCount.ToString() + "个";
            resultStr += "\r\n数字数量:          " + NumCount.ToString() + "个";
            textEditorControl1.Text = resultStr;
        }
    }
}
