コード例 #1
0
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            string key = attributeEntry.Key as string;

            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            switch (key)
            {
            case "PaymentAmount":
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
                break;
            }

            case "HousingExpenseType":
            {
                attributeEntry.Key   = string.Format("{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", ((Enums.PresentHousingExpenseType)attributeEntry.Value));
                break;
            }
            }


            return(true);
        }
コード例 #2
0
        private void SerializeDictionary(System.Collections.IDictionary o, System.Text.StringBuilder sb, int depth, System.Collections.Hashtable objectsInUse, JavaScriptSerializer.SerializationFormat serializationFormat)
        {
            sb.Append('{');
            bool flag = true;

            System.Collections.DictionaryEntry[] array = new System.Collections.DictionaryEntry[o.Count];
            o.CopyTo(array, 0);
            for (int i = 0; i < array.Length; i++)
            {
                System.Collections.DictionaryEntry dictionaryEntry = array[i];
                if (!flag)
                {
                    sb.Append(',');
                }
                string text = dictionaryEntry.Key as string;
                if (text == null)
                {
                    throw new System.ArgumentException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Type '{0}' is not supported for serialization/deserialization of a dictionary, keys must be strings or objects.", new object[]
                    {
                        o.GetType().FullName
                    }));
                }
                JavaScriptSerializer.SerializeString((string)dictionaryEntry.Key, sb);
                sb.Append(':');
                this.SerializeValue(dictionaryEntry.Value, sb, depth, objectsInUse, serializationFormat);
                flag = false;
            }
            sb.Append('}');
        }
コード例 #3
0
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            string key = attributeEntry.Key as string;

            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            switch (key)
            {
            case "LoanAmortizationType":
            {
                attributeEntry.Key   = string.Format("{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", ((Enums.LoanAmortizationType)attributeEntry.Value));
                break;
            }

            case "MortgageType":
            {
                attributeEntry.Key   = string.Format("{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", ((Enums.MortgageType)attributeEntry.Value));
                break;
            }
            }

            return(true);
        }
コード例 #4
0
        /// <summary>
        /// Analyzes the processing of a particular attribute.
        /// </summary>
        /// <param name="attributeEntry">The attribute to analyze.</param>
        /// <returns>True if we want to continue processing and false otherwise.</returns>
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            string key = attributeEntry.Key as string;

            switch (key)
            {
            case "Type":
            {
                attributeEntry.Key   = string.Format("_{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", (MISMO.Enums.LoanPurposeType)attributeEntry.Value);
                break;
            }

            case "PropertyRightsType":
            {
                attributeEntry.Value = string.Format("{0}", (MISMO.Enums.PropertyRightsType)attributeEntry.Value);
                break;
            }

            case "PropertyUsageType":
            {
                attributeEntry.Value = string.Format("{0}", (MISMO.Enums.PropertyUsageType)attributeEntry.Value);
                break;
            }
            }

            return(true);
        }
コード例 #5
0
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            string key = attributeEntry.Key as string;

            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            switch (key)
            {
            case "PriorPropertyUsageType":
            {
                attributeEntry.Value = string.Format("{0}", (MISMO.Enums.PriorPropertyUsageType)attributeEntry.Value);
                break;
            }

            case "PriorPropertyTitleType":
            {
                attributeEntry.Value = string.Format("{0}", (MISMO.Enums.PriorPropertyTitleType)attributeEntry.Value);
                break;
            }

            case "CitizenshipResidencyType":
            {
                attributeEntry.Value = string.Format("{0}", (MISMO.Enums.CitizenshipResidencyType)attributeEntry.Value);
                break;
            }
            }

            return(true);
        }
コード例 #6
0
        public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
        {
            lock (this)
            {
                if (tvx != null)
                {
                    if (state.numDocsInStore > 0)
                    {
                        // In case there are some final documents that we
                        // didn't see (because they hit a non-aborting exception):
                        Fill(state.numDocsInStore - docWriter.GetDocStoreOffset());
                    }

                    tvx.Flush();
                    tvd.Flush();
                    tvf.Flush();
                }

                System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
                while (it.MoveNext())
                {
                    System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current;
                    System.Collections.IEnumerator     it2   = ((System.Collections.ICollection)entry.Value).GetEnumerator();
                    while (it2.MoveNext())
                    {
                        TermVectorsTermsWriterPerField perField = (TermVectorsTermsWriterPerField)((System.Collections.DictionaryEntry)it2.Current).Key;
                        perField.termsHashPerField.Reset();
                        perField.ShrinkHash();
                    }

                    TermVectorsTermsWriterPerThread perThread = (TermVectorsTermsWriterPerThread)entry.Key;
                    perThread.termsHashPerThread.Reset(true);
                }
            }
        }
