Esempio n. 1
0
        private void buttonLoadFilelist_Click(object sender, EventArgs e)
        {
            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName != null && openFileDialog1.FileName != "")
            {
                logMessage("Loading " + openFileDialog1.FileName);
                openImageFile = openFileDialog1.FileName;
                byte[] fileData = File.ReadAllBytes(openFileDialog1.FileName);

                if (BitConverter.ToInt32(fileData, 0) == FILE_MAGIC_NUMBER)
                {
                    byte[] uncompressedBytes = new byte[fileData.Length - 4];
                    Array.Copy(fileData, 4, uncompressedBytes, 0, fileData.Length - 4);
                    using (var inStream = new MemoryStream(uncompressedBytes))
                    {
                        using (var archive = new ZipArchive(inStream, ZipArchiveMode.Read, true))
                        {
                            var fileInArchive = archive.GetEntry("filelist_zipped");

                            Stream unzippedEntryStream = fileInArchive.Open();
                            mImageRecordList.Clear();
                            while (true)
                            {
                                ImageRecord newRecord = ImageRecord.ImageRecordFromStream(unzippedEntryStream);
                                if (newRecord == null)
                                {
                                    break;
                                }
                                mImageRecordList.Add(newRecord);
                            }
                        }
                    }

                    logMessage(mImageRecordList.Count.ToString() + " records loaded.");

                    updateImageRecordStatus(true);

                    buttonSaveFilelist.Enabled = true;

                    // Populate combobox of day setting files based on files in the same directory
                    comboBoxDaySettingFiles.Items.Clear();
                    string[] daySettingFiles = System.IO.Directory.GetFiles(Path.GetDirectoryName(openFileDialog1.FileName),
                                                                            "*.llods", SearchOption.AllDirectories);
                    foreach (String file in daySettingFiles)
                    {
                        comboBoxDaySettingFiles.Items.Add(Path.GetFileNameWithoutExtension(file));
                    }
                }
            }
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            // Exif button loaded
            logMessage("Reading EXIF data: " + localFiles[0]);
            int counter = 0;

            mImageRecordList = new List <ImageRecord>(localFiles.Length);
            foreach (String file in localFiles)
            {
                ImageRecord imageRecord = new ImageRecord();
                imageRecord.FileName = file;
                var directories = ImageMetadataReader.ReadMetadata(file);
                imageRecord.CaptureTime = directories[3].GetDateTime(ExifDirectoryBase.TagDateTimeOriginal);
                mImageRecordList.Add(imageRecord);
                counter++;
            }
            mImageRecordList.Sort();
            updateImageRecordStatus(true);
            logMessage("Done processing");
        }
Esempio n. 3
0
        public void addImage(ImageRecord ir)
        {
            int captureTimeStamp = ir.CaptureTimeAdjusted.Hour * 100 + ir.CaptureTimeAdjusted.Minute;

            if (captureTimeStamp >= CfgStartTime && captureTimeStamp <= CfgEndTime)
            {
                if (SelectedPreviousImageRecord != null)
                {
                    if (Math.Abs((SelectedPreviousImageRecord.CaptureTimeAdjusted - ir.CaptureTimeAdjusted).TotalSeconds) >= (double)CfgIntervalSec)
                    {
                        SelectedImages.Add(ir);
                        SelectedPreviousImageRecord = ir;
                    }
                }
                else
                {
                    SelectedImages.Add(ir);
                    SelectedPreviousImageRecord = ir;
                }
            }
            AllImages.Add(ir);
        }
Esempio n. 4
0
        private Image getThumbnailFromImageRecord(ImageRecord ir)
        {
            Image returnImage;

            if ((returnImage = ImageProcessing.getJpgThumbnailFromFile(ir.FileName)) != null)
            {
                ir.ThumbnailStored = true;
                return(returnImage);
            }
            else if ((returnImage = ImageProcessing.getJpgThumbnailFromNEF(ir.FileName)) != null)
            {
                Console.WriteLine("Thumb not found, generated: " + ir.FileName);
                ImageProcessing.saveJpgThumbnailToFile(returnImage, ir.FileName);
                ir.ThumbnailStored = true;
                return(returnImage);
            }
            else
            {
                logMessage("Error: Can't generate JPG thumbnail from NEF");
                return(null);
            }
        }