public void SetHeader(ref ReadableBuffer key, ref ReadableBuffer value)
 {
     string headerKey = GetHeaderKey(ref key);
     _headers[headerKey] = new HeaderValue
     {
         Raw = value.Preserve()
     };
 }
Beispiel #2
0
        public void Send(Address address, HeaderValue[] headers)
        {
            Mandate.ParameterNotNull(address, "address");
            Mandate.ParameterNotNullOrEmpty(headers, "headers");

            var outgoingMessage = OutgoingMessageContext.BuildControl(address, headers);
            messageTransport.SendMessage(outgoingMessage);
        }
Beispiel #3
0
            /// <summary>
            /// Writes a string to the console asynchronously + critical
            /// </summary>
            /// <param name="Line">String to write</param>
            /// <param name="Parameters">Object parameters</param>
            public static async void WriteCritical(string Line, params object[] Parameters)
            {
                System.Console.ForegroundColor = LOG.HeaderColor;
                await LOG.Console.WriteAsync(" " +
                                             HeaderValue.Replace(
                                                 "@time", DateTime.Now.ToString()).Replace(
                                                 "@type", GetCallingType().ToString()) + " ");

                System.Console.ForegroundColor = ConsoleColor.Red;
                await LOG.Console.WriteLineAsync(string.Format(Line, Parameters));
            }
        public bool TryConvert <T>(HeaderValue <T> headerValue, out HeaderValue <MessageAttributeValue> result)
        {
            if (headerValue.IsStringValue(out HeaderValue <string> stringValue) && _allowTransportHeader(stringValue))
            {
                result = CreateMessageAttributeValue(stringValue);
                return(true);
            }

            result = default;
            return(false);
        }
        public bool TryConvert <T>(HeaderValue <T> headerValue, out HeaderValue result)
        {
            if (headerValue.IsStringValue(out var stringValue))
            {
                result = stringValue;
                return(true);
            }

            result = default;
            return(false);
        }
Beispiel #6
0
    //-----------------------------------------------------------------

    public override void SetUpConsolePart1()
    {
        Console.Header.ReserveLines(5);
        _progress = Console.Header.CreateBlockValue(61, "Progress: ", ValueToUTFBars.Styles.Vertical);
        Console.Header.ForceNewLine();
        _currentValue = Console.Header.CreateFormatedValue(60, "Value   :  ");
        Console.Header.ForceNewLine();
        _currentMask = Console.Header.CreateFormatedValue(60, "Mask    :  ");
        Console.Header.ForceNewLine();
        _currentResult = Console.Header.CreateFormatedValue(60, "Result  :  ");
        Console.Header.ForceNewLine();
        _currentSum = Console.Header.CreateFormatedValue(60, "Sum     :  ");
    }
Beispiel #7
0
        static void AssertCsvValues(CombinedHttpHeaders headers, HeaderValue headerValue)
        {
            Assert.True(ContentEquals(headerValue.AsCsv(), headers.Get(HeaderName, null)));

            List <ICharSequence>  expected = headerValue.AsList();
            IList <ICharSequence> values   = headers.GetAll(HeaderName);

            Assert.Equal(expected.Count, values.Count);
            for (int i = 0; i < expected.Count; i++)
            {
                Assert.True(expected[i].ContentEquals(values[i]));
            }
        }
        public TransportMessageDto(Guid messageId, Guid correlationId, string endpoint, string body, HeaderValue[] headers)
        {
            Mandate.ParameterNotDefaut(messageId, "messageId");
            Mandate.ParameterNotDefaut(correlationId, "correlationId");
            Mandate.ParameterNotNullOrEmpty(endpoint, "endpoint");
            Mandate.ParameterNotNullOrEmpty(body, "body");
            Mandate.ParameterNotNullOrEmpty(headers, "headers");

            MessageId = messageId;
            CorrelationId = correlationId;
            ReplyToAddress = endpoint;
            Body = body;
            Headers = headers;
        }
Beispiel #9
0
 internal void SetHeader()
 {
     if (!HeaderKey.IsNullOrEmpty() && !HeaderValue.IsNullOrEmpty())
     {
         OptionBuilder.Header.Add(HeaderKey, HeaderValue);
     }
     if (Headers != null && Headers.Count > 0)
     {
         Headers.ForDicEach((key, par) =>
         {
             OptionBuilder.Header.Add(key, par);
         });
     }
 }