コード例 #7
0
ファイル: Hashtable.cs プロジェクト: xwyangjshb/qizmt
        internal bool cangetnext()
        {
            lock (slave)
            {
                if (first)
                {
                    first = false;
                    internalsendreset();
                }

                // 'N' for next..
                slave.nstm.WriteByte((byte)'N');
                slave.nstm.WriteByte(enumid);

                // Replies with tag '+' and xcontent key and xcontent value; or tag '-' if not exists.
                int len;
                int x = slave.nstm.ReadByte();
                if ('+' == x)
                {
                    byte[] key   = XContent.ReceiveXBytes(slave.nstm, out len, null); // Null buffer for copy.
                    byte[] value = XContent.ReceiveXBytes(slave.nstm, out len, null); // Null buffer for copy.
                    cur = new System.Collections.DictionaryEntry(key, value);
                    return(true);
                }
                else if ('-' == x)
                {
                    return(false);
                }
                else
                {
                    throw new Exception("Server returned invalid response for enumeration");
                }
            }
        }
コード例 #8
0
ファイル: DocInverter.cs プロジェクト: thinhtp/liteweb.info
        public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
        {
            System.Collections.IDictionary childThreadsAndFields    = new System.Collections.Hashtable();
            System.Collections.IDictionary endChildThreadsAndFields = new System.Collections.Hashtable();

            System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
            while (it.MoveNext())
            {
                System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current;

                DocInverterPerThread perThread = (DocInverterPerThread)entry.Key;

                System.Collections.ICollection fields = (System.Collections.ICollection)entry.Value;

                System.Collections.IEnumerator fieldsIt       = fields.GetEnumerator();
                System.Collections.Hashtable   childFields    = new System.Collections.Hashtable();
                System.Collections.Hashtable   endChildFields = new System.Collections.Hashtable();
                while (fieldsIt.MoveNext())
                {
                    DocInverterPerField perField = (DocInverterPerField)((System.Collections.DictionaryEntry)fieldsIt.Current).Key;
                    childFields[perField.consumer]       = perField.consumer;
                    endChildFields[perField.endConsumer] = perField.endConsumer;
                }

                childThreadsAndFields[perThread.consumer]       = childFields;
                endChildThreadsAndFields[perThread.endConsumer] = endChildFields;
            }

            consumer.Flush(childThreadsAndFields, state);
            endConsumer.Flush(endChildThreadsAndFields, state);
        }
コード例 #9
0
        /// <summary>
        /// Analyzes the processing of a particular attribute.
        /// </summary>
        /// <param name="attributeEntry">The attribute to analyze.</param>
        /// <returns>True if we want to continue processing and false otherwise.</returns>
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            string key = attributeEntry.Key as string;

            switch (key)
            {
            case "PropertyAcquiredYear":
            {
                attributeEntry.Value = PropertyAcquiredYear.Year.ToString();
                break;
            }

            case "GSERefinancePurposeType":
            {
                attributeEntry.Key   = string.Format("_{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", ((Enums.GSERefinancePurposeType)attributeEntry.Value));
                break;
            }
            }

            return(true);
        }
コード例 #10
0
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Object @value = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Object @key = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = new System.Collections.DictionaryEntry(@key, @value);

            if (!isNewObj)
            {
                __ret--;
                WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);
                return(__ret);
            }

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
コード例 #11
0
ファイル: Valuation.cs プロジェクト: snitsars/pMISMOtraining
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            string key = attributeEntry.Key as string;

            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            switch (key)
            {
            case "MethodType":
            {
                attributeEntry.Key   = string.Format("_{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", ((Enums.ValuationMethodType)attributeEntry.Value));
                break;
            }

            case "MethodTypeOtherDescription":
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
                break;
            }
            }
            return(true);
        }
コード例 #12
0
ファイル: FieldCacheImpl.cs プロジェクト: philiphoy/ravendb
 public virtual CacheEntry[] GetCacheEntries()
 {
     System.Collections.IList       result    = new System.Collections.ArrayList(17);
     System.Collections.IEnumerator outerKeys = caches.Keys.GetEnumerator();
     while (outerKeys.MoveNext())
     {
         System.Type cacheType = (System.Type)outerKeys.Current;
         Cache       cache     = (Cache)caches[cacheType];
         System.Collections.IEnumerator innerKeys = cache.readerCache.Keys.GetEnumerator();
         while (innerKeys.MoveNext())
         {
             // we've now materialized a hard ref
             System.Object readerKey = innerKeys.Current;
             // innerKeys was backed by WeakHashMap, sanity check
             // that it wasn't GCed before we made hard ref
             if (null != readerKey && cache.readerCache.Contains(readerKey))
             {
                 System.Collections.IDictionary innerCache       = ((System.Collections.IDictionary)cache.readerCache[readerKey]);
                 System.Collections.IEnumerator entrySetIterator = new System.Collections.Hashtable(innerCache).GetEnumerator();
                 while (entrySetIterator.MoveNext())
                 {
                     System.Collections.DictionaryEntry mapEntry = (System.Collections.DictionaryEntry)entrySetIterator.Current;
                     Entry entry = (Entry)mapEntry.Key;
                     result.Add(new CacheEntryImpl(readerKey, entry.field, cacheType, entry.type, entry.custom, entry.locale, mapEntry.Value));
                 }
             }
         }
     }
     return((CacheEntry[])new System.Collections.ArrayList(result).ToArray(typeof(CacheEntry)));
 }
