2019-05-29 16:55:14 zs1342084776 阅读数 1899
  • MT5编程从入门到精通:MQL5编程认知

    本课程是MT5编程从入门到精通的第一阶段课程,详细的介绍了没有编程经验的小白也能快速的进入MT5编程的世界,为没有编程经验的外汇交易爱好者,树立MT5程序化交易的信心。 本阶段课程共分为三个章节,第一章重点讲解了MT5的安装与调试,MT5数据文件介绍,以及学完本课程后能开发出怎么的程序化交易;第二章重点讲解了MT5拥有多货币、多周期回测功能,以及MT5强大的参数优化功能和MT5的EA生成功能;第三章重点讲解了MT5的脚本开发框架,指标开发框架和EA开发框架,以及MT5的断点调试功能。

    4436 人正在学习 去看看 李文帅

                    设置断点: F9 / 可能出错的行头双击

                        调试:  F5

               

               

                   单步执行: F10

            第一次累加sum = 60

              

               判断长度

              

               找出错误

          

2013-01-28 11:12:25 coaxhappy 阅读数 570
  • MT5编程从入门到精通:MQL5编程认知

    本课程是MT5编程从入门到精通的第一阶段课程,详细的介绍了没有编程经验的小白也能快速的进入MT5编程的世界,为没有编程经验的外汇交易爱好者,树立MT5程序化交易的信心。 本阶段课程共分为三个章节,第一章重点讲解了MT5的安装与调试,MT5数据文件介绍,以及学完本课程后能开发出怎么的程序化交易;第二章重点讲解了MT5拥有多货币、多周期回测功能,以及MT5强大的参数优化功能和MT5的EA生成功能;第三章重点讲解了MT5的脚本开发框架,指标开发框架和EA开发框架,以及MT5的断点调试功能。

    4436 人正在学习 去看看 李文帅
