コード例 #1
0
        public string Export(WordLibraryList wlList)
        {
            var sb = new StringBuilder();
            //sb.Append(GetFileHeader());
            IDictionary <string, string> xiaoxiaoDic = new Dictionary <string, string>();

            for (int i = 0; i < wlList.Count; i++)
            {
                string key   = "";
                var    wl    = wlList[i];
                string value = wl.Word;
                if (CodeType == CodeType.Pinyin)
                {
                    key = (wl.GetPinYinString("", BuildType.None));
                }
                else if (CodeType == wl.CodeType)
                {
                    key = (wl.Codes[0][0]);
                }
                else
                {
                    IList <string> codes = CodeGenerater.GetCodeOfString(wl.Word);
                    if (CodeGenerater.Is1CharMutiCode)
                    {
                        foreach (string code in codes)
                        {
                            if (xiaoxiaoDic.ContainsKey(code))
                            {
                                xiaoxiaoDic[code] += " " + value;
                            }
                            else
                            {
                                xiaoxiaoDic.Add(code, value);
                            }
                        }
                        continue;
                    }
                    else
                    {
                        key = (CollectionHelper.ListToString(codes));
                    }
                }


                if (xiaoxiaoDic.ContainsKey(key))
                {
                    xiaoxiaoDic[key] += " " + value;
                }
                else
                {
                    xiaoxiaoDic.Add(key, value);
                }
            }
            foreach (var keyValuePair in xiaoxiaoDic)
            {
                sb.Append(keyValuePair.Key + " " + keyValuePair.Value + "\n");
            }

            return(sb.ToString());
        }
コード例 #2
0
        //public Form ExportConfigForm { get { return form; } }
        public IList <string> Export(WordLibraryList wlList)
        {
            var sb = new StringBuilder();
            //sb.Append(GetFileHeader());
            IDictionary <string, string> xiaoxiaoDic = new Dictionary <string, string>();

            for (int i = 0; i < wlList.Count; i++)
            {
                string      key   = "";
                WordLibrary wl    = wlList[i];
                string      value = wl.Word;
                if (CodeType == CodeType.Pinyin)
                {
                    key = (wl.GetPinYinString("", BuildType.None));
                }
                else if (CodeType == wl.CodeType)
                {
                    key = (wl.Codes[0][0]);
                }
                else
                {
                    var codes = CodeGenerater.GetCodeOfString(wl.Word);
                    var list  = codes.ToCodeString();
                    foreach (var code in list)
                    {
                        if (xiaoxiaoDic.ContainsKey(code))
                        {
                            xiaoxiaoDic[code] += " " + value;
                        }
                        else
                        {
                            xiaoxiaoDic.Add(code, value);
                        }
                    }
                }


                if (xiaoxiaoDic.ContainsKey(key))
                {
                    xiaoxiaoDic[key] += " " + value;
                }
                else
                {
                    xiaoxiaoDic.Add(key, value);
                }
            }
            foreach (var keyValuePair in xiaoxiaoDic)
            {
                sb.Append(keyValuePair.Key + " " + keyValuePair.Value + "\n");
            }

            return(new List <string>()
            {
                sb.ToString()
            });
        }
コード例 #3
0
        public string ExportLine(WordLibrary wl)
        {
            var sb = new StringBuilder();

            if (CodeType == CodeType.Pinyin)
            {
                sb.Append(wl.GetPinYinString("", BuildType.None));
            }
            else if (CodeType == wl.CodeType)
            {
                sb.Append(wl.Codes);
            }
            else
            {
                sb.Append(CollectionHelper.ListToString(CodeGenerater.GetCodeOfString(wl.Word)));
            }
            sb.Append(" ");
            sb.Append(wl.Word);
            return(sb.ToString());
        }
コード例 #4
0
        public string ExportLine(WordLibrary wl)
        {
            var sb = new StringBuilder();

            if (CodeType == CodeType.Pinyin)
            {
                sb.Append(wl.GetPinYinString("", BuildType.None));
            }
            else if (CodeType == wl.CodeType)
            {
                sb.Append(wl.Codes[0][0]);
            }
            else
            {
                var code = CodeGenerater.GetCodeOfString(wl.Word);
                sb.Append(code.ToCodeString());
            }
            sb.Append(" ");
            sb.Append(wl.Word);
            return(sb.ToString());
        }