示例#1
0
        public void WriteToSendBuffer(byte[] cmdBytes)
        {
            if (CouldAddToCurrentBuffer(cmdBytes))
            {
                return;
            }

            PushCurrentBuffer();

            if (CouldAddToCurrentBuffer(cmdBytes))
            {
                return;
            }

            var bytesCopied = 0;

            while (bytesCopied < cmdBytes.Length)
            {
                var copyOfBytes = BufferPool.GetBuffer();
                var bytesToCopy = Math.Min(cmdBytes.Length - bytesCopied, copyOfBytes.Length);
                Buffer.BlockCopy(cmdBytes, bytesCopied, copyOfBytes, 0, bytesToCopy);
                cmdBuffer.Add(new ArraySegment <byte>(copyOfBytes, 0, bytesToCopy));
                bytesCopied += bytesToCopy;
            }
        }
示例#2
0
        public override void SaveAllProperties(System.Collections.Generic.IList <System.Collections.Generic.KeyValuePair <string, object> > output)
        {
            if (NRols != 0)
            {
                output.Add(new KeyValuePair <string, object>("rows", this.NRols));
            }

            if (NCols != 0)
            {
                output.Add(new KeyValuePair <string, object>("cols", this.NCols));
            }

            base.SaveAllProperties(output);
        }
示例#3
0
 public virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledSelect GroupBy(Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression field)
 {
     Invalidate();
     groupByExpressions.Add(field);
     PrepareChildren(field);
     return(this);
 }
示例#4
0
 public virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledSelect Join(Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledJoinCriteria someJoin)
 {
     joinsTables.Add(someJoin);
     PrepareChildren(someJoin);
     ExportDeclaration(someJoin.GetEntity(), someJoin.GetEntityAlias());
     return(this);
 }
示例#5
0
        public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList <ISignature> signatures)
        {
            var span = session.CreateTrackingSpan(_textBuffer);

            var sigs = _textBuffer.CurrentSnapshot.GetSignatures(span);

            ISignature curSig = null;

            foreach (var sig in sigs.Signatures)
            {
                if (sigs.ParameterIndex == 0 || sig.Parameters.Count > sigs.ParameterIndex)
                {
                    curSig = sig;
                    break;
                }
            }

            foreach (var sig in sigs.Signatures)
            {
                signatures.Add(sig);
            }

            if (curSig != null)
            {
                // save the current sig so we don't need to recalculate it (we can't set it until
                // the signatures are added by our caller).
                session.Properties.AddProperty(typeof(PythonSignature), curSig);
            }
        }
示例#6
0
        /// <summary>
        /// Merges two ILists of type T where each item is only added if there isn't already one there with the same value in the specified field
        /// </summary>
        /// <param name="collection1">
        /// The collection 1.
        /// </param>
        /// <param name="collection2">
        /// The collection 2.
        /// </param>
        /// <param name="fieldName">
        /// The field name.
        /// </param>
        /// <typeparam name="T">
        /// The generic type parameter
        /// </typeparam>
        public static void DistinctAdd <T>(this System.Collections.Generic.IList <T> collection1, System.Collections.Generic.IList <T> collection2, string fieldName)
        {
            if ((collection1 == null) || (collection2 == null))
            {
                return;
            }

            foreach (var item in collection2)
            {
                var anotherItem = item;
                var prop        = typeof(T).GetProperty(fieldName);
                var field       = typeof(T).GetField(fieldName);
                System.Collections.Generic.IEnumerable <T> results = null;
                if (prop != null)
                {
                    // ReSharper disable ImplicitlyCapturedClosure
                    results = collection1.Where(x => prop.GetValue(x, null) == prop.GetValue(anotherItem, null));
                    // ReSharper restore ImplicitlyCapturedClosure
                }

                if (field != null)
                {
                    // ReSharper disable ImplicitlyCapturedClosure
                    results = collection1.Where(x => field.GetValue(x) == field.GetValue(anotherItem));
                    // ReSharper restore ImplicitlyCapturedClosure
                }

                if (results == null || !results.Any())
                {
                    collection1.Add(item);
                }
            }
        }
 public static void AddRange <T>(this System.Collections.Generic.IList <T> list, System.Collections.Generic.IEnumerable <T> items) where T : class
 {
     foreach (T item in items)
     {
         list.Add(item);
     }
 }
