Esempio n. 1
0
        public static void Normalize()
        {
            ExtendedCSV extended = new ExtendedCSV(
                new FileStream("/Users/jcox/Documents/loanerLaptops.csv", FileMode.Open), new List <String>()
            {
                "WASP"
            });

            extended.NormalizeColumns(
                new MACAddressNormalizationRule()
            {
                Capitalize = false, Separator = MACAddressNormalizationRule.MacSeparator.None
            },
                new List <String>()
            {
                "Wifi", "Bluetooth", "Ethernet"
            });
            extended.NormalizeColumns(
                new SerialNumberNormalizationRule()
            {
                Capitalize = true
            },
                new List <String>()
            {
                "Serial", "Model"
            }
                );

            extended.Save("/Users/jcox/Documents/loanersCleaned.csv");
        }
Esempio n. 2
0
        public static void SerialNumberComparison(String missingFileName, String outputFileName)
        {
            ExtendedCSV extended = new ExtendedCSV(
                new FileStream(missingFileName, FileMode.Open), new List <string>()
            {
                "Serial No"
            });

            ExtendedCSV other = new ExtendedCSV(
                new FileStream("/Users/jcox/Documents/employee_laptop_serials.csv", FileMode.Open), new List <string>()
            {
                "Serial No"
            })
            {
                ConflictRule = new PickTheFirstConflictRule()
            };

            other.NormalizeColumns(new SerialNumberNormalizationRule()
            {
                Capitalize = true
            }, new List <String>()
            {
                "Serial No"
            });

            other = new ExtendedCSV(other.FlattenRows(), new List <string>()
            {
                "Serial No"
            });
            other.Save("/Users/jcox/Documents/employee_laptop_serials.csv");
            ExtendedCSV output = new ExtendedCSV(extended.PullRowsMatchingPrimaryKeysWith(other), new List <String>()
            {
                "Serial No"
            });

            output.GetDataColumnsFrom(other, new List <String>()
            {
                "First", "Last"
            });
            output.Save(outputFileName);
        }