示例#1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Start of program...");

            Console.WriteLine("Initialise class...");
            DeletionFile ToDelete = new DeletionFile("test_file.txt");

            Console.WriteLine("Read file...");
            ToDelete.readFile();

            Console.WriteLine("Print file to console...");
            ToDelete.printFile();

            Console.WriteLine("Initialise class...");
            MatchingItems matchedItems = new MatchingItems("items_to_keep.txt");

            Console.WriteLine("Read file...");
            matchedItems.readFile();

            Console.WriteLine("Matching coys...");
            matchedItems.findMatchingItems(ToDelete);

            Console.WriteLine("Printing list of test coys...");
            matchedItems.printFile();

            Console.WriteLine("Saving list of test coys...");
            matchedItems.saveToFile("../../test_output.txt");
        }
示例#2
0
 public void findMatchingItems(DeletionFile itemsToDelete)
 {
     foreach (KeyValuePair <string, string> kvp in itemsToDelete.DeletionList)
     {
         foreach (var item in itemsInUse)
         {
             if (kvp.Key.ToString() == item.ToString())
             {
                 matchedItems.Add(new KeyValuePair <string, string>(kvp.Key.ToString(), kvp.Value.ToString()));
             }
         }
     }
 }