示例#8
0
        public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList <ISignature> signatures)
        {
            var span = session.GetApplicableSpan(_textBuffer);

            var sigs = _provider._serviceProvider.GetPythonToolsService().GetSignatures(
                session.TextView,
                _textBuffer.CurrentSnapshot,
                span
                );

            if (sigs != null)
            {
                ISignature curSig = sigs.Signatures
                                    .OrderBy(s => s.Parameters.Count)
                                    .FirstOrDefault(s => sigs.ParameterIndex < s.Parameters.Count);

                foreach (var sig in sigs.Signatures)
                {
                    signatures.Add(sig);
                }

                if (curSig != null)
                {
                    // save the current sig so we don't need to recalculate it (we can't set it until
                    // the signatures are added by our caller).
                    session.Properties.AddProperty(typeof(PythonSignature), curSig);
                }
            }
        }
示例#9
0
 private void SetUnpackedValueOfListPolymorphicItself(MsgPack.Serialization.PolymorphicMemberTypeKnownType_List_ListPolymorphicItselfPrivateSetterCollectionProperty unpackingContext, System.Collections.Generic.IList <string> unpackedValue)
 {
     System.Collections.Generic.IList <string> existent = default(System.Collections.Generic.IList <string>);
     existent = unpackingContext.ListPolymorphicItself;
     if ((existent == null))
     {
         this._methodBasePolymorphicMemberTypeKnownType_List_ListPolymorphicItselfPrivateSetterCollectionProperty_set_ListPolymorphicItself0.Invoke(unpackingContext, new object[] {
             unpackedValue
         });
     }
     else
     {
         System.Collections.Generic.IEnumerator <string> enumerator = unpackedValue.GetEnumerator();
         string current;
         try {
             for (
                 ; enumerator.MoveNext();
                 )
             {
                 current = enumerator.Current;
                 existent.Add(current);
             }
         }
         finally {
             enumerator.Dispose();
         }
     }
 }
示例#10
0
        public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList <ISignature> signatures)
        {
            var span = CompletionSource.GetApplicableSpan(session, _textBuffer);

            var sigs = VsProjectAnalyzer.GetSignatures(_textBuffer.CurrentSnapshot, span);

            ISignature curSig = null;

            foreach (var sig in sigs.Signatures)
            {
                if (sigs.ParameterIndex == 0 || sig.Parameters.Count > sigs.ParameterIndex)
                {
                    curSig = sig;
                    break;
                }
            }

            foreach (var sig in sigs.Signatures)
            {
                signatures.Add(sig);
            }

            if (curSig != null)
            {
                // save the current sig so we don't need to recalculate it (we can't set it until
                // the signatures are added by our caller).
                session.Properties.AddProperty(typeof(NodejsSignature), curSig);
            }
        }
示例#11
0
 private void  AddIfExists(System.Collections.Generic.IList <string> files, System.String fileName)
 {
     if (dir.FileExists(fileName))
     {
         files.Add(fileName);
     }
 }
示例#12
0
 private static void AddCellIfValid(int x, int y, Map map, System.Collections.Generic.IList <Cell> container)
 {
     if (MapPoint.IsInMap(x, y))
     {
         container.Add(map.Cells[(int)((System.UIntPtr)MapPoint.CoordToCellId(x, y))]);
     }
 }
示例#13
0
 protected internal virtual Net.Vpc.Upa.Expressions.QueryStatement CreateViewQuery() /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Extensions.UnionEntityExtensionDefinition entityExtension = (Net.Vpc.Upa.Extensions.UnionEntityExtensionDefinition)GetDefinition();
     Net.Vpc.Upa.Extensions.UnionQueryInfo queryInfo = entityExtension.GetQueryInfo(GetEntity());
     updatableTables = new System.Collections.Generic.List <Net.Vpc.Upa.Entity>((queryInfo.GetEntities()).Count);
     foreach (string table in queryInfo.GetEntities())
     {
         updatableTables.Add(GetPersistenceUnit().GetEntity(table));
     }
     this.discriminator = queryInfo.GetDiscriminator();
     string[] tabNames = new string[(updatableTables).Count];
     for (int i = 0; i < tabNames.Length; i++)
     {
         tabNames[i] = updatableTables[i].GetName();
     }
     viewFields = GetEntity().GetFieldNames(Net.Vpc.Upa.Impl.Util.Filters.Fields2.READ);
     viewFields.Remove(discriminator);
     fieldsMapping = (string[][])Net.Vpc.Upa.Impl.FwkConvertUtils.CreateMultiArray(typeof(string), (queryInfo.GetEntities()).Count, (viewFields).Count);
     for (int i = 0; i < tabNames.Length; i++)
     {
         for (int j = 0; j < (viewFields).Count; j++)
         {
             fieldsMapping[i][i] = queryInfo.GetFieldName(tabNames[i], viewFields[j], i, j);
         }
     }
     return(CreateViewQuery(GetEntity().GetName(), tabNames, discriminator, viewFields, fieldsMapping));
 }
