<commit_before>﻿using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;

namespace Binance.Api
{
    public sealed class BinanceHttpRequest
    {
        #region Public Properties

        /// <summary>
        /// Get or set the API key.
        /// </summary>
        public string ApiKey { get; set; }

        /// <summary>
        /// Get or set the message body.
        /// </summary>
        public string Body { get; set; }

        /// <summary>
        /// Get the URI.
        /// </summary>
        public string Uri
        {
            get
            {
                if (_parameters.Count == 0)
                    return _path;

                return $"{_path}?{QueryString}";
            }
        }

        /// <summary>
        /// Get the request query string.
        /// </summary>
        public string QueryString
        {
            get
            {
                if (_queryString != null)
                    return _queryString;

                return _queryString = BuildQueryString();
            }
        }

        /// <summary>
        /// Get the rate limit weight.
        /// </summary>
        public int RateLimitWeight { get; private set; }

        #endregion Public Properties

        #region Private Constants

        private const string RequestHeaderKeyName = "<KEY>";

        #endregion Private Constants

        #region Private Fields

        private readonly IDictionary<string, string> _parameters
            = new Dictionary<string, string>();

        private string _queryString;

        private string _path;

        #endregion Private Fields

        #region Constructors

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="rateLimitWeight"></param>
        public BinanceHttpRequest(string path, int rateLimitWeight = 1)
        {
            Throw.IfNullOrWhiteSpace(path, nameof(path));

            _path = path;

            RateLimitWeight = rateLimitWeight;
        }

        #endregion Constructors

        #region Public Methods

        public void AddParameter<T>(string field, T value)
        {
            Throw.IfNull(value, nameof(value));

            _parameters[field] = value.ToString();

            _queryString = null;
        }
<commit_msg>Fix culture dependent decimal to string conversion<commit_after>﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net.Http;
using System.Text;

namespace Binance.Api
{
    public sealed class BinanceHttpRequest
    {
        #region Public Properties

        /// <summary>
        /// Get or set the API key.
        /// </summary>
        public string ApiKey { get; set; }

        /// <summary>
        /// Get or set the message body.
        /// </summary>
        public string Body { get; set; }

        /// <summary>
        /// Get the URI.
        /// </summary>
        public string Uri
        {
            get
            {
                if (_parameters.Count == 0)
                    return _path;

                return $"{_path}?{QueryString}";
            }
        }

        /// <summary>
        /// Get the request query string.
        /// </summary>
        public string QueryString
        {
            get
            {
                if (_queryString != null)
                    return _queryString;

                return _queryString = BuildQueryString();
            }
        }

        /// <summary>
        /// Get the rate limit weight.
        /// </summary>
        public int RateLimitWeight { get; private set; }

        #endregion Public Properties

        #region Private Constants

        private const string RequestHeaderKeyName = "<KEY>";

        #endregion Private Constants

        #region Private Fields

        private readonly IDictionary<string, string> _parameters
            = new Dictionary<string, string>();

        private string _queryString;

        private string _path;

        #endregion Private Fields

        #region Constructors

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="rateLimitWeight"></param>
        public BinanceHttpRequest(string path, int rateLimitWeight = 1)
        {
            Throw.IfNullOrWhiteSpace(path, nameof(path));

            _path = path;

            RateLimitWeight = rateLimitWeight;
        }

        #endregion Constructors

        #region Public Methods

        public void AddParameter<T>(string field, T value)
        {
            Throw.IfNull(value, nameof(value));

            _parameters[field] = Convert.ToString(value, CultureInfo.InvariantCulture);

            _queryString = null;
        }

{'fraction_non_alphanumeric': 0.10008305647840532, 'fraction_numerical': 0.0008305647840531562, 'mean_word_length': 1.4551478083588176, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2961956', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1148, 'n_words': 335}