Example #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////


        // costruttore
        public Record1(HdrFields fields)
        {
            this.fields = fields;
            this.record = new Record1Type {
                Axes = setAxes(), FeatureType = setFeatureType(), Revision = setRevision()
            };
        }
Example #2
0
        /////////////////////////////////////////////////////////////////////////////////////

        public Record2(HdrFields hdr)
        {
            this.hdr    = hdr;
            this.record = new Record2Type {
                CalibrationDate = setCalibrationDate(), Comment = setComment(), Creator = setCreator(), Date = setDate(), Instrument = setInstrument(), ProbingSystem = setProbingSystem()
            };
        }
Example #3
0
        static void Main(string[] args)
        {
            // Inserisci path
            Console.Write("Inserisci path della cartella target.>");
            String path = Console.ReadLine();//"C:\\Users\\CristianSandu\\Desktop\\Test_h_firma";

            // path del file .dist
            String distfilepath = "";
            // path del file .hdr
            String hdrfilepath = "";
            //oggetto contenente campi provenienti dal file hdr
            HdrFields allfields = new HdrFields();
            // oggetto che mi crea l'XML
            CreateXML XMLScheme;

            String destinationXMLFile = "test.xml";
            String checkSumFile       = "md5checksum.hex";
            String zipFile            = "";

            //foreach che estrae i due file che mi servono .dist e .hdr
            foreach (string file in Directory.EnumerateFiles(path, "*.*"))
            {
                if (Path.GetExtension(file).Equals(".dist"))
                {
                    distfilepath = file;
                }
                else if (Path.GetExtension(file).Equals(".hdr"))
                {
                    hdrfilepath = file;
                    // creo un oggetto che estrapola e contiene i campi necessari dal file .hdr
                    allfields = new HdrFields(hdrfilepath);
                    allfields.extractFields();
                }
            }

            // prendi i campi dagli in pasto al createXML
            XMLScheme = new CreateXML(allfields);

            // calculate MD5 checksum
            String       checksum       = CalculateMD5(destinationXMLFile);
            StreamWriter checksumWriter = new StreamWriter(checkSumFile);

            checksumWriter.WriteLine(checksum); // write checksum on file
            checksumWriter.Close();

            // ZIP archive
            zipFile = hdrfilepath.Substring(0, hdrfilepath.Length - 4) + ".x3p";
            IEnumerable <String> list = new List <String> {
                checkSumFile, destinationXMLFile, distfilepath
            };

            CreateZipFile(zipFile, list);

            Console.WriteLine("Job finished: Press any key to exit.");
            Console.ReadLine();
        }
Example #4
0
        public CreateXML(HdrFields fields)
        {
            this.fields = fields;

            this.iso5436_2 = new ISO5436_2Type {
                Record1 = new Record1(fields).getRecord(), Record2 = new Record2(fields).getRecord(), Record3 = new Record3().getRecord(), Record4 = new Record4().getRecord(), VendorSpecificID = new VendorSpecificID().getid()
            };
            this.serializer = new XmlSerializer(typeof(ISO5436_2Type));
            this.stream     = new StreamWriter(destinationFile);
            serializer.Serialize(stream, iso5436_2);
            stream.Close();
        }