示例#1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="collection"></param>
 /// <returns></returns>
 public override bool AddAll(ICollection <E> collection)
 {
     if (0 == collection.Count || this == collection)
     {
         return(false);
     }
     if (collection is EnumSet <E> )
     {
         EnumSet <E> set = (EnumSet <E>)collection;
         if (!IsValidType(set.elementClass))
         {
             throw new Exception("ClassCastException");
         }
         HugeEnumSet <E> hugeSet       = (HugeEnumSet <E>)set;
         bool            addSuccessful = false;
         for (int i = 0; i < bits.Length; i++)
         {
             oldBits  = bits[i];
             bits[i] |= hugeSet.bits[i];
             if (oldBits != bits[i])
             {
                 addSuccessful = true;
                 size          = size - Int64Helper.BitCount(oldBits)
                                 + Int64Helper.BitCount(bits[i]);
             }
         }
         return(addSuccessful);
     }
     return(base.AddAll(collection));
 }
示例#2
0
        /// <summary>
        /// Adds all of the elements of the "c" collection to the "target" collection.
        /// </summary>
        /// <param name="target">Collection where the new elements will be added.</param>
        /// <param name="c">Collection whose elements will be added.</param>
        /// <returns>Returns true if at least one element was added, false otherwise.</returns>
        public static bool AddAll(System.Collections.ICollection target, System.Collections.ICollection c)
        {
            System.Collections.IEnumerator e = new System.Collections.ArrayList(c).GetEnumerator();
            bool added = false;

            //Reflection. Invoke "addAll" method for proprietary classes
            System.Reflection.MethodInfo method;
            try
            {
                method = target.GetType().GetMethod("addAll");

                if (method != null)
                {
                    added = (bool)method.Invoke(target, new System.Object[] { c });
                }
                else
                {
                    method = target.GetType().GetMethod("Add");
                    while (e.MoveNext() == true)
                    {
                        bool tempBAdded = (int)method.Invoke(target, new System.Object[] { e.Current }) >= 0;
                        added = added ? added : tempBAdded;
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            return(added);
        }
示例#3
0
 public static void Apply(System.Collections.ICollection coll, FunctionDelegate <object> func)
 {
     foreach (object obj in coll)
     {
         func(obj);
     }
 }
示例#4
0
        /// <summary>
        /// Adds a new element to the specified collection.
        /// </summary>
        /// <param name="c">Collection where the new element will be added.</param>
        /// <param name="obj">Object to add.</param>
        /// <returns>true</returns>
        public static bool Add(System.Collections.ICollection c, System.Object obj)
        {
            bool added = false;

            //Reflection. Invoke either the "add" or "Add" method.
            System.Reflection.MethodInfo method;
            try
            {
                //Get the "add" method for proprietary classes
                method = c.GetType().GetMethod("Add");
                if (method == null)
                {
                    method = c.GetType().GetMethod("add");
                }
                int index = (int)method.Invoke(c, new System.Object[] { obj });
                if (index >= 0)
                {
                    added = true;
                }
            }
            catch (System.Exception e)
            {
                throw e;
            }
            return(added);
        }
示例#5
0
        /// <summary>
        /// Retains the elements in the target collection that are contained in the specified collection
        /// </summary>
        /// <param name="target">Collection where the elements will be removed.</param>
        /// <param name="c">Elements to be retained in the target collection.</param>
        /// <returns>true</returns>
        public static bool RetainAll(System.Collections.ICollection target, System.Collections.ICollection c)
        {
            System.Collections.IEnumerator e  = new System.Collections.ArrayList(target).GetEnumerator();
            System.Collections.ArrayList   al = new System.Collections.ArrayList(c);

            //Reflection. Invoke "retainAll" method for proprietary classes or "Remove" for each element in the collection
            System.Reflection.MethodInfo method;
            try
            {
                method = c.GetType().GetMethod("retainAll");

                if (method != null)
                {
                    method.Invoke(target, new System.Object[] { c });
                }
                else
                {
                    method = c.GetType().GetMethod("Remove");

                    while (e.MoveNext() == true)
                    {
                        if (al.Contains(e.Current) == false)
                        {
                            method.Invoke(target, new System.Object[] { e.Current });
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }

            return(true);
        }
        /// <summary>
        /// Removes all the elements from the collection.
        /// </summary>
        /// <param name="c">The collection to remove elements.</param>
        public static void Clear(System.Collections.ICollection c)
        {
            //Reflection. Invoke "Clear" method or "clear" method for proprietary classes
            System.Reflection.MethodInfo method;
            try
            {
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                method = Type_WP_8_1.Type.GetMethod(c.GetType(), "Clear");
#else
                method = c.GetType().GetMethod("Clear");
#endif
                if (method == null)
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                { method = Type_WP_8_1.Type.GetMethod(c.GetType(), "clear"); }
#else
                { method = c.GetType().GetMethod("clear"); }
#endif

                method.Invoke(c, new System.Object[] {});
            }
            catch (System.Exception e)
            {
                throw e;
            }
        }
示例#7
0
        /// <summary>
        /// Removes the specified element from the collection.
        /// </summary>
        /// <param name="c">The collection where the element will be removed.</param>
        /// <param name="obj">The element to remove from the collection.</param>
        public static bool Remove(System.Collections.ICollection c, System.Object obj)
        {
            bool changed = false;

            //Reflection. Invoke "remove" method for proprietary classes or "Remove" method
            System.Reflection.MethodInfo method;
            try
            {
                method = c.GetType().GetMethod("remove");

                if (method != null)
                {
                    method.Invoke(c, new System.Object[] { obj });
                }
                else
                {
                    method  = c.GetType().GetMethod("Contains");
                    changed = (bool)method.Invoke(c, new System.Object[] { obj });
                    method  = c.GetType().GetMethod("Remove");
                    method.Invoke(c, new System.Object[] { obj });
                }
            }
            catch (System.Exception e)
            {
                throw e;
            }

            return(changed);
        }
示例#8
0
        public object Serialize(System.Collections.ICollection objects)
        {
            ComponentSerializationService componentSerializationService = _serviceProvider.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;
            SerializationStore            returnObject = null;

            using (SerializationStore serializationStore = componentSerializationService.CreateStore())
            {
                foreach (object obj in objects)
                {
                    if (obj is Control control)
                    {
                        //if (control is SMGroup group)
                        //{
                        //    foreach (object obj2 in control.Controls)
                        //    {
                        //        componentSerializationService.Serialize(serializationStore, obj2);
                        //    }
                        //}
                        //if(control is SplitContainerControl split)
                        //{
                        //    componentSerializationService.SerializeAbsolute(serializationStore, split.Panel1.Controls[0]);
                        //    componentSerializationService.SerializeAbsolute(serializationStore, split.Panel2.Controls[0]);
                        //}
                        componentSerializationService.SerializeAbsolute(serializationStore, obj);
                    }
                    returnObject = serializationStore;
                }
            }
            return(returnObject);
        }
示例#9
0
        public CasoDeUso(String nome, String resumo, String preCondicoes,
                         String posCondicoes, FluxoBasico fluxoBasico, System.Collections.ICollection subFluxos,
                         System.Collections.ICollection atores, Projeto projeto, Usuario usuario,
                         ICollection casosDeUsoIncluidos, ICollection casosDeUsoExtendidos)
        {
            this.Nome         = nome;
            this.Resumo       = resumo;
            this.PreCondicoes = preCondicoes;
            this.PosCondicoes = posCondicoes;
            this.FluxosBasicos.Add(fluxoBasico);
            fluxoBasico.CasoDeUso = this;
            this.SubFluxos.AddAll(subFluxos);
            foreach (SubFluxo subFluxo in subFluxos)
            {
                subFluxo.CasoDeUso = this;
                subFluxo.FluxoPai  = fluxoBasico;
            }
            if (atores.Count < 1)
            {
                throw new NegocioException("É necessário pelo menos um ator para criar um caso de uso. ");
            }
            this.AtoresEnvolvidos.AddAll(atores);
            this.Projeto = projeto;

            AdicionarHistorico("Criação do documento. ", usuario);
            this.CasosDeUsoIncluidos.AddAll(casosDeUsoIncluidos);
            this.CasosDeUsoExtendidos.AddAll(casosDeUsoExtendidos);

            IRepositoryCasoDeUso repositorioCasoDeUso = (IRepositoryCasoDeUso)AbstractFactoryRepository.GetInstance(
                ConfigurationManager.AppSettings["METODO_FABRICA"]).GetRepository("CasoDeUso");

            this.Codigo = repositorioCasoDeUso.GetMaxCodigo(this.projeto.Id) + 1;
        }
示例#10
0
        /// <summary>
        /// PostFlush
        /// </summary>
        /// <param name="entities"></param>
        public override void PostFlush(System.Collections.ICollection entities)
        {
            try
            {
                if (m_logRecords.Count > 0)
                {
                    AuditLogRecord log = CreateNew(null, null, AuditLogType.TransactionBegin);
                    m_session.Save(log);

                    for (int i = 0; i < m_logRecords.Count; ++i)
                    {
                        m_session.Save(m_logRecords[i]);
                    }

                    log = CreateNew(null, null, AuditLogType.TransactionCompletion);
                    m_session.Save(log);
                }
            }
            catch (HibernateException ex)
            {
                throw new CallbackException(ex);
            }
            finally
            {
                m_logRecords.Clear();
            }
        }
    static void ICollection_SyncRoot(JSVCall vc)
    {
        System.Collections.ICollection _this = (System.Collections.ICollection)vc.csObj;
        var result = _this.SyncRoot;

        JSMgr.datax.setWhatever((int)JSApi.SetType.Rval, result);
    }
示例#12
0
        /// <inheritdoc/>
        public override bool TrySetDeletedPropertyValue(string name, System.Collections.ICollection value)
        {
            // TODO: already existing key?
            _deletedResources.Add(name, value);

            return(true);
        }
示例#13
0
        /// <summary>
        /// 序列化控件,包括容器控件的子控件
        /// </summary>
        /// <param name="objects"></param>
        /// <returns></returns>
        public object Serialize(System.Collections.ICollection objects)
        {
            List <EntityFormCtrl> serializedData = new List <EntityFormCtrl>();

            System.Collections.ICollection comps = objects;
            if (comps == null)
            {
                return(serializedData);
            }

            Hashtable nametable = new Hashtable();

            serializedData.Clear();
            foreach (IComponent comp in comps)
            {
                //等LayoutControl内部内容都加载到serializedData以后再次处理
                if (!nametable.ContainsKey(comp) && !(comp is DevExpress.XtraTab.XtraTabPage) && !(comp is DevExpress.XtraLayout.LayoutControl))
                {
                    SerializeControl(nametable, string.Empty, comp, serializedData, true);
                }
            }

            foreach (IComponent comp in comps)
            {
                //处理LayoutControl的关系
                if (!nametable.ContainsKey(comp) && !(comp is DevExpress.XtraTab.XtraTabPage))
                {
                    SerializeControl(nametable, string.Empty, comp, serializedData, false);
                }
            }

            SerializeControl(nametable, string.Empty, this.designerHost.RootComponent, serializedData, false);
            return(serializedData);
        }
示例#14
0
 /// <summary>
 /// Constructora que inicializa los valores de la acción con valores dados.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="obj"></param>
 /// <param name="dictionary"></param>
 /// <param name="isAdd"></param>
 public AddDelListAction(object key, object obj, System.Collections.ICollection dictionary, bool isAdd)
 {
     this.key        = key;
     this.obj        = obj;
     this.collection = dictionary;
     this.isAdd      = isAdd;
 }
示例#15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="collection"></param>
        /// <returns></returns>
        public override bool RemoveAll(ICollection <E> collection)
        {
            if (0 == collection.Count)
            {
                return(false);
            }

            if (collection is EnumSet <E> )
            {
                EnumSet <E> set = (EnumSet <E>)collection;
                if (!IsValidType(set.elementClass))
                {
                    return(false);
                }
                bool removeSuccessful = false;
                long mask             = 0;
                for (int i = 0; i < bits.Length; i++)
                {
                    oldBits = bits[i];
                    mask    = bits[i] & ((HugeEnumSet <E>)set).bits[i];
                    if (mask != 0)
                    {
                        bits[i]         -= mask;
                        size             = (size - Int64Helper.BitCount(oldBits) + Int64Helper.BitCount(bits[i]));
                        removeSuccessful = true;
                    }
                }
                return(removeSuccessful);
            }
            return(base.RemoveAll(collection));
        }
示例#16
0
        /// <summary>
        /// Determines whether the collection contains all the elements in the specified collection.
        /// </summary>
        /// <param name="target">The collection to check.</param>
        /// <param name="c">Collection whose elements would be checked for containment.</param>
        /// <returns>true id the target collection contains all the elements of the specified collection.</returns>
        public static bool ContainsAll(System.Collections.ICollection target, System.Collections.ICollection c)
        {
            System.Collections.IEnumerator e = c.GetEnumerator();

            bool contains = false;

            //Reflection. Invoke "containsAll" method for proprietary classes or "Contains" method for each element in the collection
            System.Reflection.MethodInfo method;
            try
            {
                method = target.GetType().GetMethod("containsAll");

                if (method != null)
                {
                    contains = (bool)method.Invoke(target, new Object[] { c });
                }
                else
                {
                    method = target.GetType().GetMethod("Contains");
                    while (e.MoveNext() == true)
                    {
                        if ((contains = (bool)method.Invoke(target, new Object[] { e.Current })) == false)
                        {
                            break;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }

            return(contains);
        }
示例#17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="collection"></param>
        /// <returns></returns>
        public override bool RetainAll(ICollection <E> collection)
        {
            if (collection is EnumSet <E> )
            {
                EnumSet <E> set = (EnumSet <E>)collection;
                if (!IsValidType(set.elementClass))
                {
                    Clear();
                    return(true);
                }

                bool retainSuccessful = false;
                oldBits = 0;
                for (int i = 0; i < bits.Length; i++)
                {
                    oldBits  = bits[i];
                    bits[i] &= ((HugeEnumSet <E>)set).bits[i];
                    if (oldBits != bits[i])
                    {
                        size = size - Int64Helper.BitCount(oldBits)
                               + Int64Helper.BitCount(bits[i]);
                        retainSuccessful = true;
                    }
                }
                return(retainSuccessful);
            }
            return(base.RetainAll(collection));
        }
 private static IRecord CreateRecord(object item, System.Collections.Generic.IList <string> aliases)
 {
     System.Collections.ICollection collection = item as System.Collections.ICollection;
     if (collection != null)
     {
         System.Collections.Generic.List <object> list = collection.Cast <object>().ToList <object>();
         if (aliases != null && aliases.Count != list.Count)
         {
             aliases = null;
         }
         if (list.Count != 1)
         {
             int counter             = 0;
             DictionaryRecord record = new DictionaryRecord();
             list.ForEach(delegate(object obj)
             {
                 record.SetValue((aliases != null) ? aliases[counter++] : ("Value" + ++counter), obj);
             });
             return(record);
         }
         if (aliases != null)
         {
             aliases[0] = Pluralizer.ToSingular(aliases[0]);
         }
         item = list[0];
     }
     if (aliases == null || aliases.Count != 1)
     {
         return(RecordBase.CreateRecord(item));
     }
     return(RecordBase.CreateRecord(item, aliases[0]));
 }
////////////////////// ICollection ///////////////////////////////////////
// constructors

// fields

// properties
    static void ICollection_Count(JSVCall vc)
    {
        System.Collections.ICollection _this = (System.Collections.ICollection)vc.csObj;
        var result = _this.Count;

        JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result));
    }
 /// <summary>
 /// Constructora que inicializa los valores de la acción con valores dados.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="obj"></param>
 /// <param name="dictionary"></param>
 /// <param name="isAdd"></param>
 public AddDelListAction(object key, object obj, System.Collections.ICollection dictionary, bool isAdd)
 {
     this.key = key;
     this.obj = obj;
     this.collection = dictionary;
     this.isAdd = isAdd;
 }
        /// <summary>
        /// Determines whether the collection contains the specified element.
        /// </summary>
        /// <param name="c">The collection to check.</param>
        /// <param name="obj">The object to locate in the collection.</param>
        /// <returns>true if the element is in the collection.</returns>
        public static bool Contains(System.Collections.ICollection c, System.Object obj)
        {
            bool contains = false;

            //Reflection. Invoke "contains" method for proprietary classes
            System.Reflection.MethodInfo method;
            try
            {
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                method = Type_WP_8_1.Type.GetMethod(c.GetType(), "Contains");
#else
                method = c.GetType().GetMethod("Contains");
#endif
                if (method == null)
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                { method = Type_WP_8_1.Type.GetMethod(c.GetType(), "contains"); }
#else
                { method = c.GetType().GetMethod("contains"); }
#endif

                contains = (bool)method.Invoke(c, new System.Object[] { obj });
            }
            catch (System.Exception e)
            {
                throw e;
            }

            return(contains);
        }
    static void ICollection_IsSynchronized(JSVCall vc)
    {
        System.Collections.ICollection _this = (System.Collections.ICollection)vc.csObj;
        var result = _this.IsSynchronized;

        JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
    }
示例#23
0
        public CasoDeUso CriarNovoCasoDeUso(String nome, String resumo, String preCondicoes,
                                            String posCondicoes, Projeto projeto, Usuario usuario,
                                            FluxoBasico fluxoBasico, System.Collections.ICollection subFluxos,
                                            System.Collections.ICollection atores, ICollection casosDeUsoIncluidos,
                                            ICollection casosDeUsoExtendidos)
        {
            try
            {
                CasoDeUso casoUso = new CasoDeUso(nome, resumo, preCondicoes,
                                                  posCondicoes, fluxoBasico, subFluxos, atores, projeto, usuario,
                                                  casosDeUsoIncluidos, casosDeUsoExtendidos);

                repositorioCasoDeUso.Add(casoUso);
                return(casoUso);
            }
            catch (NegocioException nex)
            {
                throw nex;
            }
            catch (ArgumentOutOfRangeException aor)
            {
                throw new NegocioException(aor.Message + " Valor inserido: " + aor.ActualValue.ToString());
            }
            catch (DaoException daoex)
            {
                throw new NegocioException("Erro ao adicionar ao repositório. ", daoex);
            }
        }
示例#24
0
        public override bool RemoveAll(ICollection <E> collection)
        {
            bool result = false;

            if (Count <= collection.Count)
            {
                IIterator <E> it = Iterator();
                while (it.HasNext())
                {
                    if (collection.Contains(it.Next()))
                    {
                        it.Remove();
                        result = true;
                    }
                }
            }
            else
            {
                foreach (E e in collection)
                {
                    result = Remove(e) || result;
                }
            }
            return(result);
        }
        /// <summary>
        /// Adds a new element to the specified collection.
        /// </summary>
        /// <param name="c">Collection where the new element will be added.</param>
        /// <param name="obj">Object to add.</param>
        /// <returns>true</returns>
        public static bool Add(System.Collections.ICollection c, System.Object obj)
        {
            bool added = false;

            //Reflection. Invoke either the "add" or "Add" method.
            System.Reflection.MethodInfo method;
            try
            {
                //Get the "add" method for proprietary classes
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                method = Type_WP_8_1.Type.GetMethod(c.GetType(), "Add");
#else
                method = c.GetType().GetMethod("Add");
#endif
                if (method == null)
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                { method = Type_WP_8_1.Type.GetMethod(c.GetType(), "add"); }
#else
                { method = c.GetType().GetMethod("add"); }
#endif
                int index = (int)method.Invoke(c, new System.Object[] { obj });
                if (index >= 0)
                {
                    added = true;
                }
            }
            catch (System.Exception e)
            {
                throw e;
            }
            return(added);
        }
示例#26
0
        private void Init(string description, string title, ICollection types)
        {
            this.description = description;
            this.title       = title;
            this.types       = types;

            control = new ZedGraphControl();
        }
示例#27
0
		private void Init( string description, string title, ICollection types )
		{
			this.description = description;
			this.title = title;
			this.types = types;

			control = new ZedGraphControl();
		}
 public void SetSelectedComponents(System.Collections.ICollection components, SelectionTypes selectionType)
 {
     //TODO: Use .NET 2.0 SelectionTypes Primary, Add, Replace, Remove, Toggle
     if ((selectionType & SelectionTypes.Valid) == SelectionTypes.Valid)
     {
         SetSelectedComponents(components);
     }
 }
示例#29
0
        public static List <T> ToList <T>(this System.Collections.ICollection collection)
        {
            var list = new List <T>(collection.Count);

            list.AddRange(collection.Cast <T>());

            return(list);
        }
示例#30
0
 internal static System.Collections.IList CreateArrayList(System.Collections.ICollection collection)
 {
     System.Collections.IList result = new List <object>(collection.Count);
     foreach (object o in collection)
     {
         result.Add(o);
     }
     return(result);
 }
示例#31
0
        public static IList <T> Cast <T>(System.Collections.ICollection coll)
        {
            var result = new List <T>(coll.Count);

            foreach (object obj in coll)
            {
                result.Add((T)obj);
            }
            return(result);
        }
示例#32
0
        public static System.Collections.IList Transform(System.Collections.ICollection coll, FunctionDelegate <object> func)
        {
            var result = new List <object>();

            foreach (object obj in coll)
            {
                result.Add(func(obj));
            }
            return(result);
        }
示例#33
0
 private void supplier_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
 {
     if (bySupplierRadio.IsChecked.Value)
     {
         Company supplier = supplierList.SelectedItem as Company;
         ReportItems = DBResources.Instance.Context.SP_JoGRN(SupplierID, JobOrderId).ToList();
     }
 }
示例#34
0
 private void getBtn_Click_1(object sender, RoutedEventArgs e)
 {
     if (byJoNumber.IsChecked.Value)
         ReportItems = DBResources.Instance.Context.SP_JoGRN(SupplierID, JobOrderId).ToList();
 }
示例#35
0
		/// <summary>Initializes the <code>Session</code>.  Initializes Channel Zero and its
		/// listener. Sends a greeting and waits for corresponding greeting.</summary>
		/// <exception cref="BEEPException" />
		protected internal virtual void  init()
		{
			this.peerSupportedProfiles = null;
			
			GreetingListener greetingListener = new GreetingListener(this);
			
#if MESSAGELISTENER
			zero = ChannelImpl.createChannelZero(this, greetingListener, new ChannelImpl.MessageListenerAdapter(new ChannelZeroListener(this)));
#else
			zero = ChannelImpl.createChannelZero(this, greetingListener, new ChannelZeroListener(this));
#endif
			
			channels[CHANNEL_ZERO] = zero;
			
			// send greeting
			sendGreeting();
			changeState(core.SessionState.SESSION_STATE_GREETING_SENT);
			
			// start our listening thread we can now receive a greeting
			this.enableIO();
			
			// blocks until greeting is received or MAX_GREETING_WAIT is reached
			int waitCount = 0;
			
			while ((state < core.SessionState.SESSION_STATE_ACTIVE) && (waitCount < MAX_START_CHANNEL_WAIT))
			{
				try
				{
					lock (greetingListener)
					{
						
						//zero.wait(MAX_START_CHANNEL_INTERVAL);
						System.Threading.Monitor.Wait(greetingListener, TimeSpan.FromMilliseconds(MAX_START_CHANNEL_INTERVAL));
						
						waitCount += MAX_START_CHANNEL_INTERVAL;
					}
				}
				catch (System.Threading.ThreadInterruptedException)
				{
					waitCount += MAX_START_CHANNEL_INTERVAL;
				}
			}
			
			// check the channel state and return the appropriate exception
			if (state != core.SessionState.SESSION_STATE_ACTIVE)
			{
				throw new BEEPException("Greeting exchange failed");
			}
		}
示例#36
0
		/// <summary>A reentrant version of init() that doesn't block the
		/// first I/O thread waiting on a greeting when it should die
		/// and go away.</summary>
		/// <exception cref="BEEPException" />
		protected internal virtual void  tuningInit()
		{
			log.debug("Session.tuningInit");
			
			this.peerSupportedProfiles = null;
			
			GreetingListener greetingListener = new GreetingListener(this);
			
#if MESSAGELISTENER
			zero = ChannelImpl.createChannelZero(this, greetingListener, new ChannelImpl.MessageListenerAdapter(new ChannelZeroListener(this)));
#else
			zero = ChannelImpl.createChannelZero(this, greetingListener, new ChannelZeroListener(this));
#endif
			channels[CHANNEL_ZERO] = zero;
			
			// send greeting
			sendGreeting();
			changeState(core.SessionState.SESSION_STATE_GREETING_SENT);
			
			// start our listening thread we can now receive a greeting
			this.enableIO();
		}
示例#37
0
        private static bool CollectionsEqual(ICollection o1, ICollection o2)
        {
            IEnumerator e1 = o1.GetEnumerator();
            IEnumerator e2 = o2.GetEnumerator();

            int count;
            for (count = 0; e1.MoveNext() && e2.MoveNext(); count++)
            {
                if (!AreEqual(e1.Current, e2.Current))
                    break;
            }

            if (count == o1.Count && count == o2.Count)
                return true;

            return false;
        }
示例#38
0
		public DemoBase( string description, string title, ICollection types ) 
		{
			Init( description, title, types );
		}