我正在移植使用复杂类型来包含结构化消息系统的VB6应用程序。我正在工作的当前问题是将其转换为VB.net结构。以下是声明:将VB6嵌套类型作为VB.net中的结构重新表达
Global Const MAX_MSGS = 150 ' Max number of messages per set
Global Const MAX_SETS = 100 ' Max number of message sets
Global Const MAX_HGI = 96 ' Max number of HowGozIt messages per set
Global Const MAX_WPS = 96 ' Max number of way points per message set
Global Const MAX_FLS = 15 ' Max number of flight levels per waypoint
Type MessageRec
MessType As Integer 'Message Type
MessIndex As Integer 'Message Index (not used currently)
MessNextBit As Integer 'last bit for Mops messages
MessTotal As Integer 'Mess total
MultMessBit As Integer 'Multiple message bit position
MessTitle As String * 25 'Message title
MessNo As String 'Message Numbers and data for mops edit
MessText As String 'I/F displayable text
MessStr As String 'message bits for mops msgs, can be file for acars,aoc
MessLabel As String * 4 'Label and sublabel
TimeDelay As Integer 'Delayed time in seconds before message is delivered
Active As Boolean 'Flag determines active/deactive
AutoInit As Boolean 'Flag if part of auto init bundle
AIDelay As Integer 'Auto Init time delay (secs)
End Type
Type WayPointRec
Name As String * 7
DeltaTime As String * 5
FltLevel As String * 5
DeltaFuel As String * 5
Lat As String * 6 ' Latitude of waypoint
Long As String * 7 ' Longitude of waypoint
SAT As String * 3 ' Standard Air temp (no need to save in database)
Via As String
NumAlts As String * 2 ' Numer of altitudes for following weather data
FL(0 To MAX_FLS) As String * 3 ' Flight level for this weather
WindDir(0 To MAX_FLS) As String * 3 ' Wind direction
WindSpd(0 To MAX_FLS) As String * 3 ' Wind speed
Temp(0 To MAX_FLS) As String * 3 ' Temperature
End Type
Type MessageStore
Nmsgs As Integer 'Number of messages in the message set
Fltno As Integer 'Flight Number
SubFltNo As String * 1 'For multiple messages with same flight number
CityPair As String * 7 'City Pair
Descr As String * 12 'Message Set Description
Hot As Integer 'Hot/Cold flag (true => hot, use second weather message set)
DWndFL(0 To 3) As Integer 'Descent wind flight level (4 altitudes)
DWndDir(0 To 3) As Integer 'Descent wind direction (4 altitudes)
DWndSpd(0 To 3) As Integer 'Descent wind speed (4 altitudes)
WndSpd(0 To 9) As Integer 'Start/end wind speed (5 altitudes)
WndDir(0 To 9) As Integer 'Start/end wind direction (5 altitudes)
TempDev(0 To 1) As Integer 'Start/end Temperature deviation from standard
altn(0 To 1) As String * 3 'Alternate airports for area weather information
nHGIwpts As Integer 'Number of waypoints for howgozit info
HGIinfo(1 To MAX_HGI, 0 To 3) As String * 5 'Howgozit information
MsgData(1 To MAX_MSGS) As MessageRec 'Message data mlw 7/12/02 changed 30 to 60
nwpts As Integer 'Number of waypoints for winds/temp info
WayPoints(1 To MAX_WPS) As WayPointRec 'For canned messages
Index As Integer
Active As Boolean 'Flag determines active/deactive
DeltaArrivalTime As Integer 'add or subtract to get actual arrival time
TimeToGate As Integer 'Time to gate from T/D for HOWGOZIT
End Type
结构MessageStore是在磁盘格式(所有字段转换为字符串写入),这是由另一C程序读取。
我没有问题转换成固定长度蜇伤的简单字符串而是变换的固定长度字符串的数组中WayPointRec这在随后包括WayPointRec在MessageStore的航点阵列中的是,其中我目前停留
也如何最好地处理固定长度字符串
编辑的“HGIinfo” 2D字符串数组
省略了一个更详细 - 顶层
Public MsgArray() As MessageStore
其中MsgArray成长为
redim preserve MsgArray(x)
与X受限0-100
是有与所述C程序使用了该数据的任何灵活性,或这基本上是第三方事件吗?这并不是打开“在网络中全部做好”的大门,但其中一些问题非常棘手。 – Plutonix
C程序运行跨平台,VAX-VMS,AIX 4.2,SYSTEM V R4 unix,Linux –