public class DownloadUtil
    {
        #region Fields
        private static List<DownloadThread> downloadThreads;
        #endregion

        #region Sinleton instance
        private static DownloadUtil instance;

        /// <summary>
        /// Singleton instance
        /// </summary>
        public static DownloadUtil Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new DownloadUtil();
                }

                return instance;
            }
        }
        #endregion

        #region Events
        /// <summary>
        /// 当系统重新启动时,需要重新加载下载的线程列表时,给此Action赋值
        /// </summary>
        public Action<List<DownloadThread>> LoadDownloadThreadHandler;
        #endregion

        #region Private ctor
        private DownloadUtil()
        {
            downloadThreads = new List<DownloadThread>();

            // 根据外部业务逻辑初始化下载线程列表
            if (LoadDownloadThreadHandler != null)
            {
                LoadDownloadThreadHandler(downloadThreads);
            }
        }
        #endregion

        #region Public methods
        /// <summary>
        /// Start download thread
        /// </summary>
        /// <param name="id"></param>
        /// <param name="downloadUri"></param>
        /// <param name="localFileFullPath"></param>
        /// <param name="DownloadProgressChanged"></param>
        /// <param name="DownloadCompleted"></param>
        public void StartDownload(string id, string downloadUri, string localFileFullPath,
            Action<double> DownloadProgressChanged,
            Action DownloadCompleted)
        {
            DownloadThread downloadThread = new DownloadThread();
            downloadThread.Id = id;
            downloadThread.LocalFilePath = localFileFullPath;
            downloadThread.DownloadUri = downloadUri;
            Thread thread = new Thread(new ThreadStart(() =>
            {
                DownloadFileThread(localFileFullPath, downloadUri, DownloadProgressChanged, DownloadCompleted);
            }));

            downloadThread.Thread = thread;
            downloadThread.DownloadProgressChanged = new Action<double>(DownloadProgressChanged);
            downloadThread.DownloadCompleted = new Action(DownloadCompleted);
            downloadThreads.Add(downloadThread);
            downloadThread.Thread.Start();
        }

        /// <summary>
        /// Pause download thread
        /// </summary>
        /// <param name="id"></param>
        /// <returns>DownloadPosition</returns>
        public void PauseDownload(string id, string localFileFullPath)
        {
            DownloadThread downloadThread = downloadThreads.FirstOrDefault(ele => ele.LocalFilePath == localFileFullPath
                && ele.Id == id);

            if (downloadThread != null && downloadThread.Thread != null)
            {
                Thread thread = downloadThread.Thread;
                thread.Abort();
            }
        }

        /// <summary>
        /// Resume download thread
        /// </summary>
        /// <param name="id"></param>
        /// <param name="localFileFullPath"></param>
        public void ResumeDownload(string id, string localFileFullPath)
        {
            DownloadThread downloadThread = downloadThreads.FirstOrDefault(ele => ele.LocalFilePath == localFileFullPath
                    && ele.Id == id);

            if (downloadThread != null && downloadThread.Thread != null)
            {

                Thread thread = new Thread(new ThreadStart(() =>
                {
                    DownloadFileThread(localFileFullPath, downloadThread.DownloadUri,
                        downloadThread.DownloadProgressChanged,
                        downloadThread.DownloadCompleted);
                }));

                downloadThread.Thread = thread;
                thread.Start();

            }
        }

        /// <summary>
        /// Delete download thread
        /// </summary>
        /// <param name="id"></param>
        /// <param name="localFileFullPath"></param>
        public void DeleteDownload(string id, string localFileFullPath)
        {
            DownloadThread downloadThread = downloadThreads.FirstOrDefault(ele => ele.LocalFilePath == localFileFullPath
                    && ele.Id == id);

            if (downloadThread != null)
            {
                if (downloadThread.Thread != null)
                {
                    Thread thread = downloadThread.Thread;
                    thread.Abort();
                }

                downloadThreads.Remove(downloadThread);
            }
        }
        #endregion

        private void DownloadFileThread(string localFileFullPath, string downloadUri,
            Action<double> downloadProgressChanged,
            Action downloadCompleted)
        {
            FileInfo fi = new FileInfo(localFileFullPath);
            FileStream fsToWrite;

            if (!fi.Exists)
            {
                fsToWrite = fi.Create();
            }
            else
            {
                fsToWrite = fi.Open(FileMode.Append, FileAccess.Write, FileShare.Read);
            }

            long startPosition = fsToWrite.Length;

            using (fsToWrite)
            {
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(downloadUri, UriKind.Absolute));
                request.AddRange((int)startPosition);

                try
                {
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                    if (response != null)
                    {
                        Stream stream = response.GetResponseStream();

                        if (stream != null)
                        {
                            byte[] buffer = new byte[1024];
                            long contentTotalLength = response.ContentLength + startPosition;
                            int readLength = stream.Read(buffer, 0, buffer.Count());
                            long fileReadLength = startPosition + readLength;
                            double downloadPercent = Math.Round((double)fileReadLength * 100 / (double)contentTotalLength, 0);
                            double downloadPercentTemp = 0d;

                            while (readLength > 0)
                            {
                                fsToWrite.Write(buffer, 0, readLength);
                                readLength = stream.Read(buffer, 0, buffer.Count());
                                fileReadLength += readLength;

                                downloadPercentTemp = Math.Round((double)fileReadLength * 100 / (double)contentTotalLength, 0);
                                if (downloadProgressChanged != null && downloadPercent != downloadPercentTemp)
                                {
                                    downloadPercent = downloadPercentTemp;
                                    downloadProgressChanged.Invoke(downloadPercent);
                                }
                            }

                            DownloadThread downloadThread = downloadThreads.FirstOrDefault(ele => ele.LocalFilePath == localFileFullPath
                                && ele.DownloadUri == downloadUri);

                            if (downloadThread != null)
                            {
                                downloadThreads.Remove(downloadThread);
                            }

                            if (downloadCompleted != null)
                            {
                                downloadCompleted.Invoke();
                            }
                            fsToWrite.Flush();
                            fsToWrite.Close();
                        }
                    }
                }
                catch (Exception)
                {

                }
            }
        }
    }


 

