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


C# IFile.Read方法代码示例

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


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

示例1: deSerialize

        public override void deSerialize(IFile a_File)
        {
            Version = a_File.Read<short>();

            //gCInfo__ReadCompiledComSeq
            short s0 = a_File.Read<short>();
            int i0 = a_File.Read<int>();
            if (i0 > 0)
            {
                m_pCommands = new List<bCAccessorPropertyObject>();
                for (int i = 0; i < i0; i++)
                    m_pCommands.Add(new bCAccessorPropertyObject(a_File));
            }

            //gCInfo__ReadCompiledCondSeq
            short s1 = a_File.Read<short>();
            if (s1 == 1)
            {
                int i1 = a_File.Read<int>();
                if (i1 > 0)
                {
                    m_pConditions = new List<bCAccessorPropertyObject>();
                    for (int i = 0; i < i1; i++)
                        m_pConditions.Add(new bCAccessorPropertyObject(a_File));
                }
            }
        }
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:27,代码来源:gCInfo.cs

示例2: TempHeader

 public TempHeader(IFile a_Stream)
 {
     Version = a_Stream.Read<short>();
     ID = new bCPropertyID(a_Stream);
     b0 = a_Stream.Read<byte>();
     b1 = a_Stream.Read<byte>();
     bObsolete1 = a_Stream.Read<byte>();
     if (Version < 215u)
         bValue1 = a_Stream.Read<byte>();
     bValue2 = a_Stream.Read<byte>();
     bValue3 = a_Stream.Read<byte>();
     bValue1 = a_Stream.Read<byte>();
     bValue4 = a_Stream.Read<byte>();
     if (Version >= 214u)
         bValue1 = a_Stream.Read<byte>();
     bHasRefTemplateID = a_Stream.Read<byte>();
     if (bHasRefTemplateID == 1)
         m_pRefTemplateID = new bCProperty(a_Stream);
     m_fRenderAlphaValue = a_Stream.Read<float>();
     m_fViewRange = a_Stream.Read<float>();
     enumInsertType = a_Stream.Read<short>();
     st0 = new bCString(a_Stream);
     v0 = a_Stream.Read<Vector3>();
     q0 = a_Stream.Read<Quaternion>();
     if (Version < 213u)
     {
         bValue1 = a_Stream.Read<byte>();
         bValue1 = a_Stream.Read<byte>();
     }
     if (Version < 212u)
         bValue1 = a_Stream.Read<byte>();
     if (Version < 213u)
         a_Stream.Read<float>();
     dt0 = new bCDateTime(a_Stream);
     if (Version < 213u)
         a_Stream.Read<byte>();
     if (Version < 217u)
         a_Stream.Read<float>();
     if (Version < 213u)
     {
         a_Stream.Read<byte>();
         bValue1 = a_Stream.Read<byte>();
     }
     bValue5 = a_Stream.Read<byte>();
     bValue6 = a_Stream.Read<byte>();
     bValue7 = a_Stream.Read<byte>();
     if (Version >= 211u)
         m_u8ScaleGridPercentage = a_Stream.Read<byte>();
     if (Version >= 218u)
         a_Stream.Read<byte>();
 }
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:51,代码来源:TpleFile.cs

示例3: DecryptToStream

        public void DecryptToStream(IFile file, Stream outputStream)
        {
            if (file == null)
                throw new ArgumentNullException(nameof(file));
            if (outputStream == null)
                throw new ArgumentNullException(nameof(outputStream));

            //Read IV
            int ivSize = _encryptionProvider.BlockSize / 8;
            byte[] iv = new byte[ivSize];
            using (Stream fileData = file.Read())
            {
                fileData.Seek(0, SeekOrigin.Begin);
                fileData.Read(iv, 0, iv.Length);

                //Write decrypted data
                byte[] key = _key.GenerateBlock(_encryptionProvider.BlockSize);
                ICryptoTransform decryptor = _encryptionProvider.CreateDecryptor(key, iv);

                using (var cryptoStream = new CryptoStream(fileData, decryptor, CryptoStreamMode.Read))
                {
                    cryptoStream.CopyTo(outputStream);
                }
            }
        }
开发者ID:AdrianLThomas,项目名称:altCrypt,代码行数:25,代码来源:StreamEncryptor.cs

示例4: Open

 public override void Open(IFile file, long pagePoolSize) 
 {
     acceptor = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     acceptor.Bind(new IPEndPoint(IPAddress.Any, port));           
     acceptor.Listen(ListenQueueSize);
     if (file.Length > 0) 
     { 
         byte[] rootPage = new byte[Page.pageSize];
         try 
         { 
             file.Read(0, rootPage);
             prevIndex =  rootPage[DB_HDR_CURR_INDEX_OFFSET];
             initialized = rootPage[DB_HDR_INITIALIZED_OFFSET] != 0;
         } 
         catch (StorageError) 
         {
             initialized = false;
             prevIndex = -1;
         }
     } 
     else 
     { 
         prevIndex = -1;
         initialized = false;
     }
     outOfSync = false;
     base.Open(file, pagePoolSize);
 }
