protected void Degenerate_Click(object sender, EventArgs args) { //Transform Dictionary <string, string> words = Recode.GetDictionary(); Dictionary <char, string> alphabet = new Dictionary <char, string>(); alphabet.Add('a', HttpUtility.HtmlEncode(a.Text)); alphabet.Add('e', HttpUtility.HtmlEncode(e.Text)); alphabet.Add('i', HttpUtility.HtmlEncode(i.Text)); alphabet.Add('o', HttpUtility.HtmlEncode(o.Text)); alphabet.Add('u', HttpUtility.HtmlEncode(u.Text)); alphabet.Add('j', HttpUtility.HtmlEncode(j.Text)); alphabet.Add('k', HttpUtility.HtmlEncode(k.Text)); alphabet.Add('l', HttpUtility.HtmlEncode(l.Text)); alphabet.Add('m', HttpUtility.HtmlEncode(m.Text)); alphabet.Add('n', HttpUtility.HtmlEncode(n.Text)); alphabet.Add('p', HttpUtility.HtmlEncode(p.Text)); alphabet.Add('s', HttpUtility.HtmlEncode(s.Text)); alphabet.Add('t', HttpUtility.HtmlEncode(t.Text)); alphabet.Add('w', HttpUtility.HtmlEncode(w.Text)); Dictionary <string, string> mutated = new Dictionary <string, string>(words.Count); foreach (string key in words.Keys) { StringBuilder sb = new StringBuilder(); foreach (char c in key) { sb.Append(alphabet[c]); } mutated.Add(key, sb.ToString()); } var sortedDict = (from entry in mutated orderby entry.Value ascending select entry); StringBuilder newWordList = new StringBuilder(); foreach (var pair in sortedDict) { newWordList.Append("<b>"); newWordList.Append(pair.Key); newWordList.Append("</b> : "); newWordList.Append(pair.Value); newWordList.Append("<br/>"); } txtOutput.Text = newWordList.ToString(); Recode recoder = new Recode(); txtSampleText.Text = recoder.ShortenToAnyDictionary( HttpUtility.HtmlEncode(txtInput.Text), mutated, Recode.ModifierStyle.CapitalizeFirst, Recode.PunctuationStyle.Western ).Replace("\n", "<br/>"); //Apply common processes (reduplicatoin, gemmination, errosion, rebracketing) //Check for validity //Re-do if invalid }
protected void btnCompress_Click(object sender, EventArgs e) { string toConvert = Server.HtmlEncode(txtInput.Text); images.InnerHtml = recoder.ShortenToAnyDictionary( HttpUtility.HtmlEncode(toConvert), Recode.GetHeiroglyphDictionary(), Recode.ModifierStyle.CapitalizeFirst, Recode.PunctuationStyle.Western ).Replace("\n", "<br/>"); }
public IHttpActionResult RecodeAdd(Recode recode) { Dictionary <string, object> pairs = new Dictionary <string, object>(); pairs.Add("@RName", recode.RName); pairs.Add("@FId", recode.FId); int i = DBHelper.ExecProcSQL("P_Recode_Add", pairs); return(Json(i)); }
protected void btnCompress_Click(object sender, EventArgs e) { string toConvert = Server.HtmlEncode(txtInput.Text); Dictionary <string, string> target; if (TargetLanguage.SelectedValue == "Latin") { target = Recode.GetLatinRelex(); } else if (TargetLanguage.SelectedValue == "Russian") { target = Recode.GetRussianRelex(); } else if (TargetLanguage.SelectedValue == "Icelandic") { target = Recode.GetIcelandicRelex(); } else { target = Recode.GetEnglishRelex(); } StringBuilder sb = new StringBuilder(); foreach (var foo in target) { sb.Append(foo.Key.ToLower()); sb.Append("\t"); sb.Append(foo.Value); sb.Append("\n"); } RelexDictionary.Controls.Add(new Literal { Text = sb.ToString() }); string relexFirstPass = recoder.ShortenToAnyDictionary( toConvert, target, Recode.ModifierStyle.CapitalizeFirst, Recode.PunctuationStyle.Western ).Replace("\n", "<br/>"); if (phonotactics.SelectedValue == "forceTp") { TransliterateEngine transliterator = new TransliterateEngine(); string trace; relexFirstPass = transliterator.Transliterate( relexFirstPass, out trace, TransliterateEngine.DefaultOptions()).ToLower(); } txtOutput.Text = relexFirstPass; }
public void TestRecodeOneWordRoundTrip() { Recode recoder = new Recode(); string data = "soweli"; string shorter = recoder.Shorten(data); Assert.AreEqual("ow", shorter); string longer = recoder.ExpandTwoLetterWithSpaces(shorter); Assert.AreEqual(data, longer); }
public void TestRecodeTwoWordRoundTripPunctuate() { Recode recoder = new Recode(); string data = "soweli moku."; string shorter = recoder.Shorten(data); Assert.AreEqual("ow mk.", shorter); string longer = recoder.ExpandTwoLetterWithSpaces(shorter); Assert.AreEqual(data, longer); }
public void TestRecodeThreeWordRoundTrip() { Recode recoder = new Recode(); string data = "soweli moku moku"; string shorter = recoder.Shorten(data); Assert.AreEqual("ow mk mk", shorter, "Shorten failed"); string longer = recoder.ExpandTwoLetterWithSpaces(shorter); Assert.AreEqual(data, longer, "Expand failed"); }
public void TestRecodeTwoWordRoundTripProperModifer() { Recode recoder = new Recode(); string data = "jan Mato"; string shorter = recoder.Shorten(data); Assert.AreEqual("jn MATO", shorter); string longer = recoder.ExpandTwoLetterWithSpaces(shorter); Assert.AreEqual(data, longer); }
public void TestRecodeThreeWordRoundTripWithColon() { Recode recoder = new Recode(); string data = "ni: mije"; string shorter = recoder.Shorten(data); Assert.AreEqual("ni: mj", shorter); string longer = recoder.ExpandTwoLetterWithSpaces(shorter); Assert.AreEqual(data, longer); }
private void Colorize(string value) { Recode c = new Recode(); CorpusText.Text = c.ShortenToAnyDictionary( value, ColorizedText(), Recode.ModifierStyle.CapitalizeFirst, Recode.PunctuationStyle.Western, "<span class=\"proper\">", "</span>" ).Replace(Environment.NewLine, "<br/>").Replace("\n", "<br/>"); Graph.Text = "\n" + CreateGraph(value); }
protected void btnGloss_Click(object sender, EventArgs e) { string toConvert = Server.HtmlEncode(txtInput.Text); Dictionary <string, string> words = Recode.GetDictionary(); Dictionary <string, string> links = new Dictionary <string, string>(words.Count); foreach (var word in words) { links.Add(word.Key, string.Format("<a href=\"ClassicWordList.aspx#{0}\">{0}</a>", word.Key)); } txtOutput.Text = recoder.ShortenToAnyDictionary( toConvert, links, Recode.ModifierStyle.CapitalizeFirst, Recode.PunctuationStyle.Western ).Replace("\n", "<br/>"); }
private Dictionary <string, string> ColorizedText() { Dictionary <string, string> dictionary = Recode.GetDictionary(); Dictionary <string, string> dictionaryOut = new Dictionary <string, string>(); foreach (string word in dictionary.Keys) { string formated; if ((from c in new string[] { "la", "li", "e", "o", "pi" } where word == c select c).Count() == 1) { //Is thingy. formated = "<span class=\"function\">" + word + "</span>"; } else if ((from c in new string[] { "ni", "ona", "mi", "sina" } where word == c select c).Count() == 1) { formated = "<span class=\"anaphora\">" + word + "</span>"; } else if (word == "anu" || word == "en") { formated = "<span class=\"conjunction\">" + word + "</span>"; } else if (PrepositionStyle.SelectedValue == "do" && (from c in new string[] { "kepeken", "poka", "lon", "tawa", "sama", "tan" } where word == c select c).Count() == 1) { formated = "<span class=\"prep\">" + word + "</span>"; } else { formated = "<span class=\"content\">" + word + "</span>"; } dictionaryOut.Add(word, formated); } return(dictionaryOut); }
public Delete(Recode work) { Work = work; }
public Update(Recode work, Recode rest) { Work = work; Rest = rest; }
public Add(Recode work, Recode rest) { Work = work; Rest = rest; }
public void Add(ParkInfoModel park, HttpPostedFileBase File) { try { if (!System.IO.Directory.Exists(Server.MapPath("/Img/"))) { System.IO.Directory.CreateDirectory(Server.MapPath("/Img/")); } park.PImage = Server.MapPath("/Img/") + File.FileName; park.TID = Convert.ToInt32(Request["TID"]); Session["TID"] = park.TID; HttpCookie http = Request.Cookies["Cooke"]; //Cooke解码 string str = HttpUtility.UrlDecode(http.Value, Encoding.GetEncoding("UTF-8")); //反序列化 List <ViewModel> models = JsonConvert.DeserializeObject <List <ViewModel> >(str); foreach (var a in models) { park.UIDa = a.UIDa; } url += "Park/Add"; string m = JsonConvert.SerializeObject(park); string i = HttpClientHeper.Post(url, m); if (Convert.ToInt32(i) > 0) { #region 语言播报 ////获取进入车辆的车牌号 //string phrase = Session["Plate"].ToString()+"欢迎进入"; ////语言播报的功能 //SpeechSynthesizer speech = new SpeechSynthesizer(); //CultureInfo keyboardCulture = System.Globalization.CultureInfo.GetCultureInfoByIetfLanguageTag("zh-cn"); //InstalledVoice neededVoice = speech.GetInstalledVoices(keyboardCulture).LastOrDefault(); //if (neededVoice == null) //{ // phrase = "Unsupported Language"; //} //else if (!neededVoice.Enabled) //{ // phrase = "Voice Disabled"; //} //else //{ // speech.SelectVoice(neededVoice.VoiceInfo.Name); //} //speech.Speak(phrase); //// using System.Speech.Synthesis; //SpeechSynthesizer synth = new SpeechSynthesizer(); //// Configure the audio output. //synth.SetOutputToDefaultAudioDevice(); //synth.Speak("请说一句话"); //synth.Speak(Session["Plate"].ToString() + "欢迎进入"); //// Speak a string. //synth.Speak("This example demonstrates a basic use of Speech Synthesizer"); //Console.WriteLine(); //Console.WriteLine("Press any key to exit..."); //Console.ReadKey(); #endregion //MVC SpVoice speech = new SpVoice(); //new一个 int speechRate = 1; //语音朗读速度 int volume = 100; //音量 bool paused = false; //是否暂停 string testspeech = Session["Plate"].ToString() + "欢迎进入"; //测试朗读内容 if (paused) { speech.Resume(); paused = false; } else { speech.Rate = speechRate; speech.Volume = volume; speech.Speak(testspeech, SpeechVoiceSpeakFlags.SVSFlagsAsync);//开始语音朗读 } #region 明细 Recode recode = new Recode(); string text = Session["Plate"].ToString() + "驶入汽车"; recode.RName = text; List <ViewModel> modelsa = JsonConvert.DeserializeObject <List <ViewModel> >(str); foreach (var t in models) { recode.FId = t.UIDa; } string urll = "http://localhost:6201/Recode/Add"; string y = JsonConvert.SerializeObject(recode); string model = HttpClientHeper.Post(urll, y); if (Convert.ToInt32(model) > 0) { Response.Redirect("http://localhost:7652/News/NewIndex"); } #endregion Response.Write("<script>alert('驶入成功!');location.href='/News/NewIndex'</script>"); } } catch (Exception) { Response.Write("<script>alert('请选择车辆图片!');location.href='/park/Add'</script>"); } }
public void Away(int id) { try { url += "Park/Away"; DateTime Leave = System.DateTime.Now; ParkInfoModel parks = new ParkInfoModel(); parks.ExpireDate = Leave; parks.PID = id; string model = JsonConvert.SerializeObject(parks); string m = HttpClientHeper.Post(url, model); if (Convert.ToInt32(m) > 0) { //MVC SpVoice speech = new SpVoice(); //new一个 int speechRate = 1; //语音朗读速度 int volume = 100; //音量 bool paused = false; //是否暂停 string testspeech = "感谢车牌号为" + Session["Plate"].ToString() + "的客户停车,祝您一路顺风"; //测试朗读内容 if (paused) { speech.Resume(); paused = false; } else { speech.Rate = speechRate; speech.Volume = volume; speech.Speak(testspeech, SpeechVoiceSpeakFlags.SVSFlagsAsync);//开始语音朗读 } DateTime Puttime = parks.CreateDate; DateTime Gettime = parks.ExpireDate; TimeSpan a = Gettime - Puttime; double b = a.Minutes / 60; int i = (int)Math.Ceiling(b); int ids = Convert.ToInt32(Session["TID"]); string urls = $"http://localhost:6201/CarType/CarSelectOne?id={ids}"; string o = HttpClientHeper.Get(urls); List <CarTypesInfoModel> list = JsonConvert.DeserializeObject <List <CarTypesInfoModel> >(o); decimal de = list.First().Tmaney; int price = Convert.ToInt32(de); int sum = i * price; Response.Write("<script>alert('谢谢您的本次停车!')</script>"); #region 明细 HttpCookie http = Request.Cookies["Cooke"]; //Cooke解码 string str = HttpUtility.UrlDecode(http.Value, Encoding.GetEncoding("UTF-8")); //反序列化 List <ViewModel> models = JsonConvert.DeserializeObject <List <ViewModel> >(str); Recode recode = new Recode(); string text = Session["Plate"].ToString() + "驶出汽车!¥" + sum + "元"; recode.RName = text; List <ViewModel> modelsa = JsonConvert.DeserializeObject <List <ViewModel> >(str); foreach (var t in modelsa) { recode.FId = t.UIDa; } string urll = "http://localhost:6201/Recode/Add"; string y = JsonConvert.SerializeObject(recode); string modela = HttpClientHeper.Post(urll, y); if (Convert.ToInt32(modela) > 0) { Response.Redirect("http://localhost:7652/Payment/QRcode?text=" + sum); } } } catch (Exception) { throw; } #endregion Response.Write("<script>alert('请去登入再做以下操作谢谢!');location.href='/UserInfo/UserInfoLogon'</script>"); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, string> allWords = Recode.GetDictionary(); StringBuilder sb = new StringBuilder(); foreach (var word in allWords) { if (word.Key.Length > 3) { sb.Append("<tr>"); sb.Append("<td><a href=\"http://" + word.Key + ".com\">" + word.Key + ".com</a>"); string domain = word.Key + ".com"; try { //performs the DNS lookup IPHostEntry he = Dns.GetHostByName(domain); IPAddress[] ip_addrs = he.AddressList; foreach (IPAddress ip in ip_addrs) { sb.Append(ip); sb.Append("<br/>"); } } catch (System.Exception ex) { sb.Append(ex.ToString()); } sb.Append("</td>"); sb.Append("<td><a href=\"http://" + word.Key + ".org\">" + word.Key + ".org</a>"); domain = word.Key + ".org"; try { //performs the DNS lookup IPHostEntry he = Dns.GetHostByName(domain); IPAddress[] ip_addrs = he.AddressList; foreach (IPAddress ip in ip_addrs) { sb.Append(ip); sb.Append("<br/>"); } } catch (System.Exception ex) { sb.Append(ex.ToString()); } sb.Append("</td>"); sb.Append("<td><a href=\"http://" + word.Key + ".net\">" + word.Key + ".net</a>"); domain = word.Key + ".net"; try { //performs the DNS lookup IPHostEntry he = Dns.GetHostByName(domain); IPAddress[] ip_addrs = he.AddressList; foreach (IPAddress ip in ip_addrs) { sb.Append(ip); sb.Append("<br/>"); } } catch (System.Exception ex) { sb.Append(ex.ToString()); } sb.Append("</td>"); sb.Append("<td><a href=\"http://" + word.Key + ".info\">" + word.Key + ".info</a>"); domain = word.Key + ".info"; try { //performs the DNS lookup IPHostEntry he = Dns.GetHostByName(domain); IPAddress[] ip_addrs = he.AddressList; foreach (IPAddress ip in ip_addrs) { sb.Append(ip); sb.Append("<br/>"); break;//one is fine.. } } catch (System.Exception) { sb.Append("No DNS Entry"); } sb.Append("</td>"); sb.Append("</tr>"); } } this.rows.Text = sb.ToString(); }