Mercurial > repos > IBBoard.ArmyBuilder.API
comparison FileTableEntry.cs @ 0:1a5205612b72
Add initial work on ArmyBuilder API project\nno-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 19 Apr 2009 11:24:10 +0000 |
parents | |
children | ec77b60e5369 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1a5205612b72 |
---|---|
1 // This file (FileTableEntry.cs) is a part of the IBBoard.ArmyBuilder.API project and is copyright 2009 IBBoard | |
2 // | |
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. | |
4 // | |
5 | |
6 using System; | |
7 using System.IO; | |
8 | |
9 namespace IBBoard.ArmyBuilder.API | |
10 { | |
11 public class FileTableEntry | |
12 { | |
13 private ABFile parent; | |
14 private string name = ""; | |
15 private byte[] firstBytes = new byte[8]; | |
16 private int fileSize; | |
17 private int compressedSize; | |
18 private byte[] midBytes = new byte[4]; | |
19 private int location; | |
20 private byte[] endBytes = new byte[8]; | |
21 | |
22 public FileTableEntry(String fileName) | |
23 { | |
24 name = fileName; | |
25 } | |
26 | |
27 public ABFile ParentFile | |
28 { | |
29 get { return parent; } | |
30 set { | |
31 if (parent!=value) | |
32 { | |
33 if (parent!=null) | |
34 { | |
35 parent.RemoveFileTableEntry(this); | |
36 } | |
37 | |
38 parent = value; | |
39 | |
40 if (parent!=null) | |
41 { | |
42 parent.AddFileTableEntry(this); | |
43 } | |
44 } | |
45 } | |
46 } | |
47 | |
48 public string FileName | |
49 { | |
50 get { return name; } | |
51 } | |
52 | |
53 public int FileSize | |
54 { | |
55 get { return fileSize; } | |
56 set { fileSize = value; } | |
57 } | |
58 | |
59 public FileStream GetParentFileStream() | |
60 { | |
61 return (parent == null ? null : parent.GetFileStream()); | |
62 } | |
63 | |
64 public int CompressedSize | |
65 { | |
66 get { return compressedSize; } | |
67 set { compressedSize = value; } | |
68 } | |
69 | |
70 public int Location | |
71 { | |
72 get { return location; } | |
73 set { location = value; } | |
74 } | |
75 | |
76 public byte[] FirstBytes | |
77 { | |
78 get { return firstBytes; } | |
79 set | |
80 { | |
81 if (value!=null && value.Length == 8) | |
82 { | |
83 firstBytes = value; | |
84 } | |
85 } | |
86 } | |
87 | |
88 public byte[] MidBytes | |
89 { | |
90 get { return midBytes; } | |
91 set | |
92 { | |
93 if (value!=null && value.Length == 4) | |
94 { | |
95 midBytes = value; | |
96 } | |
97 } | |
98 } | |
99 | |
100 public byte[] EndBytes | |
101 { | |
102 get { return endBytes; } | |
103 set | |
104 { | |
105 if (value!=null && value.Length == 8) | |
106 { | |
107 endBytes = value; | |
108 } | |
109 } | |
110 } | |
111 } | |
112 } |