public ObservableCollection <PictureModel> CreatePictureModelList() { ObservableCollection <PictureModel> auxPictureModelList = new ObservableCollection <PictureModel>(); List <PictureModel> PictureList = new List <PictureModel>(); PictureList = _DataAccessLayer.ReturnAllPictureModels(); foreach (PictureModel pictureModel in PictureList) { IPTCModel auxIPTCModel = _DataAccessLayer.GetIPTCInfoByID(pictureModel.IPTC_ID); pictureModel.IPTC = auxIPTCModel; EXIFModel auxEXIFModel = _DataAccessLayer.GetEXIFInfoByID(pictureModel.EXIF_ID); pictureModel.EXIF = auxEXIFModel; PhotographerModel auxPhotographerModel = _DataAccessLayer.GetPhotographerByID(pictureModel.Photographer_ID); pictureModel.Photographer = auxPhotographerModel; ObservableCollection <string> auxTags = _DataAccessLayer.GetTagsByPictureID(pictureModel.ID); pictureModel.Tags = auxTags; auxPictureModelList.Add(pictureModel); } Console.Write("\n\n There are " + auxPictureModelList.Count + " pictures in the list"); return(auxPictureModelList); }
public void Save(EXIFModel exif) { var output = $"Save EXIF model for picture with ID: {exif.Pic_ID}"; if (exif == null) { throw new ArgumentNullException(nameof(exif)); } Console.WriteLine(output); try { Conn.Open(); PS.SaveExif.Parameters["@Make"].Value = exif.Make != null ? (object)exif.Make : DBNull.Value; PS.SaveExif.Parameters["@FNumber"].Value = exif.FNumber; PS.SaveExif.Parameters["@ExposureTime"].Value = exif.ExposureTime; PS.SaveExif.Parameters["@ISOValue"].Value = exif.ISOValue; PS.SaveExif.Parameters["@Flash"].Value = exif.Flash; PS.SaveExif.Parameters["@ExposureProgram"].Value = exif.ExposureProgram; PS.SaveExif.Parameters["@FK_Pic_ID"].Value = exif.Pic_ID; PS.SaveExif.ExecuteNonQuery(); Conn.Close(); } catch (Exception e) { Console.WriteLine(e.Message); throw new Exception(output, e); } finally { Conn.Close(); } }
public ObservableCollection <PictureModel> SearchAllPictures(string search) { var results = new ObservableCollection <PictureModel>(); var resultList = _DataAccessLayer.SearchForPictures(search); foreach (PictureModel pictureModel in resultList) { IPTCModel auxIPTCModel = _DataAccessLayer.GetIPTCInfoByID(pictureModel.IPTC_ID); pictureModel.IPTC = auxIPTCModel; EXIFModel auxEXIFModel = _DataAccessLayer.GetEXIFInfoByID(pictureModel.EXIF_ID); pictureModel.EXIF = auxEXIFModel; PhotographerModel auxPhotographerModel = _DataAccessLayer.GetPhotographerByID(pictureModel.Photographer_ID); pictureModel.Photographer = auxPhotographerModel; ObservableCollection <string> auxTags = _DataAccessLayer.GetTagsByPictureID(pictureModel.ID); pictureModel.Tags = auxTags; results.Add(pictureModel); } return(results); }
private void AddEXIF(EXIFModel exif, int id) { SqlCommand cmd = new SqlCommand("Select Id from EXIF WHERE PictureId = @id; SELECT SCOPE_IDENTITY();", _connection); cmd.Parameters.AddWithValue("@id", id); OpenConnection(); int?exists = (int?)cmd.ExecuteScalar(); if (exists.HasValue) { cmd = new SqlCommand("UPDATE EXIF SET Cameramodel = @cm, Author = @auth, Datatype = @datatype, Date = @date WHERE PictureId = @id", _connection); } else { cmd = new SqlCommand("INSERT INTO EXIF (PictureId, Cameramodel, Author, Datatype, Date) VALUES (@id, @cm, @auth, @datatype, @date);", _connection); } cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@id", id); cmd.Parameters.AddWithValue("@cm", exif.Cameramodel); cmd.Parameters.AddWithValue("@auth", exif.Author); cmd.Parameters.AddWithValue("@datatype", exif.Datatype); cmd.Parameters.AddWithValue("@date", exif.Date); CmdExe(cmd); }
public void InsertAllEXIFData() { EXIFModel exif; EXIFList.Clear(); if (PictureList.Count == 0) { this.InsertAllPictures(); } exif = new EXIFModel(1, "Nikon", "240x240", "27.09.1997 04:46:35", "Wien", "Österreich"); EXIFList.Add(exif); PictureList[0].EXIF_ID = 1; exif = new EXIFModel(2, "Sony", "240x240", "91.05.2003 04:46:35", "Berlin", "Deutschland"); EXIFList.Add(exif); PictureList[1].EXIF_ID = 2; exif = new EXIFModel(3, "Canon", "240x240", "15.03.2010 04:46:35", "Wien", "Österreich"); EXIFList.Add(exif); PictureList[2].EXIF_ID = 3; exif = new EXIFModel(4, "Huawei", "240x240", "01.01.2000 04:46:35", "Washington", "Amerika"); EXIFList.Add(exif); PictureList[3].EXIF_ID = 4; exif = new EXIFModel(5, "Samsung", "240x240", "18.04.1999 04:46:35", "Wien", "Österreich"); EXIFList.Add(exif); PictureList[4].EXIF_ID = 5; exif = new EXIFModel(6, "Nikon", "240x240", "02.12.2019 04:46:35", "Wien", "Österreich"); EXIFList.Add(exif); PictureList[5].EXIF_ID = 6; }
public EXIFViewModel(EXIFModel exif) { ExifVersion = exif.ExifVersion; Make = exif.Make; FNumber = exif.FNumber; ExposureTime = exif.ExposureTime; ISOSpeed = exif.ISOSpeed; }
public EXIFModel readEXIF() { EXIFModel exif = new EXIFModel(); exif.ExifVersion = 2.1; exif.Make = "Nikon"; exif.FNumber = 2.8; exif.ExposureTime = 1 / 100; exif.ISOSpeed = 150; return(exif); }
public void EXIFInfoByID() { MockDAL mock = new MockDAL(); mock.InsertAllPictures(); mock.InsertAllEXIFData(); mock.InsertAllIPTCData(); EXIFModel model = mock.GetEXIFInfoByID(3); Assert.That(model.Camera, Is.EqualTo("Canon")); }
/// /// Constructor for existing Data /// public EXIFViewModel(EXIFModel exif) { if (exif != null) { DateAndTime = exif.DateAndTime != null?exif.DateAndTime.ToString() : null; Orientation = exif.Orientation != null ? $"{exif.Orientation}°" : null; FocalLength = FocalLengthForView(exif.FocalLength); FNumber = exif.FNumber != null ? $"f/{exif.FNumber}" : null; Exposure = exif.Exposure; Iso = exif.Iso.ToString(); } }
/// <summary> /// Extracts EXIF information from a picture. NOTE: You may simulate the action. /// </summary> /// <param name="filename"></param> /// <returns></returns> public IEXIFModel ExtractEXIF(string filename) { var exifData = new EXIFModel(); IEnumerable <string> pathFiles = Directory.EnumerateFiles(GlobalInformation.Path); if (!pathFiles.Contains(Path.Combine(GlobalInformation.Path, filename))) { throw new FileNotFoundException(); } exifData.ExposureProgram = ExposurePrograms.CreativeProgram; exifData.ExposureTime = 10; exifData.FNumber = 2; exifData.Flash = true; exifData.ISOValue = 8008; exifData.Make = "Make"; return(exifData); }
public EXIFModel getExif(int ID) { EXIFModel exif = new EXIFModel(); using (connection = new SqlConnection(connectionString)) using (SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Pictures WHERE Id = " + ID, connection)) { DataTable table = new DataTable(); adapter.Fill(table); exif.ExifCameraModel = (string)table.Rows[0][2]; exif.FNumber = (double)table.Rows[0][3]; exif.ExposureTime = (int)table.Rows[0][4]; exif.DateTime = (DateTime)table.Rows[0][5]; return(exif); } }
public EXIFViewModel(int ID) { exif = bl.getExif(ID); }
public EXIFModel getEXIFInfos() { EXIFModel em = new EXIFModel(); return(em); }