public ImagePatternDigit LoadDigitEntry(XmlElement xmlElem) { ImagePatternDigit result = new ImagePatternDigit(-1, null); if (xmlElem != null && xmlElem.Name == "digit" && xmlElem.HasAttribute("type") && xmlElem.HasAttribute("value")) { string typeName = xmlElem.GetAttribute("type"); string hashValue = xmlElem.GetAttribute("value"); result = new ImagePatternDigit(int.Parse(typeName), ImageDataDigit.FromHexString(hashValue)); } return(result); }
public List <ImagePatternDigit> LoadDigitHashes(JsonParser.ArrayValue jsonArr) { List <ImagePatternDigit> list = new List <ImagePatternDigit>(); foreach (JsonParser.Value value in jsonArr.entries) { JsonParser.ObjectValue jsonOb = (JsonParser.ObjectValue)value; string hashValue = (JsonParser.StringValue)jsonOb["hash"]; ImagePatternDigit digitHash = new ImagePatternDigit((JsonParser.IntValue)jsonOb["id"], ImageDataDigit.FromHexString(hashValue)); list.Add(digitHash); } return(list); }