开发者ID:yan122725529,项目名称:TripRobot.Crawler,代码行数:28,代码来源:ReplicationStaticSlaveStorageImpl.cs

示例5: deSerialize

 public override void deSerialize(IFile bs)
 {
     Version = bs.Read<int>();
     int ArraySize = bs.Read<int>();
     data = new List<float[]>();
     if (ArraySize != 0)
     {
         int ItemCount = bs.Read<int>();
         for (int j = 0; j < ItemCount; j++)
         {
             float[] q = new float[5];
             for (int i = 0; i < 5; i++)
                 q[i] = bs.Read<float>();
             data.Add(q);
         }
     }
 }
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:17,代码来源:xMatClasses.cs

示例6: deSerialize

 public override void deSerialize(IFile a_File)
 {
     a_File.Position = 14L;
     i0 = a_File.Read<int>();
     if (i0 != 875579463)
         return;
     i1 = a_File.Read<int>();
     C = new List<c0>();
     for (int i = 0; i < 10; i++)
     {
         c0 c = new c0();
         c.i2 = a_File.Read<int>();
         c.obj = new bCAccessorPropertyObject(a_File);
         c.s0 = new bCString(a_File);
         c.i3 = a_File.Read<int>();
         a_File.Position += 16;
         C.Add(c);
     }
 }
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:19,代码来源:GENOME_Files.cs

示例7: EncryptToStream

        public void EncryptToStream(IFile file, Stream outputStream)
        {
            if (file == null)
                throw new ArgumentNullException(nameof(file));
            if (outputStream == null)
                throw new ArgumentNullException(nameof(outputStream));

            byte[] key = _key.GenerateBlock(_encryptionProvider.BlockSize);
            byte[] iv = _iv.GenerateIV(_encryptionProvider.BlockSize);
            ICryptoTransform encryptor = _encryptionProvider.CreateEncryptor(key, iv);

            //Write IV in plain text to beginning of stream
            outputStream.Seek(0, SeekOrigin.Begin);
            outputStream.Write(iv, 0, iv.Length);

            //Write encrypted data
            using (Stream stream = file.Read())
            {
                var cryptoStream = new CryptoStream(outputStream, encryptor, CryptoStreamMode.Write);
                stream.CopyTo(cryptoStream);
                cryptoStream.FlushFinalBlock();
            }
        }
开发者ID:AdrianLThomas,项目名称:altCrypt,代码行数:23,代码来源:StreamEncryptor.cs