在以上代码中用到的实体类

   public class DownloadThread
    {
        private Thread downloadThread;

        public Thread Thread
        {
            get { return downloadThread; }
            set { downloadThread = value; }
        }

        private string id;

        /// <summary>
        /// 此处保存的是唯一标识
        /// </summary>
        public string Id
        {
            get { return id; }
            set { id = value; }
        }

        private string localFilePath;

        public string LocalFilePath
        {
            get { return localFilePath; }
            set { localFilePath = value; }
        }

        private Action<double> downloadProgressChanged;

        public Action<double> DownloadProgressChanged
        {
            get { return downloadProgressChanged; }
            set { downloadProgressChanged = value; }
        }

        private Action downloadCompleted;

        public Action DownloadCompleted
        {
            get { return downloadCompleted; }
            set { downloadCompleted = value; }
        }
        
        private string downloadUri = string.Empty;

        public string DownloadUri
        {
            get { return downloadUri; }
            set { downloadUri = value; }
        }
    }


 

2010-08-24 10:07:00 w395115323 阅读数 35
  • MT5编程从入门到精通:MQL5编程认知

    本课程是MT5编程从入门到精通的第一阶段课程,详细的介绍了没有编程经验的小白也能快速的进入MT5编程的世界,为没有编程经验的外汇交易爱好者,树立MT5程序化交易的信心。 本阶段课程共分为三个章节,第一章重点讲解了MT5的安装与调试,MT5数据文件介绍,以及学完本课程后能开发出怎么的程序化交易;第二章重点讲解了MT5拥有多货币、多周期回测功能,以及MT5强大的参数优化功能和MT5的EA生成功能;第三章重点讲解了MT5的脚本开发框架,指标开发框架和EA开发框架,以及MT5的断点调试功能。

    4436 人正在学习 去看看 李文帅

C# HttpWebRequest可断点上传,下载文件;SOCKET多线程多管道可断点传送大文件

SOCKET多线程多管道可断点传送大文件 http://www.cnblogs.com/Googler/archive/2010/06/03/1750616.html

ContractedBlock.gifExpandedBlockStart.gifHttpWebRequest
using System;
using System.Net;
using System.Web;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Text;

