Beispiel #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         ValidOlsonFiles.Dispose();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Enumerates and returns all of the valid olson files for this directory.
        /// </summary>
        /// <exception cref="System.ArgumentNullException">fileName is null.</exception>
        /// <exception cref="System.Security.SecurityException">The caller does not have the required permission.</exception>
        /// <exception cref="System.ArgumentException">The file name is empty, contains only white spaces, or contains invalid characters.</exception>
        /// <exception cref="System.UnauthorizedAccessException">Access to fileName is denied.</exception>
        /// <exception cref="System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.
        /// For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.</exception>
        /// <exception cref="System.NotSupportedException">fileName contains a colon (:) in the middle of the string.</exception>
        /// <exception cref="System.IO.FileNotFoundException">The filePath provided does not exist.</exception>
        /// <exception cref="NUIClockUpdater.Models.InvaliOlsonFileException">The file provided is not a valid Olson Database file.</exception>
        public BlockingCollection <OlsonFileInfo> GetValidOlsonFiles()
        {
            try
            {
                string[] paths = null;

                paths = Directory.GetFiles(ToString());
                foreach (string path in paths)
                {
                    try
                    {
                        OlsonFileInfo file = new OlsonFileInfo(path);
                        if (_validFiles.Contains(file.Name.ToLower()))
                        {
                            ValidOlsonFiles.Add(file);
                        }
                    }
                    catch (InvalidOlsonFileException)
                    {
                        continue;
                    }
                }
                return(ValidOlsonFiles);
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                ValidOlsonFiles.CompleteAdding();
            }
        }