示例#14
0
        /// <summary>
        /// Static constructor.
        /// <locDE><para />Statischer Konstruktor.</locDE>
        /// </summary>
        static AppHelper()
        {
            IDEPathSuffixes = new System.Collections.Generic.List <string>();
            IDEPathSuffixes.Add("\\bin\\debug");
            IDEPathSuffixes.Add("\\bin\\release");

            // Assignment will be valid for console or WPF applications, null for ASP.net (must be injected)
            // Zuweisung wird gültig sein bei Konsolen- oder WPF-Anwendung, null bei ASP.net (muss injiziert werden)
            EntryAssembly = System.Reflection.Assembly.GetEntryAssembly();
            if (null == EntryAssembly)
            {
                // Most probably ASP.net environment
                // Höchstwahrscheinlich ASP.net Umgebung
                RuntimeHelper.IsRunningOnASPnet = true;
            }
        }
示例#15
0
 public static void ListAddRange <E>(System.Collections.Generic.IList <E> list, System.Collections.Generic.IList <E> items)
 {
     foreach (E i in items)
     {
         list.Add(i);
     }
 }
示例#16
0
 public Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledUpdate Set(Net.Vpc.Upa.Field key, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression @value)
 {
     Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal varVal = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(key), @value);
     fields.Add(varVal);
     PrepareChildren(varVal);
     return(this);
 }
 public override void SaveAllProperties(System.Collections.Generic.IList <System.Collections.Generic.KeyValuePair <string, object> > output)
 {
     if (this.Charset != null)
     {
         output.Add(new KeyValuePair <string, object>("charset", this.Charset));
     }
     base.SaveAllProperties(output);
 }
示例#18
0
 public override void SaveAllProperties(System.Collections.Generic.IList <System.Collections.Generic.KeyValuePair <string, object> > output)
 {
     if (this.NumberOfCharacters != 0)
     {
         output.Add(new KeyValuePair <string, object>("chars", this.NumberOfCharacters));
     }
     base.SaveAllProperties(output);
 }
示例#19
0
 public virtual void AddKey(string key)
 {
     if (keys == null)
     {
         keys = new System.Collections.Generic.List <string>();
     }
     keys.Add(key);
 }
示例#20
0
 public virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledInsert Set(string key, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression @value)
 {
     Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar    fName  = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(key);
     Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal varVal = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal(fName, @value);
     fields.Add(varVal);
     PrepareChildren(varVal);
     return(this);
 }
示例#21
0
 public virtual void ExportDeclaration(string name, Net.Vpc.Upa.Impl.Uql.DecObjectType type, object referrerName, object referrerParentId)
 {
     if (exportedDeclarations == null)
     {
         exportedDeclarations = new System.Collections.Generic.List <Net.Vpc.Upa.Impl.Uql.ExpressionDeclaration>(3);
     }
     exportedDeclarations.Add(new Net.Vpc.Upa.Impl.Uql.ExpressionDeclaration(name, type, referrerName, referrerParentId));
 }
 public override void SaveAllProperties(System.Collections.Generic.IList <System.Collections.Generic.KeyValuePair <string, object> > output)
 {
     if (this.Size != 0)
     {
         output.Add(new KeyValuePair <string, object>("size", this.Size));
     }
     base.SaveAllProperties(output);
 }
示例#23
0
 public virtual void AddCloseListener(Net.Vpc.Upa.CloseListener closeListener)
 {
     if (closeListeners == null)
     {
         closeListeners = new System.Collections.Generic.List <Net.Vpc.Upa.CloseListener>();
     }
     closeListeners.Add(closeListener);
 }