コード例 #13
0
ファイル: DocFieldConsumers.cs プロジェクト: stgwilli/ravendb
        public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
        {
            System.Collections.IDictionary oneThreadsAndFields = new System.Collections.Hashtable();
            System.Collections.IDictionary twoThreadsAndFields = new System.Collections.Hashtable();

            System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
            while (it.MoveNext())
            {
                System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current;

                DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread)entry.Key;

                System.Collections.ICollection fields = (System.Collections.ICollection)entry.Value;

                System.Collections.IEnumerator fieldsIt  = fields.GetEnumerator();
                System.Collections.Hashtable   oneFields = new System.Collections.Hashtable();
                System.Collections.Hashtable   twoFields = new System.Collections.Hashtable();
                while (fieldsIt.MoveNext())
                {
                    DocFieldConsumersPerField perField = (DocFieldConsumersPerField)fieldsIt.Current;
                    SupportClass.CollectionsHelper.AddIfNotContains(oneFields, perField.one);
                    SupportClass.CollectionsHelper.AddIfNotContains(twoFields, perField.two);
                }

                oneThreadsAndFields[perThread.one] = oneFields;
                twoThreadsAndFields[perThread.two] = twoFields;
            }


            one.Flush(oneThreadsAndFields, state);
            two.Flush(twoThreadsAndFields, state);
        }
コード例 #14
0
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            string key = attributeEntry.Key as string;

            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            switch (key)
            {
            case "GenderType":
            {
                attributeEntry.Key   = string.Format("{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", ((Enums.GenderType)attributeEntry.Value));
                break;
            }

            case "RaceNationalOriginType":
            {
                attributeEntry.Key   = string.Format("{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", ((Enums.RaceNationalOriginType)attributeEntry.Value));
                break;
            }

            case "HMDAEthnicityType":
            {
                attributeEntry.Key   = string.Format("{0}", attributeEntry.Key);
                attributeEntry.Value = string.Format("{0}", ((Enums.HMDAEthnicityType)attributeEntry.Value));
                break;
            }
            }

            return(true);
        }
コード例 #15
0
ファイル: ARM.cs プロジェクト: snitsars/pMISMOtraining
        /// <summary>
        /// Method executed by the xml factory.
        /// </summary>
        /// <param name="attributeEntry">The key-value pair of the element's attribute.</param>
        /// <returns>True if the factory should continue processing and false otherwise</returns>
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            string key = attributeEntry.Key as string;

            if (key != "PaymentAdjustmentLifetimeCapAmount" ||
                key != "PaymentAdjustmentLifetimeCapPercent" ||
                key != "RateAdjustmentLifetimeCapPercent")
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
            }

            // convert the percent numeric (8,7) back to whole percents
            switch (key)
            {
            case "IndexCurrentValuePercent":
            case "IndexMarginPercent":
            case "QualifyingRatePercent":
            case "PaymentAdjustmentLifetimeCapPercent":
            case "RateAdjustmentLifetimeCapPercent":
            {
                attributeEntry.Value = ((Decimal)attributeEntry.Value) * 100;
                break;
            }
            }

            return(true);
        }
コード例 #16
0
            public void Add(System.Collections.DictionaryEntry de)
            {
                Property p = new Property();

                p.Name  = String.Format("{0}", de.Key);
                p.Value = String.Format("{0}", de.Value);
                this.Add(p);
            }
コード例 #17
0
 bool OrcaLogic.Xml.IXmlFactoryElement.ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
 {
     if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
     {
         return(false);
     }
     return(true);
 }
コード例 #18
0
ファイル: Hashtable.cs プロジェクト: xwyangjshb/qizmt
 public void Reset()
 {
     lock (slave)
     {
         cur = new System.Collections.DictionaryEntry();
         internalsendreset();
     }
 }
コード例 #19
0
 /// <summary> Assumes the fields are not storing term vectors.
 ///
 /// </summary>
 /// <param name="names">The names of the fields
 /// </param>
 /// <param name="isIndexed">Whether the fields are indexed or not
 ///
 /// </param>
 /// <seealso cref="Add(String, boolean)">
 /// </seealso>
 public void  Add(System.Collections.ICollection names, bool isIndexed)
 {
     System.Collections.IEnumerator i = names.GetEnumerator();
     while (i.MoveNext())
     {
         System.Collections.DictionaryEntry t = (System.Collections.DictionaryEntry)i.Current;
         Add((System.String)t.Key, isIndexed);
     }
 }
コード例 #20
0
        /// <summary>
        /// Method executed by the xml factory.
        /// </summary>
        /// <param name="attributeEntry">The key-value pair of the element's attribute.</param>
        /// <returns>True if the factory should continue processing and false otherwise</returns>
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            return(true);
        }
