protected override void WriteAdditionalInfo(System.Collections.Specialized.NameValueCollection additionalInformation)
        {
            DateTime time ;
            if (DateTime.TryParse(additionalInformation["TimeStamp"], out time))
            {
                additionalInformation.Set("TimeStamp", time.ToLocalTime().ToString("dd/MM/yyyy HH:mm:ss"));
            }

            base.WriteAdditionalInfo(additionalInformation);
        }
Example #2
0
        private static void _find_file(List<CIM_DataFile> _find_files, System.Threading.ManualResetEvent rs_e, 
            Win32_Process prc, ref List<Win32_Process> lstProc)
        {
            CIM_DataFile[] files = prc.GetOpenedCIM_DataFiles();
                foreach (CIM_DataFile file in files)
                {
                    _search_file = file;
                    CIM_DataFile d_finded = _find_files.Find(find_file);
                    if (d_finded != null)
                    {
                        lstProc.Add(prc);
                    }

                }
                rs_e.Set();
        }
		private void  CheckExpecteds(System.Collections.BitArray expecteds)
		{
			IndexReader r = IndexReader.Open(dir);
			
			//Perhaps not the most efficient approach but meets our needs here.
			for (int i = 0; i < r.MaxDoc(); i++)
			{
				if (!r.IsDeleted(i))
				{
					System.String sval = r.Document(i).Get(FIELD_RECORD_ID);
					if (sval != null)
                    {
                        int val = System.Int32.Parse(sval);
                        Assert.IsTrue(expecteds.Get(val), "Did not expect document #" + val);
                        expecteds.Set(val, false); 
                    }
				}
			}
			r.Close();
			Assert.AreEqual(0, Support.BitSetSupport.Cardinality(expecteds), "Should have 0 docs remaining ");
		}
Example #4
0
            /// <summary>
            /// Sets the specified bit to true.
            /// </summary>
            /// <param name="bits">The BitArray to modify.</param>
            /// <param name="index">The bit index to set to true.</param>
            public static void Set(System.Collections.BitArray bits, System.Int32 index)
            {
                for (int increment = 0; index >= bits.Length; increment = +64)
                {
                    bits.Length += increment;
                }

                bits.Set(index, true);
            }
