/// <summary> /// Ben ndryshimin e vleres se ruajtur ne rregjistra duke deshifruar vleren e deritanishme /// te ruajtur ne rregjistra. Versioni kthehet ne DEMO nese numri i dhomave eshte me i madh /// se sa ai i dhene me perpara, pavaresisht nese ka qene version i plote apo jo /// </summary> /// <param name="numerFillestarDhomash"></param> /// <param name="numerDhomash"></param> public static void EditRegistryKey(int numerFillestarDhomash, int numerDhomash) { string key1 = ""; string keyValue = GetKeyValue(path, name); string[] splitKey = keyValue.Split(new char[] { '-' }); int roomsCount = (numerDhomash + 4) * 3; if (splitKey.Length >= 2) { splitKey.SetValue(roomsCount.ToString(), splitKey.Length - 1); for (int i = 0; i < splitKey.Length - 1; i++) { key1 += splitKey.GetValue(i).ToString(); } key1 += "-" + splitKey.GetValue(splitKey.Length - 1).ToString(); key1 = RegistrationClass.EncryptKeyDemo(numerDhomash); StoreKeyValue(path, name, key1); StoreKeyValue("Vlera2", numerDhomash.ToString().Length.ToString()); } else { key1 = RegistrationClass.EncryptKeyDemo(numerDhomash); StoreKeyValue(path, name, key1); StoreKeyValue("Vlera2", numerDhomash.ToString().Length.ToString()); } }
/// <summary> /// Lexon numrin serial nga rregjistrat dhe nga ky numer, ne baze te algoritmit, /// nxjerr numrin e dhomave /// </summary> /// <returns></returns> public static int GetRoomsCount() { try { string keyValue = GetKeyValue(path, name); string[] splitKey = keyValue.Split(new char[] { '-' }); if (splitKey.Length >= 2) { int roomNumber = Convert.ToInt32(splitKey.GetValue(splitKey.Length - 1)); roomNumber = (roomNumber / 3) - 4; return(roomNumber); } // Nese versioni nuk eshte demo, atehere do te thote qe eshte full keshtu qe bejme // deshifrimin per vleren e gjetur return(Convert.ToInt32(RegistrationClass.DecryptRoomsCountFull())); } catch { return(0); } }