namespace Rocky.Net
{
public class HttpWalker
{
#region StaticMembers
public static void DownloadFile(HttpContext context, string filePath)
{
AppRuntime.Guard
<ArgumentNullException>(context == null);
HttpRequest Request
= context.Request;
HttpResponse Response
= context.Response;
Response.Clear();
Response.Buffer
= false;
Response.AddHeader(
"Accept-Ranges", "bytes");
using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
byte[] buffer = BufferUtility.GetBuffer((int)stream.Length);
long p = 0L, l = stream.Length;
#region Resolve Range
string range = Request.Headers["Range"];
if (range != null)
{
//Range:bytes=1024-
//Range:bytes=1024-2048
//Range:bytes=-1024
//Range:bytes=0-512,1024-2048
int index = range.IndexOf("=");
if (index != -1)
{
string[] ranges = range.Substring(index + 1).Split(',');
if (ranges.Length > 1)
{
//not supported multipart/byterange
}
else
{
bool flag = false;
if (ranges[0].StartsWith("-"))
{
long _p, _absp;
if (long.TryParse(ranges[0], out _p) && (_absp = Math.Abs(_p)) <= l)
{
if (_p < 0)
{
p
= l - _absp;
l
= _absp;
flag
= true;
}
}
}
else
{
ranges
= ranges[0].Split('-');
if (ranges.Length == 2)
{
long _p, _l;
if (ranges[1] == string.Empty)
{
if (long.TryParse(ranges[0], out _p) && _p <= l)
{
p
= _p;
flag
= true;
}
}
else if (long.TryParse(ranges[0], out _p) && long.TryParse(ranges[1], out _l) && _p > 0 && _l > 0 && _p < _l && _l < l)
{
p
= _p;
l
= _l + 1;
flag
= true;
}
}
}
if (flag)
{
Response.StatusCode
= 206;
Response.AddHeader(
"Content-Range", "bytes " + p.ToString() + "-" + l.ToString() + "/" + stream.Length.ToString());
}
else
{
Response.StatusCode
= 416; //Requested range not satisfiable
}
}
}
}
#endregion
Response.AddHeader(
"Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(filePath), Encoding.UTF8));
Response.AddHeader(
"Content-Length", l.ToString());
Response.ContentType
= "application/octet-stream";
stream.Position
= p;
int read;
while (Response.IsClientConnected && p < l)
{
Response.OutputStream.Write(buffer,
0, read = stream.Read(buffer, 0, buffer.Length));
Response.Flush();
p
+= read;
}
}
Response.End();
}

public static void UploadFile(HttpContext context, string savePath)
{
AppRuntime.Guard
<ArgumentNullException>(context == null);
HttpRequest Request
= context.Request;
HttpResponse Response
= context.Response;
string msg = "0", fileName = Request.Headers["filename"];
if (fileName != null)
{
FileInfo file
= new FileInfo(Path.Combine(Path.GetDirectoryName(savePath), fileName));
if (Request.Headers["breakpoint"] == bool.TrueString)
{
Response.AddHeader(
"Content-Length", (file.Exists ? file.Length : 0L).ToString());
}
else
{
long l;
if (Request.Files.Count > 0 && long.TryParse(Request.Headers["breakpoint"], out l))
{
HttpPostedFile postedFile
= Request.Files[0];
using (FileStream stream = file.Open(file.Exists ? FileMode.Append : FileMode.Create, FileAccess.Write, FileShare.None))
{
byte[] buffer = BufferUtility.GetBuffer((int)stream.Length);
Stream postedStream
= postedFile.InputStream;
long p = stream.Position;
int read;
while (Response.IsClientConnected && p < l)
{
stream.Write(buffer,
0, read = postedStream.Read(buffer, 0, buffer.Length));
stream.Flush();
p
+= read;
}
}
file.MoveTo(savePath);
msg
= "1";
}
}
}
Response.Write(msg);
Response.End();
}
#endregion

#region Fields
private HttpWebRequest httpRequest;
private CookieContainer cookieContainer;
private string referer;
private NameValueCollection form;
private List<HttpFile> files;
#endregion

#region Properties
public Uri RequestUri
{
set { httpRequest = (HttpWebRequest)WebRequest.Create(value); }
get { return httpRequest.RequestUri; }
}
public HttpWebRequest Request
{
get { return httpRequest; }
}
public CookieCollection Cookies
{
get { return cookieContainer.GetCookies(httpRequest.RequestUri); }
}
public NameValueCollection Form
{
get
{
if (form == null)
{
form
= new NameValueCollection();
}
return form;
}
}
public List<HttpFile> Files
{
get
{
if (files == null)
{
files
= new List<HttpFile>();
}
return files;
}
}
#endregion

#region Constructor
public HttpWalker(Uri uri)
{
this.RequestUri = uri;
cookieContainer
= new CookieContainer();
referer
= "http://www.google.com";
}
#endregion

#region Methods
public long GetContentLengthByHead()
{
return GetContentLengthByHead(true);
}
public long GetContentLengthByHead(bool reset)
{
using (HttpWebResponse httpResponse = GetResponse(WebRequestMethods.Http.Head))
{
if (reset)
{
httpRequest
= (HttpWebRequest)WebRequest.Create(httpRequest.RequestUri);
}
return httpResponse.ContentLength;
}
}

public HttpWebResponse GetResponse()
{
if ((form != null && form.Count > 0) || (files != null && files.Count > 0))
{
return GetResponse(WebRequestMethods.Http.Post);
}
else
{
return GetResponse(WebRequestMethods.Http.Get);
}
}
public HttpWebResponse GetResponse(string method)
{
if (httpRequest.RequestUri.Scheme == "https")
{
ServicePointManager.ServerCertificateValidationCallback
= new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);
}
httpRequest.CookieContainer
= cookieContainer;
httpRequest.Referer
= referer;
httpRequest.Accept
= "*/*";
httpRequest.UserAgent
= "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
if ((httpRequest.Method = method) == WebRequestMethods.Http.Post)
{
StringBuilder sb
= new StringBuilder();
if (files.Count > 0)
{
Queue methodQueue
= new Queue();
string boundary = Guid.NewGuid().ToString().Replace("-", string.Empty), line = "\r\n";
byte[] beginBoundary = Encoding.ASCII.GetBytes("--" + boundary + line);
//byte[] endBoundary = Encoding.ASCII.GetBytes("--" + boundary + "--" + newLine);
httpRequest.ContentType = "multipart/form-data; boundary=" + boundary;
long contentLength = 0L;
if (form != null && form.Count > 0)
{
for (int i = 0; i < form.Count; i++)
{
sb.Length
= 0;
sb.AppendFormat(
"Content-Disposition: form-data; name=\"{0}\"\r\n\r\n", form.GetKey(i));
sb.AppendFormat(
"{0}\r\n", form.Get(i));
byte[] header = Encoding.UTF8.GetBytes(sb.ToString());
contentLength
+= beginBoundary.LongLength + header.LongLength;
methodQueue.Enqueue(
new Action<Stream>(stream =>
{
stream.Write(beginBoundary,
0, beginBoundary.Length);
stream.Write(header,
0, header.Length);
}));
}
}
if (files != null)
{
sb.Length
= 0;
sb.Append(line);
sb.Append(
"--" + boundary + line);
byte[] endOfFile = Encoding.ASCII.GetBytes(sb.ToString());
files.ForEach(file
=>
{
sb.Length
= 0;
sb.AppendFormat(
"Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n", file.FieldName, Path.GetFileName(file.FileName));
sb.Append(
"Content-Type: application/octet-stream\r\n\r\n");
byte[] header = Encoding.UTF8.GetBytes(sb.ToString());
contentLength
+= beginBoundary.LongLength + header.LongLength + file.ContentLength + endOfFile.LongLength;
methodQueue.Enqueue(
new Action<Stream>(stream =>
{
stream.Write(beginBoundary,
0, beginBoundary.Length);
stream.Write(header,
0, header.Length);
file.WriteTo(stream);
stream.Write(endOfFile,
0, endOfFile.Length);
}));
});
}
httpRequest.ContentLength
= contentLength;
Stream requestStream
= httpRequest.GetRequestStream();
while (methodQueue.Count > 0)
{
((Action
<Stream>)methodQueue.Dequeue())(requestStream);
}
requestStream.Close();
}
else
{
if (form != null && form.Count > 0)
{
httpRequest.ContentType
= "application/x-www-form-urlencoded";
sb.Append(form.GetKey(
0)).Append("=").Append(form.Get(0));
for (int i = 1; i < form.Count; i++)
{
sb.Append(
"&").Append(form.GetKey(i)).Append("=").Append(form.Get(i));
}
byte[] data = Encoding.UTF8.GetBytes(sb.ToString());
httpRequest.ContentLength
= data.LongLength;
Stream requestStream
= httpRequest.GetRequestStream();
requestStream.Write(data,
0, data.Length);
requestStream.Close();
}
}
}
HttpWebResponse httpResponse
= (HttpWebResponse)httpRequest.GetResponse();
referer
= httpResponse.ResponseUri.AbsoluteUri;
return httpResponse;
}
//https
private bool CheckValidationResult(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors errors)
{
// Always accept
return true;
}

public void Reset(Uri uri)
{
this.RequestUri = uri;
cookieContainer
= new CookieContainer();
referer
= "http://www.google.com";
if (form != null)
{
form.Clear();
}
if (files != null)
{
files.Clear();
}
}
public void RefreshCookies()
{
cookieContainer
= new CookieContainer();
}

public override string ToString()
{
HttpWebResponse httpResponse
= GetResponse();
using (StreamReader reader = new StreamReader(httpResponse.GetResponseStream(), Encoding.GetEncoding(httpResponse.CharacterSet ?? "gb2312")))
{
return reader.ReadToEnd();
}
}
#endregion

#region File
public void DownloadFile(string savePath)
{
using (FileStream stream = new FileStream(savePath, File.Exists(savePath) ? FileMode.Append : FileMode.CreateNew, FileAccess.Write, FileShare.None))
{
httpRequest.AddRange((
int)stream.Length);
HttpWebResponse response
= GetResponse();
byte[] buffer = new byte[BufferUtility.FileBufferSize];
Stream responseStream
= response.GetResponseStream();
long p = stream.Length, l = response.ContentLength;
int read;
while (p < l && (read = responseStream.Read(buffer, 0, buffer.Length)) != 0)
{
stream.Write(buffer,
0, read);
stream.Flush();
p
+= read;
}
responseStream.Close();
}
}

public string UploadFile(string filePath)
{
string fileName = Path.GetFileName(filePath);
string base64FileName = Convert.ToBase64String(Encoding.ASCII.GetBytes(fileName));
httpRequest.Headers[
"filename"] = base64FileName;
httpRequest.Headers[
"breakpoint"] = bool.TrueString;
long p = GetContentLengthByHead(), l;
string boundary = DateTime.Now.Ticks.ToString("x"), line = "\r\n";
StringBuilder sb
= new StringBuilder();
sb.Append(
"--").Append(boundary).Append(line);
sb.Append(
"Content-Disposition: form-data; name=\"file\"; ").Append("filename=\"").Append(fileName).Append("\"").Append(line);
sb.Append(
"Content-Type: application/octet-stream").Append(line);
sb.Append(line);
byte[] headerBytes = Encoding.UTF8.GetBytes(sb.ToString());
sb.Length
= 0;
sb.Append(line);
sb.Append(
"--").Append(boundary).Append(line);
byte[] endOfFile = Encoding.ASCII.GetBytes(sb.ToString());
httpRequest.Method
= WebRequestMethods.Http.Post;
httpRequest.AllowWriteStreamBuffering
= false;
httpRequest.Timeout
= 300000;
httpRequest.ContentType
= "multipart/form-data; boundary=" + boundary;
using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
httpRequest.Headers[
"filename"] = base64FileName;
httpRequest.Headers[
"breakpoint"] = stream.Length.ToString();
stream.Position
= p;
l
= stream.Length;
httpRequest.ContentLength
= headerBytes.Length + (l - p) + endOfFile.Length;
byte[] buffer = BufferUtility.GetBuffer((int)stream.Length);
Stream requestStream
= httpRequest.GetRequestStream();
requestStream.Write(headerBytes,
0, headerBytes.Length);
int read;
while (p < l)
{
requestStream.Write(buffer,
0, read = stream.Read(buffer, 0, buffer.Length));
requestStream.Flush();
p
+= read;
}
requestStream.Write(endOfFile,
0, endOfFile.Length);
requestStream.Close();
}
return ToString();
}
#endregion
}