コード例 #21
0
 /// <summary> Add fields that are indexed. Whether they have termvectors has to be specified.
 ///
 /// </summary>
 /// <param name="names">The names of the fields
 /// </param>
 /// <param name="storeTermVectors">Whether the fields store term vectors or not
 /// </param>
 /// <param name="storePositionWithTermVector">treu if positions should be stored.
 /// </param>
 /// <param name="storeOffsetWithTermVector">true if offsets should be stored
 /// </param>
 public void  AddIndexed(System.Collections.ICollection names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
 {
     System.Collections.IEnumerator i = names.GetEnumerator();
     while (i.MoveNext())
     {
         System.Collections.DictionaryEntry t = (System.Collections.DictionaryEntry)i.Current;
         Add((System.String)t.Key, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector);
     }
 }
コード例 #22
0
ファイル: XmlFactory.cs プロジェクト: snitsars/pMISMOtraining
        /// <summary>
        /// Sets the attributes of the class element with its own attributes.
        /// </summary>
        /// <param name="classElement">The class element to set attributes for.</param>
        /// <param name="any">Any object.</param>
        private static void SetAttributes(XmlElement classElement, object any)
        {
            // attemp to convert the generic object to a factory element
            IXmlFactoryElement factoryelement = any as IXmlFactoryElement;

            PropertyTable properties         = new PropertyTable(any, BindingFlags.Instance | BindingFlags.Public);
            PropertyInfo  pinfo              = null;
            bool          continueprocessing = false;

            // add any additional attributes that can not be extracted from the object
            if (factoryelement != null)
            {
                System.Collections.Specialized.NameValueCollection additionalattribs = factoryelement.AdditionalAttributes;
                if (additionalattribs != null && additionalattribs.Count > 0)
                {
                    for (int i = 0; i < additionalattribs.Count; i++)
                    {
                        classElement.SetAttribute(string.Format("{0}", additionalattribs.Keys[i]), string.Format("{0}", additionalattribs[additionalattribs.Keys[i]]));
                    }
                }
            }


            System.Collections.DictionaryEntry dentry;

            // process all the property members
            foreach (string membername in properties.MemberNames)
            {
                dentry = new System.Collections.DictionaryEntry(membername, null);
                pinfo  = properties[membername];
                if (pinfo != null)
                {
                    try
                    {
                        dentry.Value = pinfo.GetValue(any, null);
                    }
                    catch
                    {
                        dentry.Value = null;
                    }
                    if (factoryelement != null)
                    {
                        continueprocessing = factoryelement.ProcessAttribute(ref dentry);
                    }
                    else
                    {
                        continueprocessing = true;                         // just keep going without constraints
                    }
                    // if there is no reason to quit processing then set attributes.
                    if (continueprocessing)
                    {
                        classElement.SetAttribute(string.Format("{0}", dentry.Key), string.Format("{0}", dentry.Value));
                    }
                }
            }
        }
コード例 #23
0
        public void CopyTo(Array array, int index)
        {
            int len = _insertionOrderList.Count;

            for (int i = 0; i < len; i++)
            {
                DictionaryEntry e = new DictionaryEntry(_insertionOrderList[i], _dictionary[_insertionOrderList[i]]);
                array.SetValue(e, index++);
            }
        }
コード例 #24
0
 private void  AddIndexed(IndexReader reader, FieldInfos fieldInfos, System.Collections.ICollection names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
 {
     System.Collections.IEnumerator i = names.GetEnumerator();
     while (i.MoveNext())
     {
         System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry)i.Current;
         System.String field = (System.String)e.Key;
         fieldInfos.Add(field, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector, !reader.HasNorms(field));
     }
 }
コード例 #25
0
        public override void  GetTermFreqVector(int docNumber, TermVectorMapper mapper)
        {
            EnsureOpen();

            System.Collections.IEnumerator i = new System.Collections.Hashtable(fieldToReader).GetEnumerator();
            while (i.MoveNext())
            {
                System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry)i.Current;
                System.String field  = (System.String)e.Key;
                IndexReader   reader = (IndexReader)e.Value;
                reader.GetTermFreqVector(docNumber, field, mapper);
            }
        }
コード例 #26
0
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            string key = attributeEntry.Key as string;

            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            switch (key)
            {
            case "StreetAddress":
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
                break;
            }

            case "StreetAddress2":
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
                break;
            }

            case "City":
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
                break;
            }

            case "State":
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
                break;
            }

            case "PostalCode":
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
                break;
            }

            case "Country":
            {
                attributeEntry.Key = string.Format("_{0}", attributeEntry.Key);
                break;
            }
            }

            return(true);
        }
コード例 #27
0
        /// <summary>
        /// GetEnvironmentVariables Method - gets the environment variables as a two dimensional string
        /// </summary>
        /// <returns>Two dimensional array of strings</returns>
        public string[,] GetEnvironmentVariables()
        {
            int numVars = Process.StartInfo.EnvironmentVariables.Count;

            string[,] stringArray = new string[numVars, 2];
            System.Collections.DictionaryEntry[] dicArray = new System.Collections.DictionaryEntry[numVars];
            Process.StartInfo.EnvironmentVariables.CopyTo(dicArray, 0);
            for (int i = 0; i < numVars; i++)
            {
                stringArray[i, 0] = dicArray[i].Key.ToString();
                stringArray[i, 1] = dicArray[i].Value.ToString();
            }
            return(stringArray);
        }
