Ejemplo n.º 1
0
 public ProjectionConvention()
 {
     this.SourceMemberProvider   = new SourceMemberProvider();
     this.TargetMemberProvider   = new TargetMemberProvider();
     this.StringSplitter         = new StringSplitter(StringSplittingRules.PascalCase);
     this.MatchingRules          = new TypeSet <IMatchingRule>();
     this.MatchingRulesEvaluator = new DefaultMatchingRuleEvaluator();
 }
Ejemplo n.º 2
0
 public DistrictsController(IRepository <Districts> distrepo,
                            ElectionsIndiaContext db, IRepository <States> staterepo,
                            IDistrictService districtService, IStringSplitter strSplitter)
 {
     _distrepo            = distrepo;
     _db                  = db;
     _staterepo           = staterepo;
     this.districtService = districtService;
     this.strSplitter     = strSplitter;
 }
Ejemplo n.º 3
0
 public CityController(IRepository <City> cityrepo, ElectionsIndiaContext db,
                       IRepository <CityListViewModels> clrepo, IRepository <Districts> disrepo,
                       ICityService cityService, IRepository <City> cityRepo, IStringSplitter strSplitter)
 {
     this.cityrepo    = cityrepo;
     this.db          = db;
     this.clrepo      = clrepo;
     this.disrepo     = disrepo;
     this.cityService = cityService;
     this.cityRepo    = cityRepo;
     this.strSplitter = strSplitter;
 }
        public CountriesController(IRepository <Countries> countryrep, ElectionsIndiaContext db, IRepository <Languages> langrepo, IRepository <CountryLanguages> countrylang
                                   , IRepository <States> stateRepo, IDistrictService distService,
                                   IStringSplitter strSplitter)
        {
            _countryrepo = countryrep;
            _db          = db;
            _langrepo    = langrepo;
            _countrylang = countrylang;

            this.stateRepo   = stateRepo;
            this.distService = distService;
            this.strSplitter = strSplitter;
        }
Ejemplo n.º 5
0
 public AreasController(IRepository <AreaListViewModel> alistrepo, ElectionsIndiaContext db, IRepository <States> staterepo, IRepository <Languages> langrepo, IRepository <Countries> courepo, IRepository <City> city, IRepository <ElectionArea> earepo
                        , IAreaService areaService, IRepository <ElectionArea> areaRepo, IStringSplitter strSplitter)
 {
     _alistrepo       = alistrepo;
     _db              = db;
     _langrepo        = langrepo;
     _staterepo       = staterepo;
     _courepo         = courepo;
     this.city        = city;
     this.earepo      = earepo;
     this.areaService = areaService;
     this.areaRepo    = areaRepo;
     this.strSplitter = strSplitter;
 }
