GetDefaultLogDir() public static method

public static GetDefaultLogDir ( ) : string
return string
Beispiel #1
0
        /// <summary>
        /// scan for tlogs to upload
        /// </summary>
        /// <param name="logsafter">use  Settings.Instance["AirMarket_logdate"]</param>
        /// <returns></returns>
        public static async Task ScanTLogs(DateTime logsafter)
        {
            if (!Enabled)
            {
                return;
            }

            var username = Settings.Instance["AirMarket_username"];
            var password = Settings.Instance["AirMarket_password"];
            var server   = Settings.Instance["AirMarket_server"];

            var logdir = Settings.GetDefaultLogDir();

            //

            var logstoupload = Directory.GetFiles(logdir, "*.tlog", SearchOption.AllDirectories).Select(a => new FileInfo(a)).Where(a => a.LastWriteTime > logsafter).AsParallel()
                               .OrderBy(a => a.LastWriteTime).ToList();

            while (logstoupload.Count > 25)
            {
                logstoupload.RemoveAt(0);
            }

            foreach (var log in logstoupload)
            {
                Queue.Enqueue(log);
            }

            StartUploader();
        }