コード例 #28
0
        protected virtual bool ProcessAttribute(ref System.Collections.DictionaryEntry attributeEntry)
        {
            if (!MISMO.XmlHelper.CanProcessAttribute(this, ref attributeEntry))
            {
                return(false);
            }

            string key = attributeEntry.Key as string;

            if (key != "MISMOVersionID")
            {
                return(false);                                     // not supported
            }
            return(true);
        }
コード例 #29
0
ファイル: LeakHelper.cs プロジェクト: pcdummy/Eto
        static private void GetUserPreferenceChangedList()
        {
            Type oSystemEventsType = typeof(SystemEvents);

            //Using reflection, get the FieldInfo object for the internal collection of handlers
            // we will use this collection to find the handler we want to unhook and remove it.
            // as you can guess by the naming convention it is a private member.
            System.Reflection.FieldInfo oFieldInfo = oSystemEventsType.GetField("_handlers",
                                                                                System.Reflection.BindingFlags.Static |
                                                                                System.Reflection.BindingFlags.GetField |
                                                                                System.Reflection.BindingFlags.FlattenHierarchy |
                                                                                System.Reflection.BindingFlags.NonPublic);

            //now, get a reference to the value of this field so that you can manipulate it.
            //pass null to GetValue() because we are working with a static member.
            object oFieldInfoValue = oFieldInfo.GetValue(null);

            //the returned object is of type Dictionary<object, List<SystemEventInvokeInfo>>
            //each of the Lists<> in the Dictionary<> is used to maintain a different event implementation.
            //It may be more efficient to figure out how the UserPreferenceChanged event is keyed here but a quick-and-dirty
            // method is to just scan them all the first time and then cache the List<> object once it's found.

            System.Collections.IDictionary dictFieldInfoValue = oFieldInfoValue as System.Collections.IDictionary;
            foreach (object oEvent in dictFieldInfoValue)
            {
                System.Collections.DictionaryEntry deEvent            = (System.Collections.DictionaryEntry)oEvent;
                System.Collections.IList           listEventListeners = deEvent.Value as System.Collections.IList;

                //unfortunately, SystemEventInvokeInfo is a private class so we can't declare a reference of that type.
                //we will use object and then use reflection to get what we need...
                List <Delegate> listDelegatesToRemove = new List <Delegate>();

                //we need to take the first item in the list, get it's delegate and check the type...
                if (listEventListeners.Count > 0 && listEventListeners[0] != null)
                {
                    Delegate oDelegate = GetDelegateFromSystemEventInvokeInfo(listEventListeners[0]);
                    if (oDelegate is UserPreferenceChangedEventHandler)
                    {
                        _UserPreferenceChangedList = listEventListeners;
                    }
                }
                //if we've found the list, no need to continue searching
                if (_UserPreferenceChangedList != null)
                {
                    break;
                }
            }
        }
コード例 #30
0
        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref System.Collections.DictionaryEntry instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.Object:
            {
                __mStack[ptr_of_this_method->Value] = instance_of_this_method;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Collections.DictionaryEntry[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
            }
            break;
            }
        }
