求解,c#转换到4.0报溢出错误。

yzhongb 2012-06-29 09:56:13
求高手指教,以下代码,从3.5转换成4.0出现溢出报错,帮我看看,哪里需要修改。
最好给个4.0更新类的表或者文章看一下。


----------------------------------------------------
using System;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;
using System.IO;
using System.Xml;
using System.Management;
using Microsoft.Win32;
using System.Diagnostics;
using Vbaccelerator.Components.Algorithms;
using Vbaccelerator.Components.HiResTimerLib;
using System.Globalization;
using System.Security.Principal;
using System.Text.RegularExpressions;

private bool shortcutfrom(XmlNode xn)
{
string id = "";
int pos = -1;
string keyword = "shortcutfrom";

try
{

id = xn.SelectSingleNode("ID").InnerText;
pos = Convert.ToInt32(xn.SelectSingleNode("Position").InnerText);
string target = xn.SelectSingleNode("Params/Param1").InnerText;
string soll_start = xn.SelectSingleNode("Params/Param2").InnerText;
string format = "N/A";
bool b_result = false;

string is_start = "";

target = functions.envirpath_i(target, false);
soll_start = functions.envirpath_i(soll_start, true);

if (!target.Contains("-!-") && !target.Contains("*") && File.Exists(target) && Directory.Exists(soll_start))
{


DirectoryInfo di = new DirectoryInfo(soll_start);


foreach (FileInfo sfi in di.GetFiles("*.lnk"))
{

Shell32.ShellClass Shell = new Shell32.ShellClass();
Shell32.Folder Ordner = Shell.NameSpace(sfi.DirectoryName);
Shell32.FolderItem Datei = Ordner.Items().Item(sfi.Name);
Shell32.ShellLinkObject Verk = (Shell32.ShellLinkObject)Datei.GetLink;

string is_target = Verk.Path;


if (target.ToUpper() == is_target.ToUpper())
{
is_start = sfi.FullName;
b_result = true;
break;
}
}
}

al_output.Add(new c_output(id, pos, keyword, is_start, format, b_result, soll_start));

return b_result;
}
catch (Exception ex)
{
al_output.Add(new c_output(id, pos, keyword, "!!ERROR " + ex.Message, "N/A", false, "OK"));
adderror(ex.Message.ToString(), xn);
return false;
}

}
...全文
108 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yzhongb 2012-06-29
  • 打赏
  • 举报
回复
请说得具体点。。。。
qldsrx 2012-06-29
  • 打赏
  • 举报
回复
这不是.NET4.0的问题,是你用的第三方控件的问题。
烈火蜓蜻 2012-06-29
  • 打赏
  • 举报
回复
你说溢出,具体是什么出错提示,贴出来,把堆栈也弄出来给大家看一下。
qldsrx 2012-06-29
  • 打赏
  • 举报
回复
这需要断点调试,一步步跟踪,看执行到哪一行代码出现了问题。而且我也不知道你用了什么第三方控件,没法具体啊。

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