Exemplo n.º 1
0
        internal void AddNeighborhoodPaths(NeighborhoodPaths hoods)
        {
            foreach (string s in savegames)
            {
                string pt = System.IO.Path.Combine(GetRealPath(s), "Neighborhoods");

                if (System.IO.Directory.Exists(pt))
                {
                    if (flag.HasNgbhProfiles)
                    {
                        string profiles = System.IO.Path.Combine(pt, "Profiles.ini");
                        try
                        {
                            if (System.IO.File.Exists(profiles))
                            {
                                profilesini = new IniRegistry(profiles, true);
                                string defaulthood = profilesini.GetValue("State", "LastSaved", "");
                                defaulthood = defaulthood.ToUpper().Trim();

                                IniRegistry.SectionContent sec = profilesini.Section("Profiles");
                                foreach (string k in sec)
                                {
                                    string hood = sec.GetValue(k);
                                    if (hood == null)
                                    {
                                        continue;
                                    }
                                    hood = hood.ToUpper().Trim();
                                    string path = System.IO.Path.Combine(pt, hood.Replace("0X", ""));
                                    if (System.IO.Directory.Exists(path))
                                    {
                                        NeighborhoodPath np = new NeighborhoodPath(k, path, this, hood == defaulthood);
                                        if (!hoods.Contains(np))
                                        {
                                            hoods.Add(np);
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            if (Helper.DebugMode)
                            {
                                Helper.ExceptionMessage(ex);
                            }
                        }
                    }
                    else
                    {
                        NeighborhoodPath np = new NeighborhoodPath("", pt, this, true);
                        if (!hoods.Contains(np))
                        {
                            hoods.Add(np);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public override bool Equals(object obj)
 {
     if (obj.GetType() == typeof(NeighborhoodPath))
     {
         NeighborhoodPath np = (NeighborhoodPath)obj;
         return(Helper.CompareableFileName(np.Path) == Helper.CompareableFileName(Path));
     }
     return(base.Equals(obj));
 }