//private static char ToHex(int b) //{ // return (char)((b >= 10) ? (97 + b - 10) : (48 + b)); //} #if false public static bool TryParse(string input, out JSImplGuid result) { if (input == null) { throw new ArgumentNullException("input"); } JSImplGuid.GuidParser guidParser = new JSImplGuid.GuidParser(input); return(guidParser.Parse(out result)); }
public static bool TryParseExact(string input, string format, out JSImplGuid result) { if (input == null) { throw new ArgumentNullException("input"); } if (format == null) { throw new ArgumentNullException("format"); } JSImplGuid.GuidParser guidParser = new JSImplGuid.GuidParser(input); return(guidParser.Parse(JSImplGuid.ParseFormat(format), out result)); }
//public static JSImplGuid NewGuid() //{ // JSImplGuid guid = new JSImplGuid(); // char[] s = new char[36]; // string hexDigits = "0123456789abcdef"; // for (var i = 0; i < 36; i++) // { // //int k = (int) Math.Floor(_random.Next(16)); // int k = _random.Next(16); // s[i] = hexDigits[k]; // } // s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010 // s[19] = hexDigits[((s[19] & 0x3) | 0x8)]; // bits 6-7 of the clock_seq_hi_and_reserved to 01 // s[8] = s[13] = s[18] = s[23] = '-'; // string uuid = new string(s); // return uuid; //} #if false public JSImplGuid(string g) { JSImplGuid.CheckNull(g); g = g.Trim(); JSImplGuid.GuidParser guidParser = new JSImplGuid.GuidParser(g); JSImplGuid guid; if (!guidParser.Parse(out guid)) { throw JSImplGuid.CreateFormatException(g); } @ @tb the following line produces invalid js code(FireFox is reports it while loading the jsclr.js file) this = guid; }