コード例 #31
0
        public static CFuJian Upload(UploadedFile file, string UCProcessType, string UCProcessID, string UCWorkItemID)
        {
            CFuJian cFuJian = new CFuJian();

            OA_DocumentService api = MossObject.GetMOSSAPI();

            string[] fileInfo = GetUploadFileInfo(UCProcessType, file.FileName);

            cFuJian.Type = System.IO.Path.GetExtension(file.FileName); //文件类型 扩展名
            if (cFuJian.Type.IndexOf('.') > -1)
            {
                cFuJian.Type = cFuJian.Type.Substring(1);
            }
            cFuJian.Alias = file.FileName.Substring(0, file.FileName.Length - cFuJian.Type.Length - 1); //别名
            //ff.Title = ff.Alias + "." + ff.Type;
            cFuJian.Title = fileInfo[3];
            if (cFuJian.Type.Length == 0)//没有扩展名
            {
                cFuJian.Alias = file.FileName;
            }
            cFuJian.Alias = cFuJian.Alias.Replace(" ", "");

            cFuJian.FolderName = fileInfo[2];

            cFuJian.FileName = fileInfo[3];

            cFuJian.Size = MossObject.ToFileSize(file.ContentLength); //文件大小
            cFuJian.ProcessType = UCProcessType;
            cFuJian.WorkItemID = UCWorkItemID;

            string[] saveUrl;

            #region DLL
            if (OAConfig.GetConfig("MOSS认证", "是否启用DLL") == "1")
            {
                #region 更新栏位
                List<System.Collections.DictionaryEntry> lst = new List<System.Collections.DictionaryEntry>();
                System.Collections.DictionaryEntry de = new System.Collections.DictionaryEntry();
                de.Key = "流程实例";
                de.Value = UCProcessID;
                lst.Add(de);

                de = new System.Collections.DictionaryEntry();
                de.Key = "别名";
                de.Value = cFuJian.Alias;
                lst.Add(de);

                de = new System.Collections.DictionaryEntry();
                de.Key = "上次修改者";
                de.Value = CurrentUserInfo.DisplayName;
                lst.Add(de);
                #endregion

                System.Collections.DictionaryEntry[] result = DocumentManager.ConvertToDE(lst.ToArray());

                if (file.ContentLength <= MossObject.middleFileSize * 1024 * 1024)
                {
                    saveUrl = DocumentManager.Upload(fileInfo, MossObject.StreamToBytes(file.InputStream), result, false);

                }
                else
                {
                    string strFileTemp = "D:\\FileTemp\\";

                    if (System.IO.Directory.Exists(strFileTemp) == false)
                    {
                        System.IO.Directory.CreateDirectory(strFileTemp);
                    }

                    string fileTemp = strFileTemp + "OA" + Current.UserName + Path.GetFileNameWithoutExtension(file.TmpFile.Name);

                    string filePath = fileTemp + file.FileName;

                p1:
                    if (System.IO.File.Exists(filePath))
                    {
                        filePath = fileTemp + new Random(1).Next(100).ToString() + file.FileName;
                        goto p1;
                    }
                    else
                    {
                        file.TmpFile.MoveTo(filePath);
                    }

                    saveUrl = DocumentManager.Upload(fileInfo, filePath, result, false);

                    File.Delete(filePath);
                }

                ////int ret = api.CopyTo(fileInfo, "322.doc", true);
                //file.TmpFile.Delete(); //删除临时文件
                //cFuJian.fullURL = saveUrl[0]; //全路径
                //cFuJian.URL = saveUrl[1];//文件夹+/文件名
                //cFuJian.Encode = "";//文件编码
                //return cFuJian;
            }
            #endregion

            #region webservice
            else
            {
                #region 更新栏位
                List<DictionaryEntry> lst = new List<DictionaryEntry>();
                DictionaryEntry de = new DictionaryEntry();
                de.Key = "流程实例";
                de.Value = UCProcessID;
                lst.Add(de);

                de = new DictionaryEntry();
                de.Key = "别名";
                de.Value = cFuJian.Alias;
                lst.Add(de);

                de = new DictionaryEntry();
                de.Key = "上次修改者";
                de.Value = CurrentUserInfo.DisplayName;
                lst.Add(de);
                #endregion

                DictionaryEntry[] result = api.ConvertToDE(lst.ToArray());

                if (file.ContentLength <= MossObject.middleFileSize * 1024 * 1024)
                {
                    //上传到文档库
                    saveUrl = api.Upload(fileInfo, MossObject.StreamToBytes(file.InputStream), result, false);
                }
                else
                {
                    string strFileTemp = "D:\\FileTemp\\";

                    if (System.IO.Directory.Exists(strFileTemp) == false)
                    {
                        System.IO.Directory.CreateDirectory(strFileTemp);
                    }

                    string fileTemp = strFileTemp + "OA" + Current.UserName + Path.GetFileNameWithoutExtension(file.TmpFile.Name);

                    string filePath = fileTemp + file.FileName;

                p1:
                    if (System.IO.File.Exists(filePath))
                    {
                        filePath = fileTemp + new Random(1).Next(100).ToString() + file.FileName;
                        goto p1;
                    }
                    else
                    {
                        file.TmpFile.MoveTo(filePath);
                    }

                    saveUrl = api.Upload_New(fileInfo, filePath, result, false);

                    File.Delete(filePath);
                }
            }

            #endregion

            file.TmpFile.Delete(); //删除临时文件

            cFuJian.fullURL = saveUrl[0]; //全路径
            cFuJian.URL = saveUrl[1];//文件夹+/文件名
            cFuJian.Encode = "";//文件编码
            return cFuJian;
        }
コード例 #32
0
 public override void Deserialise(Corba.DataInputStream source) {
     // skip rmi data
     source.read_octet();
     source.read_octet();
     // load factor
     m_loadFactor = source.read_float();
     // treshhold, ignore (calculated)
     source.read_long();
     // capacity
     m_capacity = source.read_long();
     // size
     int size = source.read_long();
     // buckets
     m_buckets = new System.Collections.DictionaryEntry[size];
     for (int i = 0; i < size; i++) {                
         object key = ReadObject(source);
         object val = ReadObject(source);
         m_buckets[i] = new System.Collections.DictionaryEntry(key, val);
     }            
 }
