Exemple #1
0
        public void Save()
        {
            db.Save(Dir.FullName + "/meta/" + Name + "_current.fog");
            XElement xconfig = Cassette.RDFdb(Name + "_cassette_1",
                                              new XElement(ONames.TagSourcemeta,
                                                           new XAttribute(ONames.rdfabout, Name + "config_1"),
                                                           new XElement(ONames.TagFoldername, _folderNumber),
                                                           new XElement(ONames.TagDocumentNumber, _documentNumber)));

            xconfig.Save(Dir.FullName + "/meta/" + Name + "_config.fog");
        }
Exemple #2
0
        /// <summary>
        /// Создатель новой кассеты
        /// </summary>
        /// <param name="cassPath"></param>
        /// <returns></returns>
        static public Cassette Create(string cassPath, string owner)
        {
            string cass_name = cassPath.Split(Cassette.slashes).Last();

            if (Directory.Exists(cassPath) && File.Exists(cassPath + "/cassette.finfo"))
            {
                return(new Cassette(cassPath));
            }
            else
            {
                DirectoryInfo dir = Directory.Exists(cassPath) ? new DirectoryInfo(cassPath) : Directory.CreateDirectory(cassPath);
                // Специальная отметка для кассеты
                Cassette.finfo_default.Save(dir.FullName + "/cassette.finfo");

                DirectoryInfo meta      = Directory.CreateDirectory(cassPath + "/meta");
                DirectoryInfo originals = Directory.CreateDirectory(cassPath + "/originals");
                DirectoryInfo preview   = Directory.CreateDirectory(cassPath + "/documents");
                Directory.CreateDirectory(originals.FullName + "/0001");
                DirectoryInfo small   = Directory.CreateDirectory(preview.FullName + "/small/0001");
                DirectoryInfo medium  = Directory.CreateDirectory(preview.FullName + "/medium/0001");
                DirectoryInfo normal  = Directory.CreateDirectory(preview.FullName + "/normal/0001");
                XElement      xconfig =
                    Cassette.RDFdb("configdb_" + cass_name + "_1",
                                   new XElement(ONames.TagSourcemeta,
                                                new XAttribute(ONames.rdfabout, "sourcemeta_" + cass_name + "_1"),
                                                new XElement(ONames.TagFoldername, "0001"),
                                                new XElement(ONames.TagDocumentNumber, "0001")));
                xconfig.Save(meta.FullName + "/" + cass_name + "_config.fog");
                //string owner = "mag_9347";
                string   uri     = "iiss://" + cass_name + "@iis.nsk.su/meta";
                XElement xmetadb =
                    Cassette.RDFdb(cass_name + "_current",
                                   new XAttribute(ONames.AttUri, uri),
                                   new XAttribute(ONames.AttOwner, owner),
                                   new XAttribute(ONames.AttPrefix, cass_name + "_"),
                                   new XAttribute(ONames.AttCounter, "1001"),
                                   new XElement(ONames.TagCassette,
                                                new XAttribute(ONames.rdfabout, cass_name + "_cassetteId"),
                                                new XElement(ONames.TagName, cass_name),
                                                new XElement(ONames.TagCassetteUri, uri)),
                                   new XElement(ONames.TagCollectionmember,
                                                new XAttribute(ONames.rdfabout, cass_name + "_cassetteId_cmId"),
                                                new XElement(ONames.TagIncollection,
                                                             new XAttribute(ONames.rdfresource, "cassetterootcollection")),
                                                new XElement(ONames.TagCollectionitem,
                                                             new XAttribute(ONames.rdfresource, cass_name + "_cassetteId"))));
                xmetadb.Save(meta.FullName + "/" + cass_name + "_current.fog");
                return(new Cassette(dir, cass_name, "0001", "0001", xmetadb));
            }
        }