|登录 |注册

查看: 4007|回复: 14
打印 上一主题 下一主题

{"Exception has been thrown by the target of an invocation."}

[复制链接]
goodhermit95
2010-1-23 04:53 PM
{"Exception has been thrown by the target of an invocation."}
在Application.Run();


  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7. using System.Net;

  8. namespace Skydrive_Linkgen
  9. {
  10.     public partial class Main : Form
  11.     {
  12.         public Main()
  13.         {
  14.             InitializeComponent();
  15.         }

  16.         private void button1_Click(object sender, EventArgs e)
  17.         {
  18.             WebClient client = new WebClient();
  19.             client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
  20.             client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);

  21.             // Starts the download
  22.             client.DownloadFileAsync(new Uri("http://cid-9c4752bf5eb398a9.skydrive.live.com/self.aspx/Public/MapleStory2.5D/Maplestory25D.Alpha2.7z"), "tmp.tmp");

  23.         }


  24.         void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
  25.         {
  26.             double bytesIn = double.Parse(e.BytesReceived.ToString());
  27.             double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
  28.             double percentage = bytesIn / totalBytes * 100;

  29.             progressBar1.Value = int.Parse(Math.Truncate(percentage).ToString());
  30.         }

  31.         void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
  32.         {
  33.             string keyword = "<a id=\"spPreviewLink\" href=\"";
  34.             System.IO.StreamReader SR = new System.IO.StreamReader("tmp.tmp");
  35.             string[] line = SR.ReadToEnd().Split(Environment.NewLine.ToCharArray());
  36.             string dta = null;
  37.             for (int i = 0; i < line.Length; i++)
  38.             {
  39.                 if (line[i].Contains(keyword))
  40.                 {
  41.                     dta = line[i].ToString();
  42.                     dta.Replace("\" rel=\"nofollow\"  target=\"\" title=\"Download\">", "");
  43.                     dta = dta.Replace(keyword, "");
  44.                     dta = dta.Replace("&#58;", ":");
  45.                     dta = dta.Replace("&#47;", "/");
  46.                     dta = dta.Replace("&#63;", "/");
  47.                 }
  48.             }
  49.             ListViewItem lst = new ListViewItem(System.IO.Path.GetFileName(dta.Replace("?download","")));
  50.             lst.SubItems.Add(dta);
  51.             listView1.Items.Add(lst);
  52.         }

  53.         private void Main_Load(object sender, EventArgs e)
  54.         {

  55.         }

  56.         private void copyDownloadLinkToolStripMenuItem_Click(object sender, EventArgs e)
  57.         {
  58.             for (int i = 0; i < listView1.Items.Count; i++)
  59.             {
  60.                 if (listView1.Items[i].Selected = true)
  61.                 {
  62.                     Clipboard.SetText(listView1.Items[i].Text);
  63.                 }
  64.             }
  65.         }

  66.         private void button2_Click(object sender, EventArgs e)
  67.         {
  68.             Application.Exit();
  69.         }


  70.     }
  71. }

复制代码
goodhermit95
2010-1-23 05:01 PM
找到了
是path问题

回复 #1 goodhermit95 的帖子

宅男-兜着走
2010-1-23 09:37 PM
你在做什么 软件

回复 #3 宅男-兜着走 的帖子

goodhermit95
2010-1-23 11:08 PM
其实我开贴的原因是 他的Exception出在Application.Run
过后用那个叫什么watch的东西才发现 是处理不当 所以System.IO.Path出现exception

我在做 maple story 单机版 批量directlink获取器
已经圆满完成 完全没有问题
过后发现Mediafire比skydrive好很多 可说是没有用了 =.=
online
2010-1-24 05:37 PM
李smaple story 单机版 成功了拉给我玩

回复 #4 goodhermit95 的帖子

宅男-兜着走
2010-1-24 06:55 PM

出了吗? 我要玩玩看
加油。

回复 #6 宅男-兜着走 的帖子

goodhermit95
2010-1-24 08:59 PM
烦恼 我不会graphic design

回复 #7 goodhermit95 的帖子

宅男-兜着走
2010-1-24 09:37 PM
如果你是 WPF 的或 Silverlight 能试试用 微软的 Expression Studio 或 Expression Blend。 价钱 RM 7 , 翻版

是蛮不错的 Graphic Design 工具 , Component Skinning 我不懂可以不可以。

回复 #8 宅男-兜着走 的帖子

goodhermit95
2010-1-24 09:41 PM
XNA啦
什么WPF

回复 #9 goodhermit95 的帖子

宅男-兜着走
2010-1-24 09:42 PM

XNA 没听过, 但是真的有 WPF 这个东西的。
不过是 Markup 语言 的。
您需要登录后才可以回帖 登录 | 注册

JBTALKS.CC |联系我们 |隐私政策 |Share

GMT+8, 2026-1-2 01:12 AM , Processed in 0.106220 second(s), 25 queries .

Powered by Discuz! X2.5 © 2001-2012 Comsenz Inc.

本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved

Dedicated Server powered by iCore Technology Sdn. Bhd.

合作联盟网站:
JBTALKS 马来西亚中文论坛 | JBTALKS我的空间 | ICORE TECHNOLOGY SDN. BHD.
回顶部