Exemple #1
0
        public int CreateManifest(string tempDir, string guid, string repoGuid)
        {
            //This is the new improved install rutine, which chops up the process into 3 steps, creating the manifest, moving files, and finally handling umb objects
            var packName      = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/name"));
            var packAuthor    = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/name"));
            var packAuthorUrl = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/website"));
            var packVersion   = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/version"));
            var packReadme    = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/readme"));
            var packLicense   = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/license "));
            var packUrl       = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/url "));
            var iconUrl       = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/iconUrl"));

            var enableSkins  = false;
            var skinRepoGuid = "";

            if (Config.DocumentElement.SelectSingleNode("/umbPackage/enableSkins") != null)
            {
                var skinNode = Config.DocumentElement.SelectSingleNode("/umbPackage/enableSkins");
                enableSkins = bool.Parse(XmlHelper.GetNodeValue(skinNode));
                if (skinNode.Attributes["repository"] != null && string.IsNullOrEmpty(skinNode.Attributes["repository"].Value) == false)
                {
                    skinRepoGuid = skinNode.Attributes["repository"].Value;
                }
            }

            //Create a new package instance to record all the installed package adds - this is the same format as the created packages has.
            //save the package meta data
            var insPack = InstalledPackage.MakeNew(packName);

            insPack.Data.Author    = packAuthor;
            insPack.Data.AuthorUrl = packAuthorUrl;
            insPack.Data.Version   = packVersion;
            insPack.Data.Readme    = packReadme;
            insPack.Data.License   = packLicense;
            insPack.Data.Url       = packUrl;
            insPack.Data.IconUrl   = iconUrl;

            insPack.Data.PackageGuid    = guid;     //the package unique key.
            insPack.Data.RepositoryGuid = repoGuid; //the repository unique key, if the package is a file install, the repository will not get logged.
            insPack.Save();

            return(insPack.Data.Id);
        }