Пример #1
0
 /// <summary>
 /// Generates a new <see cref="Watch"/> instance
 /// Can be either <see cref="ByteWatch"/>, <see cref="WordWatch"/>, <see cref="DWordWatch"/> or <see cref="SeparatorWatch"/>
 /// </summary>
 /// <param name="domain">The <see cref="MemoryDomain"/> where you want to watch</param>
 /// <param name="address">The address into the <see cref="MemoryDomain"/></param>
 /// <param name="size">The size</param>
 /// <param name="type">How the watch will be displayed</param>
 /// <param name="bigEndian">Endianess (true for big endian)</param>
 /// <param name="note">A custom note about the <see cref="Watch"/></param>
 /// <param name="value">The current watch value</param>
 /// <param name="prev">Previous value</param>
 /// <param name="changeCount">Number of changes occurs in current <see cref="Watch"/></param>
 /// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
 public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note = "", long value = 0, long prev = 0, int changeCount = 0)
 {
     return(size switch
     {
         WatchSize.Separator => SeparatorWatch.NewSeparatorWatch(note),
         WatchSize.Byte => new ByteWatch(domain, address, type, bigEndian, note, (byte)value, (byte)prev, changeCount),
         WatchSize.Word => new WordWatch(domain, address, type, bigEndian, note, (ushort)value, (ushort)prev, changeCount),
         WatchSize.DWord => new DWordWatch(domain, address, type, bigEndian, note, (uint)value, (uint)prev, changeCount),
         _ => SeparatorWatch.NewSeparatorWatch(note)
     });
Пример #2
0
        /// <summary>
        /// Generates a new <see cref="Watch"/> instance
        /// Can be either <see cref="ByteWatch"/>, <see cref="WordWatch"/>, <see cref="DWordWatch"/> or <see cref="SeparatorWatch"/>
        /// </summary>
        /// <param name="domain">The <see cref="MemoryDomain"/> where you want to watch</param>
        /// <param name="address">The address into the <see cref="MemoryDomain"/></param>
        /// <param name="size">The size</param>
        /// <param name="type">How the watch will be displayed</param>
        /// <param name="bigEndian">Endianess (true for big endian)</param>
        /// <param name="note">A custom note about the <see cref="Watch"/></param>
        /// <param name="value">The current watch value</param>
        /// <param name="prev">Previous value</param>
        /// <param name="changeCount">Number of changes occurs in current <see cref="Watch"/></param>
        /// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
        public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note = "", long value = 0, long prev = 0, int changeCount = 0)
        {
            switch (size)
            {
            default:
            case WatchSize.Separator:
                return(SeparatorWatch.NewSeparatorWatch(note));

            case WatchSize.Byte:
                return(new ByteWatch(domain, address, type, bigEndian, note, (byte)value, (byte)prev, changeCount));

            case WatchSize.Word:
                return(new WordWatch(domain, address, type, bigEndian, note, (ushort)value, (ushort)prev, changeCount));

            case WatchSize.DWord:
                return(new DWordWatch(domain, address, type, bigEndian, note, (uint)value, (uint)prev, changeCount));
            }
        }