Ejemplo n.º 1
0
        private static void Sub1()
        {
            var temp = new KeyThread[threads.Length - 1];

            for (int i = 0; i < temp.Length; i++)
            {
                temp[i] = threads[i];
            }
            threads = temp;
        }
Ejemplo n.º 2
0
 public static int FindIndex(KeyThread thread)
 {
     for (int i = 0; i < threads.Length; i++)
     {
         if (threads[i] == thread)
         {
             return(i);
         }
     }
     return(-1);
 }
Ejemplo n.º 3
0
        public static KeyThread Sub(KeyThread thread)
        {
            KeyThread ret = null;

            for (int i = 0; i < threads.Length; i++)
            {
                if (threads[i] == thread)
                {
                    ret = threads[i];
                    for (int j = i; j < threads.Length - 1; j++)
                    {
                        threads[j] = threads[j + 1];
                    }
                }
            }
            if (ret != null)
            {
                Sub1();
            }
            return(ret);
        }
Ejemplo n.º 4
0
        public static void Add(Thread a, string key)
        {
            if (threads.Length != 0)
            {
                for (int i = 0; i < threads.Length; i++)
                {
                    if (threads[i].Key == key)
                    {
                        throw new ArgumentException("Cant assign 2 threads with the same key!");
                    }
                }
            }
            var temp = new KeyThread[threads.Length + 1];

            for (int i = 0; i < threads.Length; i++)
            {
                temp[i] = threads[i];
            }
            temp[temp.Length - 1] = new KeyThread(a, key);
            threads = temp;
        }