日期:2014-05-19  浏览次数:20727 次

C#中生成dll的问题
有一个多线程写文件的函数,想生成DLL,生成TransClass.dll后却报找不到入口,两个函数如下,请教一下哪里错了,谢谢:
//TransClass.cs
using   System;
using   System.Threading;
using   System.Data;
using   System.IO;
namespace   DataServer
{
///   <summary>
///   Class1   的摘要说明。
///   </summary>
public   class   TransClass
{
private   int[]   EachFileSize;
private   int[]   FilePosition;
public   TransClass()
{
//
//   TODO:   在此处添加构造函数逻辑
//
}

public   bool   FileCopy(int   ThreadCount,string   FilePath,string   NewFilePath)
{
int   eachFileSize   =   (int)(File.OpenRead(FilePath).Length)   /   ThreadCount;
int   LastFileSize   =   eachFileSize   +   (int)(File.OpenRead(FilePath).Length)   %   ThreadCount;
EachFileSize   =   new   int[ThreadCount];
FilePosition   =   new   int[ThreadCount];
for   (int   m   =   0;   m   <   ThreadCount   -   1;   m++)
{
EachFileSize[m]   =   eachFileSize;
}
EachFileSize[ThreadCount   -   1]   =   LastFileSize;
for   (int   n   =   0;   n   <   ThreadCount;   n++)
{
FilePosition[n]   =   n   *   eachFileSize;
}

Thread[]   ThrArray   =   new   Thread[ThreadCount];
for   (int   j   =   0;   j   <   ThreadCount;   j++)
{
ThreadCopy   threadcopy   =   new   ThreadCopy();
threadcopy.FilePath   =   FilePath;
threadcopy.NewFilePath   =   NewFilePath;
threadcopy.ThreadIndex   =   j;
threadcopy.EachFileSize   =   EachFileSize;
threadcopy.FilePosition   =   FilePosition;
ThrArray[j]   =   new   Thread(new   ThreadStart(threadcopy.MutilThreadCopy));
ThrArray[j].Start();
}
return   true;
}
}
}

//ThreadCopy.cs
using   System;
using   System.Data;
using   System.IO;
namespace   DataServer
{
///   <summary>
///   ThreadCopy   的摘要说明。
///   </summary>
public   class   ThreadCopy
{
public   string   FilePath,NewFilePath;
public   int   ThreadIndex;
public   int[]   EachFileSize;
public   int[]   FilePosition;
public   ThreadCopy()
{
//
//   TODO:   在此处添加构造函数逻辑
//
}
public   void   MutilThreadCopy()
{
try
{
FileStream   fs   =   new   FileStream(FilePath,   FileMode.OpenOrCreate,   FileAccess.Read,   FileShare.Read);
BinaryReader   br   =   new   BinaryReader(fs);
FileStream   nfs   =   new   FileStream(NewFilePath,   FileMode.OpenOrCreate,   FileAccess.ReadWrite,   FileShare.ReadWrite);
BinaryWriter   bw   =   new   BinaryWriter(nfs);

int   ReadedLength;
byte[]   buffer   =   new   byte[EachFileSize[ThreadIndex]];
fs.Seek(FilePosition[ThreadIndex],   SeekOrigin.Begin);
Rea