Пример #1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         makeDnObject(4);
     }
     if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         dn = new Dn(6);
     }
     if (Input.GetKeyDown(KeyCode.Alpha3))
     {
         dn = new Dn(8);
     }
     if (Input.GetKeyDown(KeyCode.Alpha4))
     {
         dn = new Dn(10);
     }
     if (Input.GetKeyDown(KeyCode.Alpha5))
     {
         dn = new Dn(12);
     }
     if (Input.GetKeyDown(KeyCode.Alpha6))
     {
         dn = new Dn(20);
     }
 }
        /// <summary>
        ///     Compares the two strings per the distinguishedNameMatch equality matching
        ///     (using case-ignore matching).  IllegalArgumentException is thrown if one
        ///     or both DNs are invalid.  UnsupportedOperationException is thrown if the
        ///     API implementation is not able to determine if the DNs match or not.
        /// </summary>
        /// <param name="dn1">
        ///     String form of the first DN to compare.
        /// </param>
        /// <param name="dn2">
        ///     String form of the second DN to compare.
        /// </param>
        /// <returns>
        ///     Returns true if the two strings correspond to the same DN; false
        ///     if the DNs are different.
        /// </returns>
        public static bool Equals(string dn1, string dn2)
        {
            var dnA = new Dn(dn1);
            var dnB = new Dn(dn2);

            return(dnA.Equals(dnB));
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected String createUserCN(String user, String group, String firstname, String lastname, String email) throws Exception
        protected internal virtual string createUserCN(string user, string group, string firstname, string lastname, string email)
        {
            Dn dn = new Dn("cn=" + lastname + "\\," + firstname + ",ou=" + group + ",o=camunda,c=org");

            createUser(user, firstname, lastname, email, dn);
            return(dn.NormName);
        }
Пример #4
0
 private void pass_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (Dn.Focus())
         {
             Dn_Click(pass, null);
         }
     }
 }
Пример #5
0
            private void gen18()
            {
                double part1, part2, part3, part4, part5, part6, Mn, ME, Dn, DE, MEn, DEn;

                part1     = r.Next(1, 8);
                part2     = r.Next(1, 10 - (int)part1);
                part3     = 10 - part1 - part2;
                part4     = r.Next(0, (int)part1) / 10d;
                part1     = Math.Abs(part1 / 10d - part4);
                part5     = r.Next(0, (int)part2) / 10d;
                part2     = Math.Abs(part2 / 10d - part5);
                part6     = r.Next(0, (int)part3) / 10d;
                part3     = Math.Abs(part3 / 10d - part6);
                paragraph = document.InsertParagraph();
                paragraph.AppendLine("18.  ").Font(font).FontSize(12).Bold().Alignment = Alignment.left;
                paragraph.Append("Дана таблица распределения вероятностей двумерной случайной величины (y,x)").Font(font).FontSize(12);
                Table table = document.AddTable(3, 4);

                table.Alignment = Alignment.center;
                table.SetColumnWidth(0, 40);
                table.SetColumnWidth(1, 40);
                table.SetColumnWidth(2, 40);
                table.SetColumnWidth(3, 40);
                table.Rows[0].Cells[0].Paragraphs[0].Append("y/x").Alignment            = Alignment.center;
                table.Rows[0].Cells[1].Paragraphs[0].Append("-1").Alignment             = Alignment.center;
                table.Rows[0].Cells[2].Paragraphs[0].Append("0").Alignment              = Alignment.center;
                table.Rows[0].Cells[3].Paragraphs[0].Append("1").Alignment              = Alignment.center;
                table.Rows[1].Cells[0].Paragraphs[0].Append("0").Alignment              = Alignment.center;
                table.Rows[2].Cells[0].Paragraphs[0].Append("1").Alignment              = Alignment.center;
                table.Rows[1].Cells[1].Paragraphs[0].Append(part1.ToString()).Alignment = Alignment.center;
                table.Rows[1].Cells[2].Paragraphs[0].Append(part2.ToString()).Alignment = Alignment.center;
                table.Rows[1].Cells[3].Paragraphs[0].Append(part3.ToString()).Alignment = Alignment.center;
                table.Rows[2].Cells[1].Paragraphs[0].Append(part4.ToString()).Alignment = Alignment.center;
                table.Rows[2].Cells[2].Paragraphs[0].Append(part5.ToString()).Alignment = Alignment.center;
                table.Rows[2].Cells[3].Paragraphs[0].Append(part6.ToString()).Alignment = Alignment.center;

                paragraph = document.InsertParagraph();
                paragraph.InsertTableBeforeSelf(table);
                paragraph.Append("Найти М(y), М(x), М(yx), D(y), D(x), D(yx).").Font(font).FontSize(12);
                ME = part4 + part5 + part6;
                DE = part4 + part5 + part6 - ME * ME;
                Mn = (part1 + part4) * (-1) + part3 + part6;
                Dn = (part1 + part4) + part3 + part6 - Mn * Mn;

                MEn = 1d * (-1d) * part4 + 1d * 1d * part6;
                DEn = 1d * 1d * part4 + 1d * 1d * part6 - MEn * MEn;
                allresult[variantIterator] += "\n18. М(y)= " + ME.ToString() +
                                              "\n      D(y)= " + doubleNormalize(DE.ToString()) +
                                              "\n      М(x)= " + doubleNormalize(Mn.ToString()) +
                                              "\n      D(x)= " + doubleNormalize(Dn.ToString()) +
                                              "\n      М(yx)= " + doubleNormalize(MEn.ToString()) +
                                              "\n      D(yx)= " + doubleNormalize(DEn.ToString()) + ". ";
            }
