예제 #1
0
파일: RBase.cs 프로젝트: Tamschi/MarsMiner
        public override ResourceItem[] LoadFromFile(String keyPrefix, String fileName, String fileExtension, FileStream stream)
        {
            StreamReader reader = new StreamReader(stream);
            String       text   = reader.ReadToEnd();

            reader.Close();

            if (fileExtension == "lang")
            {
                String[] split = text.Split('"');

                ResourceItem[] items = new ResourceItem[(split.Length - 1) / 4];
                for (int i = 1, j = 0; i < split.Length; i += 4, ++j)
                {
                    items[j] = new ResourceItem(split[i].ToLower(), split[i + 2]);
                }

                return(items);
            }
            else
            {
                return new ResourceItem[] { new ResourceItem(keyPrefix + fileName, text) }
            };
        }
예제 #2
0
파일: Info.cs 프로젝트: vashage/MarsMiner
        public override ResourceItem[] LoadFromFile( string keyPrefix, string fileName, string fileExtension, FileStream stream )
        {
            InfoObject[] objs = Info.ParseStream( stream );
            ResourceItem[] items = new ResourceItem[ objs.Length ];

            for( int i = 0; i < objs.Length; ++ i )
            {
                Info.Register( objs[ i ] );
                items[ i ] = new ResourceItem( objs[ i ].Type + "_" + objs[ i ].Name, objs[ i ] );
            }

            return items;
        }
예제 #3
0
파일: RBase.cs 프로젝트: vashage/MarsMiner
        public override ResourceItem[] LoadFromFile( String keyPrefix, String fileName, String fileExtension, FileStream stream )
        {
            StreamReader reader = new StreamReader( stream );
            String text = reader.ReadToEnd();
            reader.Close();

            if ( fileExtension == "lang" )
            {
                String[] split = text.Split( '"' );

                ResourceItem[] items = new ResourceItem[ ( split.Length - 1 ) / 4 ];
                for ( int i = 1, j = 0; i < split.Length; i += 4, ++ j )
                    items[ j ] = new ResourceItem( split[ i ].ToLower(), split[ i + 2 ] );

                return items;
            }
            else
                return new ResourceItem[] { new ResourceItem( keyPrefix + fileName, text ) };
        }