コード例 #33
0
        public void RunFullCmdletTest()
        {
            RunComputer = "VISIA1";
            UseLocalUser = true;
            CommandLineArgs = @"D:\VS\out\Tests\SimplePerfTests.dll -outdir D:\VS\out\Tests\TestResults\test -runner D:\PerfUnitTest\xunit\src\xunit.console\bin\Release\xunit.console.exe ";
            int arraySize = 0;
            foreach (System.Collections.DictionaryEntry de in Environment.GetEnvironmentVariables())
            {
                arraySize++;
            }
            RunEnvVars = new System.Collections.DictionaryEntry[arraySize];
            arraySize = 0;
            foreach (System.Collections.DictionaryEntry de in Environment.GetEnvironmentVariables())
            {
                RunEnvVars[arraySize] = de;
                arraySize++;
            }
            var pass = "******".ToCharArray();
            System.Security.SecureString securepass = new System.Security.SecureString();
            foreach (char ch in pass)
                securepass.AppendChar(ch);





            if (UseLocalUser)
            {
                if (RunComputer == null || RunEnvVars == null)
                    throw new Exception("If using local user, must specify runcomputer, runcredential, runenvvars.");
            }

            Program p = new Program();

            if (args.Length == 0 || args[0] == "-?")
            {
                p.PrintHeader();
                Program.PrintUsage();
                return;
            }

            try
            {
                var project = p.ParseCommandLine(args);
                string UserName = "******";

                if (UseLocalUser)
                {
                    project.UseLocalUser = true;
                    project.runComputer = RunComputer;
                    project.runCredentialsUsername = UserName;
                    project.runCredentialsPassword = securepass;
                    project.runEnvVars = RunEnvVars;
                }

                if (!p._nologo)
                {
                    p.PrintHeader();
                }

                using (AssemblyHelper.SubscribeResolve())
                {
                    p.PrintIfVerbose($"Creating output directory: {project.OutputDir}");
                    if (!Directory.Exists(project.OutputDir))
                        Directory.CreateDirectory(project.OutputDir);

                    p.RunTests(project);

                }

                return;
            }
            catch (Exception ex)
            {
                Console.Error.Write("Error: ");
                Program.ReportExceptionToStderr(ex);
            }
        }
コード例 #34
0
ファイル: Hashtable.cs プロジェクト: erisonliang/qizmt
 public void Reset()
 {
     lock (slave)
     {
         cur = new System.Collections.DictionaryEntry();
         internalsendreset();
     }
 }
コード例 #35
0
ファイル: HashList.cs プロジェクト: Fedorm/core-master
		public void CopyTo(Array array, int index)
		{
			int len = _insertionOrderList.Count;
			for (int i = 0; i < len; i++)
			{
				DictionaryEntry e = new DictionaryEntry(_insertionOrderList[i], _dictionary[_insertionOrderList[i]]);
				array.SetValue(e, index++);
			}
		}
コード例 #36
0
ファイル: Hashtable.cs プロジェクト: erisonliang/qizmt
        internal bool cangetnext()
        {
            lock (slave)
            {
                if (first)
                {
                    first = false;
                    internalsendreset();
                }

                // 'N' for next..
                slave.nstm.WriteByte((byte)'N');
                slave.nstm.WriteByte(enumid);

                // Replies with tag '+' and xcontent key and xcontent value; or tag '-' if not exists.
                int len;
                int x = slave.nstm.ReadByte();
                if ('+' == x)
                {
                    byte[] key = XContent.ReceiveXBytes(slave.nstm, out len, null); // Null buffer for copy.
                    byte[] value = XContent.ReceiveXBytes(slave.nstm, out len, null); // Null buffer for copy.
                    cur = new System.Collections.DictionaryEntry(key, value);
                    return true;
                }
                else if ('-' == x)
                {
                    return false;
                }
                else
                {
                    throw new Exception("Server returned invalid response for enumeration");
                }
            }
        }
コード例 #37
0
ファイル: XmlFactory.cs プロジェクト: snitsars/pMISMOtraining
        /// <summary>
        /// Sets the attributes of the class element with its own attributes.
        /// </summary>
        /// <param name="classElement">The class element to set attributes for.</param>
        /// <param name="any">Any object.</param>
        private static void SetAttributes(XmlElement classElement, object any)
        {
            // attemp to convert the generic object to a factory element
            IXmlFactoryElement factoryelement = any as IXmlFactoryElement;

            PropertyTable properties = new PropertyTable(any, BindingFlags.Instance | BindingFlags.Public);
            PropertyInfo pinfo = null;
            bool continueprocessing = false;

            // add any additional attributes that can not be extracted from the object
            if (factoryelement != null)
            {
                System.Collections.Specialized.NameValueCollection additionalattribs = factoryelement.AdditionalAttributes;
                if (additionalattribs != null && additionalattribs.Count > 0)
                {
                    for(int i = 0; i<additionalattribs.Count; i++)
                    {
                        classElement.SetAttribute(string.Format("{0}", additionalattribs.Keys[i]), string.Format("{0}", additionalattribs[additionalattribs.Keys[i]]));
                    }
                }
            }

            System.Collections.DictionaryEntry dentry;

            // process all the property members
            foreach(string membername in properties.MemberNames)
            {
                dentry = new System.Collections.DictionaryEntry(membername, null);
                pinfo = properties[membername];
                if (pinfo != null)
                {
                    try
                    {
                        dentry.Value = pinfo.GetValue(any, null);
                    }
                    catch
                    {
                        dentry.Value = null;
                    }
                    if (factoryelement != null)
                        continueprocessing = factoryelement.ProcessAttribute(ref dentry);
                    else
                        continueprocessing = true; // just keep going without constraints

                    // if there is no reason to quit processing then set attributes.
                    if (continueprocessing)
                        classElement.SetAttribute(string.Format("{0}", dentry.Key), string.Format("{0}", dentry.Value));
                }
            }
        }
