/// <summary>
            /// Updates XMP data of Png file and creates output file
            /// </summary>
            public static void UpdateXMPData()
            {
                try
                {
                    //ExStart:UpdateXMPPropertiesPngImage
                    // initialize PngFormat
                    PngFormat pngFormat = new PngFormat(Common.MapSourceFilePath(filePath));

                    // get xmp wrapper
                    XmpPacketWrapper xmpPacket = pngFormat.GetXmpData();

                    // create xmp wrapper if not exists
                    if (xmpPacket == null)
                    {
                        xmpPacket = new XmpPacketWrapper();
                    }

                    // check if DublinCore schema exists
                    if (!xmpPacket.ContainsPackage(Namespaces.DublinCore))
                    {
                        // if not - add DublinCore schema
                        xmpPacket.AddPackage(new DublinCorePackage());
                    }

                    // get DublinCore package
                    DublinCorePackage dublinCorePackage = (DublinCorePackage)xmpPacket.GetPackage(Namespaces.DublinCore);

                    string authorName  = "New author";
                    string description = "New description";
                    string subject     = "New subject";
                    string publisher   = "New publisher";
                    string title       = "New title";
                    // set author
                    dublinCorePackage.SetAuthor(authorName);
                    // set description
                    dublinCorePackage.SetDescription(description);
                    // set subject
                    dublinCorePackage.SetSubject(subject);
                    // set publisher
                    dublinCorePackage.SetPublisher(publisher);
                    // set title
                    dublinCorePackage.SetTitle(title);
                    // update XMP package
                    pngFormat.SetXmpData(xmpPacket);

                    // commit changes
                    pngFormat.Save(Common.MapDestinationFilePath(filePath));
                    //ExEnd:UpdateXMPPropertiesPngImage
                    Console.WriteLine("File saved in destination folder.");
                }
                catch (Exception exp)
                {
                    Console.WriteLine(exp.Message);
                }
            }
            /// <summary>
            /// Updates Basic Job XMP data of Png file and creates output file
            /// </summary> 
            public static void UpdateBasicJobXMPProperties()
            {
                try
                {
                    //ExStart:UpdateBasicJobTicketXmpPropertiesPngImage
                    // initialize PngFormat
                    PngFormat pngFormat = new PngFormat(Common.MapSourceFilePath(filePath));

                    // get xmp data
                    var xmp = pngFormat.GetXmpData();

                    BasicJobTicketPackage package = null;

                    // looking for the BasicJob schema if xmp data is presented
                    if (xmp != null)
                    {
                        package = xmp.GetPackage(Namespaces.BasicJob) as BasicJobTicketPackage;
                    }
                    else
                    {
                        xmp = new XmpPacketWrapper();
                    }

                    if (package == null)
                    {
                        // create package if not exist
                        package = new BasicJobTicketPackage();

                        // and add it to xmp data
                        xmp.AddPackage(package);
                    }

                    // create array of jobs
                    Job[] jobs = new Job[1];
                    jobs[0] = new Job()
                    {
                        Id = "1",
                        Name = "test job"
                    };

                    // update schema
                    package.SetJobs(jobs);

                    // update xmp data
                    pngFormat.SetXmpData(xmp);

                    // commit changes
                    pngFormat.Save(Common.MapDestinationFilePath(filePath));
                    //ExEnd:UpdateBasicJobTicketXmpPropertiesPngImage

                    Console.WriteLine("File saved in destination folder.");
                }
                catch (Exception exp)
                {
                    Console.WriteLine(exp.Message);
                }
            }
            /// <summary>
            /// Updates XMP data of Png file and creates output file
            /// </summary> 
            public static void UpdateXMPData()
            {
                try
                {
                    //ExStart:UpdateXMPPropertiesPngImage 
                    // initialize PngFormat
                    PngFormat pngFormat = new PngFormat(Common.MapSourceFilePath(filePath));

                    // get xmp wrapper
                    XmpPacketWrapper xmpPacket = pngFormat.GetXmpData();

                    // create xmp wrapper if not exists
                    if (xmpPacket == null)
                    {
                        xmpPacket = new XmpPacketWrapper();
                    }

                    // check if DublinCore schema exists
                    if (!xmpPacket.ContainsPackage(Namespaces.DublinCore))
                    {
                        // if not - add DublinCore schema
                        xmpPacket.AddPackage(new DublinCorePackage());
                    }

                    // get DublinCore package
                    DublinCorePackage dublinCorePackage = (DublinCorePackage)xmpPacket.GetPackage(Namespaces.DublinCore);

                    string authorName = "New author";
                    string description = "New description";
                    string subject = "New subject";
                    string publisher = "New publisher";
                    string title = "New title";
                    // set author
                    dublinCorePackage.SetAuthor(authorName);
                    // set description
                    dublinCorePackage.SetDescription(description);
                    // set subject
                    dublinCorePackage.SetSubject(subject);
                    // set publisher
                    dublinCorePackage.SetPublisher(publisher);
                    // set title
                    dublinCorePackage.SetTitle(title);
                    // update XMP package
                    pngFormat.SetXmpData(xmpPacket);

                    // commit changes
                    pngFormat.Save(Common.MapDestinationFilePath(filePath));
                    //ExEnd:UpdateXMPPropertiesPngImage 
                    Console.WriteLine("File saved in destination folder.");
                }
                catch (Exception exp)
                {
                    Console.WriteLine(exp.Message);
                }
            }
        public JsonResult <List <PropertyItem> > Get(string file)
        {
            try
            {
                FileStream        original          = File.Open(Utils._storagePath + "\\" + file, FileMode.OpenOrCreate);
                FileFormatChecker fileFormatChecker = new FileFormatChecker(original);

                DocumentType        documentType = fileFormatChecker.GetDocumentType();
                List <PropertyItem> values       = new List <PropertyItem>();

                if (fileFormatChecker.VerifyFormat(documentType))
                {
                    switch (documentType)
                    {
                    case DocumentType.Doc:

                        DocFormat docFormat = new DocFormat(original);
                        values = AppendMetadata(docFormat.GetMetadata(), values);

                        break;

                    case DocumentType.Xls:

                        XlsFormat xlsFormat = new XlsFormat(original);
                        values = AppendMetadata(xlsFormat.GetMetadata(), values);

                        break;

                    case DocumentType.Pdf:

                        PdfFormat pdfFormat = new PdfFormat(original);
                        values = AppendMetadata(pdfFormat.GetMetadata(), values);
                        values = AppendXMPData(pdfFormat.GetXmpData(), values);

                        break;

                    case DocumentType.Png:

                        PngFormat pngFormat = new PngFormat(original);
                        values = AppendMetadata(pngFormat.GetMetadata(), values);
                        values = AppendXMPData(pngFormat.GetXmpData(), values);

                        break;

                    case DocumentType.Jpeg:

                        JpegFormat jpegFormat = new JpegFormat(original);
                        values = AppendMetadata(jpegFormat.GetMetadata(), values);
                        values = AppendXMPData(jpegFormat.GetXmpData(), values);

                        break;

                    case DocumentType.Gif:

                        GifFormat gifFormat = new GifFormat(original);
                        values = AppendMetadata(gifFormat.GetMetadata(), values);
                        values = AppendXMPData(gifFormat.GetXmpData(), values);

                        break;

                    case DocumentType.Bmp:

                        BmpFormat bmpFormat = new BmpFormat(original);
                        values = AppendMetadata(bmpFormat.GetMetadata(), values);

                        break;

                    case DocumentType.Msg:

                        OutlookMessage outlookMessage = new OutlookMessage(original);
                        values = AppendMetadata(outlookMessage.GetMsgInfo(), values);
                        break;

                    case DocumentType.Eml:

                        EmlFormat emlFormat = new EmlFormat(original);
                        values = AppendMetadata(emlFormat.GetEmlInfo(), values);
                        break;

                    case DocumentType.Dwg:

                        DwgFormat dwgFormat = new DwgFormat(original);
                        values = AppendMetadata(dwgFormat.GetMetadata(), values);
                        break;

                    case DocumentType.Dxf:

                        DxfFormat dxfFormat = new DxfFormat(original);
                        values = AppendMetadata(dxfFormat.GetMetadata(), values);
                        break;

                    default:

                        DocFormat defaultDocFormat = new DocFormat(original);
                        values = AppendMetadata(defaultDocFormat.GetMetadata(), values);

                        break;
                    }

                    return(Json(values));
                }
                else
                {
                    throw new Exception("File format not supported.");
                }
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }