private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); { FoldersFilesUtils.CreateFolder(); } Application.Run(new MainForm()); }
private static void Main() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => { if (args.Name.Contains("Newtonsoft.Json")) { return(Assembly.Load(Decompress(Resources.Newtonsoft_Json))); } return(null); }; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); { FoldersFilesUtils.CreateFolder(); } Application.Run(new MainForm()); }
public static void MoveFilesTask() { try { foreach (var inputFolder in FoldersRulesCollection.FoldersRulesList.FindAll(x => x.Enabled)) { foreach (var rule in inputFolder.RulesDictionary.FindAll(x => x.Enabled)) { foreach ( var value in rule.ValuesList.FindAll( x => x.Enabled && x.Type == EnumData.EnumRuleValuesTypes.Extension) .Select(x => x.Value)) { var filesInInputFolder = Directory.GetFiles(inputFolder.InputFolderPath) .ToList() .FindAll(x => Path.GetExtension(x) == value); foreach (var fileInInputFolder in filesInInputFolder) { string outputPath = rule.OutputFolderPath + @"\" + Path.GetFileName(fileInInputFolder); if (File.Exists(outputPath)) { if (FoldersFilesUtils.CompareFiles(fileInInputFolder, outputPath)) { File.Delete(fileInInputFolder); } } else { File.Move(fileInInputFolder, outputPath); } } } } } } catch (Exception ex) { ex.Error(); } //Parallel.ForEach(FoldersRulesCollection.FoldersRulesList.FindAll(x => x.Enabled), folderRuleItem => //{ // Parallel.ForEach(folderRuleItem.RulesDictionary.FindAll(x => x.Enabled), rulesDictionaryItem => // { // Parallel.ForEach( // rulesDictionaryItem.ValuesList.FindAll(x => x.Enabled && x.Type == EnumData.EnumRuleValuesTypes.Extension) // .Select(x => x.Value), // value => // { // var filesInInputFolder = // Directory.GetFiles(folderRuleItem.InputFolderPath) // .ToList(); // Parallel.ForEach(filesInInputFolder.FindAll(x => Path.GetExtension(x) == value), // fileInInputFolder => // { // File.Move(fileInInputFolder, // rulesDictionaryItem.OutputFolderPath + @"\" + // Path.GetFileName(fileInInputFolder)); // }); // Parallel.ForEach(filesInInputFolder.FindAll(x => Regex.IsMatch(Path.GetFileName(x), value)), // fileInInputFolder => // { // File.Move(fileInInputFolder, // rulesDictionaryItem.OutputFolderPath + @"\" + // Path.GetFileName(fileInInputFolder)); // }); // }); // }); //}); }