Beispiel #1
0
        public virtual void Process()
        {
            var overrides = Settings.OverridesFiles.SelectMany(GetFiles);

            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            // Read enum signatures
            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadEnums(file, Enums, Profile, Version);
            }

            // Read delegate signatures
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadDelegates(file, Delegates, Profile, Version);
            }

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);
            var doc_processor  = new DocProcessor(this);

            Enums    = enum_processor.Process(Enums, Profile);
            Wrappers = func_processor.Process(enum_processor, doc_processor,
                                              Delegates, Enums, Profile, Version);
        }
Beispiel #2
0
        internal List <SearchParameter> GetSearchParameters()
        {
            List <SearchParameter> parameters = new List <SearchParameter>();

            // get search paramteres and their values
            if (_view.YearSearch != "")
            {
                parameters.Add(new SearchParamYear(Convert.ToInt32(_view.YearSearch)));
            }
            if (_view.MonthSearch != "")
            {
                parameters.Add(new SearchParamMonth(Convert.ToInt32(_view.MonthSearch)));
            }
            if (_view.LocationSearch != "")
            {
                parameters.Add(new SearchParamLocation(_view.LocationSearch));
            }
            if (_view.WindSearch != "")
            {
                parameters.Add(new SearchParamParamWind(EnumProcessor.GetWindFromDTO(_view.WindSearch)));
            }
            if (_view.MoonPhaseSearch != "")
            {
                parameters.Add(new SearchParamMoonPhase(EnumProcessor.GetMoonPhaseFromDTO(_view.MoonPhaseSearch)));
            }
            if (_view.TideSearch != "")
            {
                parameters.Add(new SearchParamTide(EnumProcessor.GetTideFromDTO(_view.TideSearch)));
            }

            return(parameters);
        }
Beispiel #3
0
 private void SetPossibleSearchValues()
 {
     _view.Years      = RepositoryService.GetYears();
     _view.Months     = RepositoryService.GetMonths();
     _view.Locations  = RepositoryService.GetLocations();
     _view.Winds      = EnumProcessor.GetDTOwinds();
     _view.MoonPhases = EnumProcessor.GetDTOmoonPhases();
     _view.Tides      = EnumProcessor.GetDTOtides();
 }
Beispiel #4
0
        public AddFishingRecordPresenter(IAddFishingRecordView inView, PresenterMain inParent)
        {
            _view     = inView;
            _parent   = inParent;
            fishCatch = new FishCatch();

            // fill view with data
            _view.Locations  = LocationRepository.GetInstance().GetLocationNames();
            _view.Winds      = EnumProcessor.GetDTOwinds();
            _view.MoonPhases = EnumProcessor.GetDTOmoonPhases();
            _view.Tides      = EnumProcessor.GetDTOtides();
        }
Beispiel #5
0
        public Move(string[] arrayMove)
        {
            this.PlayerName = arrayMove[0];

            System.Enum convertedStrategy = EnumProcessor.Enumerador <StrategiesEnum>(arrayMove[1]);

            if (convertedStrategy == null)
            {
                throw new NoSuchStrategyException("Estratégia inválida!");
            }

            this.Strategy = (StrategiesEnum)convertedStrategy;
        }
Beispiel #6
0
        public virtual void Process()
        {
            string overrides = Path.Combine(Settings.InputPath, Settings.OverridesFile);
            Type.GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            Type.CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));
            Enums = SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec));
            Utilities.Merge(Enums, SpecReader.ReadEnums(overrides));
            Delegates = SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec));
            Utilities.Merge(Delegates, SpecReader.ReadDelegates(overrides));

            Enums = new EnumProcessor(overrides).Process(Enums);
            Wrappers = new FuncProcessor(overrides).Process(Delegates, Enums);
        }
Beispiel #7
0
        public virtual void Process()
        {
            var overrides = Settings.OverridesFiles.SelectMany(GetFiles);

            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            // Read enum signatures
            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadEnums(file, Enums, Profile, Version);
            }

            // Read delegate signatures
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadDelegates(file, Delegates, Profile, Version);
            }

            HashSet <string> extensions = new HashSet <string>();

            foreach (var(name, list) in Delegates)
            {
                var @delegate = list[0];
                if (string.IsNullOrEmpty(@delegate.Category) == false)
                {
                    foreach (var part in @delegate.Category.Split('|'))
                    {
                        extensions.Add(part);
                    }
                }
            }

            foreach (var(name, @enum) in Enums)
            {
                var match = Utilities.Extensions.Match(name);
                if (match.Index == 0 && match.Length != 0)
                {
                    extensions.Add(name);
                }
            }

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);
            var doc_processor  = new DocProcessor(this);

            Enums    = enum_processor.Process(Enums, Profile, extensions);
            Wrappers = func_processor.Process(enum_processor, doc_processor, Delegates, Enums, Profile, Version);
        }
Beispiel #8
0
        public virtual void Process()
        {
            string overrides = Path.Combine(Settings.InputPath, Settings.OverridesFile);

            Type.GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            Type.CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));
            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums);
            SpecReader.ReadEnums(overrides, Enums);
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates);
            SpecReader.ReadDelegates(overrides, Delegates);

            Enums    = new EnumProcessor(overrides).Process(Enums);
            Wrappers = new FuncProcessor(overrides).Process(Delegates, Enums);
        }
Beispiel #9
0
        public virtual void Process()
        {
            string overrides = Path.Combine(Settings.InputPath, Settings.OverridesFile);

            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            SpecReader.ReadEnums(overrides, Enums, Profile, Version);
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            SpecReader.ReadDelegates(overrides, Delegates, Profile, Version);

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);

            Enums    = enum_processor.Process(Enums, Profile);
            Wrappers = func_processor.Process(enum_processor, Delegates, Enums, Profile, Version);
        }