示例#24
0
 public virtual bool Visit(Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression e)
 {
     if (filter == null || filter.Accept(e))
     {
         expressions.Add(e);
     }
     return(true);
 }
示例#25
0
 public virtual void AddFunction(NeoDatis.Odb.Test.VO.Login.Function function)
 {
     if (functions == null)
     {
         functions = new System.Collections.Generic.List <Function>();
     }
     functions.Add(function);
 }
示例#26
0
 protected internal virtual void ProtectedAddArgument(Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression e)
 {
     if (e == null)
     {
         throw new System.ArgumentException();
     }
     expressions.Add(e);
     PrepareChildren(e);
 }
示例#27
0
 public Paginator(InternalPaginator paginator)
 {
     this.paginator = paginator;
     foreach (var item in paginator.Items)
     {
         typedItems.Add((T)(object)item);
     }
     ;
 }
示例#28
0
        public virtual void Install(Net.Vpc.Upa.Entity e)
        {
            string cname = callbackName;

            if (Net.Vpc.Upa.Impl.Config.Annotationparser.AnnotationParserUtils.IsEmptyString(cname))
            {
                cname = (dataInterceptor.GetType()).Name;
            }
            addedTriggers.Add(e.AddTrigger(cname, dataInterceptor));
        }
示例#29
0
 public virtual void Update()
 {
     System.Collections.Generic.ISet <string> visited = new System.Collections.Generic.HashSet <string>();
     persistSequenceGeneratorFields.Clear();
     updateSequenceGeneratorFields.Clear();
     insertExpressions.Clear();
     updateExpressions.Clear();
     System.Collections.Generic.IList <Net.Vpc.Upa.Field> fields1 = entity.GetFields();
     foreach (Net.Vpc.Upa.Field field in fields1)
     {
         visited.Remove(field.GetName());
         Net.Vpc.Upa.Impl.Persistence.FieldPersistenceInfo fieldPersistenceInfo = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Impl.Persistence.FieldPersistenceInfo>(fields, field.GetName());
         if (fieldPersistenceInfo == null)
         {
             fieldPersistenceInfo    = new Net.Vpc.Upa.Impl.Persistence.FieldPersistenceInfo();
             fields[field.GetName()] = fieldPersistenceInfo;
         }
         fieldPersistenceInfo.field            = field;
         fieldPersistenceInfo.persistenceStore = persistenceStore;
         fieldPersistenceInfo.Synchronize();
         if (fieldPersistenceInfo.persistFieldPersister != null)
         {
             persistSequenceGeneratorFields.Add(fieldPersistenceInfo);
         }
         if (fieldPersistenceInfo.updateFieldPersister != null)
         {
             updateSequenceGeneratorFields.Add(fieldPersistenceInfo);
         }
         if (fieldPersistenceInfo.insertExpression != null)
         {
             insertExpressions.Add(fieldPersistenceInfo);
         }
         if (fieldPersistenceInfo.updateExpression != null)
         {
             updateExpressions.Add(fieldPersistenceInfo);
         }
         if (field.GetDataType() is Net.Vpc.Upa.Types.ManyToOneType)
         {
             ((Net.Vpc.Upa.Impl.AbstractField)field).SetFieldPersister(new Net.Vpc.Upa.Impl.EntityTypeFieldPersister());
         }
         else if (Net.Vpc.Upa.Impl.Util.UPAUtils.IsPasswordTransform(Net.Vpc.Upa.Impl.Util.UPAUtils.GetTypeTransformOrIdentity(field)))
         {
             ((Net.Vpc.Upa.Impl.AbstractField)field).SetFieldPersister(new Net.Vpc.Upa.Impl.Transform.PasswordTypeFieldPersister());
         }
         else
         {
             ((Net.Vpc.Upa.Impl.AbstractField)field).SetFieldPersister(new Net.Vpc.Upa.Impl.SimpleFieldPersister());
         }
     }
     foreach (string r in visited)
     {
         fields.Remove(r);
     }
 }
示例#30
0
 public virtual void AddObjectListener(Net.Vpc.Upa.UPAObjectListener listener)
 {
     if (listener != null)
     {
         if (objectListeners == null)
         {
             objectListeners = new System.Collections.Generic.List <Net.Vpc.Upa.UPAObjectListener>();
         }
         objectListeners.Add(listener);
     }
 }
