Exemple #1
0
        /// ------------------------------------------------------------------------------------
        public void Load()
        {
            // SP-791: Invalid URI: The hostname could not be parsed.
            Uri settingsUri;

            if (!Uri.TryCreate(SettingsFilePath, UriKind.Absolute, out settingsUri))
            {
                var msg = LocalizationManager.GetString("DialogBoxes.LoadProject.InvalidPath", "SayMore is not able to open the project file. \"{0}\" is not a valid path.");
                ErrorReport.ReportNonFatalMessageWithStackTrace(msg, SettingsFilePath);

                // allow the user to select a different project
                var prs = new Process();
                prs.StartInfo.FileName  = Application.ExecutablePath;
                prs.StartInfo.Arguments = "-nl";
                prs.Start();

                Environment.Exit(0);
            }

            var project = XElement.Load(SettingsFilePath);

            var settingValue = GetStringSettingValue(project, "transcriptionFont", null);

            if (!string.IsNullOrEmpty(settingValue))
            {
                TranscriptionFont = FontHelper.MakeFont(settingValue);
                _needToDisposeTranscriptionFont = true;
            }
            settingValue = GetStringSettingValue(project, "freeTranslationFont", null);
            if (!string.IsNullOrEmpty(settingValue))
            {
                FreeTranslationFont = FontHelper.MakeFont(settingValue);
                _needToDisposeFreeTranslationFont = true;
            }
            var autoSegmenterSettings = project.Element("AutoSegmentersettings");

            if (autoSegmenterSettings != null)
            {
                AutoSegmenterMinimumSegmentLengthInMilliseconds = GetIntAttributeValue(autoSegmenterSettings,
                                                                                       "minSegmentLength");
                AutoSegmenterMaximumSegmentLengthInMilliseconds = GetIntAttributeValue(autoSegmenterSettings,
                                                                                       "maxSegmentLength");
                AutoSegmenterPreferrerdPauseLengthInMilliseconds = GetIntAttributeValue(autoSegmenterSettings,
                                                                                        "preferrerdPauseLength");
                AutoSegmenterOptimumLengthClampingFactor = GetDoubleAttributeValue(autoSegmenterSettings,
                                                                                   "optimumLengthClampingFactor");
            }

            Title = GetStringSettingValue(project, "Title", string.Empty);
            FundingProjectTitle       = GetStringSettingValue(project, "FundingProjectTitle", string.Empty);
            ProjectDescription        = GetStringSettingValue(project, "ProjectDescription", string.Empty);
            VernacularISO3CodeAndName = GetStringSettingValue(project, "VernacularISO3CodeAndName", string.Empty);
            AnalysisISO3CodeAndName   = GetStringSettingValue(project, "AnalysisISO3CodeAndName", ArchivingHelper.AnalysisLanguage());
            Location               = GetStringSettingValue(project, "Location", string.Empty);
            Region                 = GetStringSettingValue(project, "Region", string.Empty);
            Country                = GetStringSettingValue(project, "Country", "Unspecified");
            Continent              = GetStringSettingValue(project, "Continent", "Unspecified");
            ContactPerson          = GetStringSettingValue(project, "ContactPerson", string.Empty);
            AccessProtocol         = GetStringSettingValue(project, "AccessProtocol", string.Empty);
            _accessProtocolChanged = false;

            DateAvailable = GetStringSettingValue(project, "DateAvailable", string.Empty);
            RightsHolder  = GetStringSettingValue(project, "RightsHolder", string.Empty);
            Depositor     = GetStringSettingValue(project, "Depositor", string.Empty);

            IMDIOutputDirectory = GetStringSettingValue(project, "IMDIOutputDirectory", string.Empty);
        }