我需要将 one.xaml 文件的内容复制到一个字节 clob 中。这是我的代码。看起来我没有访问此文件的内容。谁能告诉我为什么。我是 C# API 的新手,但我是一名程序员。选择 4000 是因为最大字符串大小限制,以防万一有人想知道。我可能有关于 zies 等的错误。但主要是我想将 thje xaml 文件的内容放入 clob 中。谢谢。
string LoadedFileName = @"C:\temp2\one.xaml";//Fd.FileName;
byte[] clobByteTotal ;
FileStream stream = new FileStream(LoadedFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
if (stream.Length % 2 >= 1)
{
clobByteTotal = new byte[stream.Length + 1];
}
else clobByteTotal = new byte[stream.Length];
for (int i = 0; i <= stream.Length/4000; i++)
{
int x = (stream.Length / 4000 == 0) ? (int)stream.Length : 4000;
stream.Read(stringSizeClob, i*4000, x);
String tempString1 = stringSizeClob.ToString();
byte[] clobByteSection = Encoding.Unicode.GetBytes(stringSizeClob.ToString());
Buffer.BlockCopy(clobByteSection, 0, clobByteTotal, i * clobByteSection.Length, clobByteSection.Length);
}