protected void AddNeighborhood(ExpansionItem.NeighborhoodPath np, string path) { AddNeighborhood(np, path, "_Neighborhood.package"); /*int i=1; * while (AddNeighborhood(path, "_University"+Helper.MinStrLength(i.ToString(), 3)+".package")) * { * i++; * }*/ }
protected bool AddNeighborhood(ExpansionItem.NeighborhoodPath np, string path, string filename) { Application.DoEvents(); string flname = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), System.IO.Path.Combine(System.IO.Path.GetFileName(path), System.IO.Path.GetFileName(path) + filename)); if (!System.IO.File.Exists(flname)) { return(false); } AddImage(flname); flname = System.IO.Path.Combine(path, flname); string name = flname; string actime = ""; bool ret = false; if (System.IO.File.Exists(name)) { actime = " (" + System.IO.File.GetLastWriteTime(name).ToString(); /*if (Helper.WindowsRegistry.HiddenMode)*/ actime += ", " + NeighborhoodIdentifier(flname); actime += ")"; ret = true; try { SimPe.Packages.File pk = SimPe.Packages.File.LoadFromFile(name); NeighborhoodType t; name = LoadLabel(pk, out t); } catch (Exception) {} } ListViewItem lvi = new ListViewItem(); lvi.Text = name + actime; if (np.Lable != "") { lvi.Text = np.Lable + ": " + lvi.Text; } lvi.ImageIndex = ilist.Images.Count - 1; lvi.SubItems.Add(flname); lvi.SubItems.Add(name); lvi.SubItems.Add(np.Lable); if (Helper.WindowsRegistry.HiddenMode) { lvi.ToolTipText = flname; } lv.Items.Add(lvi); return(ret); }