iFileUpLoad2000.java 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. /*** Eclipse Class Decompiler plugin, copyright (c) 2016 Chen Chao (cnfree2000@hotmail.com) ***/
  2. package DBstep;
  3. import java.io.File;
  4. import java.io.FileOutputStream;
  5. import javax.servlet.http.HttpServletRequest;
  6. public class iFileUpLoad2000 {
  7. public String FFilePath;
  8. public String FFileName;
  9. public byte[] FBuffer;
  10. public int FBufLen;
  11. public int FBinLen;
  12. public byte[] FSingBuf;
  13. public int FSingLen;
  14. public String FCopyright;
  15. public iFileUpLoad2000(HttpServletRequest request) {
  16. int totalRead = 0;
  17. boolean readBytes = false;
  18. boolean mSingCur = false;
  19. try {
  20. this.FBufLen = request.getContentLength();
  21. int arg6;
  22. for (this.FBuffer = new byte[this.FBufLen]; totalRead < this.FBufLen; totalRead += arg6) {
  23. request.getInputStream();
  24. arg6 = request.getInputStream().read(this.FBuffer, totalRead,
  25. this.FBufLen - totalRead);
  26. }
  27. } catch (Exception arg5) {
  28. System.out.println(arg5.toString());
  29. }
  30. for (this.FSingLen = 0; this.FBuffer[this.FSingLen] != 13; ++this.FSingLen) {
  31. ;
  32. }
  33. this.FSingBuf = new byte[this.FSingLen];
  34. for (int arg7 = 0; arg7 < this.FSingLen; ++arg7) {
  35. this.FSingBuf[arg7] = this.FBuffer[arg7];
  36. }
  37. this.FFilePath = "";
  38. this.FFileName = "";
  39. this.FCopyright = "[数据驿站,版权所有]";
  40. }
  41. public int FindSing(int Start) {
  42. boolean result = true;
  43. int s = Start;
  44. int arg5;
  45. while (true) {
  46. if (s >= this.FBufLen - this.FSingLen) {
  47. arg5 = -1;
  48. break;
  49. }
  50. boolean DjfOk = true;
  51. for (int i = 0; i < this.FSingLen; ++i) {
  52. if (this.FSingBuf[i] != this.FBuffer[s + i]) {
  53. DjfOk = false;
  54. break;
  55. }
  56. }
  57. if (DjfOk) {
  58. arg5 = s;
  59. break;
  60. }
  61. ++s;
  62. }
  63. return arg5;
  64. }
  65. public int FindItem(String TagName) {
  66. boolean result = true;
  67. int s = 0;
  68. int arg5;
  69. while (true) {
  70. s = this.FindSing(s);
  71. if (s == -1) {
  72. arg5 = -1;
  73. break;
  74. }
  75. s = s + this.FSingLen + 40;
  76. int e = s;
  77. if (s + 1 >= this.FBufLen) {
  78. arg5 = -1;
  79. break;
  80. }
  81. while (this.FBuffer[e + 1] != 34) {
  82. ++e;
  83. }
  84. String strName = new String(this.FBuffer, s, e - s + 1);
  85. if (TagName.equalsIgnoreCase(strName)) {
  86. arg5 = e + 1;
  87. break;
  88. }
  89. }
  90. return arg5;
  91. }
  92. public String ItemValue(String TagName) {
  93. String strTmp = "";
  94. String result = "";
  95. int s = this.FindItem(TagName);
  96. if (s == -1) {
  97. return result;
  98. } else {
  99. int e;
  100. if (this.FBuffer[s + 1] == 59) {
  101. s += 13;
  102. for (e = s; this.FBuffer[e + 1] != 34; ++e) {
  103. ;
  104. }
  105. } else {
  106. s += 5;
  107. e = this.FindSing(s) - 3;
  108. }
  109. if (e - s < 0) {
  110. return result;
  111. } else {
  112. strTmp = new String(this.FBuffer, s, e - s + 1);
  113. return strTmp;
  114. }
  115. }
  116. }
  117. public String ExtName(String TagName) {
  118. String mFileName = "";
  119. String mExtName = "";
  120. mExtName = "";
  121. mFileName = this.ItemValue(TagName);
  122. if (mFileName != "") {
  123. mExtName = mFileName.substring(mFileName.lastIndexOf("."));
  124. }
  125. return mExtName;
  126. }
  127. public byte[] FileBody(String TagName) {
  128. byte[] mBody = null;
  129. int s = this.FindItem(TagName);
  130. if (s == -1) {
  131. return mBody;
  132. } else {
  133. s += 13;
  134. int i;
  135. for (i = s; this.FBuffer[i] != 34; ++i) {
  136. ;
  137. }
  138. int e = i - 1;
  139. if (e - s < 0) {
  140. return mBody;
  141. } else {
  142. for (i = e; this.FBuffer[i - 4] != 13
  143. || this.FBuffer[i - 3] != 10
  144. || this.FBuffer[i - 2] != 13
  145. || this.FBuffer[i - 1] != 10; ++i) {
  146. ;
  147. }
  148. e = this.FindSing(i) - 3;
  149. if (e - i >= 0) {
  150. mBody = new byte[e - i + 1];
  151. int j = 0;
  152. for (i = i; i <= e; ++i) {
  153. mBody[j] = this.FBuffer[i];
  154. ++j;
  155. }
  156. }
  157. return mBody;
  158. }
  159. }
  160. }
  161. public String FileName(String TagName) {
  162. String result = "";
  163. int s = this.FindItem(TagName);
  164. if (s == -1) {
  165. return result;
  166. } else {
  167. s += 13;
  168. int i;
  169. for (i = s; this.FBuffer[i] != 34; ++i) {
  170. ;
  171. }
  172. int e = i - 1;
  173. if (e - s < 0) {
  174. return result;
  175. } else {
  176. for (i = e; i >= s; --i) {
  177. if ((char) this.FBuffer[i - 1] == 92) {
  178. s = i;
  179. break;
  180. }
  181. }
  182. result = new String(this.FBuffer, s, e - s + 1);
  183. return result;
  184. }
  185. }
  186. }
  187. public int FileSize(String TagName) {
  188. byte result = 0;
  189. int s = this.FindItem(TagName);
  190. if (s == -1) {
  191. return result;
  192. } else {
  193. s += 13;
  194. int i;
  195. for (i = s; this.FBuffer[i] != 34; ++i) {
  196. ;
  197. }
  198. int e = i - 1;
  199. if (e - s < 0) {
  200. return result;
  201. } else {
  202. for (i = e; this.FBuffer[i - 4] != 13
  203. || this.FBuffer[i - 3] != 10
  204. || this.FBuffer[i - 2] != 13
  205. || this.FBuffer[i - 1] != 10; ++i) {
  206. ;
  207. }
  208. e = this.FindSing(i) - 3;
  209. int arg5 = e - i + 1;
  210. return arg5;
  211. }
  212. }
  213. }
  214. public String CopyRight() {
  215. return this.FCopyright;
  216. }
  217. public String getFilePath() {
  218. return this.FFilePath;
  219. }
  220. public String Request(String TagName) {
  221. return this.ItemValue(TagName);
  222. }
  223. public boolean SaveAll(String FileName) {
  224. boolean result = false;
  225. try {
  226. FileOutputStream ex = new FileOutputStream(String.valueOf(String
  227. .valueOf((new StringBuffer(String.valueOf(String
  228. .valueOf(this.FFilePath)))).append('\\').append(
  229. FileName))));
  230. for (int i = 0; i < this.FBufLen; ++i) {
  231. ex.write(this.FBuffer[i]);
  232. }
  233. ex.close();
  234. result = true;
  235. } catch (Exception arg4) {
  236. System.out.println(arg4.toString());
  237. result = false;
  238. }
  239. return result;
  240. }
  241. public boolean SaveFile(String TagName, String FileName) {
  242. String mFileName = "";
  243. boolean result = false;
  244. int s = this.FindItem(TagName);
  245. if (s == -1) {
  246. result = false;
  247. return result;
  248. } else {
  249. s += 13;
  250. int i;
  251. for (i = s; this.FBuffer[i] != 34; ++i) {
  252. ;
  253. }
  254. int e = i - 1;
  255. if (e - s < 0) {
  256. result = false;
  257. return result;
  258. } else {
  259. for (i = e; i >= s; --i) {
  260. if ((char) this.FBuffer[i - 1] == 92) {
  261. s = i;
  262. break;
  263. }
  264. }
  265. this.FFileName = new String(this.FBuffer, s, e - s + 1);
  266. if (FileName.trim() != "") {
  267. this.FFileName = FileName;
  268. }
  269. for (i = e; this.FBuffer[i - 4] != 13
  270. || this.FBuffer[i - 3] != 10
  271. || this.FBuffer[i - 2] != 13
  272. || this.FBuffer[i - 1] != 10; ++i) {
  273. ;
  274. }
  275. s = i;
  276. e = this.FindSing(i) - 3;
  277. try {
  278. FileOutputStream ex = new FileOutputStream(
  279. String.valueOf(String.valueOf((new StringBuffer(
  280. String.valueOf(String
  281. .valueOf(this.FFilePath)))).append(
  282. '\\').append(this.FFileName))));
  283. if (ex == null) {
  284. result = false;
  285. } else if (e - s >= 0) {
  286. for (i = s; i <= e; ++i) {
  287. ex.write(this.FBuffer[i]);
  288. }
  289. result = true;
  290. }
  291. ex.close();
  292. } catch (Exception arg8) {
  293. System.out.println(arg8.toString());
  294. result = false;
  295. }
  296. return result;
  297. }
  298. }
  299. }
  300. public boolean setFilePath(String Value) {
  301. this.FFilePath = Value;
  302. File mFile = new File(this.FFilePath);
  303. mFile.mkdirs();
  304. return mFile.isDirectory();
  305. }
  306. }