Пример #1
0
        // Constructor.
        protected MultiByteEncoding(int codePage, String bodyName,
                                    String encodingName, String headerName,
                                    String webName, int windowsCodePage,
                                    String tableName)
            : base(codePage)
        {
            // Initialize this object's state.
            this.bodyName        = bodyName;
            this.encodingName    = encodingName;
            this.headerName      = headerName;
            this.webName         = webName;
            this.windowsCodePage = windowsCodePage;
            this.mainEncoding    = (codePage == windowsCodePage);

            // Load the conversion rules from the resource table.
            CodeTable table = new CodeTable(tableName);
            byte *    info  = table.GetSection(Info_Block);

            dbyteToUnicode     = table.GetSection(DByte_To_Unicode);
            lowUnicodeToDByte  = table.GetSection(Low_Unicode_To_DByte);
            midUnicodeToDByte  = table.GetSection(Mid_Unicode_To_DByte);
            highUnicodeToDByte = table.GetSection(High_Unicode_To_DByte);
            table.Dispose();

            // Decode the data in the information header block.
            lowFirst       = info[0];
            highFirst      = info[1];
            lowSecond      = info[2];
            highSecond     = info[3];
            lowRangeUpper  = (info[4] | (info[5] << 8));
            midRangeLower  = (info[6] | (info[7] << 8));
            midRangeUpper  = (info[8] | (info[9] << 8));
            highRangeLower = (info[10] | (info[11] << 8));
        }
	// Constructor.
	protected MultiByteEncoding(int codePage, String bodyName,
								String encodingName, String headerName,
								String webName, int windowsCodePage,
								String tableName)
			: base(codePage)
			{
				// Initialize this object's state.
				this.bodyName = bodyName;
				this.encodingName = encodingName;
				this.headerName = headerName;
				this.webName = webName;
				this.windowsCodePage = windowsCodePage;
				this.mainEncoding = (codePage == windowsCodePage);

				// Load the conversion rules from the resource table.
				CodeTable table = new CodeTable(tableName);
				byte *info = table.GetSection(Info_Block);
				dbyteToUnicode = table.GetSection(DByte_To_Unicode);
				lowUnicodeToDByte = table.GetSection(Low_Unicode_To_DByte);
				midUnicodeToDByte = table.GetSection(Mid_Unicode_To_DByte);
				highUnicodeToDByte = table.GetSection(High_Unicode_To_DByte);
				table.Dispose();

				// Decode the data in the information header block.
				lowFirst = info[0];
				highFirst = info[1];
				lowSecond = info[2];
				highSecond = info[3];
				lowRangeUpper = (info[4] | (info[5] << 8));
				midRangeLower = (info[6] | (info[7] << 8));
				midRangeUpper = (info[8] | (info[9] << 8));
				highRangeLower = (info[10] | (info[11] << 8));
			}
Пример #3
0
 // Constructor.
 internal DbcsConvert(string fileName)
 {
     using (CodeTable table = new CodeTable(fileName)) {
         n2u = table.GetSection(1);
         u2n = table.GetSection(2);
     }
 }
Пример #4
0
	// Constructor.
	private JISConvert()
			{
				// Load the conversion tables.
				CodeTable table = new CodeTable("jis.table");
				jisx0208ToUnicode = table.GetSection(JISX0208_To_Unicode);
				jisx0212ToUnicode = table.GetSection(JISX0212_To_Unicode);
				cjkToJis = table.GetSection(CJK_To_JIS);
				greekToJis = table.GetSection(Greek_To_JIS);
				extraToJis = table.GetSection(Extra_To_JIS);
				table.Dispose();
			}
Пример #5
0
        // Constructor.
        private JISConvert()
        {
            // Load the conversion tables.
            CodeTable table = new CodeTable("jis.table");

            jisx0208ToUnicode = table.GetSection(JISX0208_To_Unicode);
            jisx0212ToUnicode = table.GetSection(JISX0212_To_Unicode);
            cjkToJis          = table.GetSection(CJK_To_JIS);
            greekToJis        = table.GetSection(Greek_To_JIS);
            extraToJis        = table.GetSection(Extra_To_JIS);
            table.Dispose();
        }
Пример #6
0
		// Constructor.
		internal DbcsConvert(string fileName) {
			using (CodeTable table = new CodeTable(fileName)) {
				n2u = table.GetSection(1);
				u2n = table.GetSection(2);
			}
		}