Ejemplo n.º 1
0
 internal static bool Compare_Central_Config_To_File(REG_KEY Key, string Local_Config_File_Path)
 {
     if (Web_Operation.VERIFY_Central_File_Config_Hash(READ_SWELF_Reg_Key(Key, false), Local_Config_File_Path))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
 internal static bool Compare_Values(REG_KEY Key, string File_Contents)
 {
     if (READ_SWELF_Reg_Key(Key, false).ToLower() == File_Contents.ToLower())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 internal static void DELETE_SWELF_Reg_Key(REG_KEY Key)
 {
     try
     {
         BASE_SWELF_KEY.DeleteValue(SWELF_Keys[(int)Key]);
     }
     catch (Exception e)
     {
         if (e.Message.Contains("No value exists with that name") == false)
         {
             Error_Operation.Log_Error("DELETE_SWELF_Reg_Key()", e.Message.ToString(), e.StackTrace.ToString(), Error_Operation.LogSeverity.Verbose);
         }
     }
 }
Ejemplo n.º 4
0
 internal static bool CHECK_SWELF_Reg_Key_Exists(REG_KEY Key)
 {
     try
     {
         if (Settings.REG_Keys.Count > 1)
         {
             if (Settings.REG_Keys.ContainsKey(SWELF_Keys[(int)Key].ToString()))
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (String.IsNullOrEmpty(BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key]).ToString()) == false)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Exception e)
     {
         if (Key != REG_KEY.logging_level)
         {
             Error_Operation.Log_Error("CHECK_SWELF_Reg_Key_Exists()", e.Message.ToString(), e.StackTrace.ToString(), Error_Operation.LogSeverity.Verbose);
             return(false);
         }
         else
         {
             BASE_SWELF_KEY.SetValue(SWELF_Keys[(int)REG_KEY.logging_level].ToString(), Crypto_Operation.Protect_Data_Value(Settings.Logging_Level_To_Report));
             return(true);
         }
     }
 }
Ejemplo n.º 5
0
 internal static string READ_SWELF_Reg_Key(REG_KEY Key, bool Log_Error = true)
 {
     try
     {
         if (Settings.REG_Keys.Count > 1)
         {
             if (Settings.REG_Keys.ContainsKey(SWELF_Keys[(int)Key].ToString()))
             {
                 return(Settings.REG_Keys[SWELF_Keys[(int)Key]].ToString());
             }
             else
             {
                 return("");
             }
         }
         else
         {
             if (CHECK_SWELF_Reg_Key_Exists(Key))
             {
                 if (Crypto_Operation.CHECK_Value_Encrypted(Crypto_Operation.ObjectToByteArray(BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key]))))
                 {
                     try
                     {
                         return(Crypto_Operation.UnProtect_Data_Value((byte[])BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key])));
                     }
                     catch (Exception e)
                     {
                         ADD_or_CHANGE_SWELF_Reg_Key(Key, SWELF_Keys[(int)Key]);
                         return(Crypto_Operation.UnProtect_Data_Value((byte[])BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key])));
                     }
                 }
                 else
                 {
                     ADD_or_CHANGE_SWELF_Reg_Key(Key, Crypto_Operation.CONVERT_To_String_From_Bytes(Crypto_Operation.Protect_Data_Value(SWELF_Keys[(int)Key].ToString()), 1));
                     return(Crypto_Operation.UnProtect_Data_Value((byte[])BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key])));
                 }
             }
             else
             {
                 return("");
             }
         }
     }
     catch
     {
         try
         {
             if (CHECK_SWELF_Reg_Key_Exists(Key))
             {
                 if (Crypto_Operation.CHECK_Value_Encrypted(Crypto_Operation.ObjectToByteArray(BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key]))))
                 {
                     try
                     {
                         return(Crypto_Operation.UnProtect_Data_Value((byte[])BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key])));
                     }
                     catch (Exception e)
                     {
                         ADD_or_CHANGE_SWELF_Reg_Key(Key, SWELF_Keys[(int)Key]);
                         return(Crypto_Operation.UnProtect_Data_Value((byte[])BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key])));
                     }
                 }
                 else
                 {
                     ADD_or_CHANGE_SWELF_Reg_Key(Key, Crypto_Operation.CONVERT_To_String_From_Bytes(Crypto_Operation.Protect_Data_Value(SWELF_Keys[(int)Key].ToString()), 1));
                     return(Crypto_Operation.UnProtect_Data_Value((byte[])BASE_SWELF_KEY.GetValue(SWELF_Keys[(int)Key])));
                 }
             }
             else
             {
                 if (Log_Error)
                 {
                     Error_Operation.Log_Error("CHANGE_Reg_Key()", "Reg Key does not exist. RegKey=" + Key, "", Error_Operation.LogSeverity.Warning);
                 }
                 return("");
             }
         }
         catch (Exception e)
         {
             if (Log_Error)
             {
                 Error_Operation.Log_Error("CHANGE_Reg_Key()", "Reg Key does not exist. RegKey=" + Key + ". " + e.Message.ToString(), e.StackTrace.ToString(), Error_Operation.LogSeverity.Warning);
             }
             return("");
         }
     }
 }
Ejemplo n.º 6
0
 internal static void ADD_or_CHANGE_SWELF_Reg_Key(REG_KEY Key, string Value)
 {
     BASE_SWELF_KEY.SetValue(SWELF_Keys[(int)Key], Crypto_Operation.Protect_Data_Value(Value));
 }