#region HttpFile
public sealed class HttpFile
{
private long offset, length;
private byte[] binaryData;

public string FieldName { set; get; }
public string FileName { private set; get; }
public long ContentLength
{
get { return binaryData == null ? length : binaryData.LongLength; }
}

public HttpFile(string fieldName, string fileName)
{
this.FieldName = fieldName;
this.FileName = fileName;
FileInfo info
= new FileInfo(fileName);
this.offset = 0L;
this.length = info.Length;
}
public HttpFile(string fieldName, string fileName, long offset, long length)
{
this.FieldName = fieldName;
this.FileName = fileName;
this.offset = offset;
this.length = length;
}

public HttpFile(string fieldName, string fileName, byte[] binaryData)
{
this.FieldName = fieldName;
this.FileName = fileName;
this.binaryData = binaryData;
}

public void WriteTo(Stream stream)
{
if (binaryData == null)
{
using (FileStream fileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read))
{
byte[] buffer = BufferUtility.GetBuffer((int)fileStream.Length);
fileStream.Position
= offset;
long done = 0L;
int read;
while (done < length)
{
stream.Write(buffer,
0, read = fileStream.Read(buffer, 0, buffer.Length));
stream.Flush();
done
+= read;
}
}
}
else
{
stream.Write(binaryData,
0, binaryData.Length);
stream.Flush();
}
}
}
#endregion
}

 

