private ItemSizeAttribute GetItemSizeAttribute(OtpItem item) { var type = item.GetType(); var name = Enum.GetName(type, item); return(type.GetField(name).GetCustomAttribute <ItemSizeAttribute>()); }
public static async Task Update_Item(OtpItem item) { var databasePath = Path.Combine(ApplicationData.Current.RoamingFolder.Path, "Otp.db"); var db = new SQLiteAsyncConnection(databasePath); await db.UpdateAsync(item); await db.CloseAsync(); }
public byte[] GetOtpItem(OtpItem item) { var itemLength = GetItemSizeAttribute(item); lock (memoryLock) { return(underlyingMemory.ReadBytes((uint)item, itemLength.ByteLength)); } }
private bool TryGetOtpPartitionAndItem(uint readAddress, out OtpItem item, out OtpPartition partition, out int itemOffset, out int partitionOffset) { itemOffset = 0; partitionOffset = 0; item = default(OtpItem); partition = default(OtpPartition); return(Misc.TryFindPreceedingEnumItem(readAddress, out item, out itemOffset) && Misc.TryFindPreceedingEnumItem(readAddress, out partition, out partitionOffset)); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is int) { id = (int)e.Parameter; otp = await SqlAccess.Get_Item(id); init_data(); } base.OnNavigatedTo(e); }
public async static Task Add_Item(int type, string issuer, string name, string secret, int algorithm, int digits, int period, int logoType, string logo) { var databasePath = Path.Combine(ApplicationData.Current.RoamingFolder.Path, "Otp.db"); var db = new SQLiteAsyncConnection(databasePath); var item = new OtpItem() { Type = type, Issuer = issuer, Name = name, Secret = secret, Algorithm = algorithm, Digits = digits, Period = period, LogoType = logoType, Logo = logo, Group = 0, Priority = 0 }; await db.InsertAsync(item); await db.CloseAsync(); }
public OtpItem SendOPT(string Mobile, string username, int type) { string temp = GenerateOTP(); string smsTemp = "Ma+OTP+cua+ban+la: "; switch (type) { case 7: // login dai ly smsTemp = "Ma+OTP+dang+nhap+cua+ban+la:"; break; case 8: // ruts ket dai ly smsTemp = "Ma+OTP+gui+ket+cua+ban+la:"; break; case 9: //chuyen tien dai ly smsTemp = "Ma+OTP+chuyen+tien++cua+ban+la:"; break; case 10: // ruts ket dai ly smsTemp = "Ma+OTP+rut+ket+cua+ban+la:"; break; case 11: // ruts ket dai ly smsTemp = "Ma+OTP+doi+mat+khau+cua+ban+la:"; break; default: break; } var objotp = new OtpItem(); objotp.Type = type; objotp.username = username; objotp.Otp_Plus = temp; objotp.smsTemp = smsTemp; return(objotp); }