Example #5
0
 private double CalcAbs(int i, System.Collections.BitArray used)
 {
     if (i == N - 1)
     {
         int j = 0;
         while (used[j]) j++;
         return _m[i, j];
     }
     else
     {
         int a = 1;
         double sum = 0;
         for (int j = 0; j < N; j++)
         {
             if (!used[j])
             {
                 if (_m[i, j] != 0)
                 {
                     used.Set(j, true);
                     sum += a * _m[i, j] * CalcAbs(i + 1, used);
                     used.Set(j, false);
                 }
                 a = -a;
             }
         }
         return sum;
     }
 }
        private MFTestResults SetCommonHttpResponseHeaders_1_0(ref System.Net.WebHeaderCollection wrs)
        {
            MFTestResults result = MFTestResults.Pass;

            try
            {
                Log.Comment("Set Response Headers Properties");
                wrs.Set(HttpKnownHeaderNames.Allow.ToString(), "GET");
                wrs.Set(HttpKnownHeaderNames.ContentEncoding.ToString(), "gzip");
                wrs.Set(HttpKnownHeaderNames.ContentLength.ToString(), "26012");
                wrs.Set(HttpKnownHeaderNames.ContentType.ToString(), "text/plain, image/gif");
                wrs.Set(HttpKnownHeaderNames.Expires.ToString(), "Thu, 01 Dec 1994 16:00:00 GMT");  //always force client cache validate on the request
                wrs.Set(HttpKnownHeaderNames.KeepAlive.ToString(), "");
                wrs.Set(HttpKnownHeaderNames.LastModified.ToString(), "Fri, 22 May 2009 12:43:31 GMT");
                wrs.Set(HttpKnownHeaderNames.Location.ToString(), "http://www.w3.org/pub/WWW/People.html");
                wrs.Set(HttpKnownHeaderNames.WWWAuthenticate.ToString(), "BASIC realm=\"executives\"");
            }
            catch (Exception ex)
            {
                if (!HttpTests.ValidateException(ex, typeof(InvalidOperationException)))
                    result = MFTestResults.Fail;
            }

            return result;
        }
        private MFTestResults SetCommonHttpResponseHeaders(ref System.Net.WebHeaderCollection wrs)
        {
            MFTestResults result = MFTestResults.Pass;

            try
            {
                Log.Comment("Set Response Headers Properties");
                wrs.Set(HttpKnownHeaderNames.AcceptRanges.ToString(), "bytes");
                wrs.Set(HttpKnownHeaderNames.Age.ToString(), "0");
                wrs.Set(HttpKnownHeaderNames.Allow.ToString(), "GET, PUT");
                wrs.Set(HttpKnownHeaderNames.CacheControl.ToString(), "no-cache"); //Force intermediate caches to validate their copies directly with the origin server.
                wrs.Set(HttpKnownHeaderNames.Connection.ToString(), "close");
                wrs.Set(HttpKnownHeaderNames.ContentEncoding.ToString(), "gzip");
                wrs.Set(HttpKnownHeaderNames.ContentLanguage.ToString(), "mi, en");
                wrs.Set(HttpKnownHeaderNames.ContentLength.ToString(), "26012");
                wrs.Set(HttpKnownHeaderNames.ContentLocation.ToString(), "");
                wrs.Set(HttpKnownHeaderNames.ContentMD5.ToString(), "60e985979f1d55ab7542440fbb9659e5");
                wrs.Set(HttpKnownHeaderNames.ContentRange.ToString(), "bytes 21010-47021/47022");
                wrs.Set(HttpKnownHeaderNames.ContentType.ToString(), "text/plain, image/gif");
                wrs.Set(HttpKnownHeaderNames.Date.ToString(), System.DateTime.Today.ToString());
                wrs.Set(HttpKnownHeaderNames.ETag.ToString(), "W/");
                wrs.Set(HttpKnownHeaderNames.Expires.ToString(), "Thu, 01 Dec 1994 16:00:00 GMT");  //always force client cache validate on the request
                wrs.Set(HttpKnownHeaderNames.KeepAlive.ToString(), "");
                wrs.Set(HttpKnownHeaderNames.LastModified.ToString(), "Fri, 22 May 2009 12:43:31 GMT");
                wrs.Set(HttpKnownHeaderNames.Location.ToString(), "http://www.w3.org/pub/WWW/People.html");
                wrs.Set(HttpKnownHeaderNames.Pragma.ToString(), "no-cache");
                wrs.Set(HttpKnownHeaderNames.ProxyAuthenticate.ToString(), "NNNNNNNNNNNNNNNNN==");
                wrs.Set(HttpKnownHeaderNames.RetryAfter.ToString(), "120");
                wrs.Set(HttpKnownHeaderNames.SetCookie.ToString(), "http://www.w3.org/hypertext/DataSources/Overview.html");
                wrs.Set(HttpKnownHeaderNames.Trailer.ToString(), "Test Code");
                wrs.Set(HttpKnownHeaderNames.TransferEncoding.ToString(), "8BIT");
                wrs.Set(HttpKnownHeaderNames.Upgrade.ToString(), "HTTP/2.0, SHTTP/1.3");
                wrs.Set(HttpKnownHeaderNames.Vary.ToString(), "TestVary");
                wrs.Set(HttpKnownHeaderNames.Via.ToString(), "1.0 fred, 1.1 nowhere.com (Apache/1.1)");
                wrs.Set(HttpKnownHeaderNames.Warning.ToString(), "TestWarning");
                wrs.Set(HttpKnownHeaderNames.WWWAuthenticate.ToString(), "BASIC realm=\"executives\"");
            }
            catch (Exception ex)
            {
                if (!HttpTests.ValidateException(ex, typeof(InvalidOperationException)))
                    result = MFTestResults.Fail;
            }

            return result;
        }
 private void SetMaskedTextProvider(System.ComponentModel.MaskedTextProvider newProvider, string textOnInitializingMask)
 {
     newProvider.IncludePrompt = this.maskedTextProvider.IncludePrompt;
     newProvider.IncludeLiterals = this.maskedTextProvider.IncludeLiterals;
     newProvider.SkipLiterals = this.maskedTextProvider.SkipLiterals;
     newProvider.ResetOnPrompt = this.maskedTextProvider.ResetOnPrompt;
     newProvider.ResetOnSpace = this.maskedTextProvider.ResetOnSpace;
     if (this.flagState[IS_NULL_MASK] && (textOnInitializingMask == null))
     {
         this.maskedTextProvider = newProvider;
     }
     else
     {
         string textOutput;
         int testPosition = 0;
         bool flag = false;
         MaskedTextResultHint noEffect = MaskedTextResultHint.NoEffect;
         System.ComponentModel.MaskedTextProvider maskedTextProvider = this.maskedTextProvider;
         bool preserveCaret = maskedTextProvider.Mask == newProvider.Mask;
         if (textOnInitializingMask != null)
         {
             textOutput = textOnInitializingMask;
             flag = !newProvider.Set(textOnInitializingMask, out testPosition, out noEffect);
         }
         else
         {
             textOutput = this.TextOutput;
             int assignedEditPositionCount = maskedTextProvider.AssignedEditPositionCount;
             int position = 0;
             int num4 = 0;
             while (assignedEditPositionCount > 0)
             {
                 position = maskedTextProvider.FindAssignedEditPositionFrom(position, true);
                 if (preserveCaret)
                 {
                     num4 = position;
                 }
                 else
                 {
                     num4 = newProvider.FindEditPositionFrom(num4, true);
                     if (num4 == System.ComponentModel.MaskedTextProvider.InvalidIndex)
                     {
                         newProvider.Clear();
                         testPosition = newProvider.Length;
                         noEffect = MaskedTextResultHint.UnavailableEditPosition;
                         break;
                     }
                 }
                 if (!newProvider.Replace(maskedTextProvider[position], num4, out testPosition, out noEffect))
                 {
                     preserveCaret = false;
                     newProvider.Clear();
                     break;
                 }
                 position++;
                 num4++;
                 assignedEditPositionCount--;
             }
             flag = !System.ComponentModel.MaskedTextProvider.GetOperationResultFromHint(noEffect);
         }
         this.maskedTextProvider = newProvider;
         if (this.flagState[IS_NULL_MASK])
         {
             this.flagState[IS_NULL_MASK] = false;
         }
         if (flag)
         {
             this.OnMaskInputRejected(new MaskInputRejectedEventArgs(testPosition, noEffect));
         }
         if (newProvider.IsPassword)
         {
             this.SetEditControlPasswordChar('\0');
         }
         EventArgs empty = EventArgs.Empty;
         if ((textOnInitializingMask != null) || (maskedTextProvider.Mask != newProvider.Mask))
         {
             this.OnMaskChanged(empty);
         }
         this.SetWindowText(this.GetFormattedDisplayString(), textOutput != this.TextOutput, preserveCaret);
     }
 }