/// <summary> /// Decodes meta information of authentication data according to Aadhaar API specification. /// </summary> public void Decode() { ValidateEmptyString(InfoValue, nameof(InfoValue)); /* * <Version> * [00]: SHA-256 of Aadhaar Number [01]: SHA-256 of Demo element [02]: Encoded Usage Data * [03]: pid_version [04]: timestamp [05]: fmrcount * [06]: fircount [07]: iircount [08]: auth_api_ver * [09]: SHA-256 of ASA code [10]: SHA-256 of AUA code [11]: SUB AUA code * [12]: lot [13]: lov [14]: lang * [15]: pi-ms [16]: pi-mv [17]: pi-lmv * [18]: pa-ms [19]: pa-mv [20]: pa-lmv * [21]: pfa-ms [22]: pfa-mv [23]: pfa-lmv * [24]: SHA-256 of tid */ var start = InfoValue.IndexOf('{'); var end = InfoValue.LastIndexOf('}'); if (start != -1 && end != -1) { var infoArray = InfoValue.Substring(start + 1, end - (start + 1)).Split(','); AadhaarNumberHash = infoArray[0]; DemographicHash = infoArray[1]; UsageData = infoArray[2]; Timestamp = DateTimeOffset.ParseExact(infoArray[4], TimestampFormat, CultureInfo.InvariantCulture); AuaCodeHash = infoArray[10]; SubAuaCode = infoArray[11]; TerminalHash = infoArray[24]; } }
/// <summary> /// Decodes meta information of authentication data according to Aadhaar API specification. /// </summary> /// <returns>The current instance of <see cref="OtpInfo"/>.</returns> /// <exception cref="ArgumentException"><see cref="InfoValue"/> is empty.</exception> public OtpInfo Decode() { ValidateEmptyString(InfoValue, nameof(InfoValue)); /* * <Version> * [00]: SHA-256 of Aadhaar Number [01]: request-type [02]: timestamp * [03]: OTP_api_ver [04]: SHA-256 of ASA code [05]: SHA-256 of AUA code * [06]: Sub-AUA code [07]: masked-mobile [08]: masked-email */ var start = InfoValue.IndexOf('{'); var end = InfoValue.LastIndexOf('}'); if (start != -1 && end != -1) { var infoArray = InfoValue.Substring(start + 1, end - (start + 1)).Split(','); AadhaarNumberHash = infoArray[0]; RequestType = (OtpRequestType)infoArray[1][0]; // Timestamp = DateTimeOffset.ParseExact(infoArray[2], TimestampFormat, CultureInfo.InvariantCulture); AuaCodeHash = infoArray[5]; SubAuaCodeHash = infoArray[6]; } return(this); }
/// <summary> /// Decodes meta information of authentication data according to Aadhaar API specification. /// </summary> public void Decode() { ValidateEmptyString(InfoValue, nameof(InfoValue)); /* * <Version> * [00]: SHA-256 of Aadhaar Number [01]: timestamp [02]: OTP_api_ver, * [03]: SHA-256 of ASA code [04]: SHA-256 of AUA code [05]: Sub-AUA code, * [06]: masked-mobile [07]: masked-email */ var start = InfoValue.IndexOf('{'); var end = InfoValue.LastIndexOf('}'); if (start != -1 && end != -1) { var infoArray = InfoValue.Substring(start + 1, end - (start + 1)).Split(','); AadhaarNumberHash = infoArray[0]; Timestamp = DateTimeOffset.ParseExact(infoArray[1], TimestampFormat, CultureInfo.InvariantCulture); AuaCodeHash = infoArray[4]; SubAuaCode = infoArray[5]; MaskedMobile = infoArray[6]; MaskedEmail = infoArray[7]; } }
public override bool Equals(object _obj) { if (_obj is InfoValue) { InfoValue infoValue = (InfoValue)_obj; return(this.obj == infoValue.obj && this.name == infoValue.name); } return(false); }
public static void RemoveWatch(object obj, string fieldName) { for (int i = 0; i < Cheat.infos.Count; i++) { InfoValue infoValue = Cheat.infos[i] as InfoValue; if (infoValue.obj == obj && infoValue.name == fieldName) { Cheat.infos.RemoveAt(i); return; } } }
private void ShowInfoList(int id) { GUI.color = Color.white; for (int i = 0; i < Cheat.infos.Count; i++) { InfoValue infoValue = Cheat.infos[i] as InfoValue; if (infoValue != null) { GUILayout.Label(infoValue.showName + ": " + infoValue.Get().ToString(), new GUILayoutOption[0]); } } GUI.DragWindow(); }
public static void AddWatch(object obj, string fieldName, string showName = null) { InfoValue infoValue = new InfoValue(obj, fieldName); if (showName != null) { infoValue.showName = showName; } if (Cheat.infos.Contains(infoValue)) { return; } Cheat.infos.Add(infoValue); }
public override void VisitInfoValue(InfoValue value) { locations.Add(new InfoValueLocation(containingIndex, value)); }
/// <summary> /// Initializes a new instance of the <see cref="InfoValueLocation"/> class. /// </summary> /// <param name="containingIndex">Index of the containing.</param> /// <param name="value">The value.</param> public InfoValueLocation(MemoryIndex containingIndex, InfoValue value) { this.ContainingIndex = containingIndex; this.values = new Value[] { value }; Value = value; }
public override void VisitInfoValue(InfoValue value) { this.AddLocation(new InfoValueLocation(null, value)); }
public async Task UpdateAsync(IProgress <string> progress = null) { if (File.Exists(FideZipPath)) { File.Delete(FideZipPath); } if (File.Exists(RcfFilePath)) { File.Delete(RcfFilePath); } if (File.Exists(FideFilePath)) { File.Delete(FideFilePath); } using (var client = new WebClient()) { progress?.Report(FideZip); await client.DownloadFileTaskAsync(new Uri(Settings.Current.FideUrl), FideZipPath) .ConfigureAwait(false); progress?.Report(FideZipComplete); progress?.Report(RcfXsl); await client.DownloadFileTaskAsync(new Uri(Settings.Current.RcfUrl), RcfFilePath) .ConfigureAwait(false); progress?.Report(RcfXslComplete); } progress?.Report(FideUnzip); ZipFile.ExtractToDirectory(FideZipPath, TmpPath); progress?.Report(FideProcess); /* * <fideid>419214</fideid> * <name></name> * <country>ENG</country> * <sex>M</sex> * <title></title> * <w_title></w_title> * <o_title></o_title> * <foa_title></foa_title> * <rating>1736</rating> * <games>0</games> * <k>20</k> * <rapid_rating>1587</rapid_rating> * <rapid_games>10</rapid_games> * <rapid_k>20</rapid_k> * <blitz_rating></blitz_rating> * <blitz_games></blitz_games> * <blitz_k></blitz_k> * <birthday></birthday> * <flag></flag> */ await Task.Run(() => ProcessFide()).ConfigureAwait(false); progress?.Report(CompleteMsg); progress?.Report(RcfProcess); await Task.Run(() => ProcessRcf()).ConfigureAwait(false); progress?.Report(Chk); CheckProfiles(); using (var db = new Ri2Context()) { var t = db.Info.FirstOrDefault(x => x.Name == InfoKeys.LastUpdate); if (t == null) { t = new InfoValue { Name = InfoKeys.LastUpdate, Value = DateTime.Now.ToShortDateString() }; db.Info.Add(t); } else { t.Value = DateTime.Now.ToShortDateString(); } await db.SaveChangesAsync().ConfigureAwait(false); } progress?.Report(CompleteMsg); }