Ejemplo n.º 1
0
        public static Sign[] Read()
        {
            var parser = new SignParser();

            return(RuleObjectReader.Read(parser).Cast <Sign>().ToArray());
        }
Ejemplo n.º 2
0
        private void GenerateSigns_Callback()
        {
            string cfg = Path.Combine(Server.Core.BaseDirectory, "Data/signs.cfg");

            if (File.Exists(cfg))
            {
                ArrayList list = new ArrayList();

                using (StreamReader ip = new StreamReader(cfg)) {
                    string line;

                    while ((line = ip.ReadLine()) != null)
                    {
                        string[] split = line.Split(' ');

                        SignEntry e = new SignEntry(
                            line.Substring(split[0].Length + 1 + split[1].Length + 1 + split[2].Length + 1 + split[3].Length + 1 + split[4].Length + 1),
                            new Point3D(Utility.ToInt32(split[2]), Utility.ToInt32(split[3]), Utility.ToInt32(split[4])),
                            Utility.ToInt32(split[1]), Utility.ToInt32(split[0]));

                        list.Add(e);
                    }
                }

                Map[] brit   = new Map[] { Map.Felucca, Map.Trammel };
                Map[] fel    = new Map[] { Map.Felucca };
                Map[] tram   = new Map[] { Map.Trammel };
                Map[] ilsh   = new Map[] { Map.Ilshenar };
                Map[] malas  = new Map[] { Map.Malas };
                Map[] tokuno = new Map[] { Map.Tokuno };

                for (int i = 0; i < list.Count; ++i)
                {
                    SignEntry e    = (SignEntry)list[i];
                    Map[]     maps = null;

                    switch (e.m_Map)
                    {
                    case 0: maps = brit; break;                             // Trammel and Felucca

                    case 1: maps = fel; break;                              // Felucca

                    case 2: maps = tram; break;                             // Trammel

                    case 3: maps = ilsh; break;                             // Ilshenar

                    case 4: maps = malas; break;                            // Malas

                    case 5: maps = tokuno; break;                           // Tokuno Islands
                    }

                    for (int j = 0; maps != null && j < maps.Length; ++j)
                    {
                        SignParser.Add_Static(e.m_ItemID, e.m_Location, maps[j], e.m_Text);
                    }
                }

                MessageBox.Show(Core.MainForm, "Signs successfully generated", "Success");
            }
            else
            {
                MessageBox.Show(Core.MainForm, string.Format("{0} not found!", cfg), "Error");
            }
        }