求解,c#转换到4.0报溢出错误。
求高手指教,以下代码,从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;
}
}