public FamilyHistorySource(SourceType sourceType)
        {
            type = sourceType;

            string familySearchConfigFile = ConfigurationManager.AppSettings["FamilySearchConfigFile"];
            var configFileReader = new CustomConfigurationFileReader(familySearchConfigFile);
            var config = configFileReader.Config;

            switch (type)
            {                    
                case SourceType.FamilySearchService:
                    description = "Family Search - Descendancy";
                    isFamilySearch = true;
                    isDescendancy = true;
                    isAncestry = false;
                    isBoth = false;

                    // this used to come in from the config file, but now we will bake this in
                    //isSandBox = config.AppSettings.Settings["isSandBox"].Value.ToLower().Contains("true");
                    //developerKey = config.AppSettings.Settings["developerKey"].Value;

                    if (_appKey == "" || _appKey.ToLower().Contains("read from config file"))
                    {
                        appKey = config.AppSettings.Settings["appKey"].Value;
                        isSandBox = config.AppSettings.Settings["isSandBox"].Value.ToLower().Contains("true");
                    }
                    else
                    {
                        isSandBox = _isSandBox;
                        appKey = _appKey;
                    }

                    username = config.AppSettings.Settings["username"].Value;
                    password = config.AppSettings.Settings["password"].Value;

                    if (string.IsNullOrEmpty(appKey))
                        MessageBox.Show(string.Format("No 'App Key' found in {0}", familySearchConfigFile));
                    startingID = config.AppSettings.Settings["startingID"].Value;

                    break;
                case SourceType.RandomAdamEvePopulation:
                    description = "Adam and Eve Random Population Generator - Descendancy";                    
                    isDescendancy = true;
                    isAncestry = false;
                    isBoth = false;
                    break;
                case SourceType.ReadFromFile:
                    break;

            }

        }
예제 #2
0
        private void btnPlay3DFT_Click(object sender, EventArgs e)
        {
            string familySearchConfigFile = ConfigurationManager.AppSettings["FamilySearchConfigFile"];
            var configFileReader = new CustomConfigurationFileReader(familySearchConfigFile);
            var config = configFileReader.Config;

            var GameAppFilename = config.AppSettings.Settings["3DFTApplication"].Value;
            if (File.Exists(GameAppFilename))
            {
                if (File.Exists(_myAppDataStorage.FamilyInfoFileName))
                {
                    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo.FileName = GameAppFilename;
                    startInfo.Arguments = "\"" + _myAppDataStorage.FamilyInfoFileName + "\"";  //wrap with quotes paths can contain spaces
                    Process.Start(startInfo);
                }
                else
                {
                    MessageBox.Show(string.Format("No 'Family Info' file found at {0}", _myAppDataStorage.FamilyInfoFileName));
                }
            }
            else
            {
                MessageBox.Show(string.Format("No '3DFT Application' found at {0}.  Check your config file.", GameAppFilename));
            }
        }