示例#1
0
        public void Load(HomeSimCockpitSDK.ILog log)
        {
            _log = log;

            // wczytanie konfiguracji
            _configuration = global::JHFMGS.Configuration.Load(ConfigurationFilePath);

            List <Variable> variables = new List <Variable>();

            string [] leds = Enum.GetNames(typeof(Client.JH_LEDs));
            for (int i = 0; i < leds.Length; i++)
            {
                Variable v = new Variable(this, leds[i], VariableType.Bool, "", (int)Enum.Parse(typeof(Client.JH_LEDs), leds[i]));
                variables.Add(v);
            }

            string [] datas = Enum.GetNames(typeof(Client.JH_Data));
            for (int i = 0; i < datas.Length; i++)
            {
                Client.JH_Data data = (Client.JH_Data)Enum.Parse(typeof(Client.JH_Data), datas[i]);

                switch (data)
                {
                case JH_Data.DATA_CPT_MCDU_DIMMER:
                case JH_Data.DATA_CPT_ND_DIMMER:
                    continue;
                }

                Variable v = new Variable(this, datas[i], VariableType.Int, "", (int)data);
                variables.Add(v);
            }

            variables.Add(_testVariable);

            foreach (Variable v in variables)
            {
                _vars.Add(v.VID, v);
            }

            _input = variables.ToArray();
        }
        public void Load(HomeSimCockpitSDK.ILog log)
        {
            _log = log;

            // wczytanie konfiguracji
            _configuration = global::RacingData.Configuration.Load(ConfigurationFilePath);

            List <Variable> variables = new List <Variable>();
            Type            t         = typeof(ISimData);

            PropertyInfo[] properties = t.GetProperties();//BindingFlags.GetProperty);
            for (int i = 0; i < properties.Length; i++)
            {
                Variable v = null;
                if (properties[i].PropertyType == typeof(bool))
                {
                    v = new Variable(this, properties[i].Name, VariableType.Bool, "");
                }

                if (properties[i].PropertyType == typeof(int))
                {
                    v = new Variable(this, properties[i].Name, VariableType.Int, "");
                }

                if (properties[i].PropertyType == typeof(double))
                {
                    v = new Variable(this, properties[i].Name, VariableType.Double, "");
                }

                if (v != null)
                {
                    variables.Add(v);
                }
            }

            _input = variables.ToArray();
        }
示例#3
0
        public void Load(HomeSimCockpitSDK.ILog log)
        {
            _log = log;

            // wczytanie konfiguracji
            _configuration = global::FalconData.Configuration.Load(ConfigurationFilePath);

            // utworzenie zmiennych
            Type            t      = typeof(F4SharedMem.FlightData);
            List <Variable> inputs = new List <Variable>();

            _runningFalconVariable = new Variable(this, "_runningFalcon", VariableType.Bool, GetDescription("_runningFalcon"), -1);
            inputs.Add(_runningFalconVariable);
            List <string> forbidden = new List <string>()
            {
                "headPitch",
                "headRoll",
                "headYaw"
            };

            foreach (FieldInfo fi in t.GetFields())
            {
                if (forbidden.Contains(fi.Name))
                {
                    continue;
                }
                Variable v = null;
                //if (fi.FieldType.IsArray)
                //{
                //}
                //else
                {
                    if (fi.FieldType == typeof(bool))
                    {
                        v = new Variable(this, fi.Name, VariableType.Bool, GetDescription(fi.Name), -1);
                    }
                    else if (fi.FieldType == typeof(int) || fi.FieldType == typeof(byte))
                    {
                        v = new Variable(this, fi.Name, VariableType.Int, GetDescription(fi.Name), -1);
                    }
                    else if (fi.FieldType == typeof(float))
                    {
                        v = new Variable(this, fi.Name, VariableType.Double, GetDescription(fi.Name), -1);
                    }
                    else if (fi.FieldType == typeof(string))
                    {
                        v = new Variable(this, fi.Name, VariableType.String, GetDescription(fi.Name), -1);
                    }
                    else if (fi.FieldType == typeof(string[]))
                    {
                        v = new Variable(this, fi.Name, VariableType.String_Array, GetDescription(fi.Name), -1);
                    }
                }
                if (v != null)
                {
                    inputs.Add(v);
                    //System.Diagnostics.Debug.WriteLine(string.Format("_descriptions.Add(\"{0}\", \"\");", v.ID));
                }
            }
            _input = inputs.ToArray();
        }