Made old session inherit the refactored version.

This commit is contained in:
soukoku
2014-04-05 20:14:19 -04:00
parent 0064db2c2d
commit 3dc90eff89
13 changed files with 472 additions and 936 deletions

View File

@@ -972,42 +972,42 @@ namespace NTwain.Data
Marshal.WriteByte(baseAddr, offset, 0);
}
}
/// <summary>
/// Writes unicode string value.
/// </summary>
/// <param name="baseAddr"></param>
/// <param name="offset"></param>
/// <param name="item"></param>
/// <param name="maxLength"></param>
[EnvironmentPermissionAttribute(SecurityAction.LinkDemand)]
private void WriteUString(IntPtr baseAddr, int offset, string item, int maxLength)
{
if (string.IsNullOrEmpty(item))
{
// write zero
Marshal.WriteInt16(baseAddr, offset, (char)0);
}
else
{
// use 2 bytes per char
for (int i = 0; i < maxLength; i++)
{
if (i == item.Length)
{
// string end reached, so write \0 and quit
Marshal.WriteInt16(baseAddr, offset, (char)0);
return;
}
else
{
Marshal.WriteInt16(baseAddr, offset, item[i]);
offset += 2;
}
}
// when ended normally also write \0
Marshal.WriteByte(baseAddr, offset, 0);
}
}
///// <summary>
///// Writes unicode string value.
///// </summary>
///// <param name="baseAddr"></param>
///// <param name="offset"></param>
///// <param name="item"></param>
///// <param name="maxLength"></param>
//[EnvironmentPermissionAttribute(SecurityAction.LinkDemand)]
//private void WriteUString(IntPtr baseAddr, int offset, string item, int maxLength)
//{
// if (string.IsNullOrEmpty(item))
// {
// // write zero
// Marshal.WriteInt16(baseAddr, offset, (char)0);
// }
// else
// {
// // use 2 bytes per char
// for (int i = 0; i < maxLength; i++)
// {
// if (i == item.Length)
// {
// // string end reached, so write \0 and quit
// Marshal.WriteInt16(baseAddr, offset, (char)0);
// return;
// }
// else
// {
// Marshal.WriteInt16(baseAddr, offset, item[i]);
// offset += 2;
// }
// }
// // when ended normally also write \0
// Marshal.WriteByte(baseAddr, offset, 0);
// }
//}
/// <summary>
/// Entry call for reading values.
/// </summary>