Пример #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void createGroup(String name) throws javax.naming.InvalidNameException, Exception, javax.naming.NamingException
        public virtual void createGroup(string name)
        {
            Dn dn = new Dn("ou=" + name + ",o=camunda,c=org");

            if (!service.AdminSession.exists(dn))
            {
                Entry entry = service.newEntry(dn);
                entry.add("objectClass", "top", "organizationalUnit");
                entry.add("ou", name);
                service.AdminSession.add(entry);
                Console.WriteLine("created entry: " + dn.NormName);
            }
        }
Пример #7
0
        /// <summary>
        /// Initialize the server. It creates the partition, adds the index, and
        /// injects the context entries for the created partitions.
        /// </summary>
        /// <exception cref="Exception"> if there were some problems while initializing the system </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void initializeDirectory() throws Exception
        protected internal virtual void initializeDirectory()
        {
            workingDirectory.mkdirs();

            service = new DefaultDirectoryService();
            InstanceLayout il = new InstanceLayout(workingDirectory);

            service.InstanceLayout = il;

            CacheService cacheService = new CacheService();

            cacheService.initialize(service.InstanceLayout);
            service.CacheService = cacheService;

            initSchemaPartition();

            // then the system partition
            // this is a MANDATORY partition
            // DO NOT add this via addPartition() method, trunk code complains about duplicate partition
            // while initializing
            JdbmPartition systemPartition = new JdbmPartition(service.SchemaManager, service.DnFactory);

            systemPartition.Id            = "system";
            systemPartition.PartitionPath = (new File(service.InstanceLayout.PartitionsDirectory, systemPartition.Id)).toURI();
            systemPartition.SuffixDn      = new Dn(ServerDNConstants.SYSTEM_DN);
            systemPartition.SchemaManager = service.SchemaManager;

            // mandatory to call this method to set the system partition
            // Note: this system partition might be removed from trunk
            service.SystemPartition = systemPartition;

            // Disable the ChangeLog system
            service.ChangeLog.Enabled         = false;
            service.DenormalizeOpAttrsEnabled = true;

            Partition camundaPartition = addPartition("camunda", BASE_DN, service.DnFactory);

            addIndex(camundaPartition, "objectClass", "ou", "uid");

            service.startup();

            // Create the root entry
            if (!service.AdminSession.exists(camundaPartition.SuffixDn))
            {
                Dn    dn    = new Dn(BASE_DN);
                Entry entry = service.newEntry(dn);
                entry.add("objectClass", "top", "domain", "extensibleObject");
                entry.add("dc", "camunda");
                service.AdminSession.add(entry);
            }
        }
Пример #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void createRole(String roleName, String... users) throws Exception
        protected internal virtual void createRole(string roleName, params string[] users)
        {
            Dn dn = new Dn("ou=" + roleName + ",o=camunda,c=org");

            if (!service.AdminSession.exists(dn))
            {
                Entry entry = service.newEntry(dn);
                entry.add("objectClass", "top", "groupOfNames");
                entry.add("cn", roleName);
                foreach (string user in users)
                {
                    entry.add("member", user);
                }
                service.AdminSession.add(entry);
            }
        }
Пример #9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void createPosixGroup(String gid, String name, String... memberUids) throws Exception
        protected internal virtual void createPosixGroup(string gid, string name, params string[] memberUids)
        {
            Dn dn = new Dn("cn=" + name + ",ou=groups,o=camunda,c=org");

            if (!service.AdminSession.exists(dn))
            {
                Entry entry = service.newEntry(dn);
                entry.add("objectClass", "top", "posixGroup");
                entry.add("cn", name);
                entry.add("gidNumber", gid);
                foreach (string memberUid in memberUids)
                {
                    entry.add("memberUid", memberUid);
                }
                service.AdminSession.add(entry);
            }
        }
