Question: I need to write a program (in C#), to run in the client local machine, that will show a list of our windows servers (Sort of the server names in a ListBox) and let the user choose and subsequently connect via RDC. However, the program needs to know if the user is already connected to one of the listed servers, in which case the client will be advised to first disconnect from previous session before continuing. The question is how to detect if there is already such an active connection in the user local machine? And better yet, would it be possible to detect the ip address of this server, so that we can ignore the connection if it is not in one of our servers?

Answer: 
Well, even though the numbers don't seem to make sense, this is what I came up with (giving the results *you're* expecting (from the examples provided). Take this through the wringer and see if it comes out with all the results you are expecting:

```
static Int32 GetYearFromBCD(Int32 time)
{
    List<Int32> YearList = new List<Int32>();
    for (Int32 i = 3; i >= 0; i --)
    {
        Int32 place = i * 4;
        Int32 val = 0x01 << place;

        Int32 curVal = (Int32)(time / val);
        if (curVal > 9 && YearList.Count > 0)
        {
            Int32 delta = (Int32)(curVal / 10);
            YearList[YearList.Count - 1] += delta;
            curVal -= delta * 10;
        }
        YearList.Add(curVal);
        time -= curVal << place;
    }
    Int32 Year = 0;
    for (Int32 y = 0; y < 4; y++)
        Year += YearList[y] * (Int32)Math.Pow(10,(4 - y)-1);
    return Year;
}

```

I'm really just taking a shot in the dark at this as the numbers you gave aren't what I would call typical. Having said that, you have to make what you're receiving work, so :shrug:.
If you want to convert number to hex representation just use ToString with "x" as param:

```
2010.ToString("x")  output: "7da"

```

However, I don't really understand what to you want to achieve if you say that for 2010, you expect 200A.