Beispiel #10
0
        public virtual void Process()
        {
            string overrides = Path.Combine(Settings.InputPath, Settings.OverridesFile);
            
            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            SpecReader.ReadEnums(overrides, Enums, Profile, Version);
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            SpecReader.ReadDelegates(overrides, Delegates, Profile, Version);

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);

            Enums = enum_processor.Process(Enums, Profile);
            Wrappers = func_processor.Process(enum_processor, Delegates, Enums, Profile, Version);
        }
Beispiel #11
0
 public override string ToString()
 {
     return(string.Format("[\"{0}\",\"{1}\"]", this.PlayerName, EnumProcessor.Description(this.Strategy)));
 }
Beispiel #12
0
        public virtual void Translate(XPathNavigator overrides, string category, EnumCollection enums)
        {
            Enum   @enum;
            string s;

            category = EnumProcessor.TranslateEnumName(category);

            // Try to find out if it is an enum. If the type exists in the normal GLEnums list, use this.
            // Otherwise, try to find it in the aux enums list. If it exists in neither, it is not an enum.
            // Special case for Boolean - it is an enum, but it is dumb to use that instead of the 'bool' type.
            bool normal = enums.TryGetValue(CurrentType, out @enum);

            //bool aux = enums.TryGetValue(EnumProcessor.TranslateEnumName(CurrentType), out @enum);

            // Translate enum types
            if ((normal /*|| aux*/) && @enum.Name != "GLenum" && @enum.Name != "Boolean")
            {
                if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) != Settings.Legacy.None)
                {
                    QualifiedType = "int";
                }
                else
                {
                    // Some functions and enums have the same names.
                    // Make sure we reference the enums rather than the functions.
                    if (normal)
                    {
                        QualifiedType = CurrentType.Insert(0, String.Format("{0}.", Settings.EnumsOutput));
                    }
                }
            }
            else if (GLTypes.TryGetValue(CurrentType, out s))
            {
                // Check if the parameter is a generic GLenum. If it is, search for a better match,
                // otherwise fallback to Settings.CompleteEnumName (named 'All' by default).
                if (s.Contains("GLenum") /*&& !String.IsNullOrEmpty(category)*/)
                {
                    if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) != Settings.Legacy.None)
                    {
                        QualifiedType = "int";
                    }
                    else
                    {
                        // Better match: enum.Name == function.Category (e.g. GL_VERSION_1_1 etc)
                        if (enums.ContainsKey(category))
                        {
                            QualifiedType = String.Format("{0}{1}{2}", Settings.EnumsOutput,
                                                          Settings.NamespaceSeparator, EnumProcessor.TranslateEnumName(category));
                        }
                        else
                        {
                            QualifiedType = String.Format("{0}{1}{2}", Settings.EnumsOutput,
                                                          Settings.NamespaceSeparator, Settings.CompleteEnumName);
                        }
                    }
                }
                else
                {
                    // A few translations for consistency
                    switch (CurrentType.ToLower())
                    {
                    case "string": QualifiedType = "String"; break;
                    }

                    QualifiedType = s;
                }
            }

            CurrentType =
                CSTypes.ContainsKey(CurrentType) ?
                CSTypes[CurrentType] : CurrentType;

            // Make sure that enum parameters follow enum overrides, i.e.
            // if enum ErrorCodes is overriden to ErrorCode, then parameters
            // of type ErrorCodes should also be overriden to ErrorCode.
            XPathNavigator enum_override = overrides.SelectSingleNode(String.Format("/signatures/replace/enum[@name='{0}']/name", CurrentType));

            if (enum_override != null)
            {
                // For consistency - many overrides use string instead of String.
                if (enum_override.Value == "string")
                {
                    QualifiedType = "String";
                }
                else if (enum_override.Value == "StringBuilder")
                {
                    QualifiedType = "StringBuilder";
                }
                else
                {
                    CurrentType = enum_override.Value;
                }
            }

            if (CurrentType == "IntPtr" && String.IsNullOrEmpty(PreviousType))
            {
                Pointer = 0;
            }
        }
Beispiel #13
0
        public virtual void Process()
        {
            var overrides = Settings.OverridesFiles.SelectMany(GetFiles);

            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            // Read enum signatures
            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadEnums(file, Enums, Profile, Version);
            }

            // Read delegate signatures
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadDelegates(file, Delegates, Profile, Version);
            }

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);
            var doc_processor = new DocProcessor(this);

            Enums = enum_processor.Process(Enums, Profile);
            Wrappers = func_processor.Process(enum_processor, doc_processor,
                Delegates, Enums, Profile, Version);
        }
Beispiel #14
0
        public virtual void Process()
        {
            string overrides = Path.Combine(Settings.InputPath, Settings.OverridesFile);
            Type.GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            Type.CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));
            if (!string.IsNullOrEmpty(Settings.IncludePath))
                SpecReader.ReadEnums(Settings.IncludePath, Enums);
            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums);
            SpecReader.ReadEnums(overrides, Enums);
            if (!string.IsNullOrEmpty(Settings.IncludePath))
                SpecReader.ReadDelegates(Settings.IncludePath, Delegates);
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates);
            SpecReader.ReadDelegates(overrides, Delegates);

            Enums = new EnumProcessor(overrides).Process(Enums);
            Wrappers = new FuncProcessor(overrides).Process(Delegates, Enums);
        }