Ejemplo n.º 1
0
        public static ArrayList ReadAll(string path)
        {
            using (StreamReader ip = new StreamReader(path))
            {
                ArrayList list = new ArrayList();

                for (DecorationListSeers v = Read(ip); v != null; v = Read(ip))
                {
                    list.Add(v);
                }

                return(list);
            }
        }
Ejemplo n.º 2
0
        public static void Generate(string folder, params Map[] maps)
        {
            if (!Directory.Exists(folder))
            {
                return;
            }

            string[] files = Directory.GetFiles(folder, "*.cfg");

            for (int i = 0; i < files.Length; ++i)
            {
                ArrayList list = DecorationListSeers.ReadAll(files[i]);

                for (int j = 0; j < list.Count; ++j)
                {
                    m_Count += ((DecorationListSeers)list[j]).Generate(maps);
                }
            }
        }
Ejemplo n.º 3
0
        public static DecorationListSeers Read(StreamReader ip)
        {
            string line;

            while ((line = ip.ReadLine()) != null)
            {
                line = line.Trim();

                if (line.Length > 0 && !line.StartsWith("#"))
                {
                    break;
                }
            }

            if (string.IsNullOrEmpty(line))
            {
                return(null);
            }

            DecorationListSeers list = new DecorationListSeers();

            int indexOf = line.IndexOf(' ');

            list.m_Type = ScriptCompiler.FindTypeByName(line.Substring(0, indexOf++), true);

            if (list.m_Type == null)
            {
                throw new ArgumentException(String.Format("Type not found for header: '{0}'", line));
            }

            line    = line.Substring(indexOf);
            indexOf = line.IndexOf('(');
            if (indexOf >= 0)
            {
                list.m_ItemID = Utility.ToInt32(line.Substring(0, indexOf - 1));

                string parms = line.Substring(++indexOf);

                if (line.EndsWith(")"))
                {
                    parms = parms.Substring(0, parms.Length - 1);
                }

                list.m_Params = parms.Split(';');

                for (int i = 0; i < list.m_Params.Length; ++i)
                {
                    list.m_Params[i] = list.m_Params[i].Trim();
                }
            }
            else
            {
                list.m_ItemID = Utility.ToInt32(line);
                list.m_Params = m_EmptyParams;
            }

            list.m_Entries = new ArrayList();

            while ((line = ip.ReadLine()) != null)
            {
                line = line.Trim();

                if (line.Length == 0)
                {
                    break;
                }

                if (line.StartsWith("#"))
                {
                    continue;
                }

                list.m_Entries.Add(new DecorationEntrySeers(line));
            }

            return(list);
        }
        public static DecorationListSeers Read( StreamReader ip )
        {
            string line;

            while ( (line = ip.ReadLine()) != null )
            {
                line = line.Trim();

                if ( line.Length > 0 && !line.StartsWith( "#" ) )
                    break;
            }

            if ( string.IsNullOrEmpty( line ) )
                return null;

            DecorationListSeers list = new DecorationListSeers();

            int indexOf = line.IndexOf( ' ' );

            list.m_Type = ScriptCompiler.FindTypeByName( line.Substring( 0, indexOf++ ), true );

            if ( list.m_Type == null )
                throw new ArgumentException( String.Format( "Type not found for header: '{0}'", line ) );

            line = line.Substring( indexOf );
            indexOf = line.IndexOf( '(' );
            if ( indexOf >= 0 )
            {
                list.m_ItemID = Utility.ToInt32( line.Substring( 0, indexOf - 1 ) );

                string parms = line.Substring( ++indexOf );

                if ( line.EndsWith( ")" ) )
                    parms = parms.Substring( 0, parms.Length - 1 );

                list.m_Params = parms.Split( ';' );

                for ( int i = 0; i < list.m_Params.Length; ++i )
                    list.m_Params[i] = list.m_Params[i].Trim();
            }
            else
            {
                list.m_ItemID = Utility.ToInt32( line );
                list.m_Params = m_EmptyParams;
            }

            list.m_Entries = new ArrayList();

            while ( (line = ip.ReadLine()) != null )
            {
                line = line.Trim();

                if ( line.Length == 0 )
                    break;

                if ( line.StartsWith( "#" ) )
                    continue;

                list.m_Entries.Add( new DecorationEntrySeers( line ) );
            }

            return list;
        }