示例#1
0
        public void DeepCopy_1()
        {
            var p1 = ManifestUtilsTests.Get_TEZT_PATH();
            var p2 = p1 + "_2";

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

            using (var fs = new LocalFileSystem("L1"))
            {
                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);

                    Assert.IsTrue(ManifestUtils.HasTheSameContent(manifest1, manifest2));
                }
            }
        }
示例#2
0
        public void Install_1()
        {
            var source = ManifestUtilsTests.Get_TEZT_PATH();
            var target = source + "_INSTALLED";

            using (var fs = new LocalFileSystem("L1"))
            {
                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(target))
                    {
                        Console.WriteLine("Installed anew: " + install.CheckLocalAndInstallIfNeeded(set));
                    }
                }
                finally
                {
                    IOMiscUtils.EnsureFileEventuallyDeleted(fn);
                }
            }
        }