dotnetanywhere-wb /corlib/System.Globalization/NumberFormatInfo.cs

Language C# Lines 184
MD5 Hash fc4fc6df2b3abfc321d71c7b4430fc15 Estimated Cost $4,048 (why?)
Repository https://bitbucket.org/cosi2/dotnetanywhere-wb.git View Raw File
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#if !LOCALTEST

using System.Threading;
using System.IO;
namespace System.Globalization {
	public class NumberFormatInfo : IFormatProvider {

		#region Static Methods/Properties

		private static string[] defaultNativeDigits = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };

		public static NumberFormatInfo CurrentInfo {
			get {
				NumberFormatInfo nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
				return nfi;
			}
		}

		public static NumberFormatInfo InvariantInfo {
			get {
				NumberFormatInfo nfi = new NumberFormatInfo();
				nfi.isReadOnly = true;
				return nfi;
			}
		}

		public static NumberFormatInfo GetInstance(IFormatProvider provider) {
			if (provider != null) {
				NumberFormatInfo nfi;
				nfi = (NumberFormatInfo)provider.GetFormat(typeof(NumberFormatInfo));
				if (nfi != null) {
					return nfi;
				}
			}

			return CurrentInfo;
		}

		#endregion

		private bool isReadOnly;
		private int currencyDecimalDigits;
		private string currencyDecimalSeparator;
		private string currencyGroupSeparator;
		private int[] currencyGroupSizes;
		private int currencyNegativePattern;
		private int currencyPositivePattern;
		private string currencySymbol;
		private DigitShapes digitSubstitution;
		private string naNSymbol;
		private string[] nativeDigits;
		private string negativeInfinitySymbol;
		private string negativeSign;
		private int numberDecimalDigits;
		private string numberDecimalSeparator;
		private string numberGroupSeparator;
		private int[] numberGroupSizes;
		private int numberNegativePattern;
		private int percentDecimalDigits;
		private string percentDecimalSeparator;
		private string percentGroupSeparator;
		private int[] percentGroupSizes;
		private int percentNegativePattern;
		private int percentPositivePattern;
		private string percentSymbol;
		private string perMilleSymbol;
		private string positiveInfinitySymbol;
		private string positiveSign;

		private static int[] ConvertToIntArray(string s) {
			string[] list = s.Split(',');
			int listLen = list.Length;
			int[] ret = new int[listLen];
			for (int i = 0; i < listLen; i++) {
				ret[i] = int.Parse(list[i]);
			}
			return ret;
		}

		internal NumberFormatInfo(StreamReader s) {
			this.isReadOnly = true;
			// Sets up information from stream
			this.currencyDecimalDigits = int.Parse(s.ReadLine());
			this.currencyDecimalSeparator = s.ReadLine();
			this.currencyGroupSeparator = s.ReadLine();
			this.currencyGroupSizes = ConvertToIntArray(s.ReadLine());
			this.currencyNegativePattern = int.Parse(s.ReadLine());
			this.currencyPositivePattern = int.Parse(s.ReadLine());
			this.currencySymbol = s.ReadLine();
			this.digitSubstitution = (DigitShapes)int.Parse(s.ReadLine());
			this.naNSymbol = s.ReadLine();
			this.nativeDigits = s.ReadLine().Split(',');
			this.negativeInfinitySymbol = s.ReadLine();
			this.negativeSign = s.ReadLine();
			this.numberDecimalDigits = int.Parse(s.ReadLine());
			this.numberDecimalSeparator = s.ReadLine();
			this.numberGroupSeparator = s.ReadLine();
			this.numberGroupSizes = ConvertToIntArray(s.ReadLine());
			this.numberNegativePattern = int.Parse(s.ReadLine());
			this.percentDecimalDigits = int.Parse(s.ReadLine());
			this.percentDecimalSeparator = s.ReadLine();
			this.percentGroupSeparator = s.ReadLine();
			this.percentGroupSizes = ConvertToIntArray(s.ReadLine());
			this.percentNegativePattern = int.Parse(s.ReadLine());
			this.percentPositivePattern = int.Parse(s.ReadLine());
			this.percentSymbol = s.ReadLine();
			this.perMilleSymbol = s.ReadLine();
			this.positiveInfinitySymbol = s.ReadLine();
			this.positiveSign = s.ReadLine();
		}

