private static int GetPercentageProgress(long startTimestamp, int buildDuration) { var now = DateTime.Now.Ticks; var start = new JavaTimeStamp(startTimestamp).Ticks; var estimatedEnd = new JavaTimeStamp(startTimestamp + buildDuration).Ticks; var duration = estimatedEnd - start; var completed = now - start; return(Convert.ToInt32(Math.Round(Math.Ceiling((completed / duration) * 100)))); }
public static string CheckRegitry() { var partwwwroot = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); /*Create Path */ string KeyOne = "ZaniimzOxide"; string FILE_NAME = "KeyOne.DAT"; string pathImage = @"\OEM\Key\"; string pathSave = $"wwwroot{pathImage}"; var param1 = Encryption.Encrypt(getUniqueID("C"), KeyOne); var param2 = Encryption.Encrypt(GetMachineGuid(), KeyOne); var dir = Encryption.Encrypt(partwwwroot + pathImage, KeyOne); //string location = @"SOFTWARE\Foglight\"; //RegistryKey key = Registry.CurrentUser.CreateSubKey(location); ///key.SetValue("param1", param1); //key.SetValue("param2", param2); //key.SetValue("dir", dir); if (!Directory.Exists(pathSave)) { Directory.CreateDirectory(pathSave); } /**/ List <string> datalists = new List <string>(); try { using (FileStream fs = new FileStream(pathSave + FILE_NAME, FileMode.Open, FileAccess.Read)) { using (BinaryReader r = new BinaryReader(fs)) { for (int i = 0; i < 8; i++) { datalists.Add(r.ReadString()); } } } if (Encryption.Decrypt(datalists[0], KeyOne) == getUniqueID("C")) { } else { return("Please Regiter License"); } if (Encryption.Decrypt(datalists[1], KeyOne) == GetMachineGuid()) { } else { return("Please Regiter License"); } var a = JavaTimeStamp.JavaTimeStampToDateTime(Convert.ToDouble(Encryption.Decrypt(datalists[3], KeyOne))); if (DateTime.Now > JavaTimeStamp.JavaTimeStampToDateTime(Convert.ToDouble(Encryption.Decrypt(datalists[3], KeyOne)))) { return("License Expired"); } else { } } catch { return("Please Regiter License"); } return("true"); }