public DCSAxisFilter Copy()
        {
            DCSAxisFilter result = new DCSAxisFilter();

            result.deadzone    = deadzone;
            result.inverted    = inverted;
            result.slider      = slider;
            result.saturationX = saturationX;
            result.saturationY = saturationY;
            for (int i = 0; i < curviture.Count; ++i)
            {
                result.curviture.Add(curviture[i]);
            }
            return(result);
        }
Beispiel #2
0
        public DCSAxisBind toDCSAxisBind()
        {
            DCSAxisBind result = new DCSAxisBind();

            if (JAxis.Length < 1 || Joystick.Length < 1)
            {
                return(null);
            }
            result.key = JAxis.ToString();
            DCSAxisFilter daf = new DCSAxisFilter();

            result.filter   = daf;
            daf.curviture   = Curviture;
            daf.deadzone    = Deadzone;
            daf.inverted    = Inverted ?? false;
            daf.slider      = Slider ?? false;
            daf.saturationX = SaturationX;
            daf.saturationY = SaturationY;
            return(result);
        }
 public DCSAxisBind()
 {
     filter = new DCSAxisFilter();
     key    = "";
 }
Beispiel #4
0
        public void AnalyzeRawLuaInput(string content)
        {
            if (!content.Contains('{'))
            {
                return;
            }
            string cleaned = MainStructure.GetContentBetweenSymbols(content, "{", "}");
            Dictionary <object, object> dct = MainStructure.CreateAttributeDictFromLua(content);

            if (dct.ContainsKey("axisDiffs"))
            {
                foreach (KeyValuePair <object, object> kvp in (Dictionary <object, object>)dct["axisDiffs"])
                {
                    DCSLuaDiffsAxisElement current = new DCSLuaDiffsAxisElement();
                    current.Keyname = (string)kvp.Key;
                    if (axisDiffs.ContainsKey(current.Keyname))
                    {
                        axisDiffs[current.Keyname] = current;
                    }
                    else
                    {
                        axisDiffs.Add(current.Keyname, current);
                    }
                    if (((Dictionary <object, object>)kvp.Value).ContainsKey("name"))
                    {
                        current.Title = (string)((Dictionary <object, object>)kvp.Value)["name"];
                    }
                    if (((Dictionary <object, object>)kvp.Value).ContainsKey("added"))
                    {
                        Dictionary <object, object> dictAdded = (Dictionary <object, object>)((Dictionary <object, object>)kvp.Value)["added"];
                        foreach (KeyValuePair <object, object> kvpAdded in dictAdded)
                        {
                            if (((Dictionary <object, object>)kvpAdded.Value).ContainsKey("key"))
                            {
                                DCSAxisBind dab = new DCSAxisBind();
                                dab.key = (string)((Dictionary <object, object>)kvpAdded.Value)["key"];
                                if (((Dictionary <object, object>)kvpAdded.Value).ContainsKey("filter"))
                                {
                                    DCSAxisFilter daf = new DCSAxisFilter();
                                    dab.filter      = daf;
                                    daf.deadzone    = (double)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["deadzone"];
                                    daf.inverted    = (bool)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["invert"];
                                    daf.slider      = (bool)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["slider"];
                                    daf.saturationX = (double)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["saturationX"];
                                    daf.saturationY = (double)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["saturationY"];
                                    foreach (KeyValuePair <object, object> kvpCurve in (Dictionary <object, object>)((Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["filter"])["curvature"])
                                    {
                                        daf.curviture.Add((double)kvpCurve.Value);
                                    }
                                }
                                if (!current.doesAddedContainKey(dab.key))
                                {
                                    current.added.Add(dab);
                                    current.removeItemFromRemoved(dab.key);
                                }
                            }
                        }
                    }
                    if (((Dictionary <object, object>)kvp.Value).ContainsKey("removed"))
                    {
                        Dictionary <object, object> dictRemoved = (Dictionary <object, object>)((Dictionary <object, object>)kvp.Value)["removed"];
                        foreach (KeyValuePair <object, object> kvpRemoved in dictRemoved)
                        {
                            if (((Dictionary <object, object>)kvpRemoved.Value).ContainsKey("key"))
                            {
                                DCSAxisBind dab = new DCSAxisBind();
                                dab.key = (string)((Dictionary <object, object>)kvpRemoved.Value)["key"];
                                if (!current.doesRemovedContainKey(dab.key))
                                {
                                    current.removed.Add(dab);
                                    current.removeItemFromAdded(dab.key);
                                }
                            }
                        }
                    }
                }
            }
            if (dct.ContainsKey("keyDiffs"))
            {
                foreach (KeyValuePair <object, object> kvp in (Dictionary <object, object>)dct["keyDiffs"])
                {
                    DCSLuaDiffsButtonElement current = new DCSLuaDiffsButtonElement();
                    current.Keyname = (string)kvp.Key;
                    if (keyDiffs.ContainsKey(current.Keyname))
                    {
                        keyDiffs[current.Keyname] = current;
                    }
                    else
                    {
                        keyDiffs.Add(current.Keyname, current);
                    }
                    if (((Dictionary <object, object>)kvp.Value).ContainsKey("name"))
                    {
                        current.Title = (string)((Dictionary <object, object>)kvp.Value)["name"];
                    }
                    if (((Dictionary <object, object>)kvp.Value).ContainsKey("added"))
                    {
                        Dictionary <object, object> dictAdded = (Dictionary <object, object>)((Dictionary <object, object>)kvp.Value)["added"];
                        foreach (KeyValuePair <object, object> kvpAdded in dictAdded)
                        {
                            if (((Dictionary <object, object>)kvpAdded.Value).ContainsKey("key"))
                            {
                                DCSButtonBind dab = new DCSButtonBind();
                                dab.key = (string)((Dictionary <object, object>)kvpAdded.Value)["key"];
                                if (!current.doesAddedContainKey(dab.key))
                                {
                                    current.added.Add(dab);
                                    current.removeItemFromRemoved(dab.key);
                                }
                                if (((Dictionary <object, object>)kvpAdded.Value).ContainsKey("reformers"))
                                {
                                    foreach (KeyValuePair <object, object> kvpReformers in (Dictionary <object, object>)((Dictionary <object, object>)kvpAdded.Value)["reformers"])
                                    {
                                        if (!dab.reformers.Contains((string)kvpReformers.Value))
                                        {
                                            dab.reformers.Add((string)kvpReformers.Value);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (((Dictionary <object, object>)kvp.Value).ContainsKey("removed"))
                    {
                        Dictionary <object, object> dictRemoved = (Dictionary <object, object>)((Dictionary <object, object>)kvp.Value)["removed"];
                        foreach (KeyValuePair <object, object> kvpRemoved in dictRemoved)
                        {
                            if (((Dictionary <object, object>)kvpRemoved.Value).ContainsKey("key"))
                            {
                                DCSButtonBind dab = new DCSButtonBind();
                                dab.key = (string)((Dictionary <object, object>)kvpRemoved.Value)["key"];
                                if (!current.doesRemovedContainKey(dab.key))
                                {
                                    current.removed.Add(dab);
                                    current.removeItemFromAdded(dab.key);
                                }
                            }
                        }
                    }
                }
            }
        }