コード例 #1
0
        public async Task <FileSystemScanService> OpenFromFile(string filename, FileSystemScanService scanService)
        {
            var jsonScanData = await Task.Run(() => File.ReadAllText(filename));

            var ss = JsonConvert.DeserializeObject <FileSystemScanService>(jsonScanData);

            scanService.CopyProperties(ss);
            return(scanService);
        }
コード例 #2
0
 public void CopyProperties(FileSystemScanService fromScanService)
 {
     BaseFolder    = fromScanService.BaseFolder;
     ComputerName  = fromScanService.ComputerName;
     OSVersionName = fromScanService.OSVersionName;
     ScanDate      = fromScanService.ScanDate;
     ScanOptions.BaseFolderPath              = fromScanService.ScanOptions.BaseFolderPath;
     ScanOptions.IncludeSubFolders           = fromScanService.ScanOptions.IncludeSubFolders;
     ScanOptions.SearchPattern               = fromScanService.ScanOptions.SearchPattern;
     ScanOptions.ShowMinimumFolderLevelInLog = fromScanService.ScanOptions.ShowMinimumFolderLevelInLog;
     UserName   = fromScanService.UserName;
     DetailType = fromScanService.DetailType;
     Clear();
     ScanResult.AllFolders.AddRange(fromScanService.ScanResult.AllFolders);
     ScanResult.AllFiles.AddRange(fromScanService.ScanResult.AllFiles);
     ScanResult.ScanExceptions.AddRange(fromScanService.ScanResult.ScanExceptions);
     LogLines.AddRange(fromScanService.LogLines);
 }
コード例 #3
0
 public async Task SaveToFile(string filename, FileSystemScanService scanService)
 {
     var jsonScanData = JsonConvert.SerializeObject(scanService,
                                                    SaveReadableFormat ? Formatting.Indented : Formatting.None);
     await Task.Run(() => File.WriteAllText(filename, jsonScanData));
 }