1 ' **********************************************************************
3 ' Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 ' This copy of Ice is licensed to you under the terms described in the
6 ' ICE_LICENSE file included in this distribution.
8 ' **********************************************************************
11 Imports System
.Collections
.Generic
17 Public Overrides
Function ice_invoke(ByVal inparams
As Byte(), ByRef outParams
As Byte(), ByVal current
As Ice
.Current
) As Boolean
21 Dim communicator
As Ice
.Communicator
= current
.adapter
.getCommunicator()
23 Dim inStream
As Ice
.InputStream
= Nothing
24 If inparams
.Length
> 0 Then
25 inStream
= Ice
.Util
.createInputStream(communicator
, inparams
)
28 If current
.operation
.Equals("printString") Then
29 Dim message
As String = inStream
.readString()
31 Console
.WriteLine("Printing string `" & message
& "'")
33 ElseIf current
.operation
.Equals("printStringSequence") Then
34 Dim seq
As String() = StringSeqHelper
.read(inStream
)
36 Console
.Write("Printing string sequence {")
37 For i
As Integer = 0 To seq
.Length
- 1
41 Console
.Write("'" & seq(i
) & "'")
43 Console
.WriteLine("}")
45 ElseIf current
.operation
.Equals("printDictionary") Then
46 Dim dict
As Dictionary(Of
String, String) = StringDictHelper
.read(inStream
)
48 Console
.Write("Printing dictionary {")
49 Dim first
As Boolean = True
50 For Each e
As KeyValuePair(Of
String, String) In dict
55 Console
.Write(e
.Key
.ToString() & "=" & e
.Value
.ToString())
57 Console
.WriteLine("}")
59 ElseIf current
.operation
.Equals("printEnum") Then
60 Dim c
As Color
= ColorHelper
.read(inStream
)
62 Console
.WriteLine("Printing enum " & c
)
64 ElseIf current
.operation
.Equals("printStruct") Then
65 Dim s
As [Structure
] = New [Structure
]
68 Console
.WriteLine("Printing struct: name=" & s
.name
& ", value=" & s
.value
)
70 ElseIf current
.operation
.Equals("printStructSequence") Then
71 Dim seq
As [Structure
]() = StructureSeqHelper
.read(inStream
)
73 Console
.Write("Printing struct sequence: {")
74 For i
As Integer = 0 To seq
.Length
- 1
78 Console
.Write(seq(i
).name
& "=" & seq(i
).value
)
80 Console
.WriteLine("}")
82 ElseIf current
.operation
.Equals("printClass") Then
83 Dim ch
As CHelper
= New CHelper(inStream
)
85 inStream
.readPendingObjects()
87 Dim c
As InvokeDemo
.C
= ch
.value
88 Console
.WriteLine("Printing class: s.name=" & c
.s
.name
& ", s.value=" & c
.s
.value
)
90 ElseIf current
.operation
.Equals("getValues") Then
91 Dim c
As InvokeDemo
.C
= New InvokeDemo
.C
94 c
.s
.value
= Color
.green
95 Dim outStream
As Ice
.OutputStream
= Ice
.Util
.createOutputStream(communicator
)
96 CHelper
.write(outStream
, c
)
97 outStream
.writeString("hello")
98 outStream
.writePendingObjects()
99 outParams
= outStream
.finished()
101 ElseIf current
.operation
.Equals("throwPrintFailure") Then
102 Console
.WriteLine("Throwing PrintFailure")
103 Dim ex
As PrintFailure
= New PrintFailure
104 ex
.reason
= "paper tray empty"
105 Dim outStream
As Ice
.OutputStream
= Ice
.Util
.createOutputStream(communicator
)
106 outStream
.writeException(ex
)
107 outParams
= outStream
.finished()
109 ElseIf current
.operation
.Equals("shutdown") Then
110 current
.adapter
.getCommunicator().shutdown()
113 Dim ex
As Ice
.OperationNotExistException
= New Ice
.OperationNotExistException
115 ex
.facet
= current
.facet
116 ex
.operation
= current
.operation