public void SortByOneDate(DateTime dt, string pattern = "") { try { DirectoryInfo drInfo = new DirectoryInfo(_logPath); var files = drInfo.GetFiles(pattern).ToList(); var dr = _logPath + @"\" + dt.ToString("yyyy-MM-dd"); if (!Directory.Exists(dr)) { var newDrInfo = Directory.CreateDirectory(dr); if (NewDirection_Create != null) { NewDirection_Create.BeginInvoke(dr, null, null); } } if (BeforeSort != null) { BeforeSort.Invoke(files.Count); } var index = 0; files.ForEach(x => { if (BeforeSortOne_Update != null) { BeforeSortOne_Update.Invoke(index, x.Name); } try { File.Move(x.FullName, dr + @"\" + x.Name); } catch (Exception ex) { if (AfterSortOne_Exception != null) { AfterSortOne_Exception.Invoke(index, x.Name, ex); } } if (AfterSortOne_Update != null) { AfterSortOne_Update.Invoke(index, x.Name); } index++; }); if (AfterSort != null) { AfterSort.Invoke(); } } catch (Exception ex) { throw ex; } }
private void GoTop_Click(object sender, EventArgs e) { lock (RunTimeData.VideoQueue) { if (QueueSort == 0) { return; } var temp = RunTimeData.VideoQueue.FirstOrDefault(m => m.Sort == QueueSort); foreach (var m in RunTimeData.VideoQueue.Where(m => m.Sort > 0 && m.Sort < QueueSort)) { m.Sort++; } temp.Sort = 1; QueueSort = 1; } AfterSort?.Invoke(); }