Exemple #1
0
 public void LoadSet(SNOGroup grp, string path)
 {
     if (this.Sets.ContainsKey(path))
     {
         Logger.Error("Path {0} was already loaded", path);
         return;
     }
     SNOSet snoset = new SNOSet(grp);
     try
     {
         Logger.Info("Loading SNO ID set from {0}", path);
         snoset.Load(path);
         MergeSet(snoset);
     }
     catch (DirectoryNotFoundException)
     {
         Logger.Warn("Could not find directory of file path {0}", path);
     }
     catch (FileNotFoundException)
     {
         Logger.Warn("Could not open file {0}", path);
     }
     catch (Exception e)
     {
         Logger.DebugException(e, "LoadSet");
     }
 }
Exemple #2
0
 public void MergeSet(SNOSet snoset)
 {
     this.Sets.Add(snoset.Path, snoset);
     var groupDict = this.Grouped[snoset.Group];
     bool referencing = snoset.IsGroupReferencing();
     foreach (var pair in snoset.IDs)
     {
         if (!referencing)
         {
             // If group is not referencing another group, we should try to add it to Global
             if (this.Global.ContainsKey(pair.Key))
                 Logger.Warn("SNO ID {0} is already present in Global (conflictor is ignored)", pair.Key);
             else
                 this.Global.Add(pair.Key, pair.Value);
         }
         if (groupDict.ContainsKey(pair.Key))
             Logger.Warn("SNO ID {0} is already present in group {1} (conflictor is ignored)", pair.Key, Enum.GetName(typeof(SNOGroup), snoset.Group));
         else
             groupDict.Add(pair.Key, pair.Value);
     }
 }