⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exportcontactstocvs.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc
{
    using System;
    using System.IO;
    using System.Text;
    using System.Windows.Forms;
    using System.Xml;

    internal class ExportContactsToCVS : IExportContacts
    {
        public void ExportContacts(IWin32Window owner, string filePath, string xmlContacts)
        {
            XmlDocument document = new XmlDocument();
            document.LoadXml(xmlContacts);
            if (document.DocumentElement.ChildNodes.Count != 0)
            {
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < document.DocumentElement.ChildNodes[0].ChildNodes.Count; i++)
                {
                    builder.Append(string.Format("\"{0}\"", document.DocumentElement.ChildNodes[0].ChildNodes[i].Name));
                    if (i != (document.DocumentElement.ChildNodes[0].ChildNodes.Count - 1))
                    {
                        builder.Append(",");
                    }
                    else
                    {
                        builder.Append("\r\n");
                    }
                }
                foreach (XmlNode node in document.DocumentElement.ChildNodes)
                {
                    for (int j = 0; j < node.ChildNodes.Count; j++)
                    {
                        builder.Append(string.Format("\"{0}\"", node.ChildNodes[j].InnerText));
                        if ((node.ChildNodes.Count - 1) != j)
                        {
                            builder.Append(",");
                        }
                        else
                        {
                            builder.Append("\r\n");
                        }
                    }
                }
                using (StreamWriter writer = new StreamWriter(filePath, false, ImportExportManager.FileEncoding))
                {
                    writer.Write(builder.ToString());
                }
            }
        }

        public string Filter
        {
            get
            {
                return "csv files (*.csv)|*.csv";
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -