/// <summary> /// Create a new Photo object. /// </summary> /// <param name="photoID">Initial value of the PhotoID property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="sCD">Initial value of the SCD property.</param> /// <param name="cLD">Initial value of the CLD property.</param> /// <param name="eHD">Initial value of the EHD property.</param> /// <param name="cEDD">Initial value of the CEDD property.</param> /// <param name="fCTH">Initial value of the FCTH property.</param> public static Photo CreatePhoto(global::System.String photoID, global::System.String title, global::System.Byte[] sCD, global::System.Byte[] cLD, global::System.Byte[] eHD, global::System.Byte[] cEDD, global::System.Byte[] fCTH) { Photo photo = new Photo(); photo.PhotoID = photoID; photo.Title = title; photo.SCD = sCD; photo.CLD = cLD; photo.EHD = eHD; photo.CEDD = cEDD; photo.FCTH = fCTH; return photo; }
/// <summary> /// Deprecated Method for adding a new object to the PhotoSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPhotoSet(Photo photo) { base.AddObject("PhotoSet", photo); }
private List <Photo> Find(string path, CancellationToken token) { List <Photo> result = new List <Photo>(); DirectoryInfo directoryInfo = new DirectoryInfo(path); string[] dirs = Directory.GetDirectories(path); string[] files = Directory.GetFiles(path, "*.*").Where((s) => s.ToLower().EndsWith(".jpg") || s.ToLower().EndsWith(".jpeg")).ToArray();; string sw = string.Empty; foreach (var f in files) { if (token.IsCancellationRequested) { return(result); } try { var dirsPhoto = MetadataExtractor.ImageMetadataReader.ReadMetadata(Path.GetFullPath(f)); if ((sw = GetPhotoSoftware(dirsPhoto)) != null) { FileFounded?.Invoke(this, new EventArgs()); Photo photo = new Photo(); string datetime = GetDateTimeOriginal(dirsPhoto); if (datetime == null) { photo.DateTimeOriginal = "Неизвестно"; } else { photo.DateTimeOriginal = DateTime.ParseExact(datetime, "yyyy:MM:dd HH:mm:ss", CultureInfo.InvariantCulture).ToString("f"); } photo.Software = sw; photo.Path = f; result.Add(photo); } } catch (MetadataExtractor.ImageProcessingException ipe) { Trace.WriteLine(DateTime.Now.ToString("f") + " : " + ipe.Message); } catch (IOException ioe) { Trace.WriteLine(DateTime.Now.ToString("f") + " : " + ioe.Message); } } foreach (var p in dirs) { if (token.IsCancellationRequested) { return(result); } try { result.AddRange(Find(p, token)); } catch (UnauthorizedAccessException uae) { Trace.WriteLine(DateTime.Now.ToString("f") + " : " + uae.Message); } } return(result); }