System.NumberFormatter.CustomInfo.GetActiveSection C# (CSharp) Method

GetActiveSection() public static method

public static GetActiveSection ( string format, bool &positive, bool zero, int &offset, int &length ) : void
format string
positive bool
zero bool
offset int
length int
return void
			public static void GetActiveSection (string format, ref bool positive, bool zero, ref int offset, ref int length)
			{
				int[] lens = new int [3];
				int index = 0;
				int lastPos = 0;
				char literal = '\0';
				for (int i = 0; i < format.Length; i++) {
					char c = format [i];

					if (c == literal || (literal == '\0' && (c == '\"' || c == '\''))) {
						if (literal == '\0')
							literal = c;
						else
							literal = '\0';
						continue;
					}

					if (literal == '\0' && format [i] == ';' && (i == 0 || format [i - 1] != '\\')) {
						lens [index++] = i - lastPos;
						lastPos = i + 1;
						if (index == 3)
							break;
					}
				}

				if (index == 0) {
					offset = 0;
					length = format.Length;
					return;
				}
				if (index == 1) {
					if (positive || zero) {
						offset = 0;
						length = lens [0];
						return;
					}
					if (lens [0] + 1 < format.Length) {
						positive = true;
						offset = lens [0] + 1;
						length = format.Length - offset;
						return;
					}
					else {
						offset = 0;
						length = lens [0];
						return;
					}
				}
				if (index == 2) {
					if (zero) {
						offset = lens [0] + lens [1] + 2;
						length = format.Length - offset;
						return;
					}
					if (positive) {
						offset = 0;
						length = lens [0];
						return;
					}
					if (lens [1] > 0) {
						positive = true;
						offset = lens [0] + 1;
						length = lens [1];
						return;
					}
					else {
						offset = 0;
						length = lens [0];
						return;
					}
				}
				if (index == 3) {
					if (zero) {
						offset = lens [0] + lens [1] + 2;
						length = lens [2];
						return;
					}
					if (positive) {
						offset = 0;
						length = lens [0];
						return;
					}
					if (lens [1] > 0) {
						positive = true;
						offset = lens [0] + 1;
						length = lens [1];
						return;
					}
					else {
						offset = 0;
						length = lens [0];
						return;
					}
				}

				throw new ArgumentException ();
			}
NumberFormatter.CustomInfo