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


C# Headers类代码示例

本文整理汇总了C#中Headers的典型用法代码示例。如果您正苦于以下问题:C# Headers类的具体用法?C# Headers怎么用?C# Headers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Write

        public void Write(Headers headers, Version version)
        {
            if (headers == null)
                throw new ArgumentNullException("headers");

            // Signature
            _writer.Write(FileFormat.SIGNATURE);

            // Database version
            _writer.Write((short)version.Minor);
            _writer.Write((short)version.Major);

            // Headers
            Write(headers, HeaderFields.CipherID);
            Write(headers, HeaderFields.CompressionFlags);
            Write(headers, HeaderFields.MasterSeed);
            Write(headers, HeaderFields.TransformSeed);
            Write(headers, HeaderFields.TransformRounds);
            Write(headers, HeaderFields.EncryptionIV);
            Write(headers, HeaderFields.ProtectedStreamKey);
            Write(headers, HeaderFields.StreamStartBytes);
            Write(headers, HeaderFields.InnerRandomStreamID);
            Write(headers, HeaderFields.EndOfHeader);

            _writer.Flush();
        }
开发者ID:AFPass,项目名称:7Pass,代码行数:26,代码来源:HeadersWriter.cs

示例2: Get

        public HeadersResponse Get(Headers request)
        {
            HeadersResponse response = new HeadersResponse();
              List<Bm2s.Data.Common.BLL.Trade.Header> items = new List<Data.Common.BLL.Trade.Header>();
              if (!request.Ids.Any())
              {
            items.AddRange(Datas.Instance.DataStorage.Headers.Where(item =>
              (request.ActivityId == 0 || item.ActivityId == request.ActivityId) &&
              (!request.Date.HasValue || (request.Date >= item.Date && (!item.EndingDate.HasValue || request.Date < item.EndingDate.Value))) &&
              (string.IsNullOrWhiteSpace(request.Description) || item.Description.ToLower().Contains(request.Description.ToLower())) &&
              (request.HeaderStatusId == 0 || item.HeaderStatusId == request.HeaderStatusId) &&
              (!request.IsSell || item.IsSell) &&
              (!request.IsPurchase || item.IsPurchase) &&
              (string.IsNullOrWhiteSpace(request.Reference) || item.Reference.ToLower().Contains(request.Reference.ToLower())) &&
              (request.UserId == 0 || item.UserId == request.UserId)
              ));
              }
              else
              {
            items.AddRange(Datas.Instance.DataStorage.Headers.Where(item => request.Ids.Contains(item.Id)));
              }

              var collection = (from item in items
                        select new Bm2s.Poco.Common.Trade.Header()
                        {
                          Activity = new ActivitiesService().Get(new Activities() { Ids = new List<int>() { item.ActivityId } }).Activities.FirstOrDefault(),
                          Date = item.Date,
                          DeliveryObservation = item.DeliveryObservation,
                          Description = item.Description,
                          EndingDate = item.EndingDate,
                          FooterDiscount = Convert.ToDecimal(item.FooterDiscount),
                          HeaderStatus = new HeaderStatusesService().Get(new HeaderStatuses() { Ids = new List<int>() { item.HeaderStatusId } }).HeaderStatuses.FirstOrDefault(),
                          Id = item.Id,
                          IsPurchase = item.IsPurchase,
                          IsSell = item.IsSell,
                          Reference = item.Reference,
                          User = new UsersService().Get(new Users() { Ids = new List<int>() { item.UserId } }).Users.FirstOrDefault()
                        }).AsQueryable().OrderBy(request.Order, !request.DescendingOrder);

              response.ItemsCount = collection.Count();
              if (request.PageSize > 0)
              {
            response.Headers.AddRange(collection.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize));
              }
              else
              {
            response.Headers.AddRange(collection);
              }

              try
              {
            response.PagesCount = collection.Count() / response.Headers.Count + (collection.Count() % response.Headers.Count > 0 ? 1 : 0);
              }
              catch
              {
            response.PagesCount = 1;
              }

              return response;
        }
开发者ID:Csluikidikilest,项目名称:Bm2sServer,代码行数:60,代码来源:HeadersService.cs

