Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileOperations"/> class
        /// </summary>
        /// <param name="fileSpecs">The specifications pertaining to a particular search</param>
        public FileOperations(FileSpecifications fileSpecs)
        {
            // The specification must be supplied
            if (fileSpecs == null)
            {
                throw new Exception("File specifications pertaining to the search not specified");
            }

            this.fileSpecs = fileSpecs;

            // Whether today's logs need to be searched?
            if (this.IsToday)
            {
                // Yes, then set the copy from location as the local log file location in the servers
                this.fileSpecs.CopyFrom = ConfigurationManager.AppSettings["LogLocation"];
            }
            else
            {
                // No, then set the copy from location as remote log archive server
                this.fileSpecs.CopyFrom = ConfigurationManager.AppSettings["RemoteServer"];
            }
        }
Exemple #2
0
        /// <summary>
        /// Creates an instance of the FileOperations class
        /// </summary>
        /// <returns>an instance of FileOperations class</returns>
        private FileOperations CreateFileUtilityInstance()
        {
            // Prepare the set of attributes/data required for the file operations
            FileSpecifications fileSpecs = new FileSpecifications()
            {
                DateExtension = this.dateSelected,
                File = this.logSelected,
                ToMatch = searchText.Text.Trim(),
                CopyTo = this.copyTo + @"\Temp",
                Servers = this.servers,
                Date = Convert.ToDateTime(logDate.SelectedValue).Date
            };

            return new FileOperations(fileSpecs);
        }