Пример #1
0
        //public class DictIntComparer : IEqualityComparer<int>
        //{
        //    public bool Equals(int x, int y)
        //    {
        //        return x == y;
        //    }

        //    public int GetHashCode(int obj)
        //    {
        //        return obj;
        //    }
        //}

        //private Dictionary<int, string> testDict;
        //private DictIntComparer testDictComparer;

        //public class IntMap<TValue> : Map<int, TValue>
        //{
        //    protected override bool keysEqual(int key1, int key2)
        //    {
        //        return (key1 == key2);
        //    }
        //}
        //public class StringMap<TValue> : Map<string, TValue>
        //{
        //    protected override bool keysEqual(string key1, string key2)
        //    {
        //        return (key1 == key2);
        //    }
        //}

        //public float Pow(float x, float y)
        //{
        //    if (y == 0)
        //    {
        //        return 1;
        //    }
        //    else if (y == 1)
        //    {
        //        return x;
        //    }
        //    else
        //    {
        //        float xResult = x;

        //        for (int i = 2; i <= y; i++)
        //        {
        //            xResult = xResult * x;
        //        }

        //        return xResult;
        //    }
        //}
        //private float Sqrt(float d)
        //{
        //    if ((d < 0) || (float.IsNaN(d) == true) || (float.IsNegativeInfinity(d) == true))
        //    {
        //        return float.NaN;
        //    }
        //    if (float.IsPositiveInfinity(d) == true)
        //    {
        //        return float.PositiveInfinity;
        //    }
        //    if (d == 0)
        //    {
        //        return 0;
        //    }
        //    if (d == 1)
        //    {
        //        return 1;
        //    }

        //    string strD = d.ToString();
        //    int D = strD.Length;
        //    int n = 0;
        //    float x;
        //    if ((D % 2) == 0)
        //    {
        //        n = (D - 2) / 2;
        //        x = 6.0f * Pow(10f, n);
        //    }
        //    else
        //    {
        //        n = (D - 1) / 2;
        //        x = 2.0f * Pow(10f, n);
        //    }
        //    int precision = (strD.Length > 6 ? strD.Length : 6);

        //    return x;
        //}

        //internal class BaseClass
        //{
        //    public int baseField;

        //    internal BaseClass()
        //    {
        //        initFields();
        //    }

        //    protected virtual void initFields()
        //    {
        //        baseField = 1;
        //    }
        //}
        //internal class SubClass : BaseClass
        //{
        //    public int subField;

        //    internal SubClass()
        //        : base()
        //    {
        //    }

        //    protected override void initFields()
        //    {
        //        base.initFields();
        //        subField = 2;
        //    }
        //}
        //internal class SubSubClass : SubClass
        //{
        //    public int subsubField;

        //    internal SubSubClass()
        //        :base()
        //    {
        //    }

        //    protected override void initFields()
        //    {
        //        base.initFields();
        //        subsubField = 3;
        //    }
        //}

        protected override void BeforeRun()
        {
            Console.WriteLine("SSchocke Test Playground");

            Console.WriteLine("Finding network devices...");
            AMDPCNetII.FindAll();

            NetworkDevice nic = NetworkDevice.Devices[0];

            IPv4.Address myIP      = new IPv4.Address(192, 168, 1, 51);
            IPv4.Address mySubnet  = new IPv4.Address(255, 255, 255, 0);
            IPv4.Address myGateway = new IPv4.Address(192, 168, 1, 1);
            IPv4.Config  myConfig  = new IPv4.Config(myIP, mySubnet, myGateway);

            NetworkStack.ConfigIP(nic, myConfig);
            nic.Enable();

            Console.WriteLine("Init Done... Starting main loop");
        }