ContractedBlock.gifExpandedBlockStart.gif上传Demo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Rocky.Net;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//FileStream stream1 = new FileStream(@"F:\ToolsDev\fireworks8.zip", FileMode.Open);
//FileStream stream2 = new FileStream(@"d:\IE8.zip", FileMode.Create);
//long length = 1024L * 1024L * 8L;
//byte[] buffer = new byte[1024 * 4];
//int read;
//while (length > 0 && (read = stream1.Read(buffer, 0, buffer.Length)) != 0)
//{
// stream2.Write(buffer, 0, read);
// stream2.Flush();
// length -= read;
//}
//stream1.Close();
//stream2.Close();
//Response.End();
if (Request.QueryString["action"] == "server")
{
HttpWalker.UploadFile(
this.Context, Server.MapPath("~/IE8.zip"));
}
else
{
try
{
HttpWalker w
= new HttpWalker(new Uri("http://rocky.net?action=server"));
Response.Write(w.UploadFile(
@"D:\fireworks8.zip"));
}
catch (Exception ex)
{
Response.Write(ex);
}
}
Response.End();
}

protected void Button1_Click(object sender, EventArgs e)
{

}
}

 

posted on 2010-08-24 10:07 RockyLOMO 阅读(...) 评论(...) 编辑 收藏

