コード例 #1
0
ファイル: SettingTest.cs プロジェクト: shichongdong/Cube.Pdf
        public void Normalize()
        {
            var src = new SettingFolder(Assembly.GetExecutingAssembly());

            src.Normalize();

            var dest = src.Value;

            Assert.That(dest.Format, Is.EqualTo(Format.Pdf));
            Assert.That(dest.Resolution, Is.EqualTo(600));
            Assert.That(dest.Orientation, Is.EqualTo(Orientation.Auto));
            Assert.That(dest.Destination, Is.Not.Null.And.Not.Empty);

            var md = dest.Metadata;

            Assert.That(md.Title, Is.Empty);
            Assert.That(md.Author, Is.Empty);
            Assert.That(md.Subject, Is.Empty);
            Assert.That(md.Keywords, Is.Empty);
            Assert.That(md.Creator, Is.EqualTo("CubePDF"));
            Assert.That(md.Version.Major, Is.EqualTo(1));
            Assert.That(md.Version.Minor, Is.EqualTo(7));

            var pm = dest.Encryption.Permission;

            Assert.That(pm.Accessibility, Is.EqualTo(PermissionValue.Allow), nameof(pm.Accessibility));
            Assert.That(pm.CopyContents, Is.EqualTo(PermissionValue.Deny), nameof(pm.CopyContents));
            Assert.That(pm.InputForm, Is.EqualTo(PermissionValue.Deny), nameof(pm.InputForm));
            Assert.That(pm.ModifyAnnotations, Is.EqualTo(PermissionValue.Deny), nameof(pm.ModifyAnnotations));
            Assert.That(pm.ModifyContents, Is.EqualTo(PermissionValue.Deny), nameof(pm.ModifyContents));
            Assert.That(pm.Print, Is.EqualTo(PermissionValue.Deny), nameof(pm.Print));
        }
コード例 #2
0
        /* ----------------------------------------------------------------- */
        ///
        /// Create
        ///
        /// <summary>
        /// SettingFolder オブジェクトを生成します。
        /// </summary>
        ///
        /// <param name="args">プログラム引数一覧</param>
        ///
        /// <returns>SettingFolder</returns>
        ///
        /* ----------------------------------------------------------------- */
        protected SettingFolder Create(IEnumerable <string> args)
        {
            var asm  = typeof(MainWindow).Assembly;
            var fmt  = Cube.DataContract.Format.Registry;
            var path = $@"CubeSoft\CubePDF\{GetType().Name}";
            var dest = new SettingFolder(asm, fmt, path, IO);

            dest.Load();
            dest.Normalize();
            dest.Value.Destination = Results;
            dest.Value.Temp        = Get("Temp");
            dest.Set(args);

            return(dest);
        }