kvadrat4o

Files-NotFinisheed

Jul 5th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.57 KB | None | 0 0
  1.             //var regexRoot = @"\b([a-zA-Z]+)\:?\b";
  2.             //var regexFile = @"\b([a-zA-Z]+)\.([a-zA-z]+)\b";
  3.             //var regexSize = @"\b(\d+)\b";
  4.             //var regexExt = @"\b(\.[a-z]+)\b";
  5.             //MatchCollection matches = new MatchCollection();
  6.             //int n = int.Parse(Console.ReadLine());
  7.             //var pathdetails = new List<string>();
  8.             //var inputLine = "";
  9.             //for (int i = 0; i < n; i++)
  10.             //{
  11.             //    inputLine = Console.ReadLine();
  12.             //    var paths = new List<string>();
  13.             //    paths.Add(inputLine);
  14.             //    pathdetails = inputLine.Split(new [] {' ',',','.',';',':'}).ToList();
  15.             //}
  16.             ////Console.WriteLine(string.Format("[" + string.Join(",",pathdetails) +"]"));
  17.             //var keyLine = Console.ReadLine();
  18.             //var extkey = keyLine[0];
  19.             //var pathKey = keyLine[2];
  20.             ////if (pathdetails[0]  == pathKey && pathdetails[pathdetails.Count - 2] == extkey)
  21.             ////{
  22.                
  23.             ////}
  24.            
  25.  
  26.  
  27.             var rootMatches = new SortedDictionary<string, Dictionary<string,Dictionary<string,long>>>();
  28.             var directories = new List<string>();
  29.             var extensions = new List<string>();
  30.             var n = int.Parse(Console.ReadLine());
  31.             var extension = "";
  32.             var root = "";
  33.             var file = "";
  34.             var size = 0L;
  35.             for (int i = 0; i < n; i++)
  36.             {
  37.                 var inputLine = Console.ReadLine();
  38.                 directories.Add(inputLine);
  39.                 var input = inputLine.Split(new [] {'\\',' ',',',';','.',':'},StringSplitOptions.RemoveEmptyEntries).ToList();
  40.                 root = input[0];
  41.                 file = input[input.Count - 3];
  42.                 extension = input[input.Count - 2];
  43.                 size = long.Parse(input[input.Count - 1]);
  44.                 //extensions.Add(extension);
  45.                 if (!rootMatches.ContainsKey(root))
  46.                 {
  47.                     //rootMatches[root] = new Dictionary<string,Dictionary<string,long>>();
  48.                     rootMatches.Add(root,new Dictionary<string,Dictionary<string,long>>());
  49.  
  50.                 }
  51.             }
  52.             var keyLine = Console.ReadLine().Split();
  53.             var rootKey = keyLine[2];
  54.             var rootExt = keyLine[0];
  55.  
  56.  
  57.             foreach (var roote in rootMatches)
  58.             {
  59.                 if (rootMatches.ContainsKey(rootKey) && rootMatches.Values.Last().Last().Equals(rootExt))
  60.                 {
  61.                     if (directories.Contains(root) && directories.Contains(extension))
  62.                     {
  63.                         Console.WriteLine("{0}.{1} - {2} KB",file,extension,size);
  64.                     }
  65.                        
  66.                 }
  67.             }
  68.             foreach (var root1 in rootMatches)
  69.             {
  70.                 if (rootMatches.ContainsKey(rootKey))
  71.                 {
  72.                     foreach (var file in rootMatches[root1].Select(k => k.Value))
  73.                     {
  74.                         foreach (var extension in rootMatches[root1[file]].Select(a => a.Value))
  75.                         {
  76.                             if (rootMatches[root1[file]].ContainsKey(rootExt))
  77.                             {
  78.                                 Console.WriteLine(directories[root]);
  79.                             }
  80.  
  81.                         }
  82.                     }
  83.                 }
  84.             }
  85.            
  86.             //var rootMatch = Regex.Matches(rootKey,regexRoot);
Advertisement
Add Comment
Please, Sign In to add comment