Esempio n. 1
0
 public static void ReadSettings()
 {
     try
     {
         if (File.Exists(ApplicationPath) == true)
         {
             String JsonSetting = File.ReadAllText(ApplicationPath);
             ApplicationSettings = JsonConvert.DeserializeObject <Settings>(JsonSetting);
             if (ApplicationSettings.CheckValidSettings != "OK")
             {
                 WriteDefaultSettingsBoolean = true;
             }
         }
         else
         {
             WriteDefaultSettingsBoolean = true;
         }
     }
     catch (Exception)
     {
         LoggerClass.WriteLogError("Cannot Find Setting File");
         MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         File.Delete(ApplicationPath);
         WriteDefaultSettingsBoolean = true;
     }
 }
 public Boolean ReadLicence()
 {
     try
     {
         String Key = CryptographyClass.Decrypt(File.ReadAllText(LicencePath), EncryptionKey);
         if (Key != "")
         {
             if (opr.VerifyCode(Key) == true)
             {
                 return(true);
             }
             else
             {
                 LoggerClass.WriteLogWarning("Non Valid Licence");
                 File.Delete(LicencePath);
                 return(false);
             }
         }
         else
         {
             LoggerClass.WriteLogWarning("Non Valid Licence");
             File.Delete(LicencePath);
             return(false);
         }
     }
     catch (Exception ex)
     {
         LoggerClass.WriteLogError(ex.Message);
         return(false);
     }
 }
Esempio n. 3
0
        public void InitializeNetwork()
        {
            ps = new ProcessStartInfo("cmd.exe");
            ps.UseShellExecute        = false;
            ps.RedirectStandardOutput = true;
            ps.CreateNoWindow         = true;
            ps.FileName = "netsh";

            netSharingManager = Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.HNetShare.1"));

            if (netSharingManager == null)
            {
                this.Message = "HNetCfg.HNetShare.1 was not found! \n";
                LoggerClass.WriteLogError(Message);
                hasNetSharingManager = true;
            }
            else
            {
                hasNetSharingManager = false;
            }

            if (netSharingManager.SharingInstalled == false)
            {
                this.Message = "Sharing on this platform is not available \n";
                LoggerClass.WriteLogError(Message);
                hasNetSharingManager = false;
            }
            else
            {
                hasNetSharingManager = true;
            }

            if (hasNetSharingManager)
            {
                everyConnections = netSharingManager.EnumEveryConnection;
            }
        }