static void basechtp2() { var files = Directory.GetFiles(Path.Combine(new string[] { Directory.GetCurrentDirectory(), "txts2" })); var outfiles = Path.Combine(new string[] { Directory.GetCurrentDirectory(), "txts" }); StringBuilder stringBuilder = new StringBuilder(); foreach (var f in files) { var lines = File.ReadAllLines(f); var outfile = Path.Combine(new string[] { outfiles, f.Split('/')[f.Split('/').Length - 1] }); Console.WriteLine($"Writing to {outfile} .."); foreach (var line in lines) { foreach (var word in line.Split()) { //if (word.Trim().Length==0 || Char.IsDigit(word,0))continue; if (word.Trim().Length == 0) { continue; } var getchars = WBibled.diap(word); for (int i = 0; i < getchars.Length; i++) { var bch = (from x in db.WXD where x.ch == getchars[i].ToLower() select x.basech).ToList(); if (bch.Count > 0) { //if(!Regex.Match(getchars[i], @"^[a-zA-Z]*$", RegexOptions.IgnoreCase).Success) //Console.WriteLine($"Found {getchars[i]}..Replacing with {bch[0]} ..."); getchars[i] = bch[0]; } } var new_word1 = String.Join("", getchars) + " "; var new_word = ""; for (int i = 0; i < new_word1.Length; i++) { if (Char.IsDigit(new_word1, i)) { continue; } new_word += new_word1.Substring(i, 1); } stringBuilder.Append(Regex.Replace(new_word, @"[^\u0000-\u007F]+", string.Empty)); } } File.WriteAllText(outfile, stringBuilder.ToString()); stringBuilder.Clear(); } }
static void Main(string[] args) { if (args.Length == 0) { new Thread(new ThreadStart(WBibled.webthread)).Start(); try{ WBibled.Verses(); }catch (Exception x) { Console.WriteLine(x.Message); } } else { WTxUtils.tp(args[0]); } }