本文整理汇总了C#中System.Text.DecoderFallback类的典型用法代码示例。如果您正苦于以下问题:C# DecoderFallback类的具体用法?C# DecoderFallback怎么用?C# DecoderFallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DecoderFallback类属于System.Text命名空间,在下文中一共展示了DecoderFallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseCodePageEncoding
internal BaseCodePageEncoding(int codepage, int dataCodePage, EncoderFallback enc, DecoderFallback dec)
: base(codepage, enc, dec)
{
// Remember number of code pages that we'll be using the table for.
dataTableCodePage = dataCodePage;
LoadCodePageTables();
}
示例2: CodePageEncoding
protected CodePageEncoding(int codePage, string name, string webName, EncoderFallback encoderFallback, DecoderFallback decoderFallback)
: base(codePage, encoderFallback, decoderFallback)
{
codePage_ = codePage;
encodingName_ = name;
webName_ = webName;
}
示例3: CodePageEncoding
// Constructor called by serialization.
internal CodePageEncoding(SerializationInfo info, StreamingContext context)
{
// Any info?
if (info==null) throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
// All versions have a code page
this.m_codePage = (int)info.GetValue("m_codePage", typeof(int));
// See if we have a code page
try
{
//
// Try Whidbey V2.0 Fields
//
this.m_isReadOnly = (bool)info.GetValue("m_isReadOnly", typeof(bool));
this.encoderFallback = (EncoderFallback)info.GetValue("encoderFallback", typeof(EncoderFallback));
this.decoderFallback = (DecoderFallback)info.GetValue("decoderFallback", typeof(DecoderFallback));
}
catch (SerializationException)
{
//
// Didn't have Whidbey things, must be Everett
//
this.m_deserializedFromEverett = true;
// May as well be read only
this.m_isReadOnly = true;
}
}
示例4: DecoderNLSSurrogate
internal DecoderNLSSurrogate(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException(nameof(info));
}
_encoding = (Encoding)info.GetValue(EncodingKey, typeof(Encoding));
_fallback = (DecoderFallback)info.GetValue(DecoderFallbackKey, typeof(DecoderFallback));
}
示例5: GetEncoding
public virtual Encoding GetEncoding(int codepage, EncoderFallback encoderFallback, DecoderFallback decoderFallback)
{
Encoding enc = GetEncoding(codepage);
if (enc != null)
{
enc = (Encoding)GetEncoding(codepage).Clone();
enc.EncoderFallback = encoderFallback;
enc.DecoderFallback = decoderFallback;
}
return enc;
}
示例6: MLangCodePageEncoding
internal MLangCodePageEncoding(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
this.m_codePage = (int) info.GetValue("m_codePage", typeof(int));
try
{
this.m_isReadOnly = (bool) info.GetValue("m_isReadOnly", typeof(bool));
this.encoderFallback = (EncoderFallback) info.GetValue("encoderFallback", typeof(EncoderFallback));
this.decoderFallback = (DecoderFallback) info.GetValue("decoderFallback", typeof(DecoderFallback));
}
catch (SerializationException)
{
this.m_deserializedFromEverett = true;
this.m_isReadOnly = true;
}
}
示例7: MLangCodePageEncoding
// Constructor called by serialization.
internal MLangCodePageEncoding(SerializationInfo info, StreamingContext context)
{
// Any info?
if (info==null) throw new ArgumentNullException("info");
// All versions have a code page
this.m_codePage = (int)info.GetValue("m_codePage", typeof(int));
// See if we have a code page
try
{
this.m_isReadOnly = (bool)info.GetValue("m_isReadOnly", typeof(bool));
this.encoderFallback = (EncoderFallback)info.GetValue("encoderFallback", typeof(EncoderFallback));
this.decoderFallback = (DecoderFallback)info.GetValue("decoderFallback", typeof(DecoderFallback));
}
catch (SerializationException)
{
this.m_deserializedFromEverett = true;
// May as well be read only
this.m_isReadOnly = true;
}
}
示例8: GetEncoding
public static Encoding GetEncoding (string name,
EncoderFallback encoderFallback, DecoderFallback decoderFallback)
{
if (encoderFallback == null)
throw new ArgumentNullException ("encoderFallback");
if (decoderFallback == null)
throw new ArgumentNullException ("decoderFallback");
Encoding e = GetEncoding (name).Clone () as Encoding;
e.is_readonly = false;
e.encoder_fallback = encoderFallback;
e.decoder_fallback = decoderFallback;
return e;
}
示例9: SetFallbackInternal
internal void SetFallbackInternal (EncoderFallback e, DecoderFallback d)
{
if (e != null)
encoder_fallback = e;
if (d != null)
decoder_fallback = d;
}
示例10: GetEncoding
public static Encoding GetEncoding(int codepage,
EncoderFallback encoderFallback, DecoderFallback decoderFallback)
{
// Get the default encoding (which is cached and read only)
Encoding baseEncoding = GetEncoding(codepage);
// Clone it and set the fallback
Encoding fallbackEncoding = (Encoding)baseEncoding.Clone();
fallbackEncoding.EncoderFallback = encoderFallback;
fallbackEncoding.DecoderFallback = decoderFallback;
return fallbackEncoding;
}
示例11: GetEncoding
public static Encoding GetEncoding(String name,
EncoderFallback encoderFallback, DecoderFallback decoderFallback)
{
Encoding baseEncoding = EncodingProvider.GetEncodingFromProvider(name, encoderFallback, decoderFallback);
if (baseEncoding != null)
return baseEncoding;
//
// NOTE: If you add a new encoding that can be requested by name, be sure to
// add the corresponding item in EncodingTable.
// Otherwise, the code below will throw exception when trying to call
// EncodingTable.GetCodePageFromName().
//
return (GetEncoding(EncodingTable.GetCodePageFromName(name), encoderFallback, decoderFallback));
}
示例12: Create
public static KCoding Create(int codepage, EncoderFallback/*!*/ encoderFallback, DecoderFallback/*!*/ decoderFallback) {
var encoding = CreateEncoding(codepage, encoderFallback, decoderFallback);
return encoding != null ? Create(encoding) : null;
}
示例13: Windows1253Encoding
public Windows1253Encoding(EncoderFallback encoderFallback, DecoderFallback decoderFallback)
: base(1253, "Greece (Windows)", "windows-1253", encoderFallback, decoderFallback)
{
byteToChars_ = new char[]
{
'\u0000' // ''
, '\u0001' // ''
, '\u0002' // ''
, '\u0003' // ''
, '\u0004' // ''
, '\u0005' // ''
, '\u0006' // ''
, '\u0007' // ''
, '\u0008' // ''
, '\u0009' // '<TAB>'
, '\u000a' // '<LF>'
, '\u000b' // ''
, '\u000c' // ''
, '\u000d' // '<CR>'
, '\u000e' // ''
, '\u000f' // ''
, '\u0010' // ''
, '\u0011' // ''
, '\u0012' // ''
, '\u0013' // ''
, '\u0014' // ''
, '\u0015' // ''
, '\u0016' // ''
, '\u0017' // ''
, '\u0018' // ''
, '\u0019' // ''
, '\u001a' // ''
, '\u001b' // ''
, '\u001c' // ''
, '\u001d' // ''
, '\u001e' // ''
, '\u001f' // ''
, '\u0020' // ' '
, '\u0021' // '!'
, '\u0022' // '"'
, '\u0023' // '#'
, '\u0024' // '$'
, '\u0025' // '%'
, '\u0026' // '&'
, '\u0027' // '''
, '\u0028' // '('
, '\u0029' // ')'
, '\u002a' // '*'
, '\u002b' // '+'
, '\u002c' // ','
, '\u002d' // '-'
, '\u002e' // '.'
, '\u002f' // '/'
, '\u0030' // '0'
, '\u0031' // '1'
, '\u0032' // '2'
, '\u0033' // '3'
, '\u0034' // '4'
, '\u0035' // '5'
, '\u0036' // '6'
, '\u0037' // '7'
, '\u0038' // '8'
, '\u0039' // '9'
, '\u003a' // ':'
, '\u003b' // ';'
, '\u003c' // '<'
, '\u003d' // '='
, '\u003e' // '>'
, '\u003f' // '?'
, '\u0040' // '@'
, '\u0041' // 'A'
, '\u0042' // 'B'
, '\u0043' // 'C'
, '\u0044' // 'D'
, '\u0045' // 'E'
, '\u0046' // 'F'
, '\u0047' // 'G'
, '\u0048' // 'H'
, '\u0049' // 'I'
, '\u004a' // 'J'
, '\u004b' // 'K'
, '\u004c' // 'L'
, '\u004d' // 'M'
, '\u004e' // 'N'
, '\u004f' // 'O'
, '\u0050' // 'P'
, '\u0051' // 'Q'
, '\u0052' // 'R'
, '\u0053' // 'S'
, '\u0054' // 'T'
, '\u0055' // 'U'
, '\u0056' // 'V'
, '\u0057' // 'W'
, '\u0058' // 'X'
, '\u0059' // 'Y'
, '\u005a' // 'Z'
, '\u005b' // '['
, '\u005c' // '\'
, '\u005d' // ']'
, '\u005e' // '^'
//.........这里部分代码省略.........
示例14: GetEncodingFromProvider
internal static Encoding GetEncodingFromProvider(string encodingName, EncoderFallback enc, DecoderFallback dec)
{
if (s_providers == null)
return null;
EncodingProvider[] providers = s_providers;
foreach (EncodingProvider provider in providers)
{
Encoding encoding = provider.GetEncoding(encodingName, enc, dec);
if (encoding != null)
return encoding;
}
return null;
}
示例15: UTF8Decoder
// Constructor.
public UTF8Decoder (DecoderFallback fallback)
{
Fallback = fallback;
leftOverBits = 0;
leftOverCount = 0;
}