private void CopyFile(string inPath, string outPath, Action finish) { if (!File.Exists(outPath.Replace("file://", null))) { CopyFiles.Copy(inPath, outPath, null, (uwr) => { if (!string.IsNullOrEmpty(uwr.error)) { Debug.LogWarning(GetType() + "/CopyFile()/ copy error! " + uwr.error); } else { if (finish != null) { finish(); } } }); } else { if (finish != null) { finish(); } } }
private void CopyPoFile(string filename, List <String> lstFiles, string destinationPath) { try { if (this.FilesDownload != null) { this.FilesDownload.Clear(); this.FilesDownload = null; } this.FilesDownload = new List <string>(1); this.FilesDownload.Add(filename); this.DestinationPath = destinationPath; CopyFiles Temp = new CopyFiles(lstFiles, destinationPath); Temp.EV_copyComplete += new CopyFiles.DEL_copyComplete(Temp_EV_copyComplete); DIA_CopyFiles TempDiag = new DIA_CopyFiles(); TempDiag.SynchronizationObject = this; Temp.CopyAsync(TempDiag); } catch (Exception ex) { } }
public void CopyWithSearchPatternTopDirectoryOnly() { // Given Engine engine = new Engine(); engine.RootFolder = TestContext.CurrentContext.TestDirectory; engine.InputFolder = @"TestFiles\Input\"; engine.OutputFolder = @"TestFiles\Output\"; engine.CleanOutputPath(); Pipeline pipeline = new Pipeline("Pipeline", null); IExecutionContext context = new ExecutionContext(engine, pipeline); IDocument[] inputs = { context.GetDocument("Test") }; CopyFiles copyFiles = new CopyFiles("*.txt").FromTopDirectoryOnly(); // When IEnumerable <IDocument> outputs = copyFiles.Execute(inputs, context).ToList(); foreach (IDocument document in inputs.Concat(outputs)) { ((IDisposable)document).Dispose(); } // Then Assert.IsTrue( File.Exists(Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Output\test-a.txt"))); Assert.IsTrue( File.Exists(Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Output\test-b.txt"))); Assert.IsFalse( File.Exists(Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Output\Subfolder\test-c.txt"))); }
public void CopyWithSearchPatternTopDirectoryOnly() { // Given Engine engine = new Engine(); engine.Trace.AddListener(new TestTraceListener()); engine.InputFolder = @"TestFiles\Input\"; engine.OutputFolder = @"TestFiles\Output\"; Pipeline pipeline = new Pipeline("Pipeline", engine, null); IDocument[] inputs = { new Document(engine, pipeline).Clone("Test") }; IExecutionContext context = new ExecutionContext(engine, pipeline); CopyFiles copyFiles = new CopyFiles("*.txt").FromTopDirectoryOnly(); // When IEnumerable <IDocument> outputs = copyFiles.Execute(inputs, context).ToList(); foreach (IDocument document in inputs.Concat(outputs)) { ((IDisposable)document).Dispose(); } // Then Assert.IsTrue(File.Exists(@"TestFiles\Output\test-a.txt")); Assert.IsTrue(File.Exists(@"TestFiles\Output\test-b.txt")); Assert.IsFalse(File.Exists(@"TestFiles\Output\Subfolder\test-c.txt")); }
public void CopyNonExistentFolder() { // Given Engine engine = new Engine(); engine.RootFolder = TestContext.CurrentContext.TestDirectory; engine.InputFolder = @"TestFiles\Input\"; engine.OutputFolder = @"TestFiles\Output\"; engine.CleanOutputPath(); Pipeline pipeline = new Pipeline("Pipeline", null); IExecutionContext context = new ExecutionContext(engine, pipeline); IDocument[] inputs = { context.GetDocument("Test") }; CopyFiles copyFiles = new CopyFiles("NonExistent\\*.txt"); // When IEnumerable <IDocument> outputs = copyFiles.Execute(inputs, context).ToList(); foreach (IDocument document in inputs.Concat(outputs)) { ((IDisposable)document).Dispose(); } // Then // No exception should be thrown }
public ExeTransform(string xml) { var doc = XDocument.Parse(xml); VPatches.ReplaceAll(doc.Root.Elements(@"vpatch") .Select(d => new VPatchDirective { inputfile = (string)d.Attribute(@"inputfile"), outputfile = (string)d.Attribute(@"outputfile"), patchfile = (string)d.Attribute(@"patchfile") }).ToList()); PatchRedirects.ReplaceAll(doc.Root.Elements(@"patchredirect") .Select(d => ((int)d.Attribute(@"index"), (string)d.Attribute(@"outfile"))).ToList()); AlternateRedirects.ReplaceAll(doc.Root.Elements(@"alternateredirect") .Select(d => ((int)d.Attribute(@"index"), (string)d.Attribute(@"outfile"))).ToList()); NoExtractIndexes.ReplaceAll(doc.Root.Elements(@"noextract") .Select(d => (int)d.Attribute(@"index")).ToList()); CopyFiles.ReplaceAll(doc.Root.Elements(@"copyfile") .Select(d => new CopyFile() { inputfile = (string)d.Attribute(@"source"), outputfile = (string)d.Attribute(@"destination"), }).ToList()); var postTransform = doc.Root.Elements(@"posttransformmoddesc"); if (postTransform.Count() == 1) { PostTransformModdesc = (string)postTransform.First(); } }
public void OneLineWithSize() { var items = CopyFiles.ReadInputfile(new string[] { "100\tbumsti" }); var i = items.First(); Assert.AreEqual("bumsti", i.relativeFilename); Assert.AreEqual((ulong)100, i.filesize.Value); }
public void OneLineWithBadSize() { var items = CopyFiles.ReadInputfile(new string[] { "kacsi\tbumsti" }); var i = items.First(); Assert.AreEqual("bumsti", i.relativeFilename); Assert.IsNull(i.filesize); }
public void ShouldSetMetadata() { // Given CopyFiles copyFiles = new CopyFiles("**/test-a.txt"); // When copyFiles.Execute(Inputs, Context).ToList(); }
public void OneLineWithSizeandMoreColumns() { var items = CopyFiles.ReadInputfile(new string[] { "doesnotmatter\t99\tbumsti" }); var i = items.First(); Assert.AreEqual("bumsti", i.relativeFilename); Assert.AreEqual((ulong)99, i.filesize.Value); }
internal static CopyFiles To(this CopyFiles copyFiles, Func <NormalizedPath, NormalizedPath> destinationPath) { return(copyFiles.To((IFile file) => { var relativeInputPath = file.Path.GetRelativeInputPath(); var result = destinationPath(relativeInputPath); return Task.FromResult(result); })); }
private void StartCopyLuaFiles() { string destDir = BuildDefaultPath.GetBuildLuaPath; string[] sourcesDirs = { BuildDefaultPath.GetLuaDataPath, BuildDefaultPath.GetToLuaDataPath, }; CopyFiles.Copy(destDir, sourcesDirs); }
public async Task ShouldSetSourceAndDestination() { // Given TestExecutionContext context = GetExecutionContext(); CopyFiles copyFiles = new CopyFiles("**/test-a.txt"); // When TestDocument output = await ExecuteAsync(context, copyFiles).SingleAsync(); // Then output.Source.FullPath.ShouldBe("/TestFiles/Input/test-a.txt"); output.Destination.FullPath.ShouldBe("test-a.txt"); }
public void ShouldSetFilePathMetadata(string key, string expected) { // Given CopyFiles copyFiles = new CopyFiles("**/test-a.txt"); // When IDocument output = copyFiles.Execute(Inputs, Context).ToList().First(); // Then object result = output[key]; Assert.IsInstanceOf <FilePath>(result); Assert.AreEqual(expected, ((FilePath)result).FullPath); }
public void RecursivePatternCopiesFiles() { // Given CopyFiles copyFiles = new CopyFiles("**/*.txt"); // When copyFiles.Execute(Inputs, Context).ToList(); // Then Assert.IsTrue(Engine.FileSystem.GetOutputFile("test-a.txt").Exists); Assert.IsTrue(Engine.FileSystem.GetOutputFile("test-b.txt").Exists); Assert.IsTrue(Engine.FileSystem.GetOutputFile("Subfolder/test-c.txt").Exists); Assert.IsTrue(Engine.FileSystem.GetOutputDirectory("Subfolder").Exists); Assert.IsFalse(Engine.FileSystem.GetOutputFile("markdown-x.md").Exists); Assert.IsFalse(Engine.FileSystem.GetOutputFile("Subfolder/markdown-y.md").Exists); }
public void CopyFilesAboveInputPathWithOthers() { // Given CopyFiles copyFiles = new CopyFiles("../**/*.txt"); // When copyFiles.Execute(Inputs, Context).ToList(); // Then Assert.IsTrue(Engine.FileSystem.GetOutputFile("test-a.txt").Exists); Assert.IsTrue(Engine.FileSystem.GetOutputFile("test-b.txt").Exists); Assert.IsTrue(Engine.FileSystem.GetOutputFile("Subfolder/test-c.txt").Exists); Assert.IsTrue(Engine.FileSystem.GetOutputDirectory("Subfolder").Exists); Assert.IsFalse(Engine.FileSystem.GetOutputFile("markdown-x.md").Exists); Assert.IsFalse(Engine.FileSystem.GetOutputFile("Subfolder/markdown-y.md").Exists); Assert.IsTrue(Engine.FileSystem.GetOutputFile("test-above-input.txt").Exists); }
public async Task CopyFilesInSubfolderOnly() { // Given TestExecutionContext context = GetExecutionContext(); CopyFiles copyFiles = new CopyFiles("Subfolder/*.txt"); // When await ExecuteAsync(context, copyFiles); // Then Assert.IsFalse(context.FileSystem.GetOutputFile("test-a.txt").Exists); Assert.IsFalse(context.FileSystem.GetOutputFile("test-b.txt").Exists); Assert.IsTrue(context.FileSystem.GetOutputFile("Subfolder/test-c.txt").Exists); Assert.IsTrue(context.FileSystem.GetOutputDirectory("Subfolder").Exists); Assert.IsFalse(context.FileSystem.GetOutputFile("markdown-x.md").Exists); Assert.IsFalse(context.FileSystem.GetOutputFile("Subfolder/markdown-y.md").Exists); }
/// <summary> /// 打包文件夹 /// </summary> /// <param name="fileDir">文件目录</param> /// <param name="folderName">文件名称</param> /// <param name="inPathArr">输入文件路径集合</param> /// <param name="outPath">输出文件路径集合</param> /// <param name="progress">打包进度</param> private static void PackFolder(string fileDir, string folderName, string[] inPathArr, string outPath, Action <float> progress = null) { string temp = AssetDefine.UpkTempCompressionPath + "/" + folderName + "/" + fileDir; if (Directory.Exists(temp)) { Directory.Delete(temp, true); } Directory.CreateDirectory(temp); for (int i = 0; i < inPathArr.Length; i++) { string pStrFilePath = inPathArr[i]; string[] inpathArr = pStrFilePath.Split('/'); string pPerFilePath = temp + "/" + inpathArr[inpathArr.Length - 1]; CopyFiles.Copy(pStrFilePath, pPerFilePath); } UpkUtil.PackFolder(temp, outPath, progress); }
public CopyAssets(string outputPath) { if (Directory.Exists(Application.streamingAssetsPath)) { Directory.Delete(Application.streamingAssetsPath, true); } Directory.CreateDirectory(outputPath); string source = Path.Combine(ResUtility.AssetBundlesOutputPath, ResUtility.GetPlatformPath).Replace('\\', '/'); if (!Directory.Exists(source)) { Debug.LogError("No assetBundle output folder, try to build the assetBundles first."); return; } string destination = Path.Combine(outputPath, ResUtility.GetPlatformPath).Replace('\\', '/'); string[] sources = { source }; CopyFiles.Copy(destination, sources); }
/// <summary> /// Deze methode geeft een lijst van opmerkingen door naar de web service. /// De web service gebruikt deze gegevens om een .CSV-bestand te maken /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void BtnOpslaan_Click(object sender, RoutedEventArgs e) { btnSynchroniseren.IsEnabled = false; prSynchroniseren.IsActive = true; lblBoodschap.Text = "Even geduld. Gegevens worden op dit moment verstuurd..."; lblBoodschap.Visibility = Windows.UI.Xaml.Visibility.Visible; if (!swtManierOpslag.IsOn) { try { await CopyFiles.copyPhotosToUSB(); await CopyFiles.copyVideosToUSB(); if (await LocalDB.database.SynchroniseerNaarUSB()) { lblBoodschap.Text = "De gegevens zijn met succes verstuurd naar de USB!"; } else { lblBoodschap.Text = "Er is iets fout gelopen. Controleer of u een opslagmedium ingestoken heeft..."; } } catch (Exception) { lblBoodschap.Text = "Er is iets fout gelopen. Controleer of u een opslagmedium ingestoken heeft..."; } } else { await CopyFiles.copyPhotosViaNetwork(); await CopyFiles.copyVideosViaNetwork(); List <String> lijstGegevens = new List <String>(); List <Comment> opmerkingen = await OverzichtOpmerkingen.GetOverzichtComments(); List <string> lijstStringGegevens = new List <string>(); foreach (Comment opmerking in opmerkingen) { lijstStringGegevens.Add("Chauffeur: " + opmerking.Chauffeur + ", OpmperkingID: " + opmerking.Id.ToString() + ", Aangemaakt op: " + opmerking.Datum.ToString("dd/MM/yyyy HH:mm") + ", Objectcode: " + opmerking.ObjectCode + ", Defectcode: " + opmerking.DefectCode + ", Omschrijving: " + opmerking.Omschrijving); } ArrayOfString aosGegevens = new ArrayOfString(); //Een ArrayOfString is nodig voor de web service aosGegevens.AddRange(lijstStringGegevens); var avAuto = await LocalDB.database.GetToegewezenAuto(); string datum = String.Format("Wagen {0} - {1}-{2}-{3} {4}h{5}m", avAuto.Number, DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year, DateTime.Now.Hour, DateTime.Now.Minute); string bestandsNaam = String.Format("{0} opmerkingen.csv", datum); //await CopyFiles.copyVideosViaNetwork(); lblBoodschap.Text = "Videos uploaden"; if (await LocalDB.database.SetMaakSVCvoorWebSync(aosGegevens, bestandsNaam)) { lblBoodschap.Text = "De gegevens zijn met succes verstuurd naar de server!"; } else { lblBoodschap.Text = "Er is iets fout gelopen. Controleer of u met het juiste netwerk verbonden bent..."; } } btnSynchroniseren.IsEnabled = true; prSynchroniseren.IsActive = false; }
public async Task Execute(CancellationToken cancellationToken, IProgress <double> progress) { var config = Plugin.Instance.Configuration; if (Equals(config.MonitoredFolder, null) || Equals(config.EmbyAutoOrganizeFolderPath, null)) { return; } logger = LogManager.GetLogger(Plugin.Instance.Name); var directoryInfo = FileSystem.GetDirectories(path: config.MonitoredFolder); var directoryInfoList = directoryInfo.ToList(); logger.Info("Found: " + directoryInfoList.Count() + " folders in " + config.MonitoredFolder); foreach (var newMediaFolder in directoryInfoList) { if (FileSystem.FileExists(newMediaFolder.FullName + "\\####emby.extracted####")) { continue; } logger.Info("New media file: " + newMediaFolder.FullName); logger.Info("Creating compression marker " + newMediaFolder.FullName + "\\####emby.extracted####"); using (var sr = new StreamWriter(newMediaFolder.FullName + "\\####emby.extracted####")) { sr.Flush(); } var newMediaFiles = FileSystem.GetFiles(newMediaFolder.FullName); foreach (var file in newMediaFiles) { if (file.FullName.IndexOf("sample", StringComparison.OrdinalIgnoreCase) >= 0) { continue; } logger.Info("File checked: " + file.Name); switch (file.Extension) { case ".rar": logger.Info("Found new compressed file to decompress: " + file.Name); await Task.Run( () => UnzipAndCopyFiles.BeginDecompressionAndCopy(file.FullName, file.Name, logger, progress, config), cancellationToken); config.CompletedItems.Add(new ExtractionInfo { Name = newMediaFolder.Name, completed = DateTime.Now.ToString("yyyy-M-dd--HH:mm-ss"), size = FileSizeConversions.SizeSuffix(file.Length), extention = file.Extension, CreationTimeUTC = file.CreationTimeUtc, CopyType = "Unpacked" }); break; // ReSharper disable RedundantCaseLabel case ".mkv": case ".avi": case ".mp4": logger.Info("Found New File to Copy: " + file.Name); await Task.Run( () => CopyFiles.BeginCopy(file.FullName, file.Name, progress, Plugin.Instance.Configuration), cancellationToken); config.CompletedItems.Add(new ExtractionInfo { Name = newMediaFolder.Name, completed = DateTime.Now.ToString("yyyy-M-dd--HH:mm-ss"), size = FileSizeConversions.SizeSuffix(file.Length), extention = file.Extension, CreationTimeUTC = file.CreationTimeUtc, CopyType = "Copied" }); break; } } Plugin.Instance.UpdateConfiguration(new PluginConfiguration { EmbyAutoOrganizeFolderPath = config.EmbyAutoOrganizeFolderPath, MonitoredFolder = config.MonitoredFolder, CompletedItems = config.CompletedItems }); } progress.Report(100); }
private bool RunScriptsInternal(HttpClient httpClient, IEnumerable <Script> scripts, bool runInSequence = false, CopyFiles copyParameterFiles = null, CopyFiles copyResultFiles = null) { #region validation if (httpClient == null) { throw new ArgumentNullException(nameof(httpClient)); } if (scripts == null) { throw new ArgumentNullException(nameof(scripts)); } #endregion // No scripts avaiable for running // No python session has to be established if (scripts.Count() == 0) { return(false); } ScriptSession pythonSession = GetPythonSession(httpClient); if (pythonSession == null) { throw new HostUnreachableException($"Script execution host is unreachable at the moment!"); } copyParameterFiles?.Invoke(pythonSession); ScriptExecutionResults = ExecuteScripts(httpClient, pythonSession, scripts, runInSequence); copyResultFiles?.Invoke(pythonSession); EndPythonSession(httpClient, pythonSession); return(ScriptExecutionResults != null && ScriptExecutionResults.All(o => !o.IsFailed)); }
private async void cmdUnpack_Click(object sender, EventArgs e) { bool errorState = false; if (!Directory.Exists(_dictMapp["Temp"])) { return; } if (!Directory.Exists(_dictMapp["Source"])) { return; } var filecountDat = (from file in Directory.EnumerateFiles(_dictMapp["Temp"], "*.dat", SearchOption.TopDirectoryOnly) select file).Count(); var filecountZip = (from file in Directory.EnumerateFiles(_dictMapp["Temp"], "*.zip", SearchOption.TopDirectoryOnly) select file).Count(); var filecountSourcemap = (from file in Directory.EnumerateFiles(_dictMapp["Source"], "*.*", SearchOption.TopDirectoryOnly) select file).Count(); var filecountTempmap = (from file in Directory.EnumerateFiles(_dictMapp["Temp"], "*.*", SearchOption.TopDirectoryOnly) select file).Count(); Cursor.Current = Cursors.WaitCursor; StringBuilder sb = new StringBuilder(); if (filecountZip > 1) { sb.AppendLine("FEL: flera zip filer! (max = 1)"); errorState = true; } if (filecountDat > 0 && filecountZip > 0) { sb.AppendLine("FEL: mix av .dat + .zip filer! (antingen .dat / eller .zip)"); errorState = true; } if (filecountSourcemap > 0) { sb.AppendLine("FEL: Source mappen är inte tom! (måste vara tom)"); errorState = true; } if (filecountTempmap == 0) { sb.AppendLine("FEL: Tempmappen är tom."); errorState = true; } if (errorState) { MessageBox.Show(sb.ToString(), "Fel hittade!", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (!errorState) { if (filecountZip == 1) { var myZip = new ZipUnpacker(DeponaConfig.Configuration.GetMappSettingsInstance("Temp"), DeponaConfig.Configuration.GetMappSettingsInstance("Source")); string[] zipfileName = Directory.GetFiles(_dictMapp["Temp"], "*.zip"); var fileInfo = new FileInfo(zipfileName[0]); long byteSize = fileInfo.Length; float compLevel = myZip.GetZipCompression(zipfileName[0]); long totBytes = byteSize * (long)(compLevel); totBytes = totBytes / 120000; int zipCount = myZip.GetZipFileCount(zipfileName[0]); progressBarZip.Maximum = zipCount + (int)totBytes; grpFooter.Enabled = false; grpUnzip.Visible = true; timerZip.Start(); /* * await Task.Run(() => * { * var t = startUnzipAsync(); * }); */ await Task.Run(StartUnzipAsync); timerZip.Stop(); grpUnzip.Enabled = false; grpFooter.Enabled = true; grpUnzip.Visible = false; this.Show(); this.Focus(); string caption = "Zip archive extraction"; MessageBox.Show("Zip archive unpacked and files moved to 'Source'", caption, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (filecountDat > 0) { // copy all .dat files to 'Source' folder var copyfiles = new CopyFiles(DeponaConfig.Configuration.GetMappSettingsInstance("Temp"), DeponaConfig.Configuration.GetMappSettingsInstance("Source")); int res = copyfiles.copyFiles(DeponaConfig.Configuration.GetMappSettingsInstance("Temp"), DeponaConfig.Configuration.GetMappSettingsInstance("Source")); if (res == -2) { MessageBox.Show("Error: 'Source folder is NOT empty!", "Copy error!", MessageBoxButtons.OK, MessageBoxIcon.Information); } // delete all files from 'Temp' folder var files = Directory.EnumerateFiles(DeponaConfig.Configuration.GetMappSettingsInstance("Temp")); int deleteCount = 0; foreach (var fileitem in files) { File.Delete(fileitem); deleteCount++; } DeponaConfig.Configuration.WriteLogMessage($"Deleted files in 'Temp': {deleteCount}"); string message = "Copy / move success!"; MessageBox.Show($"{deleteCount} files (.dat + .pdf) moved to 'Source'", message, MessageBoxButtons.OK, MessageBoxIcon.Information); } } Cursor.Current = Cursors.Default; }
public UserControl_Attachment() { InitializeComponent(); copyFiles = new CopyFiles(); }
/// <summary> /// Run scripts in sequence. Scripts will be executed with result of previous script exection. /// With this method an combination of scripts is possible. /// </summary> /// <param name="httpClient">HttpClient to use for requests</param> /// <param name="scripts">List of scripts to run</param> /// <param name="copyParameterFiles">Function for copy parameter files</param> /// <param name="copyResultFiles">Function for copy result files</param> /// <returns>TRUE is scripts executed successfully, otherwise FALSE</returns> public bool RunScriptsInSequence(HttpClient httpClient, IEnumerable <Script> scripts, CopyFiles copyParameterFiles = null, CopyFiles copyResultFiles = null) { return(RunScriptsInternal(httpClient, scripts, true, copyParameterFiles, copyResultFiles)); }
public async Task Execute(CancellationToken cancellationToken, IProgress <double> progress) { var config = Plugin.Instance.Configuration; if (config.MonitoredFolder is null || config.EmbyAutoOrganizeFolderPath is null) { return; } logger = LogManager.GetLogger(Plugin.Instance.Name); var monitoredDirectoryInfo = FileSystem.GetDirectories(path: config.MonitoredFolder); var monitoredDirectoryContents = monitoredDirectoryInfo.ToList(); logger.Info("Found: " + monitoredDirectoryContents.Count() + " folders in " + config.MonitoredFolder); foreach (var mediaFolder in monitoredDirectoryContents) { //Ignore this directory if there is an 'extraction marker' file present because we have already extracted the contents of this folder. if (FileSystem.FileExists(mediaFolder.FullName + "\\####emby.extracted####")) { continue; } logger.Info("New media folder: " + mediaFolder.FullName); CreateExtractionMarker(mediaFolder.FullName, logger); var newMediaFiles = FileSystem.GetFiles(mediaFolder.FullName); foreach (var file in newMediaFiles) { if (file.FullName.IndexOf("sample", StringComparison.OrdinalIgnoreCase) >= 0) { continue; } logger.Info("File checked: " + file.Name); switch (file.Extension) { case ".rar": logger.Info("Found new compressed file to extract: " + file.Name); await Task.Run( () => UnzipAndCopyFiles.BeginCompressedFileExtraction(file.FullName, file.Name, logger, progress, config, SessionManager), cancellationToken); config.CompletedItems.Add(new ExtractionInfo { Name = mediaFolder.Name, completed = DateTime.Now, size = FileSizeConversions.SizeSuffix(file.Length), extension = file.Extension, CopyType = "Unpacked" }); break; case ".mkv": case ".avi": case ".mp4": logger.Info("Found new file to copy: " + file.Name); await Task.Run( () => CopyFiles.BeginFileCopy(file.FullName, file.Name, progress, Plugin.Instance.Configuration, SessionManager), cancellationToken); config.CompletedItems.Add(new ExtractionInfo { Name = mediaFolder.Name, completed = DateTime.Now, size = FileSizeConversions.SizeSuffix(file.Length), extension = file.Extension, CopyType = "Copied" }); break; } } Plugin.Instance.UpdateConfiguration(new PluginConfiguration { EmbyAutoOrganizeFolderPath = config.EmbyAutoOrganizeFolderPath, MonitoredFolder = config.MonitoredFolder, CompletedItems = config.CompletedItems.Where(i => i.completed > DateTime.Now.AddDays(-30)).ToList() //No need to keep a list of items that are 30 days old }); } progress.Report(100); }