예제 #1
0
        public static ArrayList ReadAll(string path)
        {
            try
            {
                using (StreamReader ip = new StreamReader(path))
                {
                    ArrayList list = new ArrayList();

                    try
                    {
                        for (DecorationList v = Read(ip); v != null; v = Read(ip))
                        {
                            list.Add(v);
                        }
                    }
                    catch (ArgumentException arex)
                    {
                        Console.WriteLine(arex.Message);
                    }

                    return(list);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Dans READALL: " + ex.StackTrace);
            }
            return(null);
        }
예제 #2
0
        public static ArrayList ReadAll( string path )
        {
            using ( StreamReader ip = new StreamReader( path ) )
            {
                ArrayList list = new ArrayList();

                for ( DecorationList v = Read( ip ); v != null; v = Read( ip ) )
                    list.Add( v );

                return list;
            }
        }
예제 #3
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 = DecorationList.ReadAll( files[i] );

                for ( int j = 0; j < list.Count; ++j )
                    m_Count += ((DecorationList)list[j]).Generate( maps );
            }
        }
예제 #4
0
        public static void Generate(string folder, params Map[] maps)
        {
            if (!Directory.Exists(folder))
            {
                return;
            }

            var files = Directory.GetFiles(folder, "*.cfg");

            for (var i = 0; i < files.Length; ++i)
            {
                var list = DecorationList.ReadAll(files[i]);

                for (var j = 0; j < list.Count; ++j)
                {
                    m_Count += list[j].Generate(maps);
                }
            }
        }
예제 #5
0
        public static Item FindByID(int id)
        {
            if (m_List == null)
            {
                return(null);
            }

            for (int j = 0; j < m_List.Count; ++j)
            {
                DecorationList list = (DecorationList)m_List[j];

                if (list.ID == id)
                {
                    return(list.Constructed);
                }
            }

            return(null);
        }
예제 #6
0
        private 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)
            {
                List <DecorationList> list = DecorationList.ReadAll(files[i]);

                for (int j = 0; j < list.Count; ++j)
                {
                    _count += list[j].Generate(maps);
                }
            }
        }
예제 #7
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 = DecorationList.ReadAll(files[i]);

                // genova: support uo:ml.
                #region Mondain's Legacy
                m_List = list;
                #endregion

                for (int j = 0; j < list.Count; ++j)
                {
                    m_Count += ((DecorationList)list[j]).Generate(maps);
                }
            }
        }
예제 #8
0
        public static DecorationList 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);
            }

            DecorationList list = new DecorationList();

            int indexOf = line.IndexOf(' ');

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

            if (list.m_Type == null)
            {
                return(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 DecorationEntry(line));
            }

            return(list);
        }
예제 #9
0
		public static DecorationList Read( StreamReader ip )
		{
			string line;

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

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

			if ( line == null || line.Length == 0 )
				return null;

			DecorationList list = new DecorationList();

			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 DecorationEntry( line ) );
			}

			return list;
		}