System.Windows.Deployment.CompareRuntimeVersions C# (CSharp) Method

CompareRuntimeVersions() private method

private CompareRuntimeVersions ( ) : void
return void
		void CompareRuntimeVersions ()
		{
			int[] versions = new int[4];
			string[] version_strings = RuntimeVersion.Split ('.');

			for (int i = 0; i < version_strings.Length; i ++) {
				if (!Int32.TryParse (version_strings[i], out versions[i]))
					throw new MoonException (2105, "invalid RuntimeVersion");
			}

			if (versions[0] == 2) {
				/* SL2 accepts anything newer than 2.0.30524.0 */
				if (version_strings.Length > 1)
					if (versions[1] != 0)
						throw new MoonException (2106, "Failed to load the application. It was built with an obsolete version of Silverlight");

				if (version_strings.Length > 2)
					if (versions[2] <= 30524)
						throw new MoonException (2106, "Failed to load the application. It was built with an obsolete version of Silverlight");
			}
			else if (versions[0] == 3) {
				// we need to add validation stuff for SL3 rtm here
			}
			else if (versions[0] == 4) {
				// we don't actually validate any 4.0
				// runtime versions yet since there's
				// no telling what it'll be at RTM.
			}
			else {
				throw new MoonException (2105, "invalid RuntimeVersion");
			}
		}