/// <summary> /// Load items and Nanos into static lists /// </summary> /// <returns> /// true if ok /// </returns> private static bool LoadItemsAndNanos() { Colouring.Push(ConsoleColor.Green); try { Console.WriteLine(locales.ItemLoaderLoadedItems, ItemLoader.CacheAllItems()); } catch (Exception e) { Colouring.Pop(); Colouring.Push(ConsoleColor.Red); Console.WriteLine(locales.ErrorReadingItemsFile); Console.WriteLine(e.Message); Colouring.Pop(); return(false); } Colouring.Pop(); Colouring.Push(ConsoleColor.Green); try { Console.WriteLine(locales.NanoLoaderLoadedNanos, NanoLoader.CacheAllNanos()); Console.WriteLine(); } catch (Exception e) { Colouring.Pop(); Colouring.Push(ConsoleColor.Red); Console.WriteLine(locales.ErrorReadingNanosFile); Console.WriteLine(e.Message); Colouring.Pop(); return(false); } Colouring.Pop(); Colouring.Push(ConsoleColor.Green); try { Console.WriteLine("Loaded {0} Playfields", PlayfieldLoader.CacheAllPlayfieldData()); Console.WriteLine(); } catch (Exception e) { Colouring.Pop(); Colouring.Push(ConsoleColor.Red); Console.WriteLine("Error reading statels.dat"); Console.WriteLine(e.Message); Colouring.Pop(); return(false); } Colouring.Pop(); return(true); }
private static void WriteVendingMachineIds(string fileName) { List <StatelData> temp = new List <StatelData>(); PlayfieldLoader.CacheAllPlayfieldData(); foreach (var pf in PlayfieldLoader.PFData) { temp.AddRange(pf.Value.Statels.Where(x => x.Identity.Type == IdentityType.VendingMachine).ToArray()); } List <int> templateIds = new List <int>(); foreach (StatelData sd in temp) { int templateid = sd.TemplateId; if (!templateIds.Contains(templateid)) { templateIds.Add(templateid); } } templateIds.Sort(); TextWriter tw = new StreamWriter(fileName); ItemLoader.CacheAllItems(); WriteHeader1(tw, "Vending Machine template Ids"); tw.WriteLine(); WriteHorizonalLine(tw); foreach (int templateid in templateIds) { ItemTemplate template = ItemLoader.ItemList[templateid]; string name = ItemNamesDao.Instance.Get(templateid).Name; tw.WriteLine("**" + name + "** [" + templateid + "]"); tw.WriteLine(); } WriteFooter(tw); tw.Close(); }
/// <summary> /// </summary> /// <returns> /// </returns> private static bool Initialize() { try { chatServer = new ChatServer(); if (!InitializeLogAndBug()) { return(false); } if (!InitializeTCP()) { return(false); } if (!InitializeISCom()) { return(false); } if (!InitializeConsoleCommands()) { return(false); } PlayfieldLoader.CacheAllPlayfieldData(); } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); return(false); } return(true); }