Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("usage: CreateArchiveExample sbml-file");
                return;
            }
            var archive = new CombineArchive();

            archive.addFile(
                args[0],                           // filename
                "./models/model.xml",              // target file name
                KnownFormats.lookupFormat("sbml"), // look up identifier for SBML models
                true                               // mark file as master
                );

            var description = new OmexDescription();

            description.setAbout("."); // about the archive itself
            description.setDescription("Simple test archive including one SBML model");
            description.setCreated(OmexDescription.getCurrentDateAndTime());

            var creator = new VCard();

            creator.setFamilyName("Bergmann");
            creator.setGivenName("Frank");
            creator.setEmail("*****@*****.**");
            creator.setOrganization("Caltech");

            description.addCreator(creator);

            archive.addMetadata(".", description);

            archive.writeToFile("out.omex");
        }
        static void PrintMetaDataFor(CombineArchive archive, string location)
        {
            OmexDescription desc = archive.getMetadataForLocation(location);

            if (desc.isEmpty())
            {
                Console.WriteLine("  no metadata for '{0}'", location);
                return;
            }
            Console.WriteLine("  metadata for '{0}':", location);
            Console.WriteLine("     Created : {0}", desc.getCreated().getDateAsString());
            for (int i = 0; i < desc.getNumModified(); ++i)
            {
                Console.WriteLine("     Modified : {0}", desc.getModified(i).getDateAsString());
            }

            Console.WriteLine("     # Creators: {0}", desc.getNumCreators());
            for (int i = 0; i < desc.getNumCreators(); ++i)
            {
                VCard creator = desc.getCreator(i);
                Console.WriteLine("       {0} {1}", creator.getGivenName(), creator.getFamilyName());
            }
        }