Results 1 to 7 of 7

Thread: Convert Max address to Serial

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2021
    Posts
    4

    Convert Max address to Serial

    Mac Address is : FC-45-96-95-17-18


    Code:
          string str = this.GetMacAddress().ToString();
          int int32_1 = Convert.ToInt32(str.Substring(2, 1), 16);
          int int32_2 = Convert.ToInt32(str.Substring(4, 1), 16);
          int num1 = Math.Abs(int32_1 - int32_2);
          int num2 = int32_1 * 2 + num1;
          int num3 = int32_2 * 3 + num1;
          if (this.txtN1.Text.Equals(num2.ToString().PadLeft(2, '0') + num3.ToString().PadLeft(2, '0')))

    whats the serial ?
    Last edited by dday9; Feb 11th, 2021 at 11:10 AM.

  2. #2
    Fanatic Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    750

    Re: Convert Max address to Serial

    Your code appears to be C# and is not complete anyway. What are you trying to do?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Convert Max address to Serial

    Please provide a FULL and CLEAR explanation of the problem. Explain what you're trying to achieve, how you're trying to achieve it and what happens when you try.

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2021
    Posts
    4

    Re: Convert Max address to Serial

    Code:
    using System;
    
    public class Program
    {
        public static void Main()
        {
            String str = "FC4596951718".ToString();
            int int32_1 = Convert.ToInt32(str.Substring(2,1),16);
            int int32_2 = Convert.ToInt32(str.Substring(4,1),16);
            int num1 = Math.Abs(int32_1 - int32_2);
            int num2 = int32_1 * 2 + num1;
            int num3 = int32_2 * 3 + num1;
            Console.WriteLine(int32_1);
            Console.WriteLine(int32_2);
            Console.WriteLine(num1);
            Console.WriteLine(num2);
            Console.WriteLine(num3);
        }
    }
    Result:
    • 4
    • 9
    • 5
    • 13
    • 32


    the serial is : 1332
    Last edited by dday9; Feb 11th, 2021 at 12:17 PM.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2021
    Posts
    4

    Re: Convert Max address to Serial

    yes you are right the code is writing with C#

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2021
    Posts
    4

    Re: Convert Max address to Serial

    my calc was wrong from Math.Abs but now the code working good
    thx

  7. #7
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    845

    Re: Convert Max address to Serial

    Name:  index.jpg
Views: 103
Size:  10.1 KB
    The best friend of any programmer is a search engine
    "Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
    “They did not know it was impossible so they did it” (Mark Twain)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width