Exemplo n.º 1
0
        private static IConfigFileFormatStrategy GetConfigStrategyIndex(string format)
        {
            List <Type> configFileFormatStrategies = Reflexion.GetTypesImplementing <IConfigFileFormatStrategy>();

            int configStrategyIndex = ListFinder.FindIndexFromRegex(configFileFormatStrategies, string.Format(@"{0}.*", format));

            return((IConfigFileFormatStrategy)Reflexion.InstanciateFromType(configFileFormatStrategies[configStrategyIndex]));
        }
Exemplo n.º 2
0
        public static string GetConfigFile()
        {
            List <string> fileNames = FindConfigFiles();

            if (fileNames.Count == 0)
            {
                return(null);
            }

            int elementIdx = ExtensionPicker.GetHigherPriorityExtenstionIndex(fileNames);

            return(ListFinder.FindElementFromRegex(fileNames, string.Format(@".*\.{0}", GameContainer.configManager.loadedConfig.Config.ExtensionsPriority[elementIdx])));
        }
Exemplo n.º 3
0
 [Fact] public void ArrayIsNotAMutableList() => Assert.False(ListFinder.IsAMutableListOf(new int[0], typeof(int)));
Exemplo n.º 4
0
 [Fact] public void WrongListOfType() => Assert.False(ListFinder.IsAMutableListOf(new List <DateTime>(), typeof(int)));
Exemplo n.º 5
0
 [Fact] public void ListIsAList() => Assert.True(ListFinder.IsAMutableListOf(new ArrayList(), typeof(int)));
Exemplo n.º 6
0
 [Fact] public void ListOfIntIsAList() => Assert.True(ListFinder.IsAMutableListOf(new List <int>(), typeof(int)));
Exemplo n.º 7
0
 [Fact] public void StringIsNotAList() => Assert.False(ListFinder.IsAMutableListOf("string", typeof(int)));