当前位置: 首页>>代码示例>>C#>>正文


C# EncodingType类代码示例

本文整理汇总了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;
 }
开发者ID:rfyiamcool,项目名称:solrex,代码行数:7,代码来源:Encoding.cs

示例2: Blob

 public Blob(string content, EncodingType encoding, string sha, int size)
 {
     Content = content;
     Encoding = encoding;
     Sha = sha;
     Size = size;
 }
开发者ID:alexgyori,项目名称:octokit.net,代码行数:7,代码来源:Blob.cs

示例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));
            }
        }
开发者ID:Pctg-x8,项目名称:Altseed,代码行数:35,代码来源:Program.cs

示例4: MediaFileInfo

 public MediaFileInfo(MediaType mediaType, ContainerType containerType, EncodingType encondingType, String path)
 {
     mMediaType = mediaType;
     mContainerType = containerType;
     mEncondingType = encondingType;
     mPath = path;
 }
开发者ID:sarandogou,项目名称:thialgou,代码行数:7,代码来源:MediaFileInfo.cs

示例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);
    }
开发者ID:jmdjr,项目名称:jd-bacon,代码行数:26,代码来源:JDGameUtilz.cs

示例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);
 }
开发者ID:ThadHouse,项目名称:robotdotnet-wpilib,代码行数:28,代码来源:Counter.cs

示例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[]が必要なとき使う
 }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:7,代码来源:Encoding.cs

示例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;
        }
开发者ID:john-t-white,项目名称:Hex,代码行数:31,代码来源:HtmlAttributeBuilder_FormExtensions.cs

示例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��
 }
开发者ID:VirusFree,项目名称:Poderosa,代码行数:8,代码来源:Encoding.cs

示例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;
     }
 }
开发者ID:ChadBurggraf,项目名称:small-fry,代码行数:8,代码来源:ResponseMessage.cs

示例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;
 }
开发者ID:sabotuer99,项目名称:ExtensibilityMVC,代码行数:9,代码来源:XmlActionResult.cs

示例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);
        }
开发者ID:ChadBurggraf,项目名称:small-fry,代码行数:14,代码来源:GzipDeflateEncoding.cs

示例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;
     }
 }
开发者ID:sarandogou,项目名称:thialgou,代码行数:9,代码来源:Engine.cs

示例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;
		}
开发者ID:clarkis117,项目名称:GenericMvcUtilities,代码行数:9,代码来源:IFile.cs

示例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;
     }
 }
开发者ID:farreltr,项目名称:OneLastSunset,代码行数:11,代码来源:EncodingType.cs


注:本文中的EncodingType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。