OmegaChartのソースコードの保守
リビジョン | a2f64e7f8493e3db19eaf0639fe782e4496901c9 (tree) |
---|---|
日時 | 2014-04-03 14:38:29 |
作者 | panacoran <panacoran@user...> |
コミッター | panacoran |
7z.dllを使ってUNLHA32.DLLとUNZIP32.DLLを不要にする
@@ -7,3 +7,12 @@ grammatica-1.5.dllはGrammaticaのランタイムライブラリです。 | ||
7 | 7 | http://grammatica.percederberg.net/ |
8 | 8 | ライセンスはGNU LGPLです。 |
9 | 9 | http://www.gnu.org/licenses/lgpl.html |
10 | + | |
11 | +SevenZipSharp.dllは以下のURLで配布されています。 | |
12 | +https://sevenzipsharp.codeplex.com/ | |
13 | +ライセンスはGNU LGPLです。 | |
14 | + | |
15 | +7z.dllと7z64.dllは7-Zip 9.20に含まれています。 | |
16 | +http://7-zip.org/ | |
17 | +ライセンスはGNU LGPLにunRAR制限を加えたものです。 | |
18 | +http://7-zip.org/license.txt |
@@ -3,6 +3,11 @@ | ||
3 | 3 | * |
4 | 4 | * $Id$ |
5 | 5 | */ |
6 | +// This file is modified by panacoran. | |
7 | +// Copyright (c) 2014 panacoran <panacoran@users.sourceforge.jp> | |
8 | +// This program is part of OmegaChart. | |
9 | +// OmegaChart is licensed under the Apache License, Version 2.0. | |
10 | + | |
6 | 11 | using System; |
7 | 12 | using System.Collections; |
8 | 13 | using Travis.Storage; |
@@ -141,7 +146,11 @@ namespace Zanetti.DataSource | ||
141 | 146 | case StockDownload.Bookmark: |
142 | 147 | throw new NotSupportedException("ブックマーク内のダウンロードはサポートされていません。"); |
143 | 148 | case StockDownload.Recent: |
144 | - stock_ds = new Specialized.KdbComDataSource(_dateArray); | |
149 | +#if MUJINZOU | |
150 | + stock_ds = new Specialized.MujinzouDataSource(_dateArray); | |
151 | +#else | |
152 | + stock_ds = new Specialized.KdbComDataSource(_dateArray); | |
153 | +#endif | |
145 | 154 | break; |
146 | 155 | } |
147 | 156 | if(stock_ds!=null) col.Add(stock_ds); |
@@ -3,6 +3,11 @@ | ||
3 | 3 | * |
4 | 4 | * $Id$ |
5 | 5 | */ |
6 | +// This file is modified by panacoran. | |
7 | +// Copyright (c) 2014 panacoran <panacoran@users.sourceforge.jp> | |
8 | +// This program is part of OmegaChart. | |
9 | +// OmegaChart is licensed under the Apache License, Version 2.0. | |
10 | + | |
6 | 11 | using System; |
7 | 12 | using System.Text; |
8 | 13 | using System.IO; |
@@ -11,8 +16,6 @@ using System.Diagnostics; | ||
11 | 16 | |
12 | 17 | |
13 | 18 | using Zanetti.Data; |
14 | -using Travis.Archive; | |
15 | -using Travis.Http; | |
16 | 19 | |
17 | 20 | namespace Zanetti.DataSource.Specialized |
18 | 21 | { |
@@ -59,7 +62,7 @@ namespace Zanetti.DataSource.Specialized | ||
59 | 62 | Hashtable result = new Hashtable(); |
60 | 63 | string datetext = date.ToString(); |
61 | 64 | string url = String.Format("http://www.bekkoame.ne.jp/ha/hahaha/data{0}/{1}.LZH", datetext.Substring(0,4), datetext); |
62 | - r = new StreamReader(ExtractData(url), Encoding.Default); | |
65 | + r = new StreamReader(Util.ExtractData(url), Encoding.Default); | |
63 | 66 | |
64 | 67 | string line = r.ReadLine(); |
65 | 68 | while(line!=null) { |
@@ -102,14 +105,5 @@ namespace Zanetti.DataSource.Specialized | ||
102 | 105 | if(r!=null) r.Close(); |
103 | 106 | } |
104 | 107 | } |
105 | - | |
106 | - private static Stream ExtractData(string url) { | |
107 | - MemoryStream ms = new HTTPConnection(url).Open(); | |
108 | - ms.Close(); | |
109 | - byte[] input = ms.ToArray(); | |
110 | - ArrayList list = new ExtractLha().extract(input); | |
111 | - return new MemoryStream(((Extract.FileBuffer)list[0]).buffer); | |
112 | - } | |
113 | - | |
114 | 108 | } |
115 | 109 | } |
@@ -1,3 +1,13 @@ | ||
1 | +/* | |
2 | + * Copyright (c) Daisuke OKAJIMA All rights reserved. | |
3 | + * | |
4 | + * $Id$ | |
5 | + */ | |
6 | +// This file is modified by panacoran. | |
7 | +// Copyright (c) 2014 panacoran <panacoran@users.sourceforge.jp> | |
8 | +// This program is part of OmegaChart. | |
9 | +// OmegaChart is licensed under the Apache License, Version 2.0. | |
10 | + | |
1 | 11 | using System; |
2 | 12 | using System.IO; |
3 | 13 | using System.Drawing; |
@@ -6,8 +16,7 @@ using System.ComponentModel; | ||
6 | 16 | using System.Windows.Forms; |
7 | 17 | using System.Diagnostics; |
8 | 18 | using System.Threading; |
9 | - | |
10 | -using Travis.Archive; | |
19 | +using SevenZip; | |
11 | 20 | |
12 | 21 | namespace Zanetti.Forms |
13 | 22 | { |
@@ -175,18 +184,22 @@ namespace Zanetti.Forms | ||
175 | 184 | } |
176 | 185 | |
177 | 186 | private void StartImport() { |
187 | + var execdir = Path.GetDirectoryName(Application.ExecutablePath) ?? ""; | |
188 | + SevenZipBase.SetLibraryPath(Path.Combine(execdir, IntPtr.Size == 4 ? "7z.dll" : "7z64.dll")); | |
178 | 189 | try { |
179 | - ArrayList list = new ExtractZip().extract(_filename); | |
180 | - _importCount = 0; | |
181 | - foreach(Extract.FileBuffer e in list) { | |
182 | - int code = Util.ParseInt(e.filename.Substring(5)); //ちょっとぬるいハンドリングだが | |
183 | - FileStream s = new FileStream(Util.GetDailyDataFileName(code), FileMode.Create, FileAccess.Write); | |
184 | - s.Write(e.buffer, 0, e.buffer.Length); | |
185 | - s.Close(); | |
186 | - if((++_importCount % 100)==0) | |
187 | - this.BeginInvoke(new ImportResult(OnImportProgress)); | |
188 | - } | |
189 | - this.BeginInvoke(new ImportResult(OnImportSucceeded)); | |
190 | + using (var extractor = new SevenZipExtractor(_filename)) | |
191 | + { | |
192 | + _importCount = 0; | |
193 | + foreach (var e in extractor.ArchiveFileData) | |
194 | + { | |
195 | + var code = Util.ParseInt(e.FileName.Substring(5)); | |
196 | + using (var s = File.Create(Util.GetDailyDataFileName(code))) | |
197 | + extractor.ExtractFile(e.Index, s); | |
198 | + if ((++_importCount % 100) == 0) | |
199 | + BeginInvoke(new ImportResult(OnImportProgress)); | |
200 | + } | |
201 | + } | |
202 | + BeginInvoke(new ImportResult(OnImportSucceeded)); | |
190 | 203 | } |
191 | 204 | catch(Exception ex) { |
192 | 205 | Debug.WriteLine(ex.StackTrace); |
@@ -3,16 +3,17 @@ | ||
3 | 3 | * |
4 | 4 | * $Id$ |
5 | 5 | */ |
6 | +// This file is modified by panacoran. | |
7 | +// Copyright (c) 2014 panacoran <panacoran@users.sourceforge.jp> | |
8 | +// This program is part of OmegaChart. | |
9 | +// OmegaChart is licensed under the Apache License, Version 2.0. | |
10 | + | |
6 | 11 | using System; |
7 | 12 | using System.Text; |
8 | 13 | using System.IO; |
9 | 14 | using System.Collections; |
10 | 15 | using System.Diagnostics; |
11 | - | |
12 | - | |
13 | 16 | using Zanetti.Data; |
14 | -using Travis.Archive; | |
15 | -using Travis.Http; | |
16 | 17 | |
17 | 18 | namespace Zanetti.DataSource.Specialized { |
18 | 19 | internal class MujinzouDataSource : DailyDataSource { |
@@ -77,7 +78,7 @@ namespace Zanetti.DataSource.Specialized { | ||
77 | 78 | string url = Env.Options.MujinzouUsesKakoData |
78 | 79 | ? "http://souba-data.com/k_data/" + d2.ToString(@"yyyy/yy_MM/TyyMMdd") + ".lzh" |
79 | 80 | : "http://souba-data.com/d_data/" + d2.ToString(@"yyyy\d/yy_MM\d/TyyMMdd") + ".lzh"; |
80 | - r = new StreamReader(ExtractData(url), Encoding.Default); | |
81 | + r = new StreamReader(Util.ExtractData(url), Encoding.Default); | |
81 | 82 | |
82 | 83 | string line = r.ReadLine(); |
83 | 84 | while(line!=null) { |
@@ -120,14 +121,6 @@ namespace Zanetti.DataSource.Specialized { | ||
120 | 121 | } |
121 | 122 | } |
122 | 123 | |
123 | - private static Stream ExtractData(string url) { | |
124 | - MemoryStream ms = Util.HttpDownload(url); | |
125 | - ms.Close(); | |
126 | - byte[] input = ms.ToArray(); | |
127 | - ArrayList list = new ExtractLha().extract(input); | |
128 | - return new MemoryStream(((Extract.FileBuffer)list[0]).buffer); | |
129 | - } | |
130 | - | |
131 | 124 | private static bool CheckMarket(BasicBrand br, int muj) { |
132 | 125 | MarketType mt = br.Market; |
133 | 126 | switch(mt) { |
@@ -17,7 +17,7 @@ using System.Drawing; | ||
17 | 17 | using System.Net; |
18 | 18 | using System.Diagnostics; |
19 | 19 | using System.Text; |
20 | - | |
20 | +using SevenZip; | |
21 | 21 | using Travis.Storage; |
22 | 22 | using Travis.Util; |
23 | 23 | using Travis.Http; |
@@ -109,6 +109,28 @@ namespace Zanetti | ||
109 | 109 | return new MemoryStream(strm.ToArray()); |
110 | 110 | } |
111 | 111 | |
112 | + public static Stream ExtractData(string url) | |
113 | + { | |
114 | + var execdir = Path.GetDirectoryName(Application.ExecutablePath) ?? ""; | |
115 | + SevenZipBase.SetLibraryPath(Path.Combine(execdir, IntPtr.Size == 4 ? "7z.dll" : "7z64.dll")); | |
116 | + var tmp = Path.Combine(execdir, "tmp.lzh"); | |
117 | + var result = new MemoryStream(); | |
118 | + using (var ms = Util.HttpDownload(url)) | |
119 | + using (var file = File.Create(tmp)) | |
120 | + { | |
121 | + ms.WriteTo(file); | |
122 | + using (var extractor = new SevenZipExtractor(file)) | |
123 | + { | |
124 | + if (extractor.ArchiveFileData.Count != 1) | |
125 | + throw new ApplicationException("データファイルの展開に失敗しました。"); | |
126 | + extractor.ExtractFile(0, result); | |
127 | + } | |
128 | + } | |
129 | + File.Delete(tmp); | |
130 | + result.Seek(0, SeekOrigin.Begin); | |
131 | + return result; | |
132 | + } | |
133 | + | |
112 | 134 | public static void CopyStream(Stream input, Stream output) { |
113 | 135 | byte[] buffer = new byte[0x20000]; |
114 | 136 | int n = input.Read(buffer, 0, buffer.Length); |
@@ -1,234 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright (c) Tasuku SUENAGA, Daisuke OKAJIMA All rights reserved. | |
3 | - * | |
4 | - * $Id$ | |
5 | - */ | |
6 | -using System; | |
7 | -using System.Runtime.InteropServices; | |
8 | -using System.IO; | |
9 | -using System.Text; | |
10 | -using System.Collections; | |
11 | - | |
12 | -namespace Travis.Archive { | |
13 | - /// <summary> | |
14 | - /// Extract の概要の説明です。 | |
15 | - /// </summary> | |
16 | - public abstract class Extract { | |
17 | - | |
18 | - public class FileBuffer{ | |
19 | - public string filename; | |
20 | - public byte[] buffer; | |
21 | - }; | |
22 | - | |
23 | - [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi,Pack=4)] | |
24 | - public struct INDIVIDUALINFO{ | |
25 | - public uint dwOriginalSize; | |
26 | - public uint dwCompressedSize; | |
27 | - public uint dwCRC; | |
28 | - public uint uFlag; | |
29 | - public uint uOSType; | |
30 | - public ushort wRatio; | |
31 | - public ushort wDate; | |
32 | - public ushort wTime; | |
33 | - [MarshalAs(UnmanagedType.ByValTStr,SizeConst=513)] | |
34 | - public string szFileName; | |
35 | - [MarshalAs(UnmanagedType.ByValTStr,SizeConst=3)] | |
36 | - public string dummy1; | |
37 | - [MarshalAs(UnmanagedType.ByValTStr,SizeConst=8)] | |
38 | - public string szAttribute; | |
39 | - [MarshalAs(UnmanagedType.ByValTStr,SizeConst=8)] | |
40 | - public string szMode; | |
41 | - } | |
42 | - | |
43 | - public Extract() { | |
44 | - } | |
45 | - public abstract uint getVersion(); | |
46 | - public abstract bool getRunning(); | |
47 | - public abstract bool checkArchive(string filename,int mode); | |
48 | - public abstract string getDllName(); | |
49 | - public abstract int execute(string cmdline,string output,int size); | |
50 | - | |
51 | - public abstract int extract(IntPtr harc,string filename); | |
52 | - public abstract IntPtr openArchive(string filename,uint mode); | |
53 | - public abstract int closeArchive(IntPtr harc); | |
54 | - public abstract int findFirst(IntPtr harc,ref INDIVIDUALINFO info); | |
55 | - public abstract int findNext(IntPtr harc,ref INDIVIDUALINFO info); | |
56 | - public abstract int getFileName(IntPtr harc,ref string filename); | |
57 | - public abstract int extractMem(string filename,byte[] outbuf); | |
58 | - | |
59 | - public bool throwException(string msg) { | |
60 | - throw new ApplicationException(getDllName() + " : " + msg); | |
61 | - } | |
62 | - | |
63 | - public ArrayList extract(byte[] inbuf){ | |
64 | - | |
65 | - string tmpfn = Path.GetTempFileName(); | |
66 | - FileStream fst = File.OpenWrite(tmpfn); | |
67 | - BinaryWriter bw = new BinaryWriter(fst); | |
68 | - bw.Write(inbuf); | |
69 | - bw.Close(); | |
70 | - fst.Close(); | |
71 | - | |
72 | - ArrayList retval = extract(tmpfn); | |
73 | - | |
74 | - File.Delete(tmpfn); | |
75 | - | |
76 | - return retval; | |
77 | - } | |
78 | - | |
79 | - public ArrayList extract(string infile) { | |
80 | - //指定されたファイルがあるか調べる | |
81 | - if (!System.IO.File.Exists(infile)) { | |
82 | - throw new ApplicationException("ファイルが見つかりません"); | |
83 | - } | |
84 | - | |
85 | - //DLLのチェック | |
86 | - try { | |
87 | - uint ver = getVersion(); | |
88 | - } | |
89 | - catch { | |
90 | - throwException("解凍を行うDLLが見つかりません。\nhttp://www.madobe.net/archiver/lib/main.htmlからインストールして下さい。"); | |
91 | - } | |
92 | - | |
93 | - if (getRunning()) { | |
94 | - throwException("他のアプリケーションで使用中です。"); | |
95 | - } | |
96 | - | |
97 | - if (!checkArchive(infile, 0)) { | |
98 | - throwException("このDLLでは解凍できないファイルです。"); | |
99 | - } | |
100 | - | |
101 | - if (infile.IndexOf(' ') > 0) { | |
102 | - infile = "\"" + infile + "\""; | |
103 | - } | |
104 | - | |
105 | - // ファイルを全部さらう | |
106 | - // memo:あとで個別解凍より、 | |
107 | - // 一個ずつテンポラリファイルに書き出して読み込んだほうがパフォーマンス高くなるかも | |
108 | - ArrayList fbar = new ArrayList(); | |
109 | - INDIVIDUALINFO info = new INDIVIDUALINFO(); | |
110 | - IntPtr harc = openArchive(infile,0x02000100); // M_CHECK_ALL_PATH | M_BAR_WINDOWS_OFF | |
111 | - | |
112 | - if(findFirst(harc,ref info) != -1){ | |
113 | - do{ | |
114 | - // ディレクトリは除く | |
115 | - if(info.dwOriginalSize != 0){ | |
116 | - FileBuffer fb = new FileBuffer(); | |
117 | - fb.filename = info.szFileName; | |
118 | - fb.buffer = new byte[info.dwOriginalSize]; | |
119 | - fbar.Add(fb); | |
120 | - } | |
121 | - }while(findNext(harc,ref info) != -1); | |
122 | - } | |
123 | - closeArchive(harc); | |
124 | - | |
125 | - // さらったあとで個別に解凍 | |
126 | - foreach(FileBuffer fb in fbar){ | |
127 | - if(extractMem(infile + " \"" + fb.filename + "\"",fb.buffer) != 0){ | |
128 | - throwException("ファイルの解凍に失敗しました。"); | |
129 | - } | |
130 | - } | |
131 | - | |
132 | - return fbar; | |
133 | - } | |
134 | - } | |
135 | - | |
136 | - public class ExtractLha : Extract { | |
137 | - [DllImport("unlha32")] | |
138 | - private extern static UInt16 UnlhaGetVersion(); | |
139 | - [DllImport("unlha32")] | |
140 | - private extern static bool UnlhaGetRunning(); | |
141 | - [DllImport("unlha32", CharSet=CharSet.Ansi)] | |
142 | - private extern static bool UnlhaCheckArchive(string szFileName, int iMode); | |
143 | - [DllImport("unlha32", CharSet=CharSet.Ansi)] | |
144 | - private extern static int Unlha(int hwnd, string szCmdLine, string szOutput, int dwSize); | |
145 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
146 | - private extern static int UnlhaExtract(IntPtr harc,string szFileName,string szDirName,uint dwMode); | |
147 | - [DllImport("unlha32", CharSet=CharSet.Ansi)] | |
148 | - private extern static int UnlhaExtractMem(int hwnd, string szCmdLine, byte[] szBuffer, int dwSize, IntPtr lpTime, IntPtr lpwAttr, IntPtr lpdwWriteSize); | |
149 | - [DllImport("unlha32", CharSet=CharSet.Ansi)] | |
150 | - private static extern IntPtr UnlhaOpenArchive(IntPtr hwnd, string szFileName, uint dwMode); | |
151 | - [DllImport("unlha32", CharSet=CharSet.Ansi)] | |
152 | - private static extern int UnlhaCloseArchive(IntPtr harc); | |
153 | - [DllImport("unlha32", CharSet=CharSet.Ansi)] | |
154 | - private static extern int UnlhaFindFirst(IntPtr harc, string szWildName, ref INDIVIDUALINFO lpSubInfo); | |
155 | - [DllImport("unlha32", CharSet=CharSet.Ansi)] | |
156 | - private static extern int UnlhaFindNext(IntPtr harc, ref INDIVIDUALINFO lpSubInfo); | |
157 | - [DllImport("unlha32", CharSet=CharSet.Ansi)] | |
158 | - private static extern int UnlhaGetFileName(IntPtr harc, StringBuilder lpBuffer, int nsize); | |
159 | - | |
160 | - public override uint getVersion(){return (uint)UnlhaGetVersion();} | |
161 | - public override bool getRunning(){return UnlhaGetRunning();} | |
162 | - public override bool checkArchive(string filename,int mode){return UnlhaCheckArchive(filename,mode);} | |
163 | - public override int execute(string cmdline,string output,int size){return Unlha(0,cmdline,output,size);} | |
164 | - public override string getDllName(){return "Unlha32.dll";} | |
165 | - | |
166 | - | |
167 | - public override int extract(IntPtr harc,string filename){ | |
168 | - // 未実装 | |
169 | - return 0; | |
170 | - } | |
171 | - public override int extractMem(string filename,byte[] outbuf) { | |
172 | - return UnlhaExtractMem(0,"-n " + filename,outbuf,outbuf.Length,IntPtr.Zero,IntPtr.Zero,IntPtr.Zero); | |
173 | - } | |
174 | - public override IntPtr openArchive(string filename,uint mode){return UnlhaOpenArchive(IntPtr.Zero,filename,0);} | |
175 | - public override int closeArchive(IntPtr harc){return UnlhaCloseArchive(harc);} | |
176 | - public override int findFirst(IntPtr harc,ref INDIVIDUALINFO info){return UnlhaFindFirst(harc,"*.*",ref info);} | |
177 | - public override int findNext(IntPtr harc,ref INDIVIDUALINFO info){return UnlhaFindNext(harc,ref info);} | |
178 | - public override int getFileName(IntPtr harc,ref string filename){ | |
179 | - StringBuilder sb = new StringBuilder(256); | |
180 | - int retval = UnlhaGetFileName(harc, sb, 256); | |
181 | - filename = sb.ToString(); | |
182 | - return retval; | |
183 | - } | |
184 | - } | |
185 | - public class ExtractZip : Extract { | |
186 | - [DllImport("unzip32")] | |
187 | - private extern static UInt16 UnZipGetVersion(); | |
188 | - [DllImport("unzip32")] | |
189 | - private extern static bool UnZipGetRunning(); | |
190 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
191 | - private extern static bool UnZipCheckArchive(string szFileName, int iMode); | |
192 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
193 | - private extern static int UnZip(int hwnd, string szCmdLine, string szOutput, int dwSize); | |
194 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
195 | - private extern static int UnZipExtract(IntPtr harc,string szFileName,string szDirName,uint dwMode); | |
196 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
197 | - private extern static int UnZipExtractMem(int hwnd, string szCmdLine, byte[] szBuffer, int dwSize, IntPtr lpTime, IntPtr lpwAttr, IntPtr lpdwWriteSize); | |
198 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
199 | - private static extern IntPtr UnZipOpenArchive(IntPtr hwnd, string szFileName, uint dwMode); | |
200 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
201 | - private static extern int UnZipCloseArchive(IntPtr harc); | |
202 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
203 | - private static extern int UnZipFindFirst(IntPtr harc, string szWildName, ref INDIVIDUALINFO lpSubInfo); | |
204 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
205 | - private static extern int UnZipFindNext(IntPtr harc, ref INDIVIDUALINFO lpSubInfo); | |
206 | - [DllImport("unzip32", CharSet=CharSet.Ansi)] | |
207 | - private static extern int UnZipGetFileName(IntPtr harc, StringBuilder lpBuffer, int nsize); | |
208 | - | |
209 | - public override uint getVersion(){return (uint)UnZipGetVersion();} | |
210 | - public override bool getRunning(){return UnZipGetRunning();} | |
211 | - public override bool checkArchive(string filename,int mode){return UnZipCheckArchive(filename,mode);} | |
212 | - public override int execute(string cmdline,string output,int size){return UnZip(0,cmdline,output,size);} | |
213 | - public override string getDllName(){return "UnZip32.dll";} | |
214 | - | |
215 | - public override int extract(IntPtr harc,string filename){ | |
216 | - // 未実装 | |
217 | - return 0; | |
218 | - } | |
219 | - public override int extractMem(string filename,byte[] outbuf) { | |
220 | - return UnZipExtractMem(0,"--i " + filename,outbuf,outbuf.Length,IntPtr.Zero,IntPtr.Zero,IntPtr.Zero); | |
221 | - } | |
222 | - public override IntPtr openArchive(string filename,uint mode){return UnZipOpenArchive(IntPtr.Zero,filename,0);} | |
223 | - public override int closeArchive(IntPtr harc){return UnZipCloseArchive(harc);} | |
224 | - public override int findFirst(IntPtr harc,ref INDIVIDUALINFO info){return UnZipFindFirst(harc,"*.*",ref info);} | |
225 | - public override int findNext(IntPtr harc,ref INDIVIDUALINFO info){return UnZipFindNext(harc,ref info);} | |
226 | - public override int getFileName(IntPtr harc,ref string filename) { | |
227 | - StringBuilder sb = new StringBuilder(256); | |
228 | - int retval = UnZipGetFileName(harc, sb, 256); | |
229 | - filename = sb.ToString(); | |
230 | - return retval; | |
231 | - } | |
232 | - } | |
233 | -} | |
234 | - |
@@ -3,16 +3,17 @@ | ||
3 | 3 | * |
4 | 4 | * $Id$ |
5 | 5 | */ |
6 | +// This file is modified by panacoran. | |
7 | +// Copyright (c) 2014 panacoran <panacoran@users.sourceforge.jp> | |
8 | +// This program is part of OmegaChart. | |
9 | +// OmegaChart is licensed under the Apache License, Version 2.0. | |
10 | + | |
6 | 11 | using System; |
7 | 12 | using System.Text; |
8 | 13 | using System.IO; |
9 | 14 | using System.Collections; |
10 | 15 | using System.Diagnostics; |
11 | - | |
12 | - | |
13 | 16 | using Zanetti.Data; |
14 | -using Travis.Archive; | |
15 | -using Travis.Http; | |
16 | 17 | |
17 | 18 | namespace Zanetti.DataSource.Specialized { |
18 | 19 | internal class HdatelierDataSource : DailyDataSource { |
@@ -59,7 +60,7 @@ namespace Zanetti.DataSource.Specialized { | ||
59 | 60 | Hashtable result = new Hashtable(); |
60 | 61 | string datetext = date.ToString(); |
61 | 62 | string url = String.Format("http://homepage1.nifty.com/hdatelier/data/{0}.lzh", datetext); |
62 | - r = new StreamReader(ExtractData(url), Encoding.Default); | |
63 | + r = new StreamReader(Util.ExtractData(url), Encoding.Default); | |
63 | 64 | |
64 | 65 | string line = r.ReadLine(); |
65 | 66 | while(line!=null) { |
@@ -96,14 +97,6 @@ namespace Zanetti.DataSource.Specialized { | ||
96 | 97 | } |
97 | 98 | } |
98 | 99 | |
99 | - private static Stream ExtractData(string url) { | |
100 | - MemoryStream ms = Util.HttpDownload(url); | |
101 | - ms.Close(); | |
102 | - byte[] input = ms.ToArray(); | |
103 | - ArrayList list = new ExtractLha().extract(input); | |
104 | - return new MemoryStream(((Extract.FileBuffer)list[0]).buffer); | |
105 | - } | |
106 | - | |
107 | 100 | //出来高が0だと最終気配等の文字が入るため調整 |
108 | 101 | private static string ToClosePrice(string src, double vol) { |
109 | 102 | if(vol!=0) return src; |
@@ -33,7 +33,7 @@ | ||
33 | 33 | <DebugType>pdbonly</DebugType> |
34 | 34 | <Optimize>true</Optimize> |
35 | 35 | <OutputPath>bin\Release\</OutputPath> |
36 | - <DefineConstants>TRACE</DefineConstants> | |
36 | + <DefineConstants>TRACE;MUJINZOU</DefineConstants> | |
37 | 37 | <ErrorReport>prompt</ErrorReport> |
38 | 38 | <WarningLevel>4</WarningLevel> |
39 | 39 | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
@@ -45,6 +45,9 @@ | ||
45 | 45 | <Reference Include="MagicLibrary"> |
46 | 46 | <HintPath>3rdParty\MagicLibrary.DLL</HintPath> |
47 | 47 | </Reference> |
48 | + <Reference Include="SevenZipSharp"> | |
49 | + <HintPath>3rdParty\SevenZipSharp.dll</HintPath> | |
50 | + </Reference> | |
48 | 51 | <Reference Include="System" /> |
49 | 52 | <Reference Include="System.Data" /> |
50 | 53 | <Reference Include="System.Deployment" /> |
@@ -57,7 +60,6 @@ | ||
57 | 60 | <SubType>Form</SubType> |
58 | 61 | </Compile> |
59 | 62 | <Compile Include="AccumulativeVolume.cs" /> |
60 | - <Compile Include="archiver.cs" /> | |
61 | 63 | <Compile Include="ArithmeticLibrary.cs" /> |
62 | 64 | <Compile Include="AssemblyInfo.cs" /> |
63 | 65 | <Compile Include="AutoTrading.cs" /> |
@@ -378,6 +380,9 @@ | ||
378 | 380 | <None Include="parser\condition.grammar" /> |
379 | 381 | </ItemGroup> |
380 | 382 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
383 | + <PropertyGroup> | |
384 | + <PostBuildEvent>copy $(SolutionDir)3rdParty\7z*.dll $(TargetDir)</PostBuildEvent> | |
385 | + </PropertyGroup> | |
381 | 386 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
382 | 387 | Other similar extension points exist, see Microsoft.Common.targets. |
383 | 388 | <Target Name="BeforeBuild"> |