2018-06-30 12:31:32 liukun0928 阅读数 2018
  • MT5编程从入门到精通:MQL5编程认知

    本课程是MT5编程从入门到精通的第一阶段课程,详细的介绍了没有编程经验的小白也能快速的进入MT5编程的世界,为没有编程经验的外汇交易爱好者,树立MT5程序化交易的信心。 本阶段课程共分为三个章节,第一章重点讲解了MT5的安装与调试,MT5数据文件介绍,以及学完本课程后能开发出怎么的程序化交易;第二章重点讲解了MT5拥有多货币、多周期回测功能,以及MT5强大的参数优化功能和MT5的EA生成功能;第三章重点讲解了MT5的脚本开发框架,指标开发框架和EA开发框架,以及MT5的断点调试功能。

    4436 人正在学习 去看看 李文帅

    相信大家都会遇到这个问题的,当你看到这个文章的时候肯定是其他的文章提供的方案没啥用。

    一般这个问题容易在多个项目并存并且相互引用的时候出现,并且每个项目下有类的文件夹时,这样容易导致命名空间互相引用的错误,详细检查一下类的命名空间的正确与否,肯定可以解决这个问题的。特别是项目引用外部的类时,更要注意命名空间的名字是否符合项目引用需求。

       还有一种情况是多个项目之间相互引用导致的错误,此时在每次修改之后需要清理一次解决方案并重新生成解决方案,然后编译即可。因此,在多项目的解决方案中,尽量避免交叉引用,循环引用,尽量单一引用。

C# 多线程断点续传

阅读数 1277

没有更多推荐了,返回首页