示例3: GetResult

        protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
        {
            var deviceId = "test";

            var user = _user;

            if (string.Equals(methodName, "GetSearchCapabilities", StringComparison.OrdinalIgnoreCase))
                return HandleGetSearchCapabilities();

            if (string.Equals(methodName, "GetSortCapabilities", StringComparison.OrdinalIgnoreCase))
                return HandleGetSortCapabilities();

            if (string.Equals(methodName, "GetSortExtensionCapabilities", StringComparison.OrdinalIgnoreCase))
                return HandleGetSortExtensionCapabilities();

            if (string.Equals(methodName, "GetSystemUpdateID", StringComparison.OrdinalIgnoreCase))
                return HandleGetSystemUpdateID();

            if (string.Equals(methodName, "Browse", StringComparison.OrdinalIgnoreCase))
                return HandleBrowse(methodParams, user, deviceId).Result;

            if (string.Equals(methodName, "X_GetFeatureList", StringComparison.OrdinalIgnoreCase))
                return HandleXGetFeatureList();

            if (string.Equals(methodName, "GetFeatureList", StringComparison.OrdinalIgnoreCase))
                return HandleGetFeatureList();

            if (string.Equals(methodName, "X_SetBookmark", StringComparison.OrdinalIgnoreCase))
                return HandleXSetBookmark(methodParams, user);

            if (string.Equals(methodName, "Search", StringComparison.OrdinalIgnoreCase))
                return HandleSearch(methodParams, user, deviceId).Result;

            throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
        }
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:35,代码来源:ControlHandler.cs

示例4: LoadExisting

        public void LoadExisting(Stream existing, byte[] masterKey)
        {
            if (existing == null) throw new ArgumentNullException("existing");
            if (masterKey == null) throw new ArgumentNullException("masterKey");

            var reader = new BinaryReader(existing);
            if (!FileFormat.Sign(reader))
            {
                throw new FormatException(
                    "Invalid format detected");
            }

            _version = FileFormat
                .ReadVersion(reader);

            _masterKey = masterKey;
            _headers = FileFormat
                .ReadHeaders(existing);

            _xmlWriter = new XmlWriter();

            using (var decrypt = FileFormat.Decrypt(
                existing, _headers, masterKey))
            {
                _xmlWriter.Load(decrypt);

                var crypto = CryptoSerializer
                    .Create(_headers);
                _xmlWriter.Decrypt(crypto);
            }
        }
开发者ID:AFPass,项目名称:7Pass,代码行数:31,代码来源:DatabaseWriter.cs

示例5: ReadBody

        public static void ReadBody(Stream inputStream, Stream output, Headers headers, bool strict, ref float progress)
        {
            // Read Body
            byte[] buffer = new byte[8192];
            int contentLength = 0;

            if (int.TryParse (headers.Get ("Content-Length"), out contentLength)) {
                if (contentLength > 0) {
                    var remaining = contentLength;
                    while (remaining > 0) {
                        var count = inputStream.Read (buffer, 0, buffer.Length);
                        if (count == 0) {
                            break;
                        }
                        remaining -= count;
                        output.Write (buffer, 0, count);
                        progress = Mathf.Clamp01 (1.0f - ((float)remaining / (float)contentLength));
                    }
                }
            } else {
                if (!strict) {
                    var count = inputStream.Read (buffer, 0, buffer.Length);
                    while (count > 0) {
                        output.Write (buffer, 0, count);
                        count = inputStream.Read (buffer, 0, buffer.Length);
                    }
                }
                progress = 1;
            }
        }
开发者ID:simonwittber,项目名称:netwrok-client,代码行数:30,代码来源:Protocol.cs

示例6: Decrypt

        public static Stream Decrypt(Stream source,
            Headers headers, byte[] masterKey)
        {
            byte[] easKey;
            using (var buffer = new MemoryStream())
            {
                var masterSeed = headers.MasterSeed;
                buffer.Write(masterSeed, 0, masterSeed.Length);
                buffer.Write(masterKey, 0, masterKey.Length);

                easKey = BufferEx.GetHash(buffer.ToArray());
            }

            var eas = new AesManaged
            {
                KeySize = 256,
                Key = BufferEx.Clone(easKey),
                IV = BufferEx.Clone(headers.EncryptionIV)
            };

            Stream stream = new CryptoStream(source,
                eas.CreateDecryptor(),
                CryptoStreamMode.Read);

            if (!VerifyStartBytes(headers, stream))
                return null;

            stream = new HashedBlockStream(stream, true);
            return headers.Compression == Compressions.GZip
                ? new GZipInputStream(stream) : stream;
        }
开发者ID:oldlaurel,项目名称:WinPass,代码行数:31,代码来源:FileFormat.cs