		public NumberFormatInfo() {
			this.isReadOnly = true;
			// Set up defaults for invariant culture
			this.currencyDecimalDigits = 2;
			this.currencyDecimalSeparator = ".";
			this.currencyGroupSeparator = ",";
			this.currencyGroupSizes = new int[] { 3 };
			this.currencyNegativePattern = 0;
			this.currencyPositivePattern = 0;
			this.currencySymbol = "$";
			this.digitSubstitution = DigitShapes.None;
			this.naNSymbol = "NaN";
			this.nativeDigits = defaultNativeDigits;
			this.negativeInfinitySymbol = "-Infinity";
			this.negativeSign = "-";
			this.numberDecimalDigits = 2;
			this.numberDecimalSeparator = ".";
			this.numberGroupSeparator = ",";
			this.numberGroupSizes = new int[] { 3 };
			this.numberNegativePattern = 1;
			this.percentDecimalDigits = 2;
			this.percentDecimalSeparator = ".";
			this.percentGroupSeparator = ",";
			this.percentGroupSizes = new int[] { 3 };
			this.percentNegativePattern = 0;
			this.percentPositivePattern = 0;
			this.percentSymbol = "%";
			this.perMilleSymbol = "\x2030";
			this.positiveInfinitySymbol = "Infinity";
			this.positiveSign = "+";
		}

		public bool IsReadOnly { get { return this.isReadOnly; } }
		public int CurrencyDecimalDigits { get { return this.currencyDecimalDigits; } }
		public string CurrencyDecimalSeparator { get { return this.currencyDecimalSeparator; } }
		public string CurrencyGroupSeparator { get { return this.currencyGroupSeparator; } }
		public int[] CurrencyGroupSizes { get { return this.currencyGroupSizes; } }
		public int CurrencyNegativePattern { get { return this.currencyNegativePattern; } }
		public int CurrencyPositivePattern { get { return this.currencyPositivePattern; } }
		public string CurrencySymbol { get { return this.currencySymbol; } }
		public DigitShapes DigitSubstitution { get { return this.digitSubstitution; } }
		public string NaNSymbol { get { return this.naNSymbol; } }
		public string[] NativeDigits { get { return this.nativeDigits; } }
		public string NegativeInfinitySymbol { get { return this.negativeInfinitySymbol; } }
		public string NegativeSign { get { return this.negativeSign; } }
		public int NumberDecimalDigits { get { return this.numberDecimalDigits; } }
		public string NumberDecimalSeparator { get { return this.numberDecimalSeparator; } }
		public string NumberGroupSeparator { get { return this.numberGroupSeparator; } }
		public int[] NumberGroupSizes { get { return this.numberGroupSizes; } }
		public int NumberNegativePattern { get { return this.numberNegativePattern; } }
		public int PercentDecimalDigits { get { return this.percentDecimalDigits; } }
		public string PercentDecimalSeparator { get { return this.percentDecimalSeparator; } }
		public string PercentGroupSeparator { get { return this.percentGroupSeparator; } }
		public int[] PercentGroupSizes { get { return this.percentGroupSizes; } }
		public int PercentNegativePattern { get { return this.percentNegativePattern; } }
		public int PercentPositivePattern { get { return this.percentPositivePattern; } }
		public string PercentSymbol { get { return this.percentSymbol; } }
		public string PerMilleSymbol { get { return this.perMilleSymbol; } }
		public string PositiveInfinitySymbol { get { return this.positiveInfinitySymbol; } }
		public string PositiveSign { get { return this.positiveSign; } }

		#region IFormatProvider Members

		public object GetFormat(Type formatType) {
			throw new Exception("The method or operation is not implemented.");
		}

		#endregion
	}
}

#endif
Back to Top