public void TestMethod1() { System.Net.WebClient wc = new System.Net.WebClient(); var list = TagAnalyze.GetTag(wc.DownloadString("http://www.nicovideo.jp/ranking"), "div"); list.ConsoleWriteLine(n => n.StartTag); }
public void TestTags2() { System.Net.WebClient wc = new System.Net.WebClient(); wc.Encoding = System.Text.Encoding.GetEncoding("euc-jp"); var list = TagAnalyze.GetTag("<div><h3></h3><div></div></div>", new string[] { "div", "h3" }); list.ConsoleWriteLine(n => n.StartTag); }
public void TestTags() { System.Net.WebClient wc = new System.Net.WebClient(); wc.Encoding = System.Text.Encoding.GetEncoding("euc-jp"); var list = TagAnalyze.GetTag(wc.DownloadString("http://www.j-magazine.or.jp/data_001.php"), new string[] { "div", "h3" }); list.ConsoleWriteLine(n => n.StartTag); }
private void TestFunc5(byte[] app1Buffer, UInt32 offset, DataConvertor convertor, TagAnalyze analyze) { for (int index = ((int)offset) + 6; index < app1Buffer.Length; ++index) { // タグの数 UInt16 tagCount = convertor.ToUInt16(app1Buffer, index); index += 2; // タグ領域 for (int lndex = 0; lndex < tagCount; ++lndex) { // TAG ID UInt16 tagID = convertor.ToUInt16(app1Buffer, index); // TAG型 UInt16 tagType = convertor.ToUInt16(app1Buffer, index + 2); // TAGデータ長 UInt32 tagLen = convertor.ToUInt32(app1Buffer, index + 4); // TAG値 byte[] tagValue = new byte[4]; System.Buffer.BlockCopy(app1Buffer, index + 8, tagValue, 0, tagValue.Length); index += 12; // delegate analyze(tagID, tagType, tagLen, tagValue); } // 次のIFDへのポインタ UInt32 nextPointer = convertor.ToUInt32(app1Buffer, index); index += 4; if (0 == nextPointer) { break; } index = (((int)nextPointer) - 1) + 6; } }
private void TestFunc4(byte[] app1Buffer) { if ('E' != app1Buffer[0]) { return; } if ('x' != app1Buffer[1]) { return; } if ('i' != app1Buffer[2]) { return; } if ('f' != app1Buffer[3]) { return; } if (0x00 != app1Buffer[4]) { return; } if (0x00 != app1Buffer[5]) { return; } DataConvertor convertor; if (0x4D == app1Buffer[6] && 0x4D == app1Buffer[7]) { convertor = new DataConvertor(DataConvertor.ENDIAN.BIG); // TIFF識別コード if (0x00 != app1Buffer[8]) { return; } if (0x2A != app1Buffer[9]) { return; } } else if (0x49 == app1Buffer[6] && 0x49 == app1Buffer[7]) { convertor = new DataConvertor(DataConvertor.ENDIAN.LITTLE); // TIFF識別コード if (0x00 != app1Buffer[9]) { return; } if (0x2A != app1Buffer[8]) { return; } } else { throw new Exception("Endian不明"); } UInt32 offset = convertor.ToUInt32(app1Buffer, 10); TagAnalyze funcGPSInfo = delegate(UInt16 tagID, UInt16 tagType, UInt32 tagLen, byte[] tagValue) { GPSInfoCore(tagID, tagType, tagLen, tagValue, app1Buffer, convertor); }; TagAnalyze func = delegate(UInt16 tagID, UInt16 tagType, UInt32 tagLen, byte[] tagValue) { switch (tagID) { // EXIF (0x8769) case 0x8769: { //TestFunc5(app1Buffer, tagValue, convertor, funcGPSInfo); } break; // GPS Info(0x8825) case 0x8825: { UInt32 gpsInfoOffset = convertor.ToUInt32(tagValue, 0); TestFunc5(app1Buffer, gpsInfoOffset, convertor, funcGPSInfo); } break; default: //GPSInfoCore(tagID, tagType, tagLen, tagValue, app1Buffer, convertor); break; } }; TestFunc5(app1Buffer, offset, convertor, func); }
private void TestFunc5(byte[] app1Buffer, UInt32 offset, DataConvertor convertor, TagAnalyze analyze) { for (int index = ((int)offset) + 6; index < app1Buffer.Length; ++index) { // タグの数 UInt16 tagCount = convertor.ToUInt16(app1Buffer, index); index += 2; // タグ領域 for (int lndex = 0; lndex < tagCount; ++lndex) { // TAG ID UInt16 tagID = convertor.ToUInt16(app1Buffer, index); // TAG型 UInt16 tagType = convertor.ToUInt16(app1Buffer, index + 2); // TAGデータ長 UInt32 tagLen = convertor.ToUInt32(app1Buffer, index + 4); // TAG値 byte[] tagValue = new byte[4]; System.Buffer.BlockCopy(app1Buffer, index + 8, tagValue, 0, tagValue.Length); index += 12; // delegate analyze(tagID, tagType, tagLen, tagValue); } // 次のIFDへのポインタ UInt32 nextPointer = convertor.ToUInt32( app1Buffer, index); index += 4; if (0 == nextPointer) { break; } index = (((int)nextPointer) - 1) + 6; } }