示例8: BuildTextStream

		public static Stream BuildTextStream(IFile input)
		{
			if (input == null)
				throw new ArgumentNullException("Stream input is null");

			Stream data = new MemoryStream();
			StreamWriter writer = new StreamWriter(data, Encoding.Unicode);

			StringBuilder sb = new StringBuilder();

			MiniDocReader reader = new MiniDocReader(input.FileType);
			input.Read(reader);

			foreach (KeyValuePair<string, MiniDocReader.DocContext> keyPair in reader)
			{
				foreach (string value in keyPair.Value.Text)
				{
					sb.Append(value);
				}
			}

			writer.Write(sb.ToString());
			writer.Flush();

			data.Position = 0;
			return data;
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:27,代码来源:Utils.cs

示例9: Open

        public virtual void Open(IFile file, int pagePoolSize)
        {
            lock (this)
            {
                if (opened)
                {
                    throw new StorageError(StorageError.STORAGE_ALREADY_OPENED);
                }
                if (lockFile)
                {
                    if (!file.Lock())
                    {
                        throw new StorageError(StorageError.STORAGE_IS_USED);
                    }
                }
                Page pg;
                int i;
                int indexSize = initIndexSize;
                if (indexSize < dbFirstUserId)
                {
                    indexSize = dbFirstUserId;
                }
                indexSize = (indexSize + dbHandlesPerPage - 1) & ~ (dbHandlesPerPage - 1);

                dirtyPagesMap = new int[dbDirtyPageBitmapSize / 4 + 1];
                gcThreshold = Int64.MaxValue;
                backgroundGcMonitor = new object();
                backgroundGcStartMonitor = new object();
                gcThread = null;
                gcActive = false;
                gcDone = false;
                allocatedDelta = 0;

                nNestedTransactions = 0;
                nBlockedTransactions = 0;
                nCommittedTransactions = 0;
                scheduledCommitTime = Int64.MaxValue;
                transactionMonitor = new object();
                transactionLock = new PersistentResource();

                modified = false;

                objectCache = CreateObjectCache(cacheKind, pagePoolSize, objectCacheInitSize);

                //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior.
                classDescMap = new Hashtable();
                descList = null;

                header = new Header();
                byte[] buf = new byte[Header.Sizeof];
                int rc = file.Read(0, buf);
                if (rc > 0 && rc < Header.Sizeof)
                {
                    throw new StorageError(StorageError.DATABASE_CORRUPTED);
                }

                header.Unpack(buf);
                if (header.curr < 0 || header.curr > 1)
                {
                    throw new StorageError(StorageError.DATABASE_CORRUPTED);
                }

                if (pool == null)
                {
                    pool = new PagePool(pagePoolSize / Page.pageSize);
                    pool.Open(file);
                }

                if (!header.initialized)
                {
                    header.curr = currIndex = 0;
                    long used = Page.pageSize;
                    header.root[0].index = used;
                    header.root[0].indexSize = indexSize;
                    header.root[0].indexUsed = dbFirstUserId;
                    header.root[0].freeList = 0;
                    used += indexSize * 8L;
                    header.root[1].index = used;
                    header.root[1].indexSize = indexSize;
                    header.root[1].indexUsed = dbFirstUserId;
                    header.root[1].freeList = 0;
                    used += indexSize * 8L;

                    header.root[0].shadowIndex = header.root[1].index;
                    header.root[1].shadowIndex = header.root[0].index;
                    header.root[0].shadowIndexSize = indexSize;
                    header.root[1].shadowIndexSize = indexSize;

                    int bitmapPages = (int) ((used + Page.pageSize * (dbAllocationQuantum * 8 - 1) - 1) / (Page.pageSize * (dbAllocationQuantum * 8 - 1)));
                    long bitmapSize = (long) bitmapPages * Page.pageSize;
                    int usedBitmapSize = (int) (SupportClass.URShift((used + bitmapSize), (dbAllocationQuantumBits + 3)));

                    for (i = 0; i < bitmapPages; i++)
                    {
                        pg = pool.PutPage(used + (long) i * Page.pageSize);
                        byte[] bitmap = pg.data;
                        int n = usedBitmapSize > Page.pageSize ? Page.pageSize : usedBitmapSize;
                        for (int j = 0; j < n; j++)
                        {
                            bitmap[j] = (byte) 0xFF;
//.........这里部分代码省略.........
开发者ID:kjk,项目名称:tenderbase,代码行数:101,代码来源:StorageImpl.cs

示例10: deSerialize

 public override void deSerialize(IFile a_File)
 {
     Version = a_File.Read<short>();
     data0 = new List<bCAccessorPropertyObject>(a_File.Read<int>());
     for (int i = 0; i < data0.Capacity; i++)
         data0.Add(new bCAccessorPropertyObject(a_File));
     data1 = new List<bCAccessorPropertyObject>(a_File.Read<int>());
     for (int i = 0; i < data1.Capacity; i++)
         data1.Add(new bCAccessorPropertyObject(a_File));
     data2 = new List<bCAccessorPropertyObject>(a_File.Read<int>());
     for (int i = 0; i < data2.Capacity; i++)
         data2.Add(new bCAccessorPropertyObject(a_File));
 }
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:13,代码来源:gCCombatSpecies.cs

示例11: Properties

		public Property[] Properties(IFile file,
									 string[] names)
		{
            DocumentReader docReader = file.Read() as DocumentReader;
            List<Property> props = new List<Property>();

            if (docReader == null)
            {
                throw new System.InvalidCastException("Could not cast IDocumentReader returned from File.Read()");
            }        

            // Copy the elements from names into a dictionary for quick indexing.
            Dictionary<string, bool> convertedNames = new Dictionary<string, bool>();
            for (int i = 0; i < names.Length; ++i)
            {
                convertedNames.Add(names[i].ToLower(CultureInfo.InvariantCulture), false);
            }

            List<DocumentReader.StringTriplet> customProperties = docReader.CustomProperties();
            int convertedNamesCount = convertedNames.Count;
            for (int i = 0; i < customProperties.Count; ++i)
            {
                string key = customProperties[i].First.ToLower(CultureInfo.InvariantCulture);
                if (convertedNamesCount == 0 || convertedNames.ContainsKey(key)) // add all of em if none specified
                {
                    props.Add(new Property(customProperties[i].First, customProperties[i].Second));
                }
            }

			return props.ToArray();
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:31,代码来源:CustomPropertyAnalyzer.cs

示例12: eCSubMesh

 public eCSubMesh(IFile a_File)
 {
     int q = (int)a_File.Position / 413;
     Version = a_File.Read<short>();
     int v10 = a_File.Read<int>() / 32;
     data = new List<c0>();
     int i = 0;
     while (true)
     {
         c0 c = new c0();
         c.m0 = new bCBox(a_File);
         c.m1 = a_File.Read<int>();
         c.m2 = a_File.Read<int>();
         data.Add(c);
         ++i;
         if (i >= v10)
             break;
     }
     if(a_File.Length > (q + 1) * 408 + 5)
         a_File.Position = (q + 1) * 408 + 5;
 }
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:21,代码来源:GENOME_Files.cs

示例13: deSerialize

 public override void deSerialize(IFile a_File)
 {
     a_File.Position += 8;
     int poff = a_File.Read<int>();
     int plen = a_File.Read<int>();
     int doff = a_File.Read<int>();
     int dlen = a_File.Read<int>();
     Time = DateTime.FromFileTime(a_File.Read<long>());
     char[] A = a_File.Read<char>(8);
     propObj = new bCAccessorPropertyObject(a_File);
     dataObj = new bCAccessorPropertyObject(a_File);
 }
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:12,代码来源:XmatLoader.cs


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