public static string SAfeAddNote(MediaUnit mu, string note) { var extra = mu.Notes.Length + note.Length - 1024; var otes = note + (extra > 0 ? mu.Notes.Substring(0, extra) : mu.Notes); return(otes); }
void logOldIfNewComing(MediaUnit old, MediaUnit neu) { if (old == null || neu == null || object.Equals(old, neu)) { return; } IniPosn = neu.CurPositionSec; logAuditionCurPosn(); }
void markDeletedIf(List <FileInfo> fis, MediaUnit mu) { if (fis.Any(r => string.Compare(r.FullName, mu.PathFileExtOrg, true) == 0)) { return; } if (fis.Any(r => string.Compare(r.FullName, Path.Combine(mu.PathName, mu.FileName), true) == 0)) { return; } mu.DeletedAt = _now; mu.Notes = SAfeAddNote(mu, $"Missing on {_now.ToShortDateString()}. "); }
void mediaUnitsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count < 1) { return; } CurMu9 = ((MediaUnit)((object[])e.AddedItems)[0]); if (File.Exists(CurMu9.PathFileCur)) { CurMediaFile2 = CurMu9.PathFileCur; } }
private static MediaUnit getTestMU() { var mu = new MediaUnit() { AddedAt /**/ = DateTime.Now, Auditions /**/ = new System.Collections.ObjectModel.ObservableCollection <MuAudition>(), Bookmarks /**/ = new System.Collections.ObjectModel.ObservableCollection <MuBookmark>(), DeletedAt /**/ = null, Duration /**/ = TimeSpan.FromMinutes(33.3), FileLength /**/ = 1234567, FileName /**/ = @"", Genre /**/ = new LkuGenre { Name = "Eve", Desc = "Evening" }, LastPeekAt /**/ = DateTime.Now, LastPeekPC /**/ = "NUC1", Notes /**/ = "Notes", PassedQA /**/ = false, PathFileCur /**/ = "PathFileCur", PathFileOrg /**/ = "PathFileOrg", PathName /**/ = "PathName", PositionSec /**/ = 123, TmpMsg /**/ = "tmp msg" }; mu.Bookmarks.Add(new MuBookmark { PositionSec = 123, Note = "test" }); mu.Bookmarks.Add(new MuBookmark { PositionSec = 123, Note = "test" }); mu.Bookmarks.Add(new MuBookmark { PositionSec = 123, Note = "test" }); mu.Auditions.Add(new MuAudition { DoneAt = DateTime.Now, DoneBy = "tester" }); mu.Auditions.Add(new MuAudition { DoneAt = DateTime.Now, DoneBy = "tester" }); return(mu); }
static string firstExistingFileFromSkyCache() { var fis = new List <FileInfo>(); // foreach (var filename in Directory.GetFiles(OneDrive.AlexsVpdbFolder)) fis.Add(new FileInfo(filename)); Array.ForEach(Directory.GetFiles(OneDrive.VpdbFolder), f => fis.Add(new FileInfo(f))); // Directory.GetFiles(OneDrive.AlexsVpdbFolder).ToList().ForEach(f => fis.Add(new FileInfo(f))); //fis.OrderByDescending(fi => fi.LastWriteTime).ToList().ForEach(fi => Debug.Write(string.Format("{0} - {1}\n", fi.LastWriteTime, fi.Name))); foreach (var fi in fis.OrderByDescending(fi => fi.LastWriteTime)) { var mu = MediaUnit.LoadMetaData(fi.FullName); if (File.Exists(mu.PathFileCur)) { return(mu.PathFileCur); } else { Debug.WriteLine($"::>> !exists: {mu.PathFileCur,-64} Next.."); } } return(@"C:\1\v\13.mpv"); }