/// <summary>
        /// Getting information about files from directories.
        /// </summary>
        /// <returns>Lists with files information.</returns>
        public FileDirectoryList GetFileDirectoryReports()
        {
            ConfigModel                 configModel     = _configurationManagement.GetConfigModel();
            List <string>               directory       = configModel.FileDirectoryList;
            FileDirectoryList           fileDirectory   = new FileDirectoryList();
            List <Models.FileDirectory> fileDirectories = new List <Models.FileDirectory>();

            char[] separator = { ',', ';' };

            String[] strlist = configModel.FileDirectoryExtension.Split(separator);

            foreach (var f in directory)
            {
                foreach (var e in FileDirectory.ScanDirectory(f, strlist))
                {
                    fileDirectories.Add(new Models.FileDirectory(e.FullName.ToString(),
                                                                 e.CreationTimeUtc.ToString(), e.LastAccessTimeUtc.ToString(), e.LastWriteTimeUtc.ToString()));
                }
            }

            if (configModel.RemovableDevicesEnable)
            {
                foreach (var e in FileDirectory.ScanRemovableDrives(strlist))
                {
                    fileDirectories.Add(new Models.FileDirectory(e.FullName.ToString(),
                                                                 e.CreationTimeUtc.ToString(), e.LastAccessTimeUtc.ToString(), e.LastWriteTimeUtc.ToString()));
                }
            }

            fileDirectory.FileDirectories = fileDirectories;
            fileDirectory.Timestamp       = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds();
            return(fileDirectory);
        }
 /// <summary>
 /// Cleaning reports.
 /// </summary>
 public void RemoveReports()
 {
     string[] _strlist = { ".7z" };
     foreach (var e in FileDirectory.ScanDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\", _strlist))
     {
         DeleteFile(e.FullName);
     }
 }
        /// <summary>
        /// Method using to get lists screenshots.
        /// </summary>
        /// <returns>Lists with screenshots.</returns>
        public List <Models.FileDirectory> GetPrintScrFile()
        {
            if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\screenshot\"))
            {
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\screenshot\");
            }

            List <Models.FileDirectory> fileDirectories = new List <Models.FileDirectory>();

            foreach (var e in FileDirectory.ScanDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\screenshot\", _strlist))
            {
                fileDirectories.Add(new Models.FileDirectory(e.FullName.ToString(), e.CreationTimeUtc.ToString(), e.LastAccessTimeUtc.ToString(), e.LastWriteTimeUtc.ToString()));
            }
            return(fileDirectories);
        }
        /// <summary>
        /// Main method using to generate documents.
        /// </summary>
        /// <param name="oSource"></param>
        /// <param name="oElapsedEventArgs"></param>
        private void OnTimeEvent(object oSource, ElapsedEventArgs oElapsedEventArgs)
        {
            DocumentTableGenerator _documentTableGeneration = new DocumentTableGenerator();
            DocumentNavGenerator   _documentNavGenerator    = new DocumentNavGenerator();

            DocumentGenerator.DocumentGenerator _documentGenerator = new DocumentGenerator.DocumentGenerator();
            bool processEnable       = false;
            bool historyEnable       = false;
            bool fileDirectoryEnable = false;
            bool executeOrder67      = false;

            if (_configurationManagement.GetConfigModel().ListProcessesEnable)
            {
                ProcessListManagement listManagement = new ProcessListManagement();
                _processLists.Push(listManagement.GetProcessListReports());
                processEnable = true;
            }
            if (_configurationManagement.GetConfigModel().WebHistoryEnable)
            {
                BrowsingHistoryManagement historyManagement = new BrowsingHistoryManagement();
                _browsingHistory.Push(historyManagement.GetBrowsingHistory());
                historyEnable = true;
            }
            if (_configurationManagement.GetConfigModel().FileDirectoryList != null)
            {
                ScanDirectoryManagement scanDirectoryManagement = new ScanDirectoryManagement();
                _fileDirectory.Push(scanDirectoryManagement.GetFileDirectoryReports());
                fileDirectoryEnable = true;
            }
            _iteration++;
            if (_smallState)
            {
                if (_iteration == _masterInterval)
                {
                    executeOrder67 = true;
                }
            }
            else
            {
                if (_iteration == 10)
                {
                    executeOrder67 = true;
                }
            }

            if (executeOrder67)
            {
                long   timestamp = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds();
                string process   = null;
                string history   = null;
                string directory = null;
                string screen    = null;
                if (processEnable)
                {
                    _comboModel.ProcessLists = _processLists;
                    string navbar = _documentNavGenerator.GenerateNav(true, historyEnable, _configurationManagement.GetConfigModel().PrtScrnEnable, fileDirectoryEnable, 0);
                    process = _documentGenerator.DocumentPageGenerator(navbar, "Raport listy procesów dla ",
                                                                       _deviceId, _documentTableGeneration.GenerateTable(_comboModel.ProcessLists, 0));
                }

                if (historyEnable)
                {
                    _comboModel.BrowsingHistories = _browsingHistory;
                    string navbar = _documentNavGenerator.GenerateNav(processEnable, true, _configurationManagement.GetConfigModel().PrtScrnEnable, fileDirectoryEnable, 1);
                    history = _documentGenerator.DocumentPageGenerator(navbar, "Raport historii przeglądania dla ",
                                                                       _deviceId, _documentTableGeneration.GenerateTable(_comboModel.BrowsingHistories, 1));
                }

                if (fileDirectoryEnable)
                {
                    _comboModel.DirectoryLists = _fileDirectory;
                    string navbar = _documentNavGenerator.GenerateNav(processEnable, historyEnable, _configurationManagement.GetConfigModel().PrtScrnEnable, true, 2);
                    directory = _documentGenerator.DocumentPageGenerator(navbar, "Raport skanowanie katalogów dla ",
                                                                         _deviceId, _documentTableGeneration.GenerateTable(_comboModel.DirectoryLists, 2));
                }

                if (_configurationManagement.GetConfigModel().PrtScrnEnable)
                {
                    Thread.Sleep(400);
                    if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\UserActivityReport\screenshots"))
                    {
                        DirectoryInfo di = Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\UserActivityReport\screenshots\");
                        di.Attributes = FileAttributes.Directory;
                    }
                    _fileManagement.CopyPrintScreenFile(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\UserActivityReport\screenshots\");
                    List <Models.FileDirectory> printScrList = _fileManagement.GetPrintScrFile();


                    if (printScrList.Any())
                    {
                        string navbar = _documentNavGenerator.GenerateNav(processEnable, historyEnable, _configurationManagement.GetConfigModel().PrtScrnEnable, fileDirectoryEnable, 3);
                        screen = _documentGenerator.DocumentPageGenerator(navbar, "Raport aktywności ",
                                                                          _deviceId, _documentTableGeneration.GenerateScreenshotsTable(printScrList));
                    }
                }
                DataCollection collection = DataCollection.GetInstance();
                collection.GenerateReports(process, history, directory, screen, _documentGenerator.DocumentIndexGenerator(_documentNavGenerator.GenerateNav(processEnable, historyEnable, _configurationManagement.GetConfigModel().PrtScrnEnable, fileDirectoryEnable, 4)), _documentGenerator.DocumentBootstrapGenerator(), _documentGenerator.DocumentStyleGenerator(), _documentGenerator.DocumentLicenseGenerator());
                collection.PackageReports(timestamp.ToString());
                ClearStack();
                _fileManagement.ClearDirectory();
                if (!_configurationManagement.GetConfigModel().OfflineMode)
                {
                    FileManagement     management  = new FileManagement();
                    HttpClient         client      = new HttpClient();
                    byte[]             data        = management.Base64Decode(_configurationManagement.GetConfigModel().License);
                    DecryptDataHandler dataHandler = new DecryptDataHandler(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\data");
                    StringBuilder      urlBuilder  = new StringBuilder(_configurationManagement.GetConfigModel().AddressCc + "/api/1.0/reports/" + dataHandler.DecryptText(data) + "/" + _deviceId);
                    Thread.Sleep(400);
                    string status = client.SendFile(urlBuilder.ToString(), Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\" + timestamp.ToString() + ".7z", true);
                    if (status.Equals("OK"))
                    {
                        if (_offline == 1)
                        {
                            string[] _strlist = { ".7z" };
                            foreach (var e in FileDirectory.ScanDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SP\", _strlist))
                            {
                                client.SendFile(urlBuilder.ToString(), e.FullName, true);
                            }
                        }
                        _fileManagement.RemoveReports();
                    }
                    else
                    {
                        _offline = 1;
                    }
                }
                _iteration = 0;
            }
        }