Ejemplo n.º 1
0
        public static IEnumerable <DictionaryInfo> GetAll()
        {
            foreach (FileInfo file in DataStore.CombinedDataStore.GetFiles
                         (Configuration.DictionariesFolderName, new System.Text.RegularExpressions.Regex(@"\.dictx?$"), true))
            {
                DictionaryInfo info = null;
                try {
                    if (file.Extension == ".dictx")
                    {
                        using (var dict = SqliteDictionary.FromPath(file.FullName))
                            info = dict.Info;
                    }
                    else
                    {
                        info = new SimpleDictionary.Info(file.FullName);
                    }
                } catch (IOException e) {
                    ProgramLog.Default.AddMessage(LogType.Warning, "Failed loading dictionary info for {0}: {1}", file.FullName, e.Message);
                }

                if (info != null)
                {
                    yield return(info);
                }
            }

            yield break;
        }
Ejemplo n.º 2
0
		public static IEnumerable<DictionaryInfo> GetAll() {
			foreach (FileInfo file in DataStore.CombinedDataStore.GetFiles
					 (Configuration.DictionariesFolderName, new System.Text.RegularExpressions.Regex(@"\.dictx?$"), true)) {

				DictionaryInfo info = null;
				try {
					if (file.Extension == ".dictx") {
						using (var dict = SqliteDictionary.FromPath(file.FullName))
							info = dict.Info;
					} else {
						info = new SimpleDictionary.Info(file.FullName);
					}
				} catch (IOException e) {
					ProgramLog.Default.AddMessage(LogType.Warning, "Failed loading dictionary info for {0}: {1}", file.FullName, e.Message);
				}

				if(info != null)
					yield return info;
			}

			yield break;
		}