Пример #10
0
        private NodeBodyUpdate GetSignerProperties(ValidateResponse pdfValidation, ValidateCertificateResponse certValidation, bool isSigned)
        {
            var publisher = Dn.Parse(pdfValidation?.Report?.sigInfos[0]?.signCert?.Issuer);
            var holder    = Dn.Parse(pdfValidation?.Report?.sigInfos[0]?.signCert?.Subject);
            var verifier  = Dn.Parse(GetVerifier(pdfValidation?.XMLReport));

            return(new NodeBodyUpdate()
                   .AddProperty(SpisumNames.Properties.FileIsSigned, isSigned)
                   .AddProperty(SpisumNames.Properties.UsedTime, pdfValidation?.Report?.CreationDateTime)
                   .AddProperty(SpisumNames.Properties.VerificationTime, pdfValidation?.Report?.validationProperties?.ValidationTime)
                   .AddProperty(SpisumNames.Properties.ValiditySafetyElement, pdfValidation?.Report?.globalStatus switch
            {
                SignerNames.Ok => SpisumNames.Signer.Valid,
                SignerNames.Warning => SpisumNames.Signer.ValidityAssessed,
                SignerNames.Error => SpisumNames.Signer.NotValid,
                _ => null
            })
Пример #11
0
    public void makeDnObject(int face)
    {
        string name = face.ToString();

        mt = new GameObject("D" + name);
        mt.transform.position = new Vector3(0, 1, 0);

        mt.AddComponent <MeshFilter>();
        mt.AddComponent <MeshCollider>();
        mt.AddComponent <MeshRenderer>();

        dn = new Dn(face);
        UpdateMesh();
        mesh                    = mt.GetComponent <MeshFilter>().mesh;
        meshCollider            = mt.GetComponent <MeshCollider>();
        meshCollider.sharedMesh = mesh;
        meshRend                = mt.GetComponent <MeshRenderer>();
    }
Пример #12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void init() throws Exception
        public override void init()
        {
            initializeDirectory();

            // Enable POSIX groups in ApacheDS
            Dn nis = new Dn("cn=nis,ou=schema");

            if (service.AdminSession.exists(nis))
            {
                Entry     entry       = service.AdminSession.lookup(nis);
                Attribute nisDisabled = entry.get("m-disabled");
                if (null != nisDisabled && "TRUE".Equals(nisDisabled.String, StringComparison.OrdinalIgnoreCase))
                {
                    nisDisabled.remove("TRUE");
                    nisDisabled.add("FALSE");
                    IList <Modification> modifications = new List <Modification>();
                    modifications.Add(new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, nisDisabled));
                    service.AdminSession.modify(nis, modifications);
                    service.shutdown();
                    initializeDirectory();     // Note: This instantiates service again for schema modifications to take effect.
                }
            }

            startServer();

            createGroup("office-berlin");
            createUserUid("daniel", "office-berlin", "Daniel", "Meyer", "*****@*****.**");

            createGroup("people");
            createUserUid("ruecker", "people", "Bernd", "Ruecker", "*****@*****.**");
            createUserUid("monster", "people", "Cookie", "Monster", "*****@*****.**");
            createUserUid("fozzie", "people", "Bear", "Fozzie", "*****@*****.**");

            createGroup("groups");
            createPosixGroup("1", "posix-group-without-members");
            createPosixGroup("2", "posix-group-with-members", "fozzie", "monster", "ruecker");
        }
        /// <summary>
        ///     Returns the DN normalized by removal of non-significant space characters
        ///     as per RFC 2253, section4.
        /// </summary>
        /// <returns>
        ///     a normalized string.
        /// </returns>
        public static string Normalize(string dn)
        {
            var testDn = new Dn(dn);

            return(testDn.ToString());
        }
        /// <summary>
        ///     Returns the individual components of a distinguished name (DN).
        /// </summary>
        /// <param name="dn">
        ///     The distinguished name, for example, "cn=Babs
        ///     Jensen,ou=Accounting,o=Acme,c=US".
        /// </param>
        /// <param name="noTypes">
        ///     If true, returns only the values of the
        ///     components and not the names.  For example, "Babs
        ///     Jensen", "Accounting", "Acme", "US" instead of
        ///     "cn=Babs Jensen", "ou=Accounting", "o=Acme", and
        ///     "c=US".
        /// </param>
        /// <returns>
        ///     An array of strings representing the individual components
        ///     of a DN, or null if the DN is not valid.
        /// </returns>
        public static string[] ExplodeDn(string dn, bool noTypes)
        {
            var dnToExplode = new Dn(dn);

            return(dnToExplode.ExplodeDn(noTypes));
        }
Пример #15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void createUser(String user, String firstname, String lastname, String email, org.apache.directory.api.ldap.model.name.Dn dn) throws Exception, javax.naming.NamingException, UnsupportedEncodingException
        protected internal virtual void createUser(string user, string firstname, string lastname, string email, Dn dn)
        {
            if (!service.AdminSession.exists(dn))
            {
                Entry entry = service.newEntry(dn);
                entry.add("objectClass", "top", "person", "inetOrgPerson");   //, "extensibleObject"); //make extensible to allow for the "memberOf" field
                entry.add("uid", user);
                entry.add("cn", firstname);
                entry.add("sn", lastname);
                entry.add("mail", email);
                entry.add("userPassword", user.GetBytes(Encoding.UTF8));
                service.AdminSession.add(entry);
                Console.WriteLine("created entry: " + dn.NormName);
            }
        }