示例#1
0
        private void LoadControls(Configuration conf)
        {
            // Basic Site Conf Settings
            txtPortalWebsite.Text = conf.PortalWebSite;
            txtOrganisationHashCode.Text = conf.OrganisationHashCode;
            txtPassKey.Text = conf.PassKey;
            txtPrivateKey.Text = conf.PrivateKey;
            txtServerAddress.Text = conf.ServerAddress;
            txtTestServerAddress.Text = conf.TestServerAddress;
            txtAutoUpdateLink.Text = conf.AutoUpdateLink;
            cbxClearCache.Checked = bool.Parse(conf.ClearCache);

            // Proxy Settings
            txtProxyAddress.Text = conf.ProxyAddress;
            mtxtProxyPort.Text = conf.ProxyPort;
            txtProxyUsername.Text = conf.ProxyUser;
            txtProxyPassword.Text = conf.ProxyPassword;
            txtProxyUserDomain.Text = conf.ProxyUserDomain;
            
            // GRHANITE Settings
            cbxEnableGRHANITE.Checked = conf.EnableGRHANITE;
            txtLinkageKey.Text = conf.LinkageKey;
            cbxNameTranspositionAllowed.Checked = conf.NameTranspositionAllowed;
            cbxTightSexMatching.Checked = conf.TightSexMatching;
            cbxYoBFatherSonChecking.Checked = conf.YOBFatherSonChecking;
            cbxAdditionalYOBPCodeHash.Checked = conf.AdditionalYOBPCodeHash;
            cbxExcludeMedicare.Checked = conf.ExcludeMedicare;
            cbxSuppliesMedicareDigits5to9Only.Checked = conf.SuppliesMedicareDigits5to9Only;
            cbxValidateMedicareChecksum.Checked = conf.ValidateMedicareChecksum;
        }
示例#2
0
 public XmlOutput()
 {
     DefaultExtractorContext context = new DefaultExtractorContext();
     _Conf = context.GetConfiguration();
     _EnableGrhanite = _Conf.EnableGRHANITE;
     _Hasher = InitGrhaniteHasher(_Conf);
 }
示例#3
0
 public XmlOutput(Configuration conf)
 {
     _Conf = conf;
     if (conf != null)
         _Hasher = InitGrhaniteHasher(_Conf);
     else
         _Hasher = null;
 }
示例#4
0
 /// <summary>
 /// Calls all sanity checks in the class. The one check to rule them all!
 /// </summary>
 /// <returns></returns>
 public static bool CheckAllConfig(Configuration conf)
 {
     if (
         CheckOrganisationHash(conf.OrganisationHashCode) &&
         CheckValidPassKey(conf.PassKey)
     )
         return true;
     else
         return false;
 }
示例#5
0
        public FrmConf(Configuration conf, DefaultExtractorContext context, FrmMain frmMain, bool jumpToProxyTab)
        {
            InitializeComponent();

            _conf = conf;
            _context = context;
            _frmMain = frmMain;

            LoadControls(conf);       

            // jumps straight into the proxy tab
            if (jumpToProxyTab)
                tabControl1.SelectedTab = tabPage2;
        }
        public DefaultExtractorContext()
        {
            //string path = ApplicationDeployment.CurrentDeployment.DataDirectory + "\\Configuration.xml";
            
            string path = "";
            if (System.IO.File.Exists(Application.StartupPath + "\\debug"))
                path = Application.StartupPath + "\\Configuration.xml";
            else
                path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\VariantExporter\\Configuration.xml";

            /*
            if (ApplicationDeployment.IsNetworkDeployed)
                path = ApplicationDeployment.CurrentDeployment.DataDirectory + "\\Configuration.xml";
            else
                path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Configuration.xml";*/
            
            conf = XmlDeserialiser<Configuration>.Deserialise(path);
        }
