Inheritance: Binding, IDisposable
Example #1
0
        public void LoadBindings()
        {
            var contexts = new string[1];

            contexts[0] = "ksp";

            _bindings.Clear();
            _vars.Clear();
            _flightControl = null;

            foreach (Type t in Assembly.GetExecutingAssembly().GetTypes())
            {
                kOSBinding attr = (kOSBinding)t.GetCustomAttributes(typeof(kOSBinding), true).FirstOrDefault();
                if (attr != null)
                {
                    if (!attr.Contexts.Any() || attr.Contexts.Intersect(contexts).Any())
                    {
                        var b = (Binding)Activator.CreateInstance(t);
                        b.AddTo(_shared);
                        _bindings.Add(b);

                        if (b is FlightControlManager)
                        {
                            _flightControl = (FlightControlManager)b;
                        }
                    }
                }
            }
        }
Example #2
0
        public void Load()
        {
            var contexts = new string[1];

            contexts[0] = "ksp";

            bindings.Clear();
            variables.Clear();
            flightControl = null;

            foreach (var t in Assembly.GetExecutingAssembly().GetTypes())
            {
                var attr = (BindingAttribute)t.GetCustomAttributes(typeof(BindingAttribute), true).FirstOrDefault();
                if (attr == null)
                {
                    continue;
                }
                if (attr.Contexts.Any() && !attr.Contexts.Intersect(contexts).Any())
                {
                    continue;
                }

                var b = (Binding)Activator.CreateInstance(t);
                b.AddTo(shared);
                bindings.Add(b);

                var manager = b as FlightControlManager;
                if (manager != null)
                {
                    flightControl = manager;
                }
            }
        }
Example #3
0
        public void Load()
        {
            var contexts = new string[1];

            contexts[0] = "ksp";

            bindings.Clear();
            variables.Clear();
            flightControl = null;

            foreach (BindingAttribute attr in rawAttributes.Keys)
            {
                var t = rawAttributes[attr];
                if (attr.Contexts.Any() && !attr.Contexts.Intersect(contexts).Any())
                {
                    continue;
                }
                var b = (SafeBindingBase)Activator.CreateInstance(t);
                b.AddTo(shared);
                bindings.Add(b);

                var manager = b as FlightControlManager;
                if (manager != null)
                {
                    flightControl = manager;
                }
            }
        }
Example #4
0
        public void Load()
        {
            var contexts = new string[1];

            contexts[0] = "ksp";

            bindings.Clear();
            variables.Clear();
            flightControl = null;

            foreach (KeyValuePair <BindingAttribute, Type> attrTypePair in rawAttributes)
            {
                var type = attrTypePair.Value;
                if (attrTypePair.Key.Contexts.Any() && !attrTypePair.Key.Contexts.Intersect(contexts).Any())
                {
                    continue;
                }
                var instanceWithABinding = (SafeBindingBase)Activator.CreateInstance(type);
                instanceWithABinding.AddTo(shared);
                bindings.Add(instanceWithABinding);

                var manager = instanceWithABinding as FlightControlManager;
                if (manager != null)
                {
                    flightControl = manager;
                }
            }
        }
Example #5
0
        public void Load()
        {
            var contexts = new string[1];
            contexts[0] = "ksp";

            bindings.Clear();
            variables.Clear();
            flightControl = null;

            foreach (var t in Assembly.GetExecutingAssembly().GetTypes())
            {
                var attr = (BindingAttribute)t.GetCustomAttributes(typeof(BindingAttribute), true).FirstOrDefault();
                if (attr == null) continue;
                if (attr.Contexts.Any() && !attr.Contexts.Intersect(contexts).Any()) continue;

                var b = (Binding)Activator.CreateInstance(t);
                b.AddTo(shared);
                bindings.Add(b);

                var manager = b as FlightControlManager;
                if (manager != null)
                {
                    flightControl = manager;
                }
            }
        }
Example #6
0
        public void LoadBindings()
        {
            var contexts = new string[1];
            contexts[0] = "ksp";

            _bindings.Clear();
            _vars.Clear();
            _flightControl = null;

            foreach (Type t in Assembly.GetExecutingAssembly().GetTypes())
            {
                kOSBinding attr = (kOSBinding)t.GetCustomAttributes(typeof(kOSBinding), true).FirstOrDefault();
                if (attr != null)
                {
                    if (!attr.Contexts.Any() || attr.Contexts.Intersect(contexts).Any())
                    {
                        var b = (Binding)Activator.CreateInstance(t);
                        b.AddTo(_shared);
                        _bindings.Add(b);

                        if (b is FlightControlManager)
                        {
                            _flightControl = (FlightControlManager)b;
                        }
                    }
                }
            }
        }
Example #7
0
        public void Load()
        {
            var contexts = new string[1];
            contexts[0] = "ksp";

            bindings.Clear();
            variables.Clear();
            flightControl = null;

            foreach (BindingAttribute attr in rawAttributes.Keys)
            {
                var t = rawAttributes[attr];
                if (attr.Contexts.Any() && !attr.Contexts.Intersect(contexts).Any()) continue;
                var b = (SafeBindingBase)Activator.CreateInstance(t);
                b.AddTo(shared);
                bindings.Add(b);

                var manager = b as FlightControlManager;
                if (manager != null)
                {
                    flightControl = manager;
                }
            }
        }