示例#31
0
		/*
		* Return all files referenced by this SegmentInfo.  The
		* returns List is a locally cached List so you should not
		* modify it.
		*/
		
		public System.Collections.Generic.IList<string> Files()
		{
			
			if (files != null)
			{
				// Already cached:
				return files;
			}

            files = new System.Collections.Generic.List<string>();
			
			bool useCompoundFile = GetUseCompoundFile();
			
			if (useCompoundFile)
			{
				files.Add(name + "." + IndexFileNames.COMPOUND_FILE_EXTENSION);
			}
			else
			{
				System.String[] exts = IndexFileNames.NON_STORE_INDEX_EXTENSIONS;
				for (int i = 0; i < exts.Length; i++)
					AddIfExists(files, name + "." + exts[i]);
			}
			
			if (docStoreOffset != - 1)
			{
				// We are sharing doc stores (stored fields, term
				// vectors) with other segments
				System.Diagnostics.Debug.Assert(docStoreSegment != null);
				if (docStoreIsCompoundFile)
				{
					files.Add(docStoreSegment + "." + IndexFileNames.COMPOUND_FILE_STORE_EXTENSION);
				}
				else
				{
					System.String[] exts = IndexFileNames.STORE_INDEX_EXTENSIONS;
					for (int i = 0; i < exts.Length; i++)
						AddIfExists(files, docStoreSegment + "." + exts[i]);
				}
			}
			else if (!useCompoundFile)
			{
				// We are not sharing, and, these files were not
				// included in the compound file
				System.String[] exts = IndexFileNames.STORE_INDEX_EXTENSIONS;
				for (int i = 0; i < exts.Length; i++)
					AddIfExists(files, name + "." + exts[i]);
			}
			
			System.String delFileName = IndexFileNames.FileNameFromGeneration(name, "." + IndexFileNames.DELETES_EXTENSION, delGen);
			if (delFileName != null && (delGen >= YES || dir.FileExists(delFileName)))
			{
				files.Add(delFileName);
			}
			
			// Careful logic for norms files    
			if (normGen != null)
			{
				for (int i = 0; i < normGen.Length; i++)
				{
					long gen = normGen[i];
					if (gen >= YES)
					{
						// Definitely a separate norm file, with generation:
						files.Add(IndexFileNames.FileNameFromGeneration(name, "." + IndexFileNames.SEPARATE_NORMS_EXTENSION + i, gen));
					}
					else if (NO == gen)
					{
						// No separate norms but maybe plain norms
						// in the non compound file case:
						if (!hasSingleNormFile && !useCompoundFile)
						{
							System.String fileName = name + "." + IndexFileNames.PLAIN_NORMS_EXTENSION + i;
							if (dir.FileExists(fileName))
							{
								files.Add(fileName);
							}
						}
					}
					else if (CHECK_DIR == gen)
					{
						// Pre-2.1: we have to check file existence
						System.String fileName = null;
						if (useCompoundFile)
						{
							fileName = name + "." + IndexFileNames.SEPARATE_NORMS_EXTENSION + i;
						}
						else if (!hasSingleNormFile)
						{
							fileName = name + "." + IndexFileNames.PLAIN_NORMS_EXTENSION + i;
						}
						if (fileName != null && dir.FileExists(fileName))
						{
							files.Add(fileName);
						}
					}
				}
			}
			else if (preLockless || (!hasSingleNormFile && !useCompoundFile))
			{
				// Pre-2.1: we have to scan the dir to find all
				// matching _X.sN/_X.fN files for our segment:
				System.String prefix;
				if (useCompoundFile)
					prefix = name + "." + IndexFileNames.SEPARATE_NORMS_EXTENSION;
				else
					prefix = name + "." + IndexFileNames.PLAIN_NORMS_EXTENSION;
				int prefixLength = prefix.Length;
				System.String[] allFiles = dir.ListAll();
				IndexFileNameFilter filter = IndexFileNameFilter.GetFilter();
				for (int i = 0; i < allFiles.Length; i++)
				{
					System.String fileName = allFiles[i];
					if (filter.Accept(null, fileName) && fileName.Length > prefixLength && System.Char.IsDigit(fileName[prefixLength]) && fileName.StartsWith(prefix))
					{
						files.Add(fileName);
					}
				}
			}
			return files;
		}