示例#7
0
        /// <summary>
        /// Initiates the GRHANITE hasher with all the params required to get it working from the conf.
        /// </summary>
        /// <param name="conf"></param>
        /// <returns></returns>
        private GRHANITEHasher InitGrhaniteHasher(Configuration conf)
        {
            GRHANITEHasher hasher = new GRHANITEHasher();

            // init hasher - with conf
            bool initialiseResult = hasher.InitialiseGRHANITEHashDefinition(conf.OrganisationHashCode, conf.LinkageKey, conf.AdditionalYOBPCodeHash,
                conf.ExcludeMedicare, conf.NameTranspositionAllowed, conf.SuppliesMedicareDigits5to9Only, conf.TightSexMatching, conf.ValidateMedicareChecksum,
                conf.YOBFatherSonChecking);

            if (!initialiseResult)
                throw new Exception("Error - unable to validate the GRHANITE License for this computer - please license it.");

            return hasher;
        }
示例#8
0
        public FrmMain()
        {
            InitializeComponent();
            
            // ******* testing - backgroundworkers
            init_backgroundWorkers();
            // ******* testing - backgroundworkers

            // Display loading splash screen while app init all vars
            //SplashScreen ss = new SplashScreen();
            ss = new SplashScreen();
            ss.Show();
            
            m_previousWindowState = (this.WindowState == FormWindowState.Minimized ? FormWindowState.Normal : this.WindowState);

            context = new DefaultExtractorContext();
            
            // get conf
            conf = context.GetConfiguration();

            // init logger
            log = new Log(bool.Parse(conf.VerboseLogEnable), txtStatusLog);
            
            // get webproxy and set webproxy
            ReloadProxy();

            // get orgSite
            bool RESTError = false;
            bool retry = true;

            // A loop that checks connection to the web, if unable to connect it allows user to jump into proxy
            // settings and retry connecting until either a connection can be established or user kills it.
            while (retry)
            {
                try
                {
                    // try to get orgsite via REST calls if this fails then close app.
                    _orgSite = DataLoader.GetOrgSite("OrgHashCode", conf.OrganisationHashCode);
                    retry = false;
                    RESTError = false;
                }
                catch (Exception ex)
                {
                    // close the splash screen
                    ss.Close();

                    RESTError = true;
                    // write debug message to log
                    log.write(ex.ToString());

                    // rename buttons to messagebox
                    MessageBoxManager.Yes = "Retry";
                    MessageBoxManager.No = "Settings";
                    MessageBoxManager.Cancel = "Quit";
                    // registers the buttons renamed
                    MessageBoxManager.Register();

                    DialogResult result = MessageBox.Show("Could not connect to HVP servers, there maybe issues with your current connection or the server maybe down please try again. \nIf you are connected to the internet via proxies please click on settings to configure your web proxies.",
                        "Error! Could not connect to HVP servers", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error);
                    
                    // unregisters the naming back to default
                    MessageBoxManager.Unregister();

                    // no == settings
                    if (result == DialogResult.No)
                    {
                        // open settings frm
                        FrmConf frmConf = new FrmConf(conf, context, this, true);
                        frmConf.ShowDialog();
                    }
                    
                    // cancel == cancel
                    if (result == DialogResult.Cancel)
                    {
                        // kill loop
                        retry = false;
                        // exit app
                        System.Environment.Exit(0);
                    }
                }
            }

            // close loading splash screen
            ss.Close();

            // if no error from REST
            if (RESTError == false)
            {
                // nibhernate factory for sqlite db connection
                _slFactory = new SQLiteDBFactory();
            
                // Clear Cache
                ClearCache = bool.Parse(conf.ClearCache);

                // start the file watcher if there are any uploads that require it.
                _watcher = new Util.FileWatcher(this);
                
                // check if there is an update when program loads up
                AutoUpdater.Start(conf.AutoUpdateLink);

                // set the timer for auto update in milliseconds
                CheckForUpdatesTimedEvent(3600000); // every 1 hour

                // get the commonAppPath, if release version then should be under user data
                _commonAppPath = CommonAppPath.GetCommonAppPath();

                // start with the modal upload form on screen first
                FrmUpload frmUpload = new FrmUpload(this, conf.OrganisationHashCode);
                frmUpload.Focus();
                frmUpload.ShowDialog();
            }

            // get the build version from the assembly
            _Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            // display the version number in the form window text
            // remove the last 2 chars from version since we dont display that to the user
            this.Text = "HVP - Variant Exporter (" + _Version.Remove(_Version.Length - 2) + ")";

            // display notes on icon hover
            notifyIcon1.Icon = this.Icon;
        }