Ejemplo n.º 6
0
 public static IStringCalculator CreateCalculator(IStringSplitter stringSplitter = null, INumberSetCheck numberSetCheck = null, INumberSetFilter numberSetFilter = null)
 {
     if (stringSplitter == null && numberSetCheck == null && numberSetFilter == null)
     {
         return(new StringCalculator());
     }
     stringSplitter = stringSplitter ?? new StringSplitter(new List <IDelimiterParser>
     {
         new CustomDelimiterParser(),
         new DefaultDelimiterParser()
     });
     numberSetCheck  = numberSetCheck ?? new NoNegativesNumberSetCheck();
     numberSetFilter = numberSetFilter ?? new ThousandOrLessNumberSetFilter();
     return(new StringCalculator(stringSplitter, numberSetCheck, numberSetFilter));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Splits the string by using the given splitter and converts all elements of the result to the given type.
 /// The result is configurable further more before first iteration.
 /// </summary>
 /// <param name="valueList">The string representation of the list of values to convert.</param>
 /// <param name="destinationType">The type to which the values are converted.</param>
 /// <param name="stringSplitter">The splitter to use.</param>
 /// <returns>List of converted values.</returns>
 public static UniversalTypeConverter.EnumerableStringConversion <object> ConvertToEnumerable(this string valueList, Type destinationType, IStringSplitter stringSplitter)
 {
     return(UniversalTypeConverter.ConvertToEnumerable(valueList, destinationType, stringSplitter));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Splits the string by using the given splitter and converts all elements of the result to the given type.
 /// The result is configurable further more before first iteration.
 /// </summary>
 /// <typeparam name="T">The type to which the values are converted.</typeparam>
 /// <param name="valueList">The string representation of the list of values to convert.</param>
 /// <param name="stringSplitter">The splitter to use.</param>
 /// <returns>List of converted values.</returns>
 public static UniversalTypeConverter.EnumerableStringConversion <T> ConvertToEnumerable <T>(this string valueList, IStringSplitter stringSplitter)
 {
     return(UniversalTypeConverter.ConvertToEnumerable <T>(valueList, stringSplitter));
 }
 /// <summary>
 /// Splits the given string by using the given splitter and converts all elements of the result to the given type.
 /// The result is configurable further more before first iteration.
 /// </summary>
 /// <typeparam name="T">The type to which the given values are converted.</typeparam>
 /// <param name="valueList">The string representation of the list of values to convert.</param>
 /// <param name="stringSplitter">The splitter to use.</param>
 /// <returns>List of converted values.</returns>
 public static EnumerableStringConversion <T> ConvertToEnumerable <T>(string valueList, IStringSplitter stringSplitter)
 {
     return(new EnumerableStringConversion <T>(valueList, stringSplitter));
 }
 /// <summary>
 /// Splits the given string by using the given splitter and converts all elements of the result to the given type.
 /// The result is configurable further more before first iteration.
 /// </summary>
 /// <param name="valueList">The string representation of the list of values to convert.</param>
 /// <param name="destinationType">The type to which the given values are converted.</param>
 /// <param name="stringSplitter">The splitter to use.</param>
 /// <returns>List of converted values.</returns>
 public static EnumerableStringConversion <object> ConvertToEnumerable(string valueList, Type destinationType, IStringSplitter stringSplitter)
 {
     return(new EnumerableStringConversion <object>(valueList, destinationType, stringSplitter));
 }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            var serviceProvider = new ServiceCollection()
                                  .AddSingleton <IFileLoader, FileLoader>()
                                  .AddSingleton <IStringSplitter, StringSplitter>()
                                  .AddSingleton <ISwapper, Swapper>()
                                  .AddSingleton <ISorter, Sorter>()
                                  .BuildServiceProvider();

            IFileLoader     fileLoader     = serviceProvider.GetService <IFileLoader>();
            IStringSplitter stringSplitter = serviceProvider.GetService <IStringSplitter>();
            ISwapper        swapper        = serviceProvider.GetService <ISwapper>();
            ISorter         sorter         = serviceProvider.GetService <ISorter>();

            screenWriter screenWriter = new screenWriter();

            Entities.Settings settings  = new Entities.Settings();
            List <string>     swapped   = new List <string>();
            string            inputFile = null;

            Console.WriteLine(@"
                   _   _                      ____             _              _   _  ____ 
                  | \ | | __ _ _ __ ___   ___/ ___|  ___  _ __| |_ ___ _ __  | \ | |/ ___|
                  |  \| |/ _` | '_ ` _ \ / _ \___ \ / _ \| '__| __/ _ \ '__| |  \| | |  _ 
                  | |\  | (_| | | | | | |  __/___) | (_) | |  | ||  __/ |    | |\  | |_| |
                  |_| \_|\__,_|_| |_| |_|\___|____/ \___/|_|   \__\___|_|    |_| \_|\____| v 2.0
                                                                             
            ");
            while (fileLoader.ReadFromFile(inputFile) == null)
            {
                Console.Write("Input File Name: ");
                inputFile = Console.ReadLine();
            }
            string input = fileLoader.ReadFromFile(inputFile);

            while (!settings.sortByValid())
            {
                Console.Write("Sort By? [F]irst Name / [L]ast Name : ");
                settings.sortBy = Console.ReadLine();
            }

            while (!settings.sortModeValid())
            {
                Console.Write("Sort Mode? [A]scending / [D]escending : ");
                settings.sortMode = Console.ReadLine();
            }

            //split files to string array
            var result = stringSplitter.split(input);

            Console.WriteLine("\nInput file:");
            screenWriter.writeArray(result);

            //swap the names if the sortby is LAST NAME
            if (settings.sortBy == "L" || settings.sortBy == "l")
            {
                Console.WriteLine("\nSwapped:");
                swapped = swapper.swapList(result.ToList(), false);
                screenWriter.writeList(swapped);
            }
            else
            {
                swapped = result.ToList();
            }

            //sort the names Ascending or Descending
            Console.WriteLine("\nSorted:");
            List <String> sorted = new List <String>();

            if (settings.sortMode == "A" || settings.sortMode == "a")
            {
                sorted = sorter.sortAscending(swapped);
            }
            else
            {
                sorted = sorter.sortDescending(swapped);
            }
            screenWriter.writeList(sorted);

            //swap back the names if the sortby is LAST NAME
            if (settings.sortBy == "L" || settings.sortBy == "l")
            {
                Console.WriteLine("\nSwapped Again: ");
                swapped = swapper.swapList(sorted, true);
                screenWriter.writeList(swapped);
            }
        }
Ejemplo n.º 12
0
 internal EnumerableStringConversion(string valueList, Type destinationType, IStringSplitter stringSplitter)
     : base(stringSplitter.Split(valueList), destinationType)
 {
 }
Ejemplo n.º 13
0
 internal EnumerableStringConversion(string valueList, IStringSplitter stringSplitter)
     : base(stringSplitter.Split(valueList))
 {
 }
Ejemplo n.º 14
0
 public DictionaryDeserializer(IStringDeserializer <KeyValuePair <TKey, TValue> > elementParser, IStringSplitter stringSplitter)
 {
     PairParser     = elementParser;
     StringSplitter = stringSplitter;
 }
Ejemplo n.º 15
0
 public ListDeserializer(IStringDeserializer <T> elementParser, IStringSplitter stringSplitter)
 {
     ElementParser  = elementParser;
     StringSplitter = stringSplitter;
 }
Ejemplo n.º 16
0
 public StringSplitterTest()
 {
     this.service = new StringSplitter();
 }
Ejemplo n.º 17
0
 public SentenceParser(IStringSplitter splitter)
 {
     _splitter = splitter;
 }
Ejemplo n.º 18
0
 public StringCalculator(IStringSplitter stringSplitter, INumberSetCheck numberSetCheck, INumberSetFilter numberSetFilter)
 {
     _numberSetFilter = numberSetFilter;
     _numberSetCheck  = numberSetCheck;
     _stringSplitter  = stringSplitter;
 }