private void button2_Click(object sender, EventArgs e) { this.button2.Enabled = false; arib2byteChar kanji = new arib2byteChar(true); List <byte> letter = new List <byte>(); List <byte> line = new List <byte>(); Int32 prevKanjiTabeNum = 0; List <kanjiMark> kanjiList = new List <kanjiMark>(); byte[,] alllist = new byte[256, 256]; byte[] byteData = Encoding.UTF8.GetBytes("あ①い"); string byteLine = ""; foreach (byte b in byteData) { byteLine += b.ToString("X2"); } MessageBox.Show("result:" + byteLine); using (StreamWriter sw = new StreamWriter(System.IO.Path.Combine(this.textBox3.Text, "KanjiList.txt"), false)) { using (StreamWriter sw2 = new StreamWriter(System.IO.Path.Combine(this.textBox3.Text, "KanjiDoc.txt"), false)) { using (StreamWriter swUtf8 = new StreamWriter(System.IO.Path.Combine(this.textBox3.Text, "KanjiListUtf8.txt"), false, Encoding.UTF8)) { Int32 counter = 0; while (true) { counter++; if (kanji.getNextCharAryJIS(ref letter) < 0) { kanji.setFirst(); if (prevKanjiTabeNum < kanji.currentTableNumber) { break; } prevKanjiTabeNum = kanji.currentTableNumber; continue; } kanjiMark p = new kanjiMark(letter[3], letter[4], letter); kanjiList.Add(p); line.AddRange(letter); if ((counter % 20) == 0) { string outputLine = System.Text.Encoding.GetEncoding(50220).GetString(line.ToArray()); //parseMain.exchangeJIScodeToString(line); sw2.WriteLine(outputLine); swUtf8.WriteLine(outputLine); line.Clear(); } letter.Clear(); } if (line.Count != 0) { sw2.WriteLine(parseMain.exchangeJIScodeToString(line)); } string utfline = ""; kanji.getNextLetterUtf8Gaiji(ref utfline); // 初回 while (this.makeStringUtf8Gaiji(kanji, ref utfline) == true) { swUtf8.WriteLine(utfline); } if (utfline.Length > 0) { swUtf8.WriteLine(utfline); } } } sw.WriteLine("total:" + kanjiList.Count); foreach (kanjiMark p in kanjiList) { sw.WriteLine(p.x.ToString() + "," + p.y.ToString() + ",[" + parseMain.exchangeJIScodeToString(p.jisCode) + "]"); alllist[p.x, p.y]++; } } makeKanjiTable(alllist); }
/// <summary> /// duration を、候補の中から「乱数」で選ぶ。 /// 乱数を使いはするが、「底」を日毎+自分のサービス番号と決めて使い、日が変わる時に再度「底」を宣言する。 /// </summary> /// <returns></returns> private List <outputFormatBasic> getDataTimePattern1() { List <outputFormatBasic> result = new List <outputFormatBasic>(); Int32 counter = 0; Int32 soundNameCounter = 0; Int32 soundKindCounter = 0; Int32 genleBig = 0; Int32 genleSmall = 0; string line = ""; bool keepTableFlag = true; Int32[] durationItems = this.service.madaraDurations; Int32 seed = 0; Int32 dayNum = -1; Random rnd = null; Int32 copyControlValue = 0; for (DateTime current = today; current < this.lastDay;) // 指定した日付「まで」作る { if (dayNum != current.Day) { seed = makeSeed(this.today, this.service); dayNum = current.Day; rnd = new Random(seed); } Int32 duration = durationItems[rnd.Next(durationItems.Count())]; outputFormatBasic ou = new outputFormatBasic( service.networkId.value, service, exchangeLetter); ou.eventtime = new epgEventTime(current); ou.eventid.value = ou.eventid.setEventIdFromDate(ou.eventtime.value); ou.duration.value = duration; // ou.contents.set("Contents:" + current.ToLongDateString() + "," + current.ToLongTimeString()); // ou.videoInfo = makeVideoInfoList(ref counter, this.service.madaraResolution); // HDで ou.videoInfo = makeVideoInfoList(ref counter, this.service.DefaultVideoComponentType.value); ou.audioInfo = makeAudioInfoList(ref ou.service, ref counter, ref soundKindCounter, ref soundNameCounter); line = ""; keepTableFlag = makeContentsWithAllKanji(ref kanji, ref ou, ref line); ou.contents.set(line); ou.title.set(makeTitleWithAllKanji(ref kanji)); // "title" + current.ToShortTimeString() , ou.duration.value); if (keepTableFlag == false) { kanji.setFirst(); } copyControlData cp = new copyControlData(copyControlValue); copyControlValue++; if (cp.copyControl != null && cp.contents != null) { ou.copyControlMain = cp.copyControl; ou.contentAvailability = cp.contents; } outputFormatGenle ougenle = new outputFormatGenle(); ougenle.getGenleNext(ref genleBig, ref genleSmall); ougenle.genleBig.value = genleBig; ougenle.genleSmall.value = genleSmall; ou.genleInfo.Add(ougenle); ou.service = service; outputFormatEncoderInfo enc = new outputFormatEncoderInfo(); enc.rate.value = 6000; // 6Mbps ou.encoderInfo = enc; result.Add(ou); current = current.AddMinutes(duration); counter++; } return(result); }