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


C# ASCIIEncoding.IndexOf方法代码示例

本文整理汇总了C#中System.Text.ASCIIEncoding.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# ASCIIEncoding.IndexOf方法的具体用法?C# ASCIIEncoding.IndexOf怎么用?C# ASCIIEncoding.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Text.ASCIIEncoding的用法示例。


在下文中一共展示了ASCIIEncoding.IndexOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ByteToString

 internal static string ByteToString(byte[] value, int start, int count)
 {
     string str = new ASCIIEncoding().GetString(value, start, count);
     if (str.IndexOf("\0") != -1)
         str = str.Substring(0, str.IndexOf("\0"));
     return str;
 }
开发者ID:PimentelM,项目名称:extibiabot,代码行数:7,代码来源:Utils.cs

示例2: Decrypt

        public static string Decrypt(string Data, byte[] Key, byte[] IV)
        {
            try
            {

                MemoryStream msDecrypt = new MemoryStream(Convert.FromBase64String(Data));

                // Create a CryptoStream using the MemoryStream
                // and the passed key and initialization vector (IV).
                CryptoStream csDecrypt = new CryptoStream(msDecrypt,
                    new TripleDESCryptoServiceProvider().CreateDecryptor(Key, IV),
                    CryptoStreamMode.Read);

                // Create buffer to hold the decrypted data.
                byte[] fromEncrypt = new byte[Data.Length];

                // Read the decrypted data out of the crypto stream
                // and place it into the temporary buffer.
                csDecrypt.Read(fromEncrypt, 0, fromEncrypt.Length);

                //Convert the buffer into a string and return it.
                string ReturnValue = new ASCIIEncoding().GetString(fromEncrypt);
                if (ReturnValue.Contains("\0\0\0"))
                {
                    ReturnValue = ReturnValue.Remove(ReturnValue.IndexOf("\0\0\0"));
                }
                return ReturnValue;
            }
            catch (CryptographicException e)
            {
                Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
                return null;
            }
        }
开发者ID:hoangtung56pm,项目名称:KPINew,代码行数:34,代码来源:SSOSecurity.cs

示例3: GetItem

        public string GetItem(int row, int column)
        {
            if (row >= ItemCount) return "";

            LVITEM item = new LVITEM();

            byte[] buffer = new byte[100];

            IntPtr external_buffer = window_process.AllocateMemory(buffer.Length);
            item.pszText = external_buffer;

            item.iItem = row;
            item.iSubItem = column;
            item.mask = LVIF_TEXT;
            item.cchTextMax = buffer.Length;

            unsafe
            {
                IntPtr item_pointer = new IntPtr((void*)&item);

                IntPtr external_item = window_process.AllocateMemory(Marshal.SizeOf(item));
                window_process.Write(item_pointer, external_item, Marshal.SizeOf(item));

                Interop.SendMessage(Handle, (uint)Messages.LVM_GETITEMA, IntPtr.Zero, external_item);

                window_process.Read(external_buffer, buffer, buffer.Length);

                window_process.FreeMemory(external_buffer);
                window_process.FreeMemory(external_item);
            }

            string text = new System.Text.ASCIIEncoding().GetString(buffer);

            return text.Substring(0, text.IndexOf((char)0));
        }
开发者ID:alexhanh,项目名称:Botting-Library,代码行数:35,代码来源:ListView.cs


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