Exemplo n.º 1
0
        public void Install_1()
        {
            var source = ManifestUtilsTests.Get_TEZT_PATH();
            var target = source + "_INSTALLED";

            using (var fs = new LocalFileSystem(NOPApplication.Instance))
            {
                var session   = fs.StartSession();
                var sourceDir = session[source] as FileSystemDirectory;

                var manifest = ManifestUtils.GeneratePackagingManifest(sourceDir, packageName: "Package1");
                var fn       = Path.Combine(source, ManifestUtils.MANIFEST_FILE_NAME);
                try
                {
                    manifest.Configuration.ToLaconicFile(fn);


                    var set = new List <LocalInstallation.PackageInfo>
                    {
                        new LocalInstallation.PackageInfo("Package1", sourceDir, null)//no relative path
                    };


                    using (var install = new LocalInstallation(fs.App, target))
                    {
                        Console.WriteLine("Installed anew: " + install.CheckLocalAndInstallIfNeeded(set));
                    }
                }
                finally
                {
                    IOUtils.EnsureFileEventuallyDeleted(fn);
                }
            }
        }
Exemplo n.º 2
0
        public void DeepCopy_1()
        {
            var p1 = ManifestUtilsTests.Get_TEZT_PATH();
            var p2 = p1 + "_2";

            IOUtils.EnsureDirectoryDeleted(p2);
            Directory.CreateDirectory(p2);

            using (var fs = new LocalFileSystem(NOPApplication.Instance))
            {
                using (var session = fs.StartSession())
                {
                    var fromDir   = session[p1] as FileSystemDirectory;
                    var manifest1 = ManifestUtils.GeneratePackagingManifest(fromDir);

                    var toDir = session[p2] as FileSystemDirectory;

                    fromDir.DeepCopyTo(toDir, FileSystemDirectory.DirCopyFlags.Directories | FileSystemDirectory.DirCopyFlags.Files);
                    var manifest2 = ManifestUtils.GeneratePackagingManifest(toDir);


                    Console.WriteLine(manifest1.Configuration.ContentView);

                    Aver.IsTrue(ManifestUtils.HasTheSameContent(manifest1, manifest2));
                }
            }
        }