<commit_before>﻿using System;

namespace Sqlcollaborative.Dbatools.Utility
{
    /// <summary>
    /// Class that reports File size.
    /// </summary>
    [Serializable]
    public class Size : IComparable<Size>, IComparable
    {
        /// <summary>
        /// Number of bytes contained in whatever object uses this object as a property
        /// </summary>
        public long Byte { get; set; }

        /// <summary>
        /// Kilobyte representation of the bytes
        /// </summary>
        public double Kilobyte
        {
            get
            {
                return (Byte / (double)1024);
            }
        }

        /// <summary>
        /// Megabyte representation of the bytes
        /// </summary>
        public double Megabyte
        {
            get
            {
                return (Byte / (double)1048576);
            }
        }

        /// <summary>
        /// Gigabyte representation of the bytes
        /// </summary>
        public double Gigabyte
        {
            get
            {
                return (Byte / (double)1073741824);
            }
        }

        /// <summary>
        /// Terabyte representation of the bytes
        /// </summary>
        public double Terabyte
        {
            get
            {
                return (Byte / (double)1099511627776);
            }
        }

        /// <summary>
        /// Number if digits behind the dot.
        /// </summary>
        public int Digits
        {
            get
            {
                return _digits;
            }
            set {
                _digits = value < 0 ? 0 : value;
            }
        }
        private int _digits = 2;

        /// <summary>
        /// Shows the default string representation of size
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string format = "{0:N" + Digits + "} {1}";

            if (Terabyte > 1)
            {
                return (String.Format(format, Terabyte, "TB"));
            }
            if (Gigabyte > 1)
            {
                return (String.Format(format, Gigabyte, "GB"));
            }
            if (Megabyte > 1)
            {
                return (String.Format(format, Megabyte, "MB"));
            }
            if (Kilobyte > 1)
            {
                return (String.Format(format, Kilobyte, "KB"));
            }
            if (Byte > -1)
            {
                return (String.Format("{0} {1}", Byte, "B"));
            }
            if (Byte == -1)
                return "Unlimited";
            throw new ArgumentOutOfRangeException("Byte", string.Format("Invalid value of {0} for Byte", Byte));
        }

        /// <summary>
        /// Simple equality test
        /// </summary>
        /// <param name="obj">The object to test it against</param>
        /// <returns>True if equal, false elsewise</returns>
        public override bool Equals(object obj)
        {<commit_msg>reverted size<commit_after>﻿using System;

namespace Sqlcollaborative.Dbatools.Utility
{
    /// <summary>
    /// Class that reports File size.
    /// </summary>
    [Serializable]
    public class Size : IComparable<Size>, IComparable
    {
        /// <summary>
        /// Number of bytes contained in whatever object uses this object as a property
        /// </summary>
        public long Byte { get; set; }

        /// <summary>
        /// Kilobyte representation of the bytes
        /// </summary>
        public double Kilobyte
        {
            get
            {
                return (Byte / (double)1024);
            }
        }

        /// <summary>
        /// Megabyte representation of the bytes
        /// </summary>
        public double Megabyte
        {
            get
            {
                return (Byte / (double)1048576);
            }
        }

        /// <summary>
        /// Gigabyte representation of the bytes
        /// </summary>
        public double Gigabyte
        {
            get
            {
                return (Byte / (double)1073741824);
            }
        }

        /// <summary>
        /// Terabyte representation of the bytes
        /// </summary>
        public double Terabyte
        {
            get
            {
                return (Byte / (double)1099511627776);
            }
        }

        /// <summary>
        /// Number if digits behind the dot.
        /// </summary>
        public int Digits
        {
            get
            {
                return _digits;
            }
            set {
                _digits = value < 0 ? 0 : value;
            }
        }
        private int _digits = 2;

        /// <summary>
        /// Shows the default string representation of size
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string format = "{0:N" + Digits + "} {1}";

            if (Terabyte > 1)
            {
                return (String.Format(format, Terabyte, "TB"));
            }
            if (Gigabyte > 1)
            {
                return (String.Format(format, Gigabyte, "GB"));
            }
            if (Megabyte > 1)
            {
                return (String.Format(format, Megabyte, "MB"));
            }
            if (Kilobyte > 1)
            {
                return (String.Format(format, Kilobyte, "KB"));
            }
            if (Byte > -1)
            {
                return (String.Format("{0} {1}", Byte, "B"));
            }
            if (Byte == -1)
                return "Unlimited";
            return "";
        }

        /// <summary>
        /// Simple equality test
        /// </summary>
        /// <param name="obj">The object to test it against</param>
        /// <returns>True if equal, false elsewise</returns>
        public override bool Equals(object obj)
        {
{'fraction_non_alphanumeric': 0.11727978400269996, 'fraction_numerical': 0.01603104961187985, 'mean_word_length': 1.0459095616154643, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 63, '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': '3740098', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1509, 'n_words': 410}