예제 #1
0
 public ETCAxis(string axisName)
 {
     name              = axisName;
     enable            = true;
     speed             = 15;
     invertedAxis      = false;
     isEnertia         = false;
     inertia           = 0;
     inertiaThreshold  = 0.08f;
     axisValue         = 0;
     axisSpeedValue    = 0;
     gravity           = 0;
     isAutoStab        = false;
     autoStabThreshold = 0.01f;
     autoStabSpeed     = 10;
     maxAngle          = 90;
     minAngle          = 90;
     axisState         = AxisState.None;
     maxOverTimeValue  = 1;
     overTimeStep      = 1;
     isValueOverTime   = false;
     axisThreshold     = 0.5f;
     deadValue         = 0.1f;
     actionOn          = ActionOn.Press;
 }
예제 #2
0
        public static void PerformanceTestMixed()
        {
            try
            {
                System.IO.Directory.Delete(CurrentDirectory + "/Persons2", true);
                System.IO.Directory.Delete(CurrentDirectory + "/Persons3", true);
            }
            catch { }
            var Persons2 = new DirectoryTable <Person2, string>(
                CurrentDirectory + "/Persons2",
                (person) => person.Name, false, true);
            var count = 1000000;
            Array <ActionOn> Actions = new Array <ActionOn>();

            for (int i = 0; i < count; i++)
            {
                var CurrentAction = new ActionOn()
                {
                    Id = i
                };
                CurrentAction.Insert = true;
                //CurrentAction.Update = true;
                CurrentAction.Delete = true;
                Actions.Insert(CurrentAction);
            }

            Array <string> Inserted = new Array <string>();
            Random         random   = new Random();

            while (Actions.Length > 0)
            {
                var i  = random.Next(0, Actions.Length - 1);
                var Ac = Actions[i];
                if (Ac.Insert)
                {
                    Persons2.Insert((c) => c.Name = Ac.Id.ToString());
                    Ac.Insert = false;
                }
                else if (Ac.Update)
                {
                    Persons2.Update((c) => c.Name = Ac.Id.ToString(), (c) => c.id = Ac.Id);
                    Ac.Update = false;
                }
                else
                {
                    Persons2.Delete((c) => c.Name = Ac.Id.ToString());
                    Actions.DeleteByPosition(i);
                }
            }

            Console.ReadKey();
        }
예제 #3
0
        public static void SafeTest()
        {
            var Persons = new ArrayTable <Person2, string>(
                (person) => person.Name, false);
            var count = 100000;

            Persons.ToArray();
            Array <ActionOn> Actions = new Array <ActionOn>();

            for (int i = 0; i < count; i++)
            {
                var Id            = i;
                var CurrentAction = new ActionOn()
                {
                    Id = Id
                };
                CurrentAction.Insert = () =>
                                       Persons.Insert((c) => c.Name = Id.ToString());
                CurrentAction.Update = () =>
                                       Persons.Update((c) => c.Name = Id.ToString(), (c) => c.id = Id);
                CurrentAction.Delete = () =>
                                       Persons.Delete((c) => c.Name = Id.ToString());
                Actions.Insert(CurrentAction);
            }


            Random random = new Random();

            while (Actions.Length > 0)
            {
                var i  = random.Next(0, Actions.Length - 1);
                var Ac = Actions[i];
                if (Ac.Insert != null)
                {
                    Ac.Insert();
                    Ac.Insert = null;
                }
                else if (Ac.Update != null)
                {
                    Ac.Update();
                    Ac.Update = null;
                }
                else
                {
                    Ac.Delete();
                    Actions.DeleteByPosition(i);
                }
            }
            Console.ReadKey();
        }
예제 #4
0
 public ETCAxis(string axisName)
 {
     name = axisName;
     enable = true;
     range = AxisRange.Classical;
     speed = 15;
     invertedAxis = false;
     isEnertia = false;
     inertia = 0;
     inertiaThreshold = 0.08f;
     axisValue = 0;
     axisSpeedValue = 0;
     gravity = 0;
     isAutoStab = false;
     autoStabThreshold = 0.01f;
     autoStabSpeed = 10;
     maxAngle = 90;
     minAngle = 90;
     axisState = AxisState.None;
     maxOverTimeValue = 1;
     overTimeStep = 1;
     isValueOverTime = false;
     axisThreshold = 0.5f;
     deadValue = 0.1f;
     actionOn = ActionOn.Press;
 }