コード例 #38
0
        public object CreateIdlForClsInstance(object clsInstance) {
            java.util.HashMapImpl result = new java.util.HashMapImpl();
            System.Collections.Hashtable source = (System.Collections.Hashtable)clsInstance;

            result.Capacity = (int)((source.Count + 1) / result.LoadFactor) + 1;
            System.Collections.DictionaryEntry[] buckets = new System.Collections.DictionaryEntry[source.Count];
            int i = 0;
            foreach (System.Collections.DictionaryEntry entry in source) {
                object key = BoxClsInstanceIfNeeded(entry.Key);
                object val = BoxClsInstanceIfNeeded(entry.Value);
                buckets[i] = new System.Collections.DictionaryEntry(key, val);
                i++;
            }
            result.SetBuckets(buckets);
               
            return result;
        }
コード例 #39
0
ファイル: MainForm.cs プロジェクト: kskjer/SceneNavi
        private void CreateSceneTree()
        {
            tvScenes.Nodes.Clear();
            TreeNode root = null;

            if (!individualFileMode)
            {
                root = new TreeNode(string.Format("{0} ({1}, v1.{2}; {3} scenes)", rom.Title, rom.GameID, rom.Version, rom.Scenes.Count)) { Tag = rom };
                foreach (ISceneTableEntry ste in rom.Scenes)
                {
                    TreeNode scene = new TreeNode(string.Format("{0} (0x{1:X})", ste.GetName(), ste.GetSceneStartAddress())) { Tag = ste };

                    if (ste.GetSceneHeaders().Count != 0)
                    {
                        HeaderCommands.Rooms rooms = ste.GetSceneHeaders()[0].Commands.FirstOrDefault(x => x.Command == HeaderLoader.CommandTypeIDs.Rooms) as HeaderCommands.Rooms;
                        if (rooms == null) continue;

                        foreach (HeaderLoader shead in ste.GetSceneHeaders())
                        {
                            List<HeaderLoader> rhs = new List<HeaderLoader>();
                            foreach (HeaderCommands.Rooms.RoomInfoClass ric in rooms.RoomInformation)
                                if (ric.Headers.Count != 0) rhs.Add(ric.Headers[shead.Number]);

                            HeaderLoader.HeaderPair hp = new HeaderLoader.HeaderPair(shead, rhs);

                            System.Collections.DictionaryEntry de = new System.Collections.DictionaryEntry();
                            foreach (System.Collections.DictionaryEntry d in rom.XMLStageDescriptions.Names)
                            {
                                HeaderLoader.StageKey sk = d.Key as HeaderLoader.StageKey;
                                if (sk.SceneAddress == ste.GetSceneStartAddress() && sk.HeaderNumber == hp.SceneHeader.Number)
                                {
                                    de = d;
                                    hp.Description = (string)de.Value;
                                    break;
                                }
                            }

                            TreeNode sheadnode = new TreeNode((de.Value == null ? string.Format("Stage #{0}", shead.Number) : (string)de.Value)) { Tag = hp };
                            foreach (HeaderCommands.Rooms.RoomInfoClass ric in rooms.RoomInformation)
                            {
                                TreeNode room = new TreeNode(string.Format("{0} (0x{1:X})", ric.Description, ric.Start)) { Tag = ric };
                                sheadnode.Nodes.Add(room);
                            }

                            scene.Nodes.Add(sheadnode);
                        }
                    }

                    root.Nodes.Add(scene);
                }

                root.Expand();
                tvScenes.Nodes.Add(root);
            }
            else
            {
                root = new TreeNode(tempScene.GetName()) { Tag = tempScene };
                HeaderCommands.Rooms rooms = tempScene.GetSceneHeaders()[0].Commands.FirstOrDefault(x => x.Command == HeaderLoader.CommandTypeIDs.Rooms) as HeaderCommands.Rooms;

                TreeNode nodeToSelect = null;
                if (rooms != null)
                {
                    foreach (HeaderLoader shead in tempScene.GetSceneHeaders())
                    {
                        List<HeaderLoader> rhs = new List<HeaderLoader>();
                        foreach (HeaderCommands.Rooms.RoomInfoClass ric in rooms.RoomInformation)
                            if (ric.Headers.Count != 0) rhs.Add(ric.Headers[shead.Number]);

                        HeaderLoader.HeaderPair hp = new HeaderLoader.HeaderPair(shead, rhs);

                        TreeNode sheadnode = new TreeNode(string.Format("Stage #{0}", shead.Number)) { Tag = hp };
                        foreach (HeaderCommands.Rooms.RoomInfoClass ric in rooms.RoomInformation)
                        {
                            TreeNode room = new TreeNode(string.Format("{0} (0x{1:X})", ric.Description, ric.Start)) { Tag = ric };
                            sheadnode.Nodes.Add(room);
                        }
                        sheadnode.Expand();
                        root.Nodes.Add(sheadnode);
                        if (nodeToSelect == null) nodeToSelect = sheadnode.FirstNode;
                    }
                }

                root.Expand();
                tvScenes.Nodes.Add(root);
                tvScenes.SelectedNode = nodeToSelect;
            }
        }