Beispiel #10
0
    //-----------------------------------------------------------------

    public override void SetUpConsolePart1()
    {
        Console.Header.ReserveLines(10);
        _itteration = Console.Header.CreateFormatedValue(5, "Itteration: ");

        _itteration.SetValue(10);
        _aFloat         = Console.Header.CreateFormatedValue(6, "Float: ");
        _aFormatedFloat = Console.Header.CreateFormatedValue(6, "Formated Float: ", "F3");

        _percent1 = Console.Header.CreateFormatedValue(6, "Percent: ");
        _percent2 = Console.Header.CreateBlockValue(2, "Percent: ", ValueToUTFBars.Styles.Horizontal);
        _percent3 = Console.Header.CreateBlockValue(5, "Percent: ", ValueToUTFBars.Styles.Vertical);
        _percent4 = Console.Header.CreateBlockValue(10, "Percent: ", ValueToUTFBars.Styles.Shades);
        _percent5 = Console.Header.CreateBlockValue(15, "Percent: ", ValueToUTFBars.Styles.Circle);
        _percent6 = Console.Header.CreateBlockValue(1, "Percent: ", ValueToUTFBars.Styles.CenteredVerticalBar);
    }
Beispiel #11
0
        public bool TryConvert <T>(HeaderValue <T> headerValue, out HeaderValue <Header> result)
        {
            if (headerValue.IsStringValue(out HeaderValue <string> stringValue) && _allowTransportHeader(stringValue))
            {
                result = CreateHeaderValue(stringValue);
                return(true);
            }

            if (headerValue.Value != null)
            {
                result = new HeaderValue <Header>(headerValue.Key, new Header(headerValue.Key, Serialize(headerValue.Value)));
                return(true);
            }

            result = default;
            return(false);
        }
Beispiel #12
0
        public IHttpActionResult GetQutationDetailsTable(int id)
        {
            IEnumerable <string> HeaderValue;
            var QTID = "";

            if (GlobalVeriables.WebApiClient.DefaultRequestHeaders.TryGetValues("QTID", out HeaderValue))
            {
                QTID = HeaderValue.FirstOrDefault();
            }
            int QTIDs = (QTID != "" ? Convert.ToInt32(QTID) : 0);

            if (QTIDs != 0)
            {
                var query = db.QutationDetailsTables.ToList().Where(c => c.QutationID == QTIDs).ToList();

                return(Ok(query));
            }
            else
            {
                // List<MVCQutationViewModel> qutationDetailsTable = new List<MVCQutationViewModel>();
                //   var obj = db.QutationDetailsTables.ToList().Where(c => c.QutationID == QviewModel.QutationID).ToList();

                var query = (from pd in db.QutationDetailsTables
                             join p in db.ProductTables on pd.ItemId equals p.ProductId
                             where pd.QutationID == id
                             select new MVCQutationViewModel
                {
                    ItemId = pd.ItemId,
                    QutationID = pd.QutationID,
                    Rate = pd.Rate,
                    Quantity = pd.Quantity,
                    Vat = pd.Vat,
                    ItemName = p.ProductName,
                    Total = pd.Total,
                    QutationDetailId = pd.QutationDetailId
                }).ToList();


                if (query == null)
                {
                    return(NotFound());
                }
                return(Ok(query));
            }
        }
Beispiel #13
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("table");

            tb.AddCssClass(StyleValue.ToCssClass());

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            if (CaptionValue != null)
            {
                CaptionValue.WriteTo(writer, context);
            }
            if (HeaderValue != null)
            {
                HeaderValue.WriteTo(writer, context);
            }
        }
        private HeaderValue[] GetBaseValueSegmentHeaderEvents(BaseValueSegmentDto baseValueSegmentDto, BaseValueSegmentTransactionDto transaction)
        {
            var headerRelatedEvents = _grmEventDomain.GetValueHeaderGrmEvents(baseValueSegmentDto).Result.ToArray();

            var conclusionHeaderEvents = _baseValueSegmentRepository.GetConclusionsData(baseValueSegmentDto.RevenueObjectId, baseValueSegmentDto.AsOf).Result.ToList();

            var valueHeaders = new List <HeaderValue>();

            foreach (var baseValueSegmentValueHeaderDto in transaction.BaseValueSegmentValueHeaders)
            {
                var headerRelatedEvent = headerRelatedEvents.Single(he => he.GrmEventId == baseValueSegmentValueHeaderDto.GRMEventId);
                BaseValueSegmentConclusionDto conclusionEvent = null;

                if (conclusionHeaderEvents.Count > 0)
                {
                    conclusionEvent = conclusionHeaderEvents.FirstOrDefault(conclusion => conclusion.GrmEventId == headerRelatedEvent.GrmEventId);
                }

                var headerValue = new HeaderValue
                {
                    HeaderValueId = baseValueSegmentValueHeaderDto.Id,
                    GrmEventId    = headerRelatedEvent.GrmEventId,
                    DisplayName   = headerRelatedEvent.EventType + " " + headerRelatedEvent.EffectiveDate.Year,
                    BaseYear      = baseValueSegmentValueHeaderDto.BaseYear,
                    EventDate     = headerRelatedEvent.EventDate,
                    EventType     = headerRelatedEvent.EventType,
                    EffectiveDate = headerRelatedEvent.EffectiveDate
                };

                if (conclusionEvent != null)
                {
                    headerValue.DisplayName = conclusionEvent.Description + " " + conclusionEvent.ConclusionDate.Year;
                    headerValue.EventType   = conclusionEvent.Description;
                }

                valueHeaders.Add(headerValue);
            }

            return(valueHeaders.OrderByDescending(vh => vh.BaseYear).ToArray());
        }
