/// <summary> /// Create a RegionGUID instance. /// </summary> /// <param name="GUID">GUID.</param> public RegionGUID(String GUID) : base(GUID) { Int32 categoryId; String categoryIdString; // Check arguments. if (ObjectID.Length < (Settings.Default.RegionCategoryId_LSID.Length + Settings.Default.RegionNativeId_LSID.Length + 2)) { throw new ArgumentException("Wrong format in region GUID : " + GUID); } if (ObjectID.Substring(0, Settings.Default.RegionCategoryId_LSID.Length).ToUpper() != Settings.Default.RegionCategoryId_LSID.ToUpper()) { throw new ArgumentException("Wrong format in region GUID : " + GUID); } categoryIdString = GetRegionCategoryId(); if (categoryIdString.IsEmpty() || !Int32.TryParse(categoryIdString, out categoryId)) { throw new ArgumentException("Wrong format in region GUID : " + GUID); } if (NativeId.IsEmpty()) { throw new ArgumentException("Wrong format in region GUID : " + GUID); } }
/// <summary> /// Get region category id as string. /// </summary> /// <returns>Region category id as string.</returns> private String GetRegionCategoryId() { return(ObjectID.Substring(Settings.Default.RegionCategoryId_LSID.Length, ObjectID.IndexOf(Settings.Default.RegionNativeId_LSID) - Settings.Default.RegionCategoryId_LSID.Length)); }