예제 #1
0
        public async Task <IeeeXploreSearchQuery> GetSearchQueryIeeeXplore(string query, CancellationTokenSource cts = null)
        {
            string webPageSource  = null;
            string webPageSource2 = null;

            try
            {
                string url = String.Format(_resources["SearchQueryIeeeXplore"].ToString(), query);
                webPageSource = await GetWebPageSource(url, cts);

                webPageSource2 = webPageSource.ToString();
                return(XmlSerialize <IeeeXploreSearchQuery> .DeserializeXml(webPageSource));
            }
            catch (TaskCanceledException)
            {
                throw;
            }
            catch (Exception)
            {
                if (webPageSource != null && !webPageSource.Equals(webPageSource2))
                {
                    Messenger.Default.Send(new ExceptionToSettingsMessage
                    {
                        Exception = ViewModelLocator.Instance.Settings,
                        Source    = "IEEE Xplore",
                    });
                }
                else
                {
                    throw;
                }
                return(null);
            }
        }
예제 #2
0
        public async Task <IeeeXploreSearchQuery> GetPreviousOrNextResultIeeeXplore(string query, int start, CancellationTokenSource cts = null)
        {
            try
            {
                string url           = String.Format(_resources["IeeeXplorePreviousOrNextPageResult"].ToString(), query, start);
                string webPageSource = await GetWebPageSource(url, cts);

                return(XmlSerialize <IeeeXploreSearchQuery> .DeserializeXml(webPageSource));
            }
            catch (TaskCanceledException)
            {
                throw;
            }
            catch (Exception)
            {
                return(null);
            }
        }
        private AnalyzerDatabaseSettings EmptySettings()
        {
            AnalyzerDatabaseSettings settings = new AnalyzerDatabaseSettings();

            XmlSerialize <AnalyzerDatabaseSettings> .InitEmptyProperties(settings);

            settings.ScienceDirectAndScopusApiKey = "";
            settings.SpringerApiKey        = "";
            settings.StartOnLogin          = true;
            settings.SavingPublicationPath = LocalizationSettingsService.DefaultSavingLocalizationPublicationsPath;

            if (!ZetaLongPaths.ZlpIOHelper.DirectoryExists(LocalizationSettingsService.ProgramDataApplicationDirectory))
            {
                ZetaLongPaths.ZlpIOHelper.CreateDirectory(LocalizationSettingsService.ProgramDataApplicationDirectory);
            }

            XmlSerialize <AnalyzerDatabaseSettings> .Serialize(settings, LocalizationSettingsService.AnalyzerDatabaseConfigPath);

            return(settings);
        }
예제 #4
0
        private AnalyzerDatabaseStatistics LoadStatistics()
        {
            try
            {
                AnalyzerDatabaseStatistics statistics;
                if (ZetaLongPaths.ZlpIOHelper.FileExists(LocalizationStatisticsService.AnalyzerDatabaseStatisticsPath))
                {
                    statistics = XmlSerialize <AnalyzerDatabaseStatistics> .Deserialize(
                        LocalizationStatisticsService.AnalyzerDatabaseStatisticsPath);
                }
                else
                {
                    statistics = EmptyStatistics();
                }

                return(statistics);
            }
            catch (Exception)
            {
                return(EmptyStatistics());
            }
        }
        private AnalyzerDatabaseSettings LoadSettings()
        {
            try
            {
                AnalyzerDatabaseSettings settings;
                if (ZetaLongPaths.ZlpIOHelper.FileExists(LocalizationSettingsService.AnalyzerDatabaseConfigPath))
                {
                    settings = XmlSerialize <AnalyzerDatabaseSettings> .Deserialize(
                        LocalizationSettingsService.AnalyzerDatabaseConfigPath);
                }
                else
                {
                    settings = EmptySettings();
                }

                return(settings);
            }
            catch (Exception)
            {
                return(EmptySettings());
            }
        }
예제 #6
0
        private AnalyzerDatabaseStatistics EmptyStatistics()
        {
            AnalyzerDatabaseStatistics statistics = new AnalyzerDatabaseStatistics();

            XmlSerialize <AnalyzerDatabaseStatistics> .InitEmptyProperties(statistics);

            statistics.ScienceDirectCount        = 0;
            statistics.ScopusCount               = 0;
            statistics.SpringerCount             = 0;
            statistics.IeeeXploreCount           = 0;
            statistics.DuplicateCount            = 0;
            statistics.PublicationsDownloadCount = 0;
            statistics.SumCount = 0;

            if (!ZetaLongPaths.ZlpIOHelper.DirectoryExists(LocalizationStatisticsService.ProgramDataApplicationDirectory))
            {
                ZetaLongPaths.ZlpIOHelper.CreateDirectory(LocalizationStatisticsService.ProgramDataApplicationDirectory);
            }

            XmlSerialize <AnalyzerDatabaseStatistics> .Serialize(statistics, LocalizationStatisticsService.AnalyzerDatabaseStatisticsPath);

            return(statistics);
        }
예제 #7
0
 public void SaveStatistics()
 {
     XmlSerialize <AnalyzerDatabaseStatistics> .Serialize(_analyzerDatabaseStatistics, LocalizationStatisticsService.AnalyzerDatabaseStatisticsPath);
 }
 public void Save()
 {
     XmlSerialize <AnalyzerDatabaseSettings> .Serialize(Settings, LocalizationSettingsService.AnalyzerDatabaseConfigPath);
 }