Beispiel #15
0
 public void Setup()
 {
     _headerValue = (HeaderValue <int>)HeaderValue.ParseInternal("Content-Length", Value.ToString());
 }
 public Packet MakePacket(string[] Data, HeaderValue Header)
 {
     return new Packet(Header, _id, Data);
 }
Beispiel #17
0
 public Packet(HeaderValue Header, string Sender, string[] Data)
 {
     this.Header = Header;
     this.Sender = Sender;
     this.Data = new List<string>(Data);
 }
Beispiel #18
0
 public void it_should_throw_when_no_header_value_is_passed_for_parsing()
 {
     ((HeaderValue)null).Invoking(_ => HeaderValue.Parse(null)).ShouldThrow <ArgumentNullException>().Which.ParamName.Should().Be("value");
 }
 private void SetHeader(string key, StringValues value)
 {
     _headers[key] = new HeaderValue
     {
         Value = value
     };
 }
Beispiel #20
0
    //-----------------------------------------------------------------

    public override void SetUpConsolePart2()
    {
        Console.Header.ReserveLines(1);
        _progress     = Console.Header.CreateBlockValue(40, "Progress: ", ValueToUTFBars.Styles.Shades);
        _currentIndex = Console.Header.CreateFormatedValue(4, "Index: ");
    }
Beispiel #21
0
 public void Setup()
 {
     HeaderValue.TryParse(String.Format("{0}; {1}={2}", Value, ParameterName, ParameterValue), out _headerValue);
 }
Beispiel #22
0
        public void it_should_not_try_and_parse_a_header_value()
        {
            HeaderValue value;

            HeaderValue.TryParse(null, out value).Should().BeFalse();
        }
        public bool ParseNegotiation(WebSocketResponse resp)
        {
            // Search for any returned neogitation offer
            var headerValues = resp.GetHeaderValues("Sec-WebSocket-Extensions");

            if (headerValues == null)
            {
                return(false);
            }

            for (int i = 0; i < headerValues.Count; ++i)
            {
                // If found, tokenize it
                HeaderParser parser = new HeaderParser(headerValues[i]);

                for (int cv = 0; cv < parser.Values.Count; ++cv)
                {
                    HeaderValue value = parser.Values[i];

                    if (!string.IsNullOrEmpty(value.Key) && value.Key.StartsWith("permessage-deflate", StringComparison.OrdinalIgnoreCase))
                    {
                        HTTPManager.Logger.Information("PerMessageCompression", "Enabled with header: " + headerValues[i]);

                        HeaderValue option;
                        if (value.TryGetOption("client_no_context_takeover", out option))
                        {
                            this.ClientNoContextTakeover = true;
                        }

                        if (value.TryGetOption("server_no_context_takeover", out option))
                        {
                            this.ServerNoContextTakeover = true;
                        }

                        if (value.TryGetOption("client_max_window_bits", out option))
                        {
                            if (option.HasValue)
                            {
                                int windowBits;
                                if (int.TryParse(option.Value, out windowBits))
                                {
                                    this.ClientMaxWindowBits = windowBits;
                                }
                            }
                        }

                        if (value.TryGetOption("server_max_window_bits", out option))
                        {
                            if (option.HasValue)
                            {
                                int windowBits;
                                if (int.TryParse(option.Value, out windowBits))
                                {
                                    this.ServerMaxWindowBits = windowBits;
                                }
                            }
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #24
0
    //-----------------------------------------------------------------

    public override void SetUpConsolePart2()
    {
        Console.Header.ReserveLines(11);
        _progress = Console.Header.CreateBlockValue(40, "Progress: ", ValueToUTFBars.Styles.Circle);
    }
Beispiel #25
0
 public void Teardown()
 {
     _headerValue = null;
 }
Beispiel #26
0
        public void it_should_consider_same_instance_as_equal()
        {
            var value = new HeaderValue("test");

            value.Equals(value).Should().BeTrue();
        }
Beispiel #27
0
    //-----------------------------------------------------------------

    public override void SetUpConsolePart2()
    {
        Console.Header.ReserveLines(1);
        _itteration = Console.Header.CreateFormatedValue(10, "Itterations: ");
    }
        public IHttpActionResult GetPurchaseDetailsTable(int id)
        {
            IEnumerable <string> HeaderValue;
            var PDID = "";

            if (GlobalVeriables.WebApiClient.DefaultRequestHeaders.TryGetValues("PDID", out HeaderValue))
            {
                PDID = HeaderValue.FirstOrDefault();
            }
            int PDIDs = (PDID != "" ? Convert.ToInt32(PDID) : 0);

            if (PDIDs != 0)
            {
                var query = db.PurchaseOrderDetailsTables.ToList().Where(c => c.PurchaseId == PDIDs).Select(pd => new MvcPurchaseViewModel
                {
                    PurchaseOrderDetailsId = (int)pd.PurchaseOrderDetailsId,
                    PurchaseItemId         = pd.PurchaseOrderDetailsId,
                    PurchaseDescription    = pd.PurchaseDescription,
                    PurchaseQuantity       = pd.PurchaseQuantity,
                    PurchaseItemRate       = pd.PurchaseItemRate,
                    PurchaseTotal          = pd.PurchaseTotal,
                    PurchaseVatPercentage  = pd.PurchaseVatPercentage,
                    PurchaseId             = pd.PurchaseId,
                    Type        = pd.Type,
                    RowSubTotal = pd.RowSubTotal,
                    ServiceDate = pd.ServiceDate,
                    Purchase_ID = pd.PurchaseOrderTable.PurchaseID
                }).ToList();

                return(Ok(query));
            }
            else
            {
                // List<MVCQutationViewModel> qutationDetailsTable = new List<MVCQutationViewModel>();
                //   var obj = db.QutationDetailsTables.ToList().Where(c => c.QutationID == QviewModel.QutationID).ToList();

                var query = (from pd in db.PurchaseOrderDetailsTables
                             join p in db.ProductTables on pd.PurchaseItemId equals p.ProductId
                             where pd.PurchaseId == id
                             select new MvcPurchaseViewModel
                {
                    Type = pd.Type,
                    ServiceDate = pd.ServiceDate,
                    PurchaseItemId = pd.PurchaseItemId,
                    PurchaseId = pd.PurchaseId,
                    PurchaseItemRate = pd.PurchaseItemRate,
                    PurchaseQuantity = pd.PurchaseQuantity,
                    PurchaseVatPercentage = pd.PurchaseVatPercentage,
                    PurchaseItemName = p.ProductName,
                    PurchaseTotal = pd.PurchaseTotal,
                    PurchaseOrderID = (int)pd.PurchaseId,
                    PurchaseDescription = pd.PurchaseDescription,
                    RowSubTotal = pd.RowSubTotal,
                    PurchaseOrderDetailsId = (int)pd.PurchaseOrderDetailsId
                }).ToList();


                if (query == null)
                {
                    return(NotFound());
                }
                return(Ok(query));
            }
        }
 static bool AlwaysCopy(HeaderValue <string> headerValue)
 {
     return(true);
 }
Beispiel #30
0
 static HeaderValue <Header> CreateHeaderValue(HeaderValue <string> stringValue)
 {
     return(new HeaderValue <Header>(stringValue.Key, new Header(stringValue.Key, Encoding.UTF8.GetBytes(stringValue.Value))));
 }
Beispiel #31
0
 static void AssertCsvValue(CombinedHttpHeaders headers, HeaderValue headerValue)
 {
     Assert.True(ContentEquals((StringCharSequence)headerValue.ToString(), headers.Get(HeaderName, null)));
     Assert.True(ContentEquals((StringCharSequence)headerValue.ToString(), headers.GetAll(HeaderName)[0]));
 }
Beispiel #32
0
    //-----------------------------------------------------------------

    public override void CleanUp()
    {
        _gridRenderer = null;
        _treeHit      = null;
        _progress     = null;
    }