Пример #1
0
 private static void Insert8(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, int index, global::net.sf.jni4net.utils.JniLocalHandle value)
 {
     // (ILsystem/Object;)V
     // (ILSystem/Object;)V
     global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
     try {
         global::System.Collections.IList @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C <global::System.Collections.IList>(@__env, @__obj);
         @__real.Insert(index, global::net.sf.jni4net.utils.Convertor.FullJ2C <object>(@__env, value));
     }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); }
 }
Пример #2
0
        internal void ContributeFragment(byte msg_type, int length, byte[] buf, int off, int fragment_offset, int fragment_length)
        {
            int num = fragment_offset + fragment_length;

            if (mMsgType != msg_type || mBody.Length != length || num > length)
            {
                return;
            }
            if (fragment_length == 0)
            {
                if (fragment_offset == 0 && ((global::System.Collections.ICollection)mMissing).get_Count() > 0)
                {
                    Range range = (Range)mMissing.get_Item(0);
                    if (range.End == 0)
                    {
                        mMissing.RemoveAt(0);
                    }
                }
                return;
            }
            for (int i = 0; i < ((global::System.Collections.ICollection)mMissing).get_Count(); i++)
            {
                Range range2 = (Range)mMissing.get_Item(i);
                if (range2.Start >= num)
                {
                    break;
                }
                if (range2.End <= fragment_offset)
                {
                    continue;
                }
                int num2 = Math.Max(range2.Start, fragment_offset);
                int num3 = Math.Min(range2.End, num);
                int num4 = num3 - num2;
                global::System.Array.Copy((global::System.Array)buf, off + num2 - fragment_offset, (global::System.Array)mBody, num2, num4);
                if (num2 == range2.Start)
                {
                    if (num3 == range2.End)
                    {
                        mMissing.RemoveAt(i--);
                    }
                    else
                    {
                        range2.Start = num3;
                    }
                    continue;
                }
                if (num3 != range2.End)
                {
                    mMissing.Insert(++i, (object)new Range(num3, range2.End));
                }
                range2.End = num2;
            }
        }
 private static global::System.Collections.IList permuteList(global::System.Collections.IList arr, SecureRandom rand)
 {
     global::System.Collections.IList       list       = Platform.CreateArrayList(((global::System.Collections.ICollection)arr).get_Count());
     global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)arr).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             object current = enumerator.get_Current();
             int    num     = ((Random)rand).Next(((global::System.Collections.ICollection)list).get_Count() + 1);
             list.Insert(num, current);
         }
         return(list);
     }
     finally
     {
         global::System.IDisposable disposable = enumerator as global::System.IDisposable;
         if (disposable != null)
         {
             disposable.Dispose();
         }
     }
 }
Пример #4
0
        public static PgpSecretKeyRing InsertSecretKey(PgpSecretKeyRing secRing, PgpSecretKey secKey)
        {
            //IL_0066: Unknown result type (might be due to invalid IL or missing references)
            global::System.Collections.IList list = Platform.CreateArrayList((global::System.Collections.ICollection)secRing.keys);
            bool flag  = false;
            bool flag2 = false;

            for (int i = 0; i != ((global::System.Collections.ICollection)list).get_Count(); i++)
            {
                PgpSecretKey pgpSecretKey = (PgpSecretKey)list.get_Item(i);
                if (pgpSecretKey.KeyId == secKey.KeyId)
                {
                    flag = true;
                    list.set_Item(i, (object)secKey);
                }
                if (pgpSecretKey.IsMasterKey)
                {
                    flag2 = true;
                }
            }
            if (!flag)
            {
                if (secKey.IsMasterKey)
                {
                    if (flag2)
                    {
                        throw new ArgumentException("cannot add a master key to a ring that already has one");
                    }
                    list.Insert(0, (object)secKey);
                }
                else
                {
                    list.Add((object)secKey);
                }
            }
            return(new PgpSecretKeyRing(list, secRing.extraPubKeys));
        }
Пример #5
0
        public X509Name(bool reverse, IDictionary lookUp, string dirName, X509NameEntryConverter converter)
        {
            //IL_0054: Unknown result type (might be due to invalid IL or missing references)
            this.converter = converter;
            X509NameTokenizer x509NameTokenizer = new X509NameTokenizer(dirName);

            while (x509NameTokenizer.HasMoreTokens())
            {
                string text = x509NameTokenizer.NextToken();
                int    num  = text.IndexOf('=');
                if (num == -1)
                {
                    throw new ArgumentException("badly formated directory string");
                }
                string name  = text.Substring(0, num);
                string text2 = text.Substring(num + 1);
                DerObjectIdentifier derObjectIdentifier = DecodeOid(name, lookUp);
                if (text2.IndexOf('+') > 0)
                {
                    X509NameTokenizer x509NameTokenizer2 = new X509NameTokenizer(text2, '+');
                    string            text3 = x509NameTokenizer2.NextToken();
                    ordering.Add((object)derObjectIdentifier);
                    values.Add((object)text3);
                    added.Add((object)false);
                    while (x509NameTokenizer2.HasMoreTokens())
                    {
                        string text4 = x509NameTokenizer2.NextToken();
                        int    num2  = text4.IndexOf('=');
                        string name2 = text4.Substring(0, num2);
                        string text5 = text4.Substring(num2 + 1);
                        ordering.Add((object)DecodeOid(name2, lookUp));
                        values.Add((object)text5);
                        added.Add((object)true);
                    }
                }
                else
                {
                    ordering.Add((object)derObjectIdentifier);
                    values.Add((object)text2);
                    added.Add((object)false);
                }
            }
            if (!reverse)
            {
                return;
            }
            global::System.Collections.IList list  = Platform.CreateArrayList();
            global::System.Collections.IList list2 = Platform.CreateArrayList();
            global::System.Collections.IList list3 = Platform.CreateArrayList();
            int num3 = 1;

            for (int i = 0; i < ((global::System.Collections.ICollection)ordering).get_Count(); i++)
            {
                if (!(bool)added.get_Item(i))
                {
                    num3 = 0;
                }
                int num4 = num3++;
                list.Insert(num4, ordering.get_Item(i));
                list2.Insert(num4, values.get_Item(i));
                list3.Insert(num4, added.get_Item(i));
            }
            ordering = list;
            values   = list2;
            added    = list3;
        }