Exemplo n.º 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());
        }
Exemplo n.º 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()
            });
        }
Exemplo n.º 3
0
    private string GetInitStr(string filePath)
    {
        string className   = CodeGenerater.GetFileName(filePath);
        string templateStr = "HttpManager.GetText(csvDir + \"/#{0}.csv\", text => RegisterCSV<#{1}>(\"#{2}\", text, onLoadComplete));";

        templateStr = templateStr.Replace("#{0}", filePath);
        templateStr = templateStr.Replace("#{1}", className);
        templateStr = templateStr.Replace("#{2}", className);
        return(templateStr);
    }
Exemplo n.º 4
0
        public async Task <ActionResult> SendMail(string mailto)
        {
            if (context.Users.Where(u => u.Email == mailto).Count() > 0)
            {
                Random        random = new Random();
                CodeGenerater code   = new CodeGenerater();

                await SendmailAsync(mailto, code.GetCode());

                ViewBag.Msg = "Check Your Email For Verifitation Code";
                return(RedirectToAction("VerifiEmail", new { email = mailto }));
            }

            else
            {
                ViewBag.Msg = "Email not Registered"; return(View());
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var dic_params = CommandParse.parse(args);

#if DEBUG
            dic_params["protocol"] = @"D:\work\VS\mycsharp\ProtocolGenerater\ProtocolGenerater\protocol";
            dic_params["template"] = @"D:\work\VS\mycsharp\ProtocolGenerater\ProtocolGenerater\templates\csharp\template_csharp.xml";
            dic_params["output"]   = @"J:\codes";
#endif

            if (dic_params.ContainsKey("protocol") && dic_params.ContainsKey("template") && dic_params.ContainsKey("output"))
            {
                //            var codeGenerater = new CodeGenerater();

                //            codeGenerater.generate(
                //dic_params["protocol"],
                //dic_params["template"],
                //dic_params["output"]
                //);
                try
                {
                    var codeGenerater = new CodeGenerater();

                    codeGenerater.generate(
                        dic_params["protocol"],
                        dic_params["template"],
                        dic_params["output"]
                        );
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    Console.ReadLine();
                }
            }
            else
            {
                Console.WriteLine(Properties.Resources.usage);
                Console.ReadLine();
            }

            Console.WriteLine("按任意键退出");
            Console.ReadLine();
        }
Exemplo n.º 6
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());
        }
Exemplo n.º 7
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());
        }