コード例 #1
0
        /// <summary>
        ///     Compares two IP address ranges.
        /// </summary>
        /// <returns>
        ///     <see langword="true" /> if the two address ranges are equal; otherwise, <see langword="false" />.
        /// </returns>
        /// <param name="other">An <see cref="IPRange" /> instance to compare to the current instance. </param>
        public bool Equals(IPRange other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(StartAddress.Equals(other.StartAddress) && EndAddress.Equals(other.EndAddress));
        }
コード例 #2
0
ファイル: MemorySection.cs プロジェクト: Nyubt/Practice
        public override bool Equals(Object obj)
        {
            MemorySection <T> personObj = obj as MemorySection <T>;

            if (personObj == null)
            {
                return(false);
            }
            else
            {
                return(Name.Equals(personObj.Name) && StartAddress.Equals(personObj.StartAddress) &&
                       EndAddress.Equals(personObj.EndAddress) && IsSymbol.Equals(personObj.IsSymbol));
            }
        }
コード例 #3
0
        public StatusObject GetMemoryAddresses()
        {
            StatusObject SO = new StatusObject();

            try
            {
                Console.WriteLine(StartAddress);
                Console.WriteLine(EndAddress);
                Console.WriteLine(EndAddress.ToInt64() - StartAddress.ToInt64());
            }
            catch (Exception e)
            {
                SO = new StatusObject(e, "PROCESS_GETMEMORYADDRESSES");
            }
            return(SO);
        }
コード例 #4
0
ファイル: MemorySection.cs プロジェクト: Nyubt/Practice
 /// <summary>
 /// Prints information about the Section
 /// </summary>
 public void ShowSection()
 {
     Console.WriteLine("Name: " + Name);
     Console.WriteLine("Start: " + StartAddress.ToString());
     Console.WriteLine("End: " + EndAddress.ToString());
 }
コード例 #5
0
 /// <summary>
 ///     Compares two IP address ranges.
 /// </summary>
 /// <returns>
 ///     <see langword="true" /> if the two address ranges are equal; otherwise, <see langword="false" />.
 /// </returns>
 /// <param name="comparand">An <see cref="IPRange" /> instance to compare to the current instance. </param>
 private bool Equals(IPRange comparand)
 {
     return(StartAddress.Equals(comparand.StartAddress) && EndAddress.Equals(comparand.EndAddress));
 }
コード例 #6
0
 internal DHCP_IP_RANGE ToNativeIpRange()
 => new DHCP_IP_RANGE(StartAddress.ToNativeAsNetwork(), EndAddress.ToNativeAsNetwork());
コード例 #7
0
 internal DHCP_BOOTP_IP_RANGE ToNativeBootpIpRange()
 => new DHCP_BOOTP_IP_RANGE(StartAddress.ToNativeAsNetwork(), EndAddress.ToNativeAsNetwork(), BootpClientsAllocated, MaxBootpAllowed);
コード例 #8
0
ファイル: Fsm.cs プロジェクト: xxxLucifeRxxx/TelegramBot
        public Fsm(long chatId, Message msg, TelegramBotClient bot, Context db)
        {
            User state;

            lock (Locker)
            {
                state = db.Users.FirstOrDefault(x => x.ChatId == chatId);
            }

            if (state == null)
            {
                User user = new User
                {
                    ChatId = chatId,
                    State  = StateChatEnum.StartMain
                };
                db.Users.Add(user);
                db.SaveChanges();
            }

            if (state != null)
            {
                IUpdateState updateState;

                switch (state.State)
                {
                case StateChatEnum.StartMain:
                    var uid = db.Users.FirstOrDefault(x => x.ChatId == chatId);
                    if (uid == null)
                    {
                        User user = new User
                        {
                            ChatId = chatId,
                            State  = StateChatEnum.StartText
                        };

                        db.Users.Add(user);
                        db.SaveChanges();
                    }

                    updateState = new StartMain();
                    break;

                case StateChatEnum.EndAddress:
                    updateState = new EndAddress();
                    break;

                case StateChatEnum.StartText:
                    updateState = new StartText();
                    break;

                case StateChatEnum.SendingTime:
                    updateState = new SendingTime();
                    break;

                case StateChatEnum.SendingNumberPhone:
                    updateState = new SendingNumberPhone();
                    break;

                case StateChatEnum.PaymentMethod:
                    updateState = new PaymentMethod();
                    break;

                case StateChatEnum.CarSearch:
                    updateState = new CarSearch();
                    break;

                //case StateChatEnum.CarSearch:
                //	updateState = new CarSearch();
                //	break;

                default:
                    throw new AggregateException();
                }

                updateState.UpdateAsync(msg, bot, chatId, db);
            }
        }