Ejemplo n.º 1
0
        /// <summary>
        /// Compares all the bytes in the two ranges of the arrays.
        /// Returns true iff the ranges have the same byte values.
        /// </summary>
        /// <param name="array">The first array to compare.</param>
        /// <param name="offset">The offset of the first byte to compare in the first array.</param>
        /// <param name="other">The second array to compare.</param>
        /// <param name="otherOffset">The offset of the first byte to compare in the second array.</param>
        /// <param name="count">The number of bytes to compare.</param>
        /// <returns>True iff the ranges have the same byte values.</returns>
        public static bool SequenceEqual(this byte[] array, int offset, byte[] other, int otherOffset, int count)
        {
            if (array == null)
                throw new ArgumentNullException("array");

            return array.Compare(offset, other, otherOffset, count) == 0;
        }
 public static bool Compare(this XmlDiff xmlDiff, Stream srcStream, Stream diffStream)
 {
     XmlTextReader src = new XmlTextReader(srcStream);
     XmlTextReader dest = new XmlTextReader(diffStream);
     xmlDiff.IgnoreWhitespace = true;
     return xmlDiff.Compare(src, dest);
 }
Ejemplo n.º 3
0
        public static bool Compare(this FileInfo currentFile, FileInfo otherFile)
        {
            if (currentFile == null || otherFile == null)
                return false;

            return currentFile.Compare(otherFile.FullName);
        }
        internal static void ShouldBeCopiedOK(this IPersistentBufferProvider @this,string iPath)
        {
            bool res = @this.CopyTo(iPath);
            res.Should().BeTrue();

            File.Exists(iPath).Should().BeTrue();

            IPersistentBufferProvider bc = InternalBufferFactory.GetBufferProviderFromFile(iPath);
            bc.Should().NotBeNull();
            @this.Compare(bc).Should().BeTrue();

            @this.CopyTo("").Should().BeFalse();

        }
        internal static IBufferProvider ShouldBeClonedOK(this IPersistentBufferProvider @this)
        {
            IBufferProvider res = @this.Clone(); 
            res.Should().NotBeNull();

            object.ReferenceEquals(res, @this).Should().BeFalse();
       
            @this.Compare(res).Should().BeTrue();

          

            return res;
           
        }
        public static void AutoCheck(this ICheckerCompare compare, IEnumerable<PropertyInfo> properties)
        {
            // Setup the comparisons
            foreach (var prop in properties)
            {
                // Exclude indexers
                var x = prop.GetIndexParameters();
                if (x.GetLength(0) != 0)
                {
                    continue;
                }

                compare.Compare(prop);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 現在のインスタンスと月を比較する。
 /// </summary>
 /// <param name="self">自分自身</param>
 /// <param name="value">比較する値</param>
 /// <returns>比較結果(true:一致, false:不一致)</returns>
 public static bool CompareMonth(this DateTime self, DateTime value)
 {
     return self.Compare(value, DateTimeKind.Month);
 }
Ejemplo n.º 8
0
		public static string ToString(this MDEntryType[] array)
		{
			if (array.Compare(MDEntryTypes.All)) return "All";
			var a = array.Select(t => t.ToString()).ToArray();
			return string.Join("+", a);
		}
Ejemplo n.º 9
0
 /// <summary>
 /// 現在のインスタンスとミリ秒を比較する。
 /// </summary>
 /// <param name="self">自分自身</param>
 /// <param name="value">比較する値</param>
 /// <returns>比較結果(true:一致, false:不一致)</returns>
 public static bool CompareMillisecond(this DateTime self, DateTime value)
 {
     return self.Compare(value, DateTimeKind.Milliseconds);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 現在のインスタンスと年を比較する。
 /// </summary>
 /// <param name="self">自分自身</param>
 /// <param name="value">比較する値</param>
 /// <returns>比較結果(true:一致, false:不一致)</returns>
 public static bool CompareYear(this DateTime self, DateTime value)
 {
     return self.Compare(value, DateTimeKind.Year);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 現在のインスタンスと分を比較する。
 /// </summary>
 /// <param name="self">自分自身</param>
 /// <param name="value">比較する値</param>
 /// <returns>比較結果(true:一致, false:不一致)</returns>
 public static bool CompareMinute(this DateTime self, DateTime value)
 {
     return self.Compare(value, DateTimeKind.Minute);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 現在のインスタンスと秒を比較する。
 /// </summary>
 /// <param name="self">自分自身</param>
 /// <param name="value">比較する値</param>
 /// <returns>比較結果(true:一致, false:不一致)</returns>
 public static bool CompareSecond(this DateTime self, DateTime value)
 {
     return self.Compare(value, DateTimeKind.Second);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 現在のインスタンスと日を比較する。
 /// </summary>
 /// <param name="self">自分自身</param>
 /// <param name="value">比較する値</param>
 /// <returns>比較結果(true:一致, false:不一致)</returns>
 public static bool CompareDay(this DateTime self, DateTime value)
 {
     return self.Compare(value, DateTimeKind.Day);
 }
Ejemplo n.º 14
0
        public static IFolderComparisonReport Compare(this IFolder folder1, string[] folderContent2, ReportOption reportOption = ReportOption.EqualOnly)
        {
            if (folderContent2 == null)
            {
                IFolder folder2 = null;
                return folder1.Compare(folder2);
            }

            using (var temporaryFolder = new TemporaryFolder())
            {
                foreach (string folderEntity in folderContent2)
                {
                    temporaryFolder.CreateFile(folderEntity);
                }
                return folder1.Compare(temporaryFolder, reportOption);
            }
        }
Ejemplo n.º 15
0
 public static bool StartsWith(this byte[] array1, params byte[] array2)
 {
     return array1.Compare(true, array2);
 }
Ejemplo n.º 16
0
 public static bool Compare(this byte[] array1, int[] anyMaskIndexes, params byte[] array2)
 {
     return array1.Compare(false, anyMaskIndexes, array2);
 }
Ejemplo n.º 17
0
 public static bool Compare(this byte[] array1, params byte[] array2)
 {
     return array1.Compare(false, array2);
 }
Ejemplo n.º 18
0
 /// <summary>
 ///     Returns the auto-attack range.
 /// </summary>
 /// <param name="target">
 ///     The target.
 /// </param>
 /// <returns>
 ///     The <see cref="float" />.
 /// </returns>
 public static float GetRealAutoAttackRange(this AttackableUnit target)
 {
     return GetRealAutoAttackRange(GameObjects.Player, target.Compare(GameObjects.Player) ? null : target);
 }
Ejemplo n.º 19
0
		public static IComparer Invert(this IComparer comparer)
		{
			return new FuncToComparer((x, y) => -comparer.Compare(x, y));
		}