示例7: Create

 public override Navigation.NavigationContainer Create(RlViewer.Files.FileProperties properties, Headers.Abstract.LocatorFileHeader header)
 {
     var brl4header = header as RlViewer.Headers.Concrete.Brl4.Brl4Header;
     if (brl4header == null) throw new ArgumentException("brl4header");
     return new Brl4NavigationContainer(properties.FilePath, brl4header.HeaderStruct.synthParams.D0, brl4header.HeaderStruct.rlParams.flipType, brl4header.HeaderStruct.rlParams.width,
         brl4header.HeaderStruct.rlParams.dx, brl4header.HeaderStruct.synthParams.board, brl4header.FileHeaderLength, brl4header.HeaderStruct.rlParams.width * brl4header.BytesPerSample,
         brl4header.HeaderStruct.rlParams.sx, brl4header.HeaderStruct.rlParams.sy);
 }
开发者ID:worstward,项目名称:rlviewer,代码行数:8,代码来源:Brl4NavigationContainerFactory.cs

示例8: test

 public void test()
 {
     Headers headers = new Headers();
     headers.username = "user";
     headers.password = "pass";
     service.HeadersValue = headers;
     Assert.AreEqual("hello user", service.say_hello());
 }
开发者ID:sinapam,项目名称:pyws,代码行数:8,代码来源:NeedsAuthTest.cs

示例9: Create

 public override Navigation.NavigationContainer Create(RlViewer.Files.FileProperties properties, Headers.Abstract.LocatorFileHeader header)
 {
     var rHeader = header as RlViewer.Headers.Concrete.R.RHeader;
     if (rHeader == null) throw new ArgumentException("rHeader");
     return new RNavigationContainer(properties.FilePath, rHeader.HeaderStruct.synthesisHeader.initialRange, 0, (int)rHeader.HeaderStruct.lineInfoHeader.lineLength,
         rHeader.HeaderStruct.synthesisHeader.dx, rHeader.HeaderStruct.synthesisHeader.sideObservation,
         rHeader.FileHeaderLength, (int)rHeader.HeaderStruct.lineInfoHeader.lineLength * rHeader.BytesPerSample);
 }
开发者ID:worstward,项目名称:rlviewer,代码行数:8,代码来源:RNavigationContainerFactory.cs

示例10: IOResponse

        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="status"></param>
        public IOResponse(IORequest request, IOStatus status)
        {
            Contract.Requires<ArgumentNullException>(request != null);

            this.request = request;
            this.status = status;
            this.headers = new Headers();
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:13,代码来源:IOResponse.cs

示例11: Create

 public override Navigation.NavigationContainer Create(RlViewer.Files.FileProperties properties, Headers.Abstract.LocatorFileHeader header)
 {
     var kHeader = header as RlViewer.Headers.Concrete.K.KHeader;
     if (kHeader == null) throw new ArgumentException("kHeader");
     return new KNavigationContainer(properties.FilePath, kHeader.HeaderStruct.synchronizerHeader.initialRange, 0, 0,
         0, (byte)kHeader.HeaderStruct.synchronizerHeader.board, header.FileHeaderLength,
         (int)kHeader.HeaderStruct.lineInfoHeader.lineLength * header.BytesPerSample);
 }
开发者ID:worstward,项目名称:rlviewer,代码行数:8,代码来源:KNavigationContainerFactory.cs

示例12: ModelResponse

        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="request"></param>
        public ModelResponse(ModelRequest request, ModelResponseStatus status, XDocument body)
        {
            Contract.Requires<ArgumentNullException>(request != null);

            this.request = request;
            this.status = status;
            this.body = body;
            this.headers = new Headers();
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:13,代码来源:ModelResponse.cs

示例13: GetResult

        protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
        {
            if (string.Equals(methodName, "IsAuthorized", StringComparison.OrdinalIgnoreCase))
                return HandleIsAuthorized();
            if (string.Equals(methodName, "IsValidated", StringComparison.OrdinalIgnoreCase))
                return HandleIsValidated();

            throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:9,代码来源:ControlHandler.cs

示例14: GetResult

        protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
        {
            if (string.Equals(methodName, "GetProtocolInfo", StringComparison.OrdinalIgnoreCase))
            {
                return HandleGetProtocolInfo();
            }

            throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
        }
开发者ID:jabbera,项目名称:MediaBrowser,代码行数:9,代码来源:ControlHandler.cs

示例15: KSizeCalculator

        public KSizeCalculator(Headers.Abstract.LocatorFileHeader header)
        {
            var fileHead = header as Headers.Concrete.K.KHeader;
            _dx = 300 / (2 * fileHead.HeaderStruct.adcHeader.adcFreq);
            _dy = _dx;
            //_freq = fileHead.HeaderStruct.adcHeader.adcFreq;
            //_impulseLength = fileHead.HeaderStruct

        }
开发者ID:worstward,项目名称:rlviewer,代码行数:9,代码来源:KSizeCalculator.cs


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