本文整理汇总了C#中EncodingType类的典型用法代码示例。如果您正苦于以下问题:C# EncodingType类的具体用法?C# EncodingType怎么用?C# EncodingType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EncodingType类属于命名空间,在下文中一共展示了EncodingType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EncodingProfile
protected EncodingProfile(EncodingType t, Encoding enc)
{
_type = t;
_encoding = enc;
_buffer = new byte[3]; //���͂P�����͍ő�R�o�C�g
_cursor = 0;
}
示例2: Blob
public Blob(string content, EncodingType encoding, string sha, int size)
{
Content = content;
Encoding = encoding;
Sha = sha;
Size = size;
}
示例3: Convert
static void Convert(string path, EncodingType to)
{
var binary = System.IO.File.ReadAllBytes(path);
if (binary.Length < 3) return;
EncodingType type = EncodingType.CP932;
if ( binary[0] == 0xEF &&
binary[1] == 0xBB &&
binary[2] == 0xBF)
{
type = EncodingType.UTF8;
}
string text = null;
if (type == EncodingType.UTF8)
{
text = System.IO.File.ReadAllText(path, Encoding.UTF8);
}
else if (type == EncodingType.CP932)
{
text = System.IO.File.ReadAllText(path, Encoding.GetEncoding(932));
}
if (to == EncodingType.UTF8)
{
System.IO.File.WriteAllText(path, text, Encoding.UTF8);
}
else if(to == EncodingType.CP932)
{
System.IO.File.WriteAllText(path, text, Encoding.GetEncoding(932));
}
}
示例4: MediaFileInfo
public MediaFileInfo(MediaType mediaType, ContainerType containerType, EncodingType encondingType, String path)
{
mMediaType = mediaType;
mContainerType = containerType;
mEncondingType = encondingType;
mPath = path;
}
示例5: DeserializeObject
// Here we deserialize it back into its original form
public static object DeserializeObject(string pXmlizedString, string rootElementName, Type ObjectType, EncodingType encodingType)
{
XmlRootAttribute xRoot = new XmlRootAttribute();
xRoot.ElementName = rootElementName;
XmlSerializer xs = new XmlSerializer(ObjectType, xRoot);
MemoryStream memoryStream = null;
switch (encodingType)
{
case EncodingType.Unicode:
memoryStream = new MemoryStream(StringToUTFUnicodeByteArray(pXmlizedString));
break;
case EncodingType.UTF8:
memoryStream = new MemoryStream(StringToUTF8ByteArray(pXmlizedString));
break;
case EncodingType.UTF7:
break;
default:
memoryStream = new MemoryStream(StringToUTF8ByteArray(pXmlizedString));
break;
}
return xs.Deserialize(memoryStream);
}
示例6: Counter
//External direction is encoder style.
public Counter(EncodingType encodingType, DigitalSource upSource, DigitalSource downSource, bool inverted)
{
InitCounter(Mode.ExternalDirection);
if (encodingType != EncodingType.K2X && encodingType != EncodingType.K1X)
{
throw new ArgumentOutOfRangeException(nameof(encodingType), "Counters only support 1X and 2X decoding!");
}
if (upSource == null)
throw new ArgumentNullException(nameof(upSource), "Up Source given was null");
if (downSource == null)
throw new ArgumentNullException(nameof(downSource), "Down Source given was null");
SetUpSource(upSource);
SetDownSource(downSource);
int status = 0;
if (encodingType == EncodingType.K1X)
{
SetUpSourceEdge(true, false);
SetCounterAverageSize(m_counter, 1, ref status);
}
else
{
SetUpSourceEdge(true, true);
SetCounterAverageSize(m_counter, 2, ref status);
}
CheckStatus(status);
SetDownSourceEdge(inverted, true);
}
示例7: EncodingProfile
protected EncodingProfile(EncodingType t, Encoding enc) {
_type = t;
_encoding = enc;
_buffer = new byte[3]; //今は1文字は最大3バイト
_cursor = 0;
_tempOneCharArray = new char[1]; //APIの都合で長さ1のchar[]が必要なとき使う
}
示例8: EncType
/// <summary>
/// Represents the HTML attribute "enctype".
/// </summary>
/// <param name="encodingType">The value.</param>
/// <returns>The same instance of <see cref="Hex.AttributeBuilders.HtmlAttributeBuilder"/>.</returns>
public HtmlAttributeBuilder EncType( EncodingType encodingType )
{
string encodingTypeAttributeValue;
switch( encodingType )
{
case EncodingType.Multipart:
{
encodingTypeAttributeValue = ENCODING_TYPE_MULTIPART_FORM_DATA;
break;
}
case EncodingType.Plain:
{
encodingTypeAttributeValue = ENCODING_TYPE_TEXT_PLAIN;
break;
}
default:
{
encodingTypeAttributeValue = ENCODING_TYPE_APPLICATION_URL_ENCODED;
break;
}
}
this.Attributes[ HtmlAttributes.EncType ] = encodingTypeAttributeValue;
return this;
}
示例9: EncodingProfile
protected EncodingProfile(EncodingType t, Encoding enc)
{
_type = t;
_encoding = enc;
_buffer = new byte[3]; //���͂P�����͍ő�R�o�C�g
_cursor = 0;
_tempOneCharArray = new char[1]; //API�̓s���Œ����P��char[]���K�v�ȂƂ��g��
}
示例10: SetEncodingFilter
public void SetEncodingFilter(EncodingType encodingType, IEncoding encoding)
{
if (encodingType != null && encoding != null && !"*".Equals(encodingType.Name, StringComparison.Ordinal))
{
this.OutputStream = encoding.Encode(encodingType, this.OutputStream);
this.Headers["Content-Encoding"] = encodingType.Name;
}
}
示例11: XmlActionResult
public XmlActionResult(string xml, string fileName,
EncodingType encoding = EncodingType.UTF8,
LoadOptions loadOptions = System.Xml.Linq.LoadOptions.None)
{
XmlContent = xml;
FileName = fileName;
Encoding = encoding;
LoadOptions = loadOptions;
}
示例12: CanEncode
/// <summary>
/// Gets a value indicating whether this instance can encode the given <see cref="EncodingType"/>.
/// </summary>
/// <param name="encodingType">The <see cref="EncodingType"/> to encode.</param>
/// <returns>True if this instance can encode the <see cref="EncodingType"/>, false otherwise.</returns>
public bool CanEncode(EncodingType encodingType)
{
if (encodingType == null)
{
throw new ArgumentNullException("encodingType", "encodingType cannot be null.");
}
return encodingType.Accepts(GzipDeflateEncoding.Deflate) || encodingType.Accepts(GzipDeflateEncoding.Gzip);
}
示例13: Engine
protected Engine(MediaType mediaType, ContainerType inputFileContainerType, EncodingType inputFileEncondingType, String inputFilePath, String outputFilePath)
: base(mediaType, inputFileContainerType, inputFileEncondingType, inputFilePath, outputFilePath)
{
if (!sInitialized)
{
// Native initialization here
sInitialized = true;
}
}
示例14: FileStruct
public FileStruct(string path, string name, string contentType, EncodingType type, byte[] data, FileInfo fileinfo)
{
Path = path;
Name = name;
ContentType = contentType;
EncodingType = type;
Data = data;
FileInfo = fileinfo;
}
示例15: GetEncoding
public static Encoding GetEncoding(EncodingType encodingType)
{
switch (encodingType) {
case EncodingType.ASCII: return Encoding.ASCII;
case EncodingType.Unicode: return Encoding.Unicode;
case EncodingType.UTF32: return Encoding.UTF32;
case EncodingType.UTF7: return Encoding.UTF7;
case EncodingType.UTF8: return Encoding.UTF8;
default: return Encoding.Default;
}
}