예제 #1
0
        public void ReadFile(BinaryReader br)
        {
            MpkFileHeader header = new MpkFileHeader();

            header.Read(br);
            switch (header.VersionString)
            {
            case "Version 1.0":
                readV1(br, header);
                break;
            }
            ReadFile(br);
        }
예제 #2
0
		private void readV1(BinaryReader br,MpkFileHeader header)
		{
			ArrayList files = new ArrayList();
			foreach(int size in header.Sizes)
			{
				ArrayList chars = new ArrayList();
				char ch;
				while((ch=br.ReadChar())!='\0')
					chars.Add(ch);
				
				byte[] data = br.ReadBytes(size);
				IMpkEntry ime = IMpkEntry.GetType((MpkEntryType)br.ReadByte());
				ime.Data=data;
				ime.FileName=new string((char[])chars.ToArray(typeof(char)));
				files.Add(ime);					
			}
		}
예제 #3
0
		public void WriteFile(BinaryWriter bw)
		{
			MpkFileHeader header = new MpkFileHeader();
			ArrayList entries = new ArrayList();
			
			//... put all IMpkEntries into arraylist

			header.Entries=entries;
			header.Write(bw);
			bw.Flush();
			foreach(IMpkEntry imp in entries)
			{
				bw.Write(imp.FileName.ToCharArray());
				bw.Write((char)'\0');
				bw.Write((byte)imp.Type);
				bw.Write(imp.Data);
				bw.Flush();
			}
		}
예제 #4
0
        public void WriteFile(BinaryWriter bw)
        {
            MpkFileHeader header  = new MpkFileHeader();
            ArrayList     entries = new ArrayList();

            //... put all IMpkEntries into arraylist

            header.Entries = entries;
            header.Write(bw);
            bw.Flush();
            foreach (IMpkEntry imp in entries)
            {
                bw.Write(imp.FileName.ToCharArray());
                bw.Write((char)'\0');
                bw.Write((byte)imp.Type);
                bw.Write(imp.Data);
                bw.Flush();
            }
        }
예제 #5
0
        private void readV1(BinaryReader br, MpkFileHeader header)
        {
            ArrayList files = new ArrayList();

            foreach (int size in header.Sizes)
            {
                ArrayList chars = new ArrayList();
                char      ch;
                while ((ch = br.ReadChar()) != '\0')
                {
                    chars.Add(ch);
                }

                byte[]    data = br.ReadBytes(size);
                IMpkEntry ime  = IMpkEntry.GetType((MpkEntryType)br.ReadByte());
                ime.Data     = data;
                ime.FileName = new string((char[])chars.ToArray(typeof(char)));
                files.Add(ime);
            }
        }
예제 #6
0
		public void ReadFile(BinaryReader br)
		{
			MpkFileHeader header = new MpkFileHeader();
			header.Read(br);
			switch(header.VersionString)
			{
				case "Version 1.0":
					readV1(br,header);
					break;
			}
			ReadFile(br);
		}