Beispiel #1
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         components.Dispose();
     }
     if (m_AdvFile != null)
     {
         m_AdvFile.Dispose();
         m_AdvFile = null;
     }
     base.Dispose(disposing);
 }
Beispiel #2
0
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            if (openFileDialog2.ShowDialog(this) == DialogResult.OK)
            {
                if (loadedFile != null)
                {
                    loadedFile.Dispose();
                    loadedFile = null;
                }
                loadedFile            = new AdvFile2(openFileDialog2.FileName);
                tbxFileName.Text      = openFileDialog2.FileName;
                lblWidth.Text         = loadedFile.Width.ToString();
                lblHeight.Text        = loadedFile.Height.ToString();
                lblBPP.Text           = string.Format("{0} bit, {1}", loadedFile.DataBpp, loadedFile.IsColourImage ? "Colour" : "Monochrome");
                lblMaxPixelValue.Text = loadedFile.MaxPixelValue.ToString();
                lblUtcAccuracy.Text   = GetUtcAccuracy(loadedFile.UtcTimestampAccuracyInNanoseconds);

                lblMainFrames.Text      = loadedFile.MainSteamInfo.FrameCount.ToString();
                lblMainClockFreq.Text   = string.Format("{0} Hz", loadedFile.MainSteamInfo.ClockFrequency);
                lblMainFrameTSAccu.Text = GetFrameTimeStampAccuracy(loadedFile.MainSteamInfo.TimingAccuracy * 1.0 / loadedFile.MainSteamInfo.ClockFrequency, loadedFile.MainSteamInfo.TimingAccuracy);
                LoadMetadata(lvMainStream, loadedFile.MainSteamInfo.MetadataTags);

                lblCalibFrames.Text      = loadedFile.CalibrationSteamInfo.FrameCount.ToString();
                lblCalibClockFreq.Text   = string.Format("{0} Hz", loadedFile.CalibrationSteamInfo.ClockFrequency);
                lblCalibFrameTSAccu.Text = GetFrameTimeStampAccuracy(loadedFile.CalibrationSteamInfo.TimingAccuracy * 1.0 / loadedFile.CalibrationSteamInfo.ClockFrequency, loadedFile.MainSteamInfo.TimingAccuracy);
                LoadMetadata(lvCalibStream, loadedFile.CalibrationSteamInfo.MetadataTags);

                LoadMetadata(lvImageSectionTags, loadedFile.ImageSectionTags);
                lblCountLayouts.Text  = loadedFile.ImageLayouts.Count.ToString();
                lvImageLayoutTags.Tag = loadedFile.ImageLayouts;
                LoadImageLayoutTags(loadedFile.ImageLayouts.Count - 1);

                LoadStatusTags(loadedFile.StatusTagDefinitions);

                LoadMetadata(lvSystemMedata, loadedFile.SystemMetadataTags);
                LoadMetadata(lvUserMetadata, loadedFile.UserMetadataTags);

                if (loadedFile.MainSteamInfo.FrameCount > 0)
                {
                    // Make sure we can read a frame, if any
                    AdvFrameInfo frameInfo;
                    loadedFile.GetMainFramePixels(0, out frameInfo);
                }

                if (loadedFile.MainIndex.Count > 0)
                {
                    var sb = new StringBuilder();
                    sb.AppendFormat("FrameOffset\t\tBytesCount\tElapsedTicks\r\n");
                    foreach (var ie in loadedFile.MainIndex)
                    {
                        sb.AppendFormat("0x{0}\t0x{1}\t{2}\r\n",
                                        Convert.ToString(ie.FrameOffset, 16).PadLeft(16, '0'),
                                        Convert.ToString(ie.BytesCount, 16).PadLeft(8, '0'), ie.ElapsedTicks);
                    }
                    tbxMainIndex.Text = sb.ToString();
                }

                if (loadedFile.CalibrationIndex.Count > 0)
                {
                    var sb = new StringBuilder();
                    sb.AppendFormat("FrameOffset\t\tBytesCount\tElapsedTicks\r\n");
                    foreach (var ie in loadedFile.CalibrationIndex)
                    {
                        sb.AppendFormat("0x{0}\t0x{1}\t{2}\r\n", Convert.ToString(ie.FrameOffset, 16).PadLeft(16, '0'), Convert.ToString(ie.BytesCount, 16).PadLeft(8, '0'), ie.ElapsedTicks);
                    }
                    tbxCalibIndex.Text = sb.ToString();
                }
            }
        }