コード例 #1
0
        public void DelegateWithBindThisToFirstParameterWorksWhenInvokedFromScript()
        {
            D3       d = (a, b) => a + b;
            Function f = (Function)d;

            Assert.AreEqual(f.Call(10, 20), 30);
        }
コード例 #2
0
 private void Torres_Load(object sender, EventArgs e)
 {
     // a los discos se les asigna el panel 1 y se invoca el metodo bingtofront  coloca enfrete de todo
     D1.Parent = panel1;
     D2.Parent = panel1;
     D3.Parent = panel1;
     D4.Parent = panel1;
     D5.Parent = panel1;
     D1.Top    = panel1.Height - D1.Height - 0 * D1.Height - PicBase1.Height;
     D2.Top    = panel1.Height - D2.Height - 1 * D2.Height - PicBase1.Height;
     D3.Top    = panel1.Height - D3.Height - 2 * D3.Height - PicBase1.Height;
     D4.Top    = panel1.Height - D4.Height - 3 * D4.Height - PicBase1.Height;
     D5.Top    = panel1.Height - D5.Height - 4 * D5.Height - PicBase1.Height;
     D1.BringToFront();
     D2.BringToFront();
     D3.BringToFront();
     D4.BringToFront();
     D5.BringToFront();
     pila1.Clear();
     pila1.Push(D1);
     pila1.Push(D2);
     pila1.Push(D3);
     pila1.Push(D4);
     pila1.Push(D5);
     pila2.Clear();
     pila3.Clear();
     contador     = 0;
     LbTotal.Text = "0";
 }
コード例 #3
0
        public NetworkView2()
        {
            force = D3.Layout.Force()
                    .Size(new int[] { width, height })
                    .On("tick", Tick);

            //        var force = d3.layout.force()
            //.size([width, height])
            //.on("tick", tick);

            svg = D3.Select("body").Append("svg")
                  .Attr("width", width)
                  .Attr("height", height);

            //var svg = d3.select("body").append("svg")
            //    .attr("width", width)
            //    .attr("height", height);

            link = svg.SelectAll(".link");
            node = svg.SelectAll(".node");

            //var link = svg.selectAll(".link"),
            //    node = svg.selectAll(".node");

            //root = new ForceNode("Test", 100);
            //Update();

            D3.Json("../js/json_data.js", delegate(object state, object json) {
                root = (EntityNode)json;
                Update();
            });
        }
コード例 #4
0
        private void SelectEntity(EntityReference entity)
        {
            string key = GetID(entity.Id.ToString());

            D3.Select("#" + key).SelectAll(".entityImage").Attr("filter", "url(#selected-glow)");
            D3.Select("#" + key).SelectAll(".entityImage").Transition().Attr("transform", "scale(0.6)").Transition().Attr("transform", "scale(2)");
        }
コード例 #5
0
        private static Voronoi _calculateVoronoi(Grid grid, List <double[]> points, List <double[]> boundary)
        {
            var n         = points.Count;
            var allPoints = new List <double[]>(points);

            if (boundary != null)
            {
                allPoints.AddRange(boundary);
            }

            var delauny = fromPoints(allPoints);
            var voronoi = new Voronoi()
            {
                s_triangles_r = delauny.triangles,
                s_halfedges_s = delauny.halfedges,
            };

            var voronoiCell = new VoronoiCells(voronoi, allPoints, n);

            grid.cells    = voronoiCell.cells;
            grid.cells.i  = D3.range(n);
            grid.vertices = voronoiCell.vertices;

            return(voronoi);
        }
コード例 #6
0
 public void Next3()
 {
     D3.SetActive(false);
     D4.SetActive(true);
     Nex3.SetActive(false);
     Nex4.SetActive(true);
 }
コード例 #7
0
 public void Next2()
 {
     D2.SetActive(false);
     D3.SetActive(true);
     Nex2.SetActive(false);
     Nex3.SetActive(true);
 }
コード例 #8
0
 private void D2_Tick(object sender, EventArgs e)
 {
     PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5R^7eset ^5M^7enu\n\nGod Mode\n^2-->^5Max Ammo\nAll Perks\nRapide Fire\nLock Controller");
     if (Key_IsDown((uint)0) == "R1")
     {
         D2.Stop();
         D3.Start();
     }
     if (Key_IsDown((uint)0) == "X")
     {
         byte[] buffer = new byte[] { 0x00, 0x00, 0x00 };
         PS3.SetMemory(0x01227631, buffer);
         PS3.SetMemory(0x01227649, buffer);
         PS3.SetMemory(0x012276b5, buffer);
         PS3.SetMemory(0x012276c1, buffer);
         PS3.SetMemory(0x012276d9, buffer);
         PS3.SetMemory(0x012276e5, buffer);
         //
         byte[] buffer1 = new byte[] { 0x00 };
         PS3.SetMemory(0x0122778a, buffer1);
     }
     if (Key_IsDown((uint)0) == "R3")
     {
         D2.Stop();
         HostMenuMain.Start();
     }
     if (Key_IsDown((uint)0) == "L1")
     {
         D2.Stop();
         D1.Start();
     }
 }
コード例 #9
0
    static void Test3()
    {
        Console.WriteLine("--- Test3");
        D3 <int, double> d = new D3 <int, double>();

        Console.WriteLine(d.Fct(2.718281828459045235360287));
    }
コード例 #10
0
        public void calculateTemperatures()
        {
            var temperatureEquator = _map.Options.TemperatureEquator;
            //Debug.Log($"calculateTemperatures {temperatureEquator.min} {temperatureEquator.max} {temperatureEquator.value}");

            var temp = new sbyte[cells.i.Length];

            var tEq    = _map.Options.TemperatureEquator.value;
            var tPole  = +temperaturePoleInput;
            var tDelta = tEq - tPole;

            //var msg = new List<string>();
            //msg.Add($"{tEq} {tPole} {heightExponentInput}");

            var range = D3.range(0, cells.i.Length, (int)grid.cellsX);

            foreach (var r in range)
            {
                var y        = grid.points[r][1];
                var lat      = Math.Abs(mapCoordinates.latN - y / svgHeight * mapCoordinates.latT);
                var initTemp = tEq - lat / 90 * tDelta;
                for (var i = r; i < r + grid.cellsX; i++)
                {
                    temp[i] = (sbyte)(initTemp - convertToFriendly(cells.r_height[i]));
                    //msg.Add($"{r} {i} {temp[i]}");
                }
            }
            //DebugHelper.SaveArray("calculateTemperatures.txt", msg);
            cells.temp = temp;
        }
コード例 #11
0
        // Detect and draw the coasline
        public void drawCoastline()
        {
            var msg = new List <string>();

            var features = pack.features;
            var used     = new byte[features.Length];
            var data     = features.Select(f => (f != null && f.land) ? f.cells : 0).ToArray();
            //DebugHelper.SaveArray("features.cells.txt", data);
            var largestLand = D3.scan(data, (a, b) => b - a);

            //msg.Add($"largestLand {largestLand} {features.Length}");
            foreach (var i in cells.i)
            {
                var startFromEdge = i == 0 && cells.h[i] >= 20;
                if (!startFromEdge && cells.t[i] != -1 && cells.t[i] != 1)
                {
                    continue;                                                        // non-edge cell
                }
                var f = cells.f[i];
                if (used[f] != 0)
                {
                    continue;               // already connected
                }
                if (features[f].type == "ocean")
                {
                    continue;                                    // ocean cell
                }
                var type  = features[f].type == "lake" ? 1 : -1; // type value to search for
                var start = findStart(i, type);
                if (start == -1)
                {
                    continue;              // cannot start here
                }
                var vchain = connectVertices(start, type);
                if (features[f].type == "lake")
                {
                    relax(vchain, 1.2);
                }
                used[f] = 1;
                var points = vchain.Select(v => vertices.p[v]).ToArray();
                var area   = D3.polygonArea(points); // area with lakes/islands
                //if (area > 0 && features[f].type == "lake")
                if (area < 0)                        // area < 0 顺时针多边形 area > 0 逆时针多边形
                {
                    points = points.Reverse().ToArray();
                    vchain = vchain.Reverse().ToArray();
                }
                //var pts = new List<string>();
                //foreach (var p in points) pts.Add(DebugHelper.toString(p));
                //msg.Add($"{i} {f} {type} {start} {area}");
                //msg.Add($"{i} {string.Join(",", pts)}");

                features[f].area     = Math.Abs(area);
                features[f].vertices = vchain;
                msg.Add(DebugHelper.toString(vchain));
            }
            //DebugHelper.SaveArray("drawCoastline.txt", msg);
            DebugHelper.SaveArray("vchain.txt", msg);
        }
コード例 #12
0
 private void A1_Tick(object sender, EventArgs e)
 {
     PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5M^7ain ^5M^7enu\n\n^2-->^5Host Menu\nClient 1 Menu\nReset Menu\nAccount Menu\nTeleport Menu\nVision Menu\nCredit Menu\n\n\n^3Client 0 : ^2" + textBox1.Text + "\n^3Client 1 : ^2" + textBox2.Text + "^5");
     if (Key_IsDown((uint)0) == "X")
     {
         HostMenuMain.Stop();
         B1.Start();
     }
     if (Key_IsDown((uint)0) == "R1")
     {
         HostMenuMain.Stop();
         Client1.Start();
     }
     if (Key_IsDown((uint)0) == "R3 + L3")
     {
         HostMenuMain.Stop();
         B1.Stop();
         B2.Stop();
         B3.Stop();
         B4.Stop();
         B5.Stop();
         Client1.Stop();
         C1.Stop();
         C2.Stop();
         C3.Stop();
         C4.Stop();
         ResetMenu.Stop();
         D1.Stop();
         D2.Stop();
         D3.Stop();
         D4.Stop();
         D5.Stop();
         AccountMenu.Stop();
         E1.Stop();
         E2.Stop();
         E3.Stop();
         E4.Stop();
         E5.Stop();
         TeleportMenu.Stop();
         F1.Stop();
         F2.Stop();
         F3.Stop();
         F4.Stop();
         VisionMenu.Stop();
         G1.Stop();
         G2.Stop();
         G3.Stop();
         G4.Stop();
         G5.Stop();
         G6.Stop();
         OtherMenu.Stop();
         H1.Stop();
         PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed");
         simpleButton2.Enabled           = true;
         toolStripStatusLabel2.Text      = "Not Started !";
         toolStripStatusLabel2.ForeColor = Color.Red;
         simpleButton3.Enabled           = false;
     }
 }
コード例 #13
0
        private void HighlightNode(D3Element d)
        {
            D3Element thisnode1 = D3.SelectFromElement(D3.Event.Target.ParentNode).SelectAll(".chromeImage");
            D3Element thisnode2 = D3.SelectFromElement(D3.Event.Target.ParentNode).SelectAll(".entityImage");

            thisnode1.Transition().Attr("transform", "scale(1.2)");
            thisnode2.Transition().Attr("transform", "scale(2)");
        }
コード例 #14
0
        private void UnSelectEntity(EntityReference entity)
        {
            string     key  = GetID(entity.Id.ToString());
            EntityNode node = vm.idIndex[key];

            D3.Select("#" + key).SelectAll(".entityImage").Attr("filter", "url(#no-glow)");
            D3.Select("#" + key).SelectAll(".entityImage").Transition().Attr("transform", "scale(1)");
        }
コード例 #15
0
ファイル: ToonHandleHelper.cs プロジェクト: orior/d3sharp
 public ToonHandleHelper(D3.OnlineService.EntityId entityID)
 {
     var stream = CodedInputStream.CreateInstance(entityID.ToByteArray());
     this.ID = stream.ReadUInt64();
     //this.Program = stream.ReadUInt32();
     //this.Region = stream.ReadRawVarint32();
     //this.Realm = stream.ReadRawVarint32();
 }
コード例 #16
0
        /// Make the ground mesh.
        void MakeGround(double groundY)
        {
            MeshGeometry3D groundMesh = new MeshGeometry3D();
            const double   dx         = 15;
            const double   dy         = 1;
            const double   dz         = dx;
            Point3D        corner     = new Point3D(-dx / 2, groundY - dy, -dz / 2);

            groundMesh.AddBoxWrapped(corner, D3.XVector(dx), D3.YVector(dy), D3.ZVector(dz));

            Point[] topCoords =
            {
                new Point(0.1, 0.1),
                new Point(0.1, 0.9),
                new Point(0.9, 0.9),
                new Point(0.9, 0.1),
            };
            Point[] frontCoords =
            {
                new Point(0.0, 0.1),
                new Point(0.0, 0.9),
                new Point(0.1, 0.9),
                new Point(0.1, 0.1),
            };
            Point[] leftCoords =
            {
                new Point(0.9, 0.0),
                new Point(0.1, 0.0),
                new Point(0.1, 0.1),
                new Point(0.9, 0.1),
            };
            Point[] rightCoords =
            {
                new Point(0.1, 1.0),
                new Point(0.9, 1.0),
                new Point(0.9, 0.9),
                new Point(0.1, 0.9),
            };
            Point[] backCoords =
            {
                new Point(1.0, 0.9),
                new Point(1.0, 0.1),
                new Point(0.9, 0.1),
                new Point(0.9, 0.9),
            };
            Point[] bottomCoords =
            {
                new Point(0.9, 0.1),
                new Point(0.9, 0.9),
                new Point(0.1, 0.9),
                new Point(0.1, 0.1),
            };

            groundMesh.AddBox(corner, D3.XVector(dx), D3.YVector(dy), D3.ZVector(dz),
                              frontCoords, leftCoords, rightCoords, backCoords, topCoords, bottomCoords);

            _group.Children.Add(groundMesh.MakeModel(System.IO.Path.Combine(_resDir, @"rock.jpg")));
        }
コード例 #17
0
        private void OnResize(jQueryEvent e)
        {
            int sheight = jQuery.Window.GetHeight();
            int swidth  = jQuery.Window.GetWidth();

            D3.Select("#networksvg")
            .Attr <int>("width", swidth)
            .Attr <int>("height", sheight);;
        }
コード例 #18
0
        public NetworkView(NetworkViewModel viewModel)
        {
            height = jQuery.Window.GetHeight();
            width  = jQuery.Window.GetWidth();

            vm = viewModel;

            force = D3.Layout.Force()
                    .Size(new int[] { width, height })
                    .LinkDistance(150)
                    .Friction(0.7)
                    .Charge(-700)
                    .On("tick", Tick);

            zoom = D3.Behavior
                   .Zoom()
                   .ScaleExtent(new Number[] { minZoom, maxZoom })
                   .Center2(new Number[] { width / 2, height / 2 })
                   .On("zoom", zoomed);

            svg = D3.Select("#networksvg")
                  .Attr("width", width)
                  .Attr("height", height)
                  .Call(zoom)
                  .Append("g");

            dragBehavior = force.OnDrag()
                           .On("dragstart", dragstart);

            // Add InfoBox
            SVGexactTip = D3.Select("#infoBox").Style("opacity", 0);

            nodeData = (Stack <EntityNode>)(object) force.Nodes();
            linkData = (Stack <EntityLink>)(object) force.Links();
            link     = svg.SelectAll(".link");
            node     = svg.SelectAll(".node");

            Update();

            ViewBase.RegisterViewModel(vm);

            // Create event listeners for MVVM
            vm.OnNewNodes             += OnNodesChange;
            vm.OnSelectedNodesAdded   += vm_OnSelectedNodesAdded;
            vm.OnSelectedNodesCleared += vm_OnSelectedNodesCleared;
            vm.OnSelectedLinksAdded   += vm_OnSelectedLinksAdded;
            vm.OnInfoBoxClose         += vm_OnInfoBoxClose;
            vm.OnZoom += vm_OnZoom;
            jQuery.Window.Resize(OnResize);
            jQuery.OnDocumentReady(delegate()
            {
                Window.SetTimeout(delegate()
                {
                    vm.ProcessQueue();
                }, 10);
            });
        }
コード例 #19
0
        private static void HighlightLink(string key)
        {
            D3Element link = D3.Select("#" + key);

            if (link != null)
            {
                link.Attr("filter", "url(#selected-glow)");
                link.Attr("class", "link link-selected");;
            }
        }
コード例 #20
0
 void drawBase()
 {
     D1.Set(0, 0, L1);
     D1 += P;
     D2.Set(L1 * Mathf.Sin(60f * rad), 0, -L1 * Mathf.Cos(60f * rad));
     D2 += P;
     D3.Set(-L1 * Mathf.Sin(60f * rad), 0, -L1 * Mathf.Cos(60f * rad));
     D3 += P;
     addTriangle(D1, D2, D3, Base);
 }
コード例 #21
0
        private static void UnHighlightLink(string key)
        {
            D3Element link = D3.Select("#" + key);

            if (link != null)
            {
                link.Attr <string>("filter", null);
                link.Attr("class", "link");
            }
        }
コード例 #22
0
ファイル: ChannelManager.cs プロジェクト: alvarotg/mooege
 public static Channel GetChannelByEntityId(D3.OnlineService.EntityId entityId)
 {
     if (entityId.IdHigh == (ulong)EntityIdHelper.HighIdType.ChannelId)
     {
         if (Channels.ContainsKey(entityId.IdLow))
             return Channels[entityId.IdLow];
     }
     else
         Logger.Warn("Given entity ID doesn't look like a channel ID!");
     return null;
 }
コード例 #23
0
 public ToonHandleHelper(D3.OnlineService.EntityId entityID)
 {
     var stream = CodedInputStream.CreateInstance(entityID.ToByteArray());
     ulong tmp=0;
     // I believe this actually calls ReadRawVarint64(), but just to be sure..
     stream.ReadUInt64(ref tmp);
     this.ID = tmp;
     //this.Program = stream.ReadRawVarint32();
     //this.Region = stream.ReadRawVarint32();
     //this.Realm = stream.ReadRawVarint32();
 }
コード例 #24
0
        // find cell vertex to start path detection
        private int findStart(int i, int t)
        {
            if (t == -1 && cells.b[i])
            {
                return(Array.Find(cells.v[i], v => Array.Exists(vertices.c[v], c => c >= n))); // map border cell
            }
            var filtered = cells.c[i].Where(c => cells.t[c] == t).ToArray();
            var min      = filtered.Length > 0 ? D3.min(filtered) : -1;
            var index    = Array.FindIndex(cells.c[i], c => c == min);

            return(index == -1 ? index : cells.v[i][index]);
        }
コード例 #25
0
 public void Skip1()
 {
     D2.SetActive(false);
     D1.SetActive(false);
     D3.SetActive(false);
     D4.SetActive(false);
     booltoo.SetActive(false);
     Skip.SetActive(false);
     Nex4.SetActive(false);
     Back.SetActive(false);
     Destroy(DaeHwa);
     Time.timeScale = 1.0f;
 }
コード例 #26
0
 private void smooth(double fr = 2, double add = 0)
 {
     cells.r_height = cells.r_height.Select((h, i) =>
     {
         var a = new List <byte>();
         a.Add(h);
         foreach (var c in cells.r_neighbor_r[i])
         {
             a.Add(cells.r_height[c]);
         }
         return(lim((h * (fr - 1) + D3.mean(a.ToArray()) + add) / fr));
     }).ToArray();
 }
コード例 #27
0
 private void smooth(double fr = 2, double add = 0)
 {
     cells.h = cells.h.Select((h, i) =>
     {
         var a = new List <byte>();
         a.Add(h);
         foreach (var c in cells.c[i])
         {
             a.Add(cells.h[c]);
         }
         return(lim((h * (fr - 1) + D3.avg(a.ToArray()) + add) / fr));
     }).ToArray();
 }
コード例 #28
0
ファイル: GameCreator.cs プロジェクト: Thundernick/mooege
        public void StartGame(List<MooNetClient> clients, ulong objectId, D3.OnlineService.GameCreateParams gameCreateParams, string version)
        {
            this.GameCreateParams = gameCreateParams;
            this.Version = version;
            this.InGame = GS.Game.GameManager.CreateGame((int) this.DynamicId); // create the ingame.

            clients.First().MapLocalObjectID(this.DynamicId, objectId); // map remote object-id for party leader.

            foreach(var client in clients) // get all clients in game.
            {
                this.SendConnectionInfo(client);
            }
        }
コード例 #29
0
        static void Main(string[] args)
        {
            Delegate1 d1 = new Delegate1(Method1);
            Delegate2 d2 = d1();

            d2();

            Functional func = new Functional(MethodF);

            D3 d3 = func.Invoke(new D1(M1), new D2(M2));

            Console.WriteLine(d3.Invoke());
        }
コード例 #30
0
        public void draw(SKCanvas canvas, Func <IList <SKPoint>, SKPath> curve)
        {
            var scheme             = D3.Spectral;
            var temperatureEquator = _map.Options.TemperatureEquator;
            var tMax  = temperatureEquator.max;
            var tMin  = temperatureEquator.min;
            var delta = tMax - tMin;
            var min   = D3.min(cells.temp);

            var paint = new SKPaint()
            {
                IsAntialias = true
            };
            var opacity     = 0.3f;
            var strokeWidth = 1.8f;

            paint.Color = scheme(1 - (min - tMin) / delta).Opacity(opacity).SK();
            canvas.DrawRect(0, 0, svgWidth, svgHeight, paint);

            Isolines.forEach(t =>
            {
                var chain = Chains.filter(c => c.t == t).map(c => c.points);
                if (0 == chain.Count())
                {
                    return;
                }

                var fill   = scheme(1 - (t - tMin) / delta).Opacity(opacity);
                var stroke = fill.darker(0.2f);

                var points = new List <SKPoint>();
                chain.forEach(pp => points.AddRange(pp.map(p => p.SK())));
                var path = curve(points);

                paint.Color = fill.SK();
                paint.Style = SKPaintStyle.Fill;
                canvas.DrawPath(path, paint);

                paint.Color       = stroke.SK();
                paint.Style       = SKPaintStyle.Stroke;
                paint.StrokeWidth = strokeWidth;
                canvas.DrawPath(path, paint);
            });

            paint.Style = SKPaintStyle.Fill;
            paint.Color = SKColors.Black;
            Lables.forEach(d =>
            {
                canvas.DrawText(convertTemperature(d.t), d.x, d.y, paint);
            });
        }
コード例 #31
0
        public static Biomes applyDefaultBiomesSystem()
        {
            var name         = new string[] { "Marine", "Hot desert", "Cold desert", "Savanna", "Grassland", "Tropical seasonal forest", "Temperate deciduous forest", "Tropical rainforest", "Temperate rainforest", "Taiga", "Tundra", "Glacier", "Wetland" };
            var color        = new string[] { "#53679f", "#fbe79f", "#b5b887", "#d2d082", "#c8d68f", "#b6d95d", "#29bc56", "#7dcb35", "#409c43", "#4b6b32", "#96784b", "#d5e7eb", "#0b9131" };
            var habitability = new byte[] { 0, 4, 10, 22, 30, 50, 100, 80, 90, 12, 4, 0, 12 };
            var iconsDensity = new byte[] { 0, 3, 2, 120, 120, 120, 120, 150, 150, 100, 5, 0, 150 };
            var icons        = JArray.Parse(@"[{},{dune:3, cactus:6, deadTree:1},{dune:9, deadTree:1},{acacia:1, grass:9},{grass:1},{acacia:8, palm:1},{deciduous:1},{acacia:5, palm:3, deciduous:1, swamp:1},{deciduous:6, swamp:1},{conifer:1},{grass:1},{},{swamp:1}]");
            var cost         = new byte[] { 10, 200, 150, 60, 50, 70, 70, 80, 90, 80, 100, 255, 150 }; // biome movement cost

            byte[][] biomesMartix =
            {
                // hot ↔ cold; dry ↕ wet
                new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,  2,  2,  2 },
                new byte[] { 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 9, 9, 9,  9, 10, 10 },
                new byte[] { 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 9, 9, 9, 9, 9, 10, 10, 10 },
                new byte[] { 5, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10 },
                new byte[] { 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10 }
            };

            var biomeIcons = new string[icons.Count][];

            icons.forEach((d, i) =>
            {
                var parsed = new List <string>();
                foreach (var kv in d.Value <JObject>())
                {
                    for (var j = 0; j < (int)kv.Value; ++j)
                    {
                        parsed.Add(kv.Key);
                    }
                }
                biomeIcons[i] = parsed.ToArray();
            });

            var biome = new Biomes()
            {
                i            = D3.range(name.Length),
                name         = name,
                color        = color,
                biomesMartix = biomesMartix,
                habitability = habitability,
                iconsDensity = iconsDensity,
                icons        = biomeIcons,
                cost         = cost,
            };

            return(biome);
        }
コード例 #32
0
        public void BaseAccessorsCanBeInvoked()
        {
            var d = new D3();

            d.P1 = 42;
            Assert.AreEqual(d.F1, 41, "F1 value");

            d.F1 = 15;
            Assert.AreEqual(d.P1, 16, "P1 value");

            d.F2 = 17;
            Assert.AreEqual(d.P2, 18, "P2 value");

            d.P3 = 12;
            Assert.AreEqual(d.F3, 11, "F3 value");
        }
コード例 #33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from Product where id= 12";
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            D3.DataSource = dt;
            D3.DataBind();
            con.Close();
        }
コード例 #34
0
        public void BaseAccessorsCanBeInvokedOverride()
        {
            var d = new D3();

            d.P1 = 42;
            Assert.AreEqual(41, d.F1, "F1 value");

            d.F1 = 15;
            Assert.AreEqual(16, d.P1, "P1 value");

            d.F2 = 17;
            Assert.AreEqual(18, d.P2, "P2 value");

            d.P3 = 12;
            Assert.AreEqual(11, d.F3, "F3 value");
        }
コード例 #35
0
ファイル: Monk.cs プロジェクト: murrain/Snowshoes
        public static bool AttackUnit(D3.Unit _unit, TimeSpan _timeout)
        {
            if (Sherpa.GetBool(() => _unit.Life <= 0))
            {
                return false;
            }

            TimeSpan startTime = TimeSpan.FromTicks(System.Environment.TickCount);

            while (Sherpa.GetBool(() => _unit.Life > 0))
            {
                if (Me.MaxLife - Me.Life > 10000)
                {
                    breathOfHeaven.Use();
                }

                blindingFlash.Use();
                if (sevenSidedStrike.Use(_unit))
                    Thread.Sleep(900);
                else
                {
                    var buff = Sherpa.GetData(() => UIElement.Get(0x42A41DDB1E96841A));
                    if (buff == default(UIElement) || !buff.Visible)
                        sweepingWind.Use();

                    wayOfTheHundredFists.Use(_unit);

                }
                Thread.Sleep(100);

                if (TimeSpan.FromTicks(System.Environment.TickCount).Subtract(startTime) > _timeout)
                {
                    return false;
                }
            }

            return true;
        }
コード例 #36
0
        private ByteString GetGameAccountSettings(D3.GameMessage.GetGameAccountSettings settings)
        {
            Logger.Trace("GetGameAccountSettings()");

            var gameAccount = this.Client.Account.CurrentGameAccount;
            return gameAccount.Settings.ToByteString();
            //var pref = D3.Client.Preferences.CreateBuilder().SetVersion(105).Build(); //hack since client is expecting this atm -Egris
            //return pref.ToByteString();
        }
コード例 #37
0
        private bool SaveBanner(D3.GameMessage.SaveBannerConfiguration bannerConfig)
        {
            Logger.Trace("SaveBannerConifuration()");

            if (this.Client.Account.CurrentGameAccount.BannerConfigurationField.Value == bannerConfig.Banner)
                return false;
            else
            {
                this.Client.Account.CurrentGameAccount.BannerConfiguration = bannerConfig.Banner;
                this.Client.Account.CurrentGameAccount.NotifyUpdate();
            }
            return true;
        }
コード例 #38
0
        private ByteString SelectHero(D3.OnlineService.EntityId hero)
        {
            this.Client.Account.CurrentGameAccount.CurrentToon = ToonManager.GetToonByLowID(hero.IdLow);

            Logger.Trace("SelectToon() {0}", this.Client.Account.CurrentGameAccount.CurrentToon);

            if (this.Client.Account.CurrentGameAccount.CurrentToon.D3EntityID != this.Client.Account.CurrentGameAccount.lastPlayedHeroId)
            {
                this.Client.Account.CurrentGameAccount.NotifyUpdate();
                this.Client.Account.CurrentGameAccount.lastPlayedHeroId = this.Client.Account.CurrentGameAccount.CurrentToon.D3EntityID;
            }
            return this.Client.Account.CurrentGameAccount.CurrentToon.D3EntityID.ToByteString();
        }
コード例 #39
0
ファイル: AllTests.cs プロジェクト: bholl/zeroc-ice
    public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated)
    {
        Console.Out.Write("testing stringToProxy... ");
        Console.Out.Flush();
        string r = "Test:default -p 12010 -t 2000";
        Ice.ObjectPrx basePrx = communicator.stringToProxy(r);
        test(basePrx != null);
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing checked cast... ");
        Console.Out.Flush();
        TestIntfPrx testPrx = TestIntfPrxHelper.checkedCast(basePrx);
        test(testPrx != null);
        test(testPrx.Equals(basePrx));
        Console.Out.WriteLine("ok");

        Console.Out.Write("base as Object... ");
        Console.Out.Flush();
        {
            Ice.Object o;
            SBase sb = null;
            try
            {
                o = testPrx.SBaseAsObject();
                test(o != null);
                test(o.ice_id().Equals("::Test::SBase"));
                sb = (SBase) o;
            }
            catch(Exception)
            {
                test(false);
            }
            test(sb != null);
            test(sb.sb.Equals("SBase.sb"));
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base as Object (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_SBaseAsObject().whenCompleted(cb.response_SBaseAsObject, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base as base... ");
        Console.Out.Flush();
        {
            SBase sb;
            try
            {
                sb = testPrx.SBaseAsSBase();
                test(sb.sb.Equals("SBase.sb"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base as base (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_SBaseAsSBase().whenCompleted(cb.response_SBaseAsSBase, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base with known derived as base... ");
        Console.Out.Flush();
        {
            SBase sb;
            SBSKnownDerived sbskd = null;
            try
            {
                sb = testPrx.SBSKnownDerivedAsSBase();
                test(sb.sb.Equals("SBSKnownDerived.sb"));
                sbskd = (SBSKnownDerived) sb;
            }
            catch(Exception)
            {
                test(false);
            }
            test(sbskd != null);
            test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base with known derived as base (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_SBSKnownDerivedAsSBase().whenCompleted(cb.response_SBSKnownDerivedAsSBase, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base with known derived as known derived... ");
        Console.Out.Flush();
        {
            SBSKnownDerived sbskd;
            try
            {
                sbskd = testPrx.SBSKnownDerivedAsSBSKnownDerived();
                test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base with known derived as known derived (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_SBSKnownDerivedAsSBSKnownDerived().whenCompleted(
                        cb.response_SBSKnownDerivedAsSBSKnownDerived, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base with unknown derived as base... ");
        Console.Out.Flush();
        {
            SBase sb;
            try
            {
                sb = testPrx.SBSUnknownDerivedAsSBase();
                test(sb.sb.Equals("SBSUnknownDerived.sb"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base with unknown derived as base (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_SBSUnknownDerivedAsSBase().whenCompleted(
                        cb.response_SBSUnknownDerivedAsSBase, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("unknown with Object as Object... ");
        Console.Out.Flush();
        {
            try
            {
                testPrx.SUnknownAsObject();
                test(false);
            }
            catch(Ice.NoObjectFactoryException)
            {
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("unknown with Object as Object (AMI)... ");
        Console.Out.Flush();
        {
            try
            {
                AsyncCallback cb = new AsyncCallback();
                testPrx.begin_SUnknownAsObject().whenCompleted(
                        cb.response_SUnknownAsObject, cb.exception_SUnknownAsObject);
                cb.check();
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("one-element cycle... ");
        Console.Out.Flush();
        {
            try
            {
                B b = testPrx.oneElementCycle();
                test(b != null);
                test(b.ice_id().Equals("::Test::B"));
                test(b.sb.Equals("B1.sb"));
                test(b.pb == b);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("one-element cycle (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_oneElementCycle().whenCompleted(
                        cb.response_oneElementCycle, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("two-element cycle... ");
        Console.Out.Flush();
        {
            try
            {
                B b1 = testPrx.twoElementCycle();
                test(b1 != null);
                test(b1.ice_id().Equals("::Test::B"));
                test(b1.sb.Equals("B1.sb"));

                B b2 = b1.pb;
                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B"));
                test(b2.sb.Equals("B2.sb"));
                test(b2.pb == b1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("two-element cycle (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_twoElementCycle().whenCompleted(
                        cb.response_twoElementCycle, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("known derived pointer slicing as base... ");
        Console.Out.Flush();
        {
            try
            {
                B b1;
                b1 = testPrx.D1AsB();
                test(b1 != null);
                test(b1.ice_id().Equals("::Test::D1"));
                test(b1.sb.Equals("D1.sb"));
                test(b1.pb != null);
                test(b1.pb != b1);
                D1 d1 = (D1) b1;
                test(d1 != null);
                test(d1.sd1.Equals("D1.sd1"));
                test(d1.pd1 != null);
                test(d1.pd1 != b1);
                test(b1.pb == d1.pd1);

                B b2 = b1.pb;
                test(b2 != null);
                test(b2.pb == b1);
                test(b2.sb.Equals("D2.sb"));
                test(b2.ice_id().Equals("::Test::B"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("known derived pointer slicing as base (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_D1AsB().whenCompleted(cb.response_D1AsB, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("known derived pointer slicing as derived... ");
        Console.Out.Flush();
        {
            try
            {
                D1 d1;
                d1 = testPrx.D1AsD1();
                test(d1 != null);
                test(d1.ice_id().Equals("::Test::D1"));
                test(d1.sb.Equals("D1.sb"));
                test(d1.pb != null);
                test(d1.pb != d1);

                B b2 = d1.pb;
                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B"));
                test(b2.sb.Equals("D2.sb"));
                test(b2.pb == d1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("known derived pointer slicing as derived (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_D1AsD1().whenCompleted(cb.response_D1AsD1, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("unknown derived pointer slicing as base... ");
        Console.Out.Flush();
        {
            try
            {
                B b2;
                b2 = testPrx.D2AsB();
                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B"));
                test(b2.sb.Equals("D2.sb"));
                test(b2.pb != null);
                test(b2.pb != b2);

                B b1 = b2.pb;
                test(b1 != null);
                test(b1.ice_id().Equals("::Test::D1"));
                test(b1.sb.Equals("D1.sb"));
                test(b1.pb == b2);
                D1 d1 = (D1) b1;
                test(d1 != null);
                test(d1.sd1.Equals("D1.sd1"));
                test(d1.pd1 == b2);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("unknown derived pointer slicing as base (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_D2AsB().whenCompleted(cb.response_D2AsB, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("param ptr slicing with known first... ");
        Console.Out.Flush();
        {
            try
            {
                B b1;
                B b2;
                testPrx.paramTest1(out b1, out b2);

                test(b1 != null);
                test(b1.ice_id().Equals("::Test::D1"));
                test(b1.sb.Equals("D1.sb"));
                test(b1.pb == b2);
                D1 d1 = (D1) b1;
                test(d1 != null);
                test(d1.sd1.Equals("D1.sd1"));
                test(d1.pd1 == b2);

                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
                test(b2.sb.Equals("D2.sb"));
                test(b2.pb == b1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("param ptr slicing with known first (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_paramTest1().whenCompleted(cb.response_paramTest1, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("param ptr slicing with unknown first... ");
        Console.Out.Flush();
        {
            try
            {
                B b2;
                B b1;
                testPrx.paramTest2(out b2, out b1);

                test(b1 != null);
                test(b1.ice_id().Equals("::Test::D1"));
                test(b1.sb.Equals("D1.sb"));
                test(b1.pb == b2);
                D1 d1 = (D1) b1;
                test(d1 != null);
                test(d1.sd1.Equals("D1.sd1"));
                test(d1.pd1 == b2);

                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
                test(b2.sb.Equals("D2.sb"));
                test(b2.pb == b1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("param ptr slicing with unknown first (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_paramTest2().whenCompleted(cb.response_paramTest2, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("return value identity with known first... ");
        Console.Out.Flush();
        {
            try
            {
                B p1;
                B p2;
                B ret = testPrx.returnTest1(out p1, out p2);
                test(ret == p1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("return value identity with known first (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_returnTest1().whenCompleted(cb.response_returnTest1, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("return value identity with unknown first... ");
        Console.Out.Flush();
        {
            try
            {
                B p1;
                B p2;
                B ret = testPrx.returnTest2(out p1, out p2);
                test(ret == p1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("return value identity with unknown first (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_returnTest2().whenCompleted(cb.response_returnTest2, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("return value identity for input params known first... ");
        Console.Out.Flush();
        {
            try
            {
                D1 d1 = new D1();
                d1.sb = "D1.sb";
                d1.sd1 = "D1.sd1";
                D3 d3 = new D3();
                d3.pb = d1;
                d3.sb = "D3.sb";
                d3.sd3 = "D3.sd3";
                d3.pd3 = d1;
                d1.pb = d3;
                d1.pd1 = d3;

                B b1 = testPrx.returnTest3(d1, d3);

                test(b1 != null);
                test(b1.sb.Equals("D1.sb"));
                test(b1.ice_id().Equals("::Test::D1"));
                D1 p1 = (D1) b1;
                test(p1 != null);
                test(p1.sd1.Equals("D1.sd1"));
                test(p1.pd1 == b1.pb);

                B b2 = b1.pb;
                test(b2 != null);
                test(b2.sb.Equals("D3.sb"));
                test(b2.ice_id().Equals("::Test::B")); // Sliced by server
                test(b2.pb == b1);
                try
                {
                    D3 p3 = (D3) b2;
                    test(false);
                    D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable.
                }
                catch(InvalidCastException)
                {
                }

                test(b1 != d1);
                test(b1 != d3);
                test(b2 != d1);
                test(b2 != d3);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("return value identity for input params known first (AMI)... ");
        Console.Out.Flush();
        {
            D1 d1 = new D1();
            d1.sb = "D1.sb";
            d1.sd1 = "D1.sd1";
            D3 d3 = new D3();
            d3.pb = d1;
            d3.sb = "D3.sb";
            d3.sd3 = "D3.sd3";
            d3.pd3 = d1;
            d1.pb = d3;
            d1.pd1 = d3;

            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_returnTest3(d1, d3).whenCompleted(cb.response_returnTest3, cb.exception);
            cb.check();
            B b1 = cb.rb;

            test(b1 != null);
            test(b1.sb.Equals("D1.sb"));
            test(b1.ice_id().Equals("::Test::D1"));
            D1 p1 = (D1) b1;
            test(p1 != null);
            test(p1.sd1.Equals("D1.sd1"));
            test(p1.pd1 == b1.pb);

            B b2 = b1.pb;
            test(b2 != null);
            test(b2.sb.Equals("D3.sb"));
            test(b2.ice_id().Equals("::Test::B")); // Sliced by server
            test(b2.pb == b1);
            try
            {
                D3 p3 = (D3) b2;
                test(false);
                D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable.
            }
            catch(InvalidCastException)
            {
            }

            test(b1 != d1);
            test(b1 != d3);
            test(b2 != d1);
            test(b2 != d3);
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("return value identity for input params unknown first... ");
        Console.Out.Flush();
        {
            try
            {
                D1 d1 = new D1();
                d1.sb = "D1.sb";
                d1.sd1 = "D1.sd1";
                D3 d3 = new D3();
                d3.pb = d1;
                d3.sb = "D3.sb";
                d3.sd3 = "D3.sd3";
                d3.pd3 = d1;
                d1.pb = d3;
                d1.pd1 = d3;

                B b1 = testPrx.returnTest3(d3, d1);

                test(b1 != null);
                test(b1.sb.Equals("D3.sb"));
                test(b1.ice_id().Equals("::Test::B")); // Sliced by server

                try
                {
                    D3 p1 = (D3) b1;
                    test(false);
                    D3 tmp = p1; p1 = tmp; // Stop compiler warning about unused variable.
                }
                catch(InvalidCastException)
                {
                }

                B b2 = b1.pb;
                test(b2 != null);
                test(b2.sb.Equals("D1.sb"));
                test(b2.ice_id().Equals("::Test::D1"));
                test(b2.pb == b1);
                D1 p3 = (D1) b2;
                test(p3 != null);
                test(p3.sd1.Equals("D1.sd1"));
                test(p3.pd1 == b1);

                test(b1 != d1);
                test(b1 != d3);
                test(b2 != d1);
                test(b2 != d3);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("return value identity for input params unknown first (AMI)... ");
        Console.Out.Flush();
        {
            D1 d1 = new D1();
            d1.sb = "D1.sb";
            d1.sd1 = "D1.sd1";
            D3 d3 = new D3();
            d3.pb = d1;
            d3.sb = "D3.sb";
            d3.sd3 = "D3.sd3";
            d3.pd3 = d1;
            d1.pb = d3;
            d1.pd1 = d3;

            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_returnTest3(d3, d1).whenCompleted(cb.response_returnTest3, cb.exception);
            cb.check();
            B b1 = cb.rb;

            test(b1 != null);
            test(b1.sb.Equals("D3.sb"));
            test(b1.ice_id().Equals("::Test::B")); // Sliced by server

            try
            {
                D3 p1 = (D3) b1;
                test(false);
                D3 tmp = p1; p1 = tmp; // Stop compiler warning about unused variable.
            }
            catch(InvalidCastException)
            {
            }

            B b2 = b1.pb;
            test(b2 != null);
            test(b2.sb.Equals("D1.sb"));
            test(b2.ice_id().Equals("::Test::D1"));
            test(b2.pb == b1);
            D1 p3 = (D1) b2;
            test(p3 != null);
            test(p3.sd1.Equals("D1.sd1"));
            test(p3.pd1 == b1);

            test(b1 != d1);
            test(b1 != d3);
            test(b2 != d1);
            test(b2 != d3);
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("remainder unmarshaling (3 instances)... ");
        Console.Out.Flush();
        {
            try
            {
                B p1;
                B p2;
                B ret = testPrx.paramTest3(out p1, out p2);

                test(p1 != null);
                test(p1.sb.Equals("D2.sb (p1 1)"));
                test(p1.pb == null);
                test(p1.ice_id().Equals("::Test::B"));

                test(p2 != null);
                test(p2.sb.Equals("D2.sb (p2 1)"));
                test(p2.pb == null);
                test(p2.ice_id().Equals("::Test::B"));

                test(ret != null);
                test(ret.sb.Equals("D1.sb (p2 2)"));
                test(ret.pb == null);
                test(ret.ice_id().Equals("::Test::D1"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("remainder unmarshaling (3 instances) (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_paramTest3().whenCompleted(cb.response_paramTest3, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("remainder unmarshaling (4 instances)... ");
        Console.Out.Flush();
        {
            try
            {
                B b;
                B ret = testPrx.paramTest4(out b);

                test(b != null);
                test(b.sb.Equals("D4.sb (1)"));
                test(b.pb == null);
                test(b.ice_id().Equals("::Test::B"));

                test(ret != null);
                test(ret.sb.Equals("B.sb (2)"));
                test(ret.pb == null);
                test(ret.ice_id().Equals("::Test::B"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("remainder unmarshaling (4 instances) (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_paramTest4().whenCompleted(cb.response_paramTest4, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("param ptr slicing, instance marshaled in unknown derived as base... ");
        Console.Out.Flush();
        {
            try
            {
                B b1 = new B();
                b1.sb = "B.sb(1)";
                b1.pb = b1;

                D3 d3 = new D3();
                d3.sb = "D3.sb";
                d3.pb = d3;
                d3.sd3 = "D3.sd3";
                d3.pd3 = b1;

                B b2 = new B();
                b2.sb = "B.sb(2)";
                b2.pb = b1;

                B ret = testPrx.returnTest3(d3, b2);

                test(ret != null);
                test(ret.ice_id().Equals("::Test::B"));
                test(ret.sb.Equals("D3.sb"));
                test(ret.pb == ret);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("param ptr slicing, instance marshaled in unknown derived as base (AMI)... ");
        Console.Out.Flush();
        {
            B b1 = new B();
            b1.sb = "B.sb(1)";
            b1.pb = b1;

            D3 d3 = new D3();
            d3.sb = "D3.sb";
            d3.pb = d3;
            d3.sd3 = "D3.sd3";
            d3.pd3 = b1;

            B b2 = new B();
            b2.sb = "B.sb(2)";
            b2.pb = b1;

            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_returnTest3(d3, b2).whenCompleted(cb.response_returnTest3, cb.exception);
            cb.check();
            B rv = cb.rb;

            test(rv != null);
            test(rv.ice_id().Equals("::Test::B"));
            test(rv.sb.Equals("D3.sb"));
            test(rv.pb == rv);
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("param ptr slicing, instance marshaled in unknown derived as derived... ");
        Console.Out.Flush();
        {
            try
            {
                D1 d11 = new D1();
                d11.sb = "D1.sb(1)";
                d11.pb = d11;
                d11.sd1 = "D1.sd1(1)";

                D3 d3 = new D3();
                d3.sb = "D3.sb";
                d3.pb = d3;
                d3.sd3 = "D3.sd3";
                d3.pd3 = d11;

                D1 d12 = new D1();
                d12.sb = "D1.sb(2)";
                d12.pb = d12;
                d12.sd1 = "D1.sd1(2)";
                d12.pd1 = d11;

                B ret = testPrx.returnTest3(d3, d12);
                test(ret != null);
                test(ret.ice_id().Equals("::Test::B"));
                test(ret.sb.Equals("D3.sb"));
                test(ret.pb == ret);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... ");
        Console.Out.Flush();
        {
            D1 d11 = new D1();
            d11.sb = "D1.sb(1)";
            d11.pb = d11;
            d11.sd1 = "D1.sd1(1)";

            D3 d3 = new D3();
            d3.sb = "D3.sb";
            d3.pb = d3;
            d3.sd3 = "D3.sd3";
            d3.pd3 = d11;

            D1 d12 = new D1();
            d12.sb = "D1.sb(2)";
            d12.pb = d12;
            d12.sd1 = "D1.sd1(2)";
            d12.pd1 = d11;

            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_returnTest3(d3, d12).whenCompleted(cb.response_returnTest3, cb.exception);
            cb.check();
            B rv = cb.rb;

            test(rv != null);
            test(rv.ice_id().Equals("::Test::B"));
            test(rv.sb.Equals("D3.sb"));
            test(rv.pb == rv);
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("sequence slicing... ");
        Console.Out.Flush();
        {
            try
            {
                SS ss;
                {
                    B ss1b = new B();
                    ss1b.sb = "B.sb";
                    ss1b.pb = ss1b;

                    D1 ss1d1 = new D1();
                    ss1d1.sb = "D1.sb";
                    ss1d1.sd1 = "D1.sd1";
                    ss1d1.pb = ss1b;

                    D3 ss1d3 = new D3();
                    ss1d3.sb = "D3.sb";
                    ss1d3.sd3 = "D3.sd3";
                    ss1d3.pb = ss1b;

                    B ss2b = new B();
                    ss2b.sb = "B.sb";
                    ss2b.pb = ss1b;

                    D1 ss2d1 = new D1();
                    ss2d1.sb = "D1.sb";
                    ss2d1.sd1 = "D1.sd1";
                    ss2d1.pb = ss2b;

                    D3 ss2d3 = new D3();
                    ss2d3.sb = "D3.sb";
                    ss2d3.sd3 = "D3.sd3";
                    ss2d3.pb = ss2b;

                    ss1d1.pd1 = ss2b;
                    ss1d3.pd3 = ss2d1;

                    ss2d1.pd1 = ss1d3;
                    ss2d3.pd3 = ss1d1;

                    SS1 ss1 = new SS1();
                    ss1.s = new BSeq(3);
                    ss1.s.Add(ss1b);
                    ss1.s.Add(ss1d1);
                    ss1.s.Add(ss1d3);

                    SS2 ss2 = new SS2();
                    ss2.s = new BSeq(3);
                    ss2.s.Add(ss2b);
                    ss2.s.Add(ss2d1);
                    ss2.s.Add(ss2d3);

                    ss = testPrx.sequenceTest(ss1, ss2);
                }

                test(ss.c1 != null);
                B ss1b2 = ss.c1.s[0];
                B ss1d2 = ss.c1.s[1];
                test(ss.c2 != null);
                B ss1d4 = ss.c1.s[2];

                test(ss.c2 != null);
                B ss2b2 = ss.c2.s[0];
                B ss2d2 = ss.c2.s[1];
                B ss2d4 = ss.c2.s[2];

                test(ss1b2.pb == ss1b2);
                test(ss1d2.pb == ss1b2);
                test(ss1d4.pb == ss1b2);

                test(ss2b2.pb == ss1b2);
                test(ss2d2.pb == ss2b2);
                test(ss2d4.pb == ss2b2);

                test(ss1b2.ice_id().Equals("::Test::B"));
                test(ss1d2.ice_id().Equals("::Test::D1"));
                test(ss1d4.ice_id().Equals("::Test::B"));

                test(ss2b2.ice_id().Equals("::Test::B"));
                test(ss2d2.ice_id().Equals("::Test::D1"));
                test(ss2d4.ice_id().Equals("::Test::B"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("sequence slicing (AMI)... ");
        Console.Out.Flush();
        {
            SS ss;
            {
                B ss1b = new B();
                ss1b.sb = "B.sb";
                ss1b.pb = ss1b;

                D1 ss1d1 = new D1();
                ss1d1.sb = "D1.sb";
                ss1d1.sd1 = "D1.sd1";
                ss1d1.pb = ss1b;

                D3 ss1d3 = new D3();
                ss1d3.sb = "D3.sb";
                ss1d3.sd3 = "D3.sd3";
                ss1d3.pb = ss1b;

                B ss2b = new B();
                ss2b.sb = "B.sb";
                ss2b.pb = ss1b;

                D1 ss2d1 = new D1();
                ss2d1.sb = "D1.sb";
                ss2d1.sd1 = "D1.sd1";
                ss2d1.pb = ss2b;

                D3 ss2d3 = new D3();
                ss2d3.sb = "D3.sb";
                ss2d3.sd3 = "D3.sd3";
                ss2d3.pb = ss2b;

                ss1d1.pd1 = ss2b;
                ss1d3.pd3 = ss2d1;

                ss2d1.pd1 = ss1d3;
                ss2d3.pd3 = ss1d1;

                SS1 ss1 = new SS1();
                ss1.s = new BSeq();
                ss1.s.Add(ss1b);
                ss1.s.Add(ss1d1);
                ss1.s.Add(ss1d3);

                SS2 ss2 = new SS2();
                ss2.s = new BSeq();
                ss2.s.Add(ss2b);
                ss2.s.Add(ss2d1);
                ss2.s.Add(ss2d3);

                AsyncCallback cb = new AsyncCallback();
                testPrx.begin_sequenceTest(ss1, ss2).whenCompleted(cb.response_sequenceTest, cb.exception);
                cb.check();
                ss = cb.rss;
            }
            test(ss.c1 != null);
            B ss1b3 = ss.c1.s[0];
            B ss1d5 = ss.c1.s[1];
            test(ss.c2 != null);
            B ss1d6 = ss.c1.s[2];

            test(ss.c2 != null);
            B ss2b3 = ss.c2.s[0];
            B ss2d5 = ss.c2.s[1];
            B ss2d6 = ss.c2.s[2];

            test(ss1b3.pb == ss1b3);
            test(ss1d6.pb == ss1b3);
            test(ss1d6.pb == ss1b3);

            test(ss2b3.pb == ss1b3);
            test(ss2d6.pb == ss2b3);
            test(ss2d6.pb == ss2b3);

            test(ss1b3.ice_id().Equals("::Test::B"));
            test(ss1d5.ice_id().Equals("::Test::D1"));
            test(ss1d6.ice_id().Equals("::Test::B"));

            test(ss2b3.ice_id().Equals("::Test::B"));
            test(ss2d5.ice_id().Equals("::Test::D1"));
            test(ss2d6.ice_id().Equals("::Test::B"));
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("dictionary slicing... ");
        Console.Out.Flush();
        {
            try
            {
                Dictionary<int, B> bin = new Dictionary<int, B>();
                Dictionary<int, B> bout;
                Dictionary<int, B> ret;
                int i;
                for(i = 0; i < 10; ++i)
                {
                    string s = "D1." + i.ToString();
                    D1 d1 = new D1();
                    d1.sb = s;
                    d1.pb = d1;
                    d1.sd1 = s;
                    bin[i] = d1;
                }

                ret = testPrx.dictionaryTest(bin, out bout);

                test(bout.Count == 10);
                for(i = 0; i < 10; ++i)
                {
                    B b = bout[i * 10];
                    test(b != null);
                    string s = "D1." + i.ToString();
                    test(b.sb.Equals(s));
                    test(b.pb != null);
                    test(b.pb != b);
                    test(b.pb.sb.Equals(s));
                    test(b.pb.pb == b.pb);
                }

                test(ret.Count == 10);
                for(i = 0; i < 10; ++i)
                {
                    B b = ret[i * 20];
                    test(b != null);
                    string s = "D1." + (i * 20).ToString();
                    test(b.sb.Equals(s));
                    test(b.pb == (i == 0 ? (B)null : ret[(i - 1) * 20]));
                    D1 d1 = (D1) b;
                    test(d1 != null);
                    test(d1.sd1.Equals(s));
                    test(d1.pd1 == d1);
                }
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("dictionary slicing (AMI)... ");
        Console.Out.Flush();
        {
            Dictionary<int, B> bin = new Dictionary<int, B>();
            Dictionary<int, B> bout;
            Dictionary<int, B> rv;
            int i;
            for(i = 0; i < 10; ++i)
            {
                string s = "D1." + i.ToString();
                D1 d1 = new D1();
                d1.sb = s;
                d1.pb = d1;
                d1.sd1 = s;
                bin[i] = d1;
            }

            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_dictionaryTest(bin).whenCompleted(cb.response_dictionaryTest, cb.exception);
            cb.check();
            bout = cb.obdict;
            rv = cb.rbdict;

            test(bout.Count == 10);
            for(i = 0; i < 10; ++i)
            {
                B b = bout[i * 10];
                test(b != null);
                string s = "D1." + i.ToString();
                test(b.sb.Equals(s));
                test(b.pb != null);
                test(b.pb != b);
                test(b.pb.sb.Equals(s));
                test(b.pb.pb == b.pb);
            }

            test(rv.Count == 10);
            for(i = 0; i < 10; ++i)
            {
                B b = rv[i * 20];
                test(b != null);
                string s = "D1." + (i * 20).ToString();
                test(b.sb.Equals(s));
                test(b.pb == (i == 0 ? (B)null : rv[(i - 1) * 20]));
                D1 d1 = (D1) b;
                test(d1 != null);
                test(d1.sd1.Equals(s));
                test(d1.pd1 == d1);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base exception thrown as base exception... ");
        Console.Out.Flush();
        {
            try
            {
                testPrx.throwBaseAsBase();
                test(false);
            }
            catch(BaseException e)
            {
                test(e.GetType().FullName.Equals("Test.BaseException"));
                test(e.sbe.Equals("sbe"));
                test(e.pb != null);
                test(e.pb.sb.Equals("sb"));
                test(e.pb.pb == e.pb);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("base exception thrown as base exception (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_throwBaseAsBase().whenCompleted(cb.response, cb.exception_throwBaseAsBase);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("derived exception thrown as base exception... ");
        Console.Out.Flush();
        {
            try
            {
                testPrx.throwDerivedAsBase();
                test(false);
            }
            catch(DerivedException e)
            {
                test(e.GetType().FullName.Equals("Test.DerivedException"));
                test(e.sbe.Equals("sbe"));
                test(e.pb != null);
                test(e.pb.sb.Equals("sb1"));
                test(e.pb.pb == e.pb);
                test(e.sde.Equals("sde1"));
                test(e.pd1 != null);
                test(e.pd1.sb.Equals("sb2"));
                test(e.pd1.pb == e.pd1);
                test(e.pd1.sd1.Equals("sd2"));
                test(e.pd1.pd1 == e.pd1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("derived exception thrown as base exception (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_throwDerivedAsBase().whenCompleted(cb.response, cb.exception_throwDerivedAsBase);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("derived exception thrown as derived exception... ");
        Console.Out.Flush();
        {
            try
            {
                testPrx.throwDerivedAsDerived();
                test(false);
            }
            catch(DerivedException e)
            {
                test(e.GetType().FullName.Equals("Test.DerivedException"));
                test(e.sbe.Equals("sbe"));
                test(e.pb != null);
                test(e.pb.sb.Equals("sb1"));
                test(e.pb.pb == e.pb);
                test(e.sde.Equals("sde1"));
                test(e.pd1 != null);
                test(e.pd1.sb.Equals("sb2"));
                test(e.pd1.pb == e.pd1);
                test(e.pd1.sd1.Equals("sd2"));
                test(e.pd1.pd1 == e.pd1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("derived exception thrown as derived exception (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_throwDerivedAsDerived().whenCompleted(cb.response, cb.exception_throwDerivedAsDerived);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("unknown derived exception thrown as base exception... ");
        Console.Out.Flush();
        {
            try
            {
                testPrx.throwUnknownDerivedAsBase();
                test(false);
            }
            catch(BaseException e)
            {
                test(e.GetType().FullName.Equals("Test.BaseException"));
                test(e.sbe.Equals("sbe"));
                test(e.pb != null);
                test(e.pb.sb.Equals("sb d2"));
                test(e.pb.pb == e.pb);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("unknown derived exception thrown as base exception (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_throwUnknownDerivedAsBase().whenCompleted(
                        cb.response, cb.exception_throwUnknownDerivedAsBase);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("forward-declared class... ");
        Console.Out.Flush();
        {
            try
            {
                Forward f;
                testPrx.useForward(out f);
                test(f != null);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("forward-declared class (AMI)... ");
        Console.Out.Flush();
        {
            AsyncCallback cb = new AsyncCallback();
            testPrx.begin_useForward().whenCompleted(cb.response_useForward, cb.exception);
            cb.check();
        }
        Console.Out.WriteLine("ok");

        return testPrx;
    }
コード例 #40
0
        private ByteString GetHeroList(D3.GameMessage.GetHeroIds heroIds)
        {
            Logger.Trace("GetHeroList()");

            var HeroList = D3.Hero.HeroList.CreateBuilder();
            var gameAccount = GameAccountManager.GetAccountByPersistentID(heroIds.AccountId.IdLow);
            foreach (var toon in gameAccount.Toons.Values)
            {
                HeroList.AddHeroIds(toon.D3EntityID);
            }
            return HeroList.Build().ToByteString();
        }
コード例 #41
0
        private ByteString GetAccountProfile(D3.GameMessage.GetAccountProfile profile)
        {
            Logger.Trace("GetAccountProfile()");

            var account = GameAccountManager.GetAccountByPersistentID(profile.AccountId.IdLow);
            return account.Profile.ToByteString();
        }
コード例 #42
0
        private ByteString SetToonSettings(D3.GameMessage.SetToonSettings settings)
        {
            Logger.Trace("SetToonSettings()");

            var toon = ToonManager.GetToonByLowID(settings.HeroId.IdLow);
            toon.Settings = settings.Settings;
            return ByteString.Empty;
        }
コード例 #43
0
 private ByteString UndeleteHero(D3.GameMessage.UndeleteHero heroId)
 {
     var toon = ToonManager.GetToonByLowID(heroId.UndeleteHeroId.IdLow);
     if (toon != null && toon.Deleted)
     {
         toon.Deleted = false;
         ToonManager.SaveToDB(toon);
         return toon.Digest.ToByteString();
     }
     else
         return ByteString.Empty;
 }
コード例 #44
0
        private ByteString SelectHero(D3.OnlineService.EntityId hero)
        {
            var oldToon = this.Client.Account.CurrentGameAccount.CurrentToon;
            var newtoon = ToonManager.GetToonByLowID(hero.IdLow);


            Logger.Trace("SelectToon() {0}", this.Client.Account.CurrentGameAccount.CurrentToon);

            if (oldToon != newtoon)
            {
                this.Client.Account.CurrentGameAccount.CurrentToon = newtoon;
                this.Client.Account.CurrentGameAccount.NotifyUpdate();
                AccountManager.SaveToDB(this.Client.Account);
            }
            return this.Client.Account.CurrentGameAccount.CurrentToon.D3EntityID.ToByteString();
        }
コード例 #45
0
        private void DeleteHero(D3.OnlineService.EntityId hero)
        {
            //Permanantly delete previously deleted hero
            var deleteHero = ToonManager.GetDeletedToon(this.Client.Account.CurrentGameAccount);
            if (deleteHero != null)
            {
                Logger.Trace("Permanantly deleting hero: {0}", deleteHero);
                ToonManager.DeleteToon(deleteHero);
            }
            //Mark hero as deleted
            var markHero = ToonManager.GetToonByLowID(hero.IdLow);
            markHero.Deleted = true;
            ToonManager.SaveToDB(markHero);

            Logger.Trace("DeleteHero(): Marked {0} as deleted.", markHero);
        }
コード例 #46
0
        private ByteString CreateHero(D3.OnlineService.HeroCreateParams createPrams)
        {

            var newToon = ToonManager.CreateNewToon(createPrams.Name, createPrams.GbidClass, createPrams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 1, Client.Account.CurrentGameAccount);
            return newToon.D3EntityID.ToByteString();
        }
コード例 #47
0
        private ByteString SetGameAccountSettings(D3.GameMessage.SetGameAccountSettings settings)
        {
            Logger.Trace("SetGameAccountSettings()");

            this.Client.Account.CurrentGameAccount.Settings = settings.Settings;
            return ByteString.Empty;
        }
コード例 #48
0
        private ByteString GetGameAccountSettings(D3.GameMessage.GetGameAccountSettings settings)
        {
            Logger.Trace("GetGameAccountSettings()");

            //var gameAccount = GameAccountManager.GetAccountByPersistentID(settings.AccountId.IdLow);
            //return gameAccount.Settings.ToByteString();
            var pref = D3.Client.Preferences.CreateBuilder().SetVersion(102).Build(); //hack since client is expecting this atm -Egris
            return pref.ToByteString();
        }
コード例 #49
0
        private ByteString GetToonSettings(D3.GameMessage.GetToonSettings settings)
        {
            Logger.Trace("GetToonSettings");

            if (settings.HasHeroId)
            {
                var toon = ToonManager.GetToonByLowID(settings.HeroId.IdLow);
                return toon.Settings.ToByteString();
            }
            else
                return this.Client.Account.CurrentGameAccount.CurrentToon.Settings.ToByteString();
        }
コード例 #50
0
ファイル: AllTests.cs プロジェクト: zhangwei5095/ice
    public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated)
    {
        Write("testing stringToProxy... ");
        Flush();
        Ice.ObjectPrx basePrx = communicator.stringToProxy("Test:default -p 12010 -t 2000");
        test(basePrx != null);
        WriteLine("ok");

        Write("testing checked cast... ");
        Flush();
        TestIntfPrx testPrx = TestIntfPrxHelper.checkedCast(basePrx);
        test(testPrx != null);
        test(testPrx.Equals(basePrx));
        WriteLine("ok");

        Write("base as Object... ");
        Flush();
        {
            Ice.Value o;
            SBase sb = null;
            try
            {
                o = testPrx.SBaseAsObject();
                test(o != null);
                test(o.ice_id().Equals("::Test::SBase"));
                sb = (SBase) o;
            }
            catch(Exception)
            {
                test(false);
            }
            test(sb != null);
            test(sb.sb.Equals("SBase.sb"));
        }
        WriteLine("ok");

        Write("base as Object (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_SBaseAsObject().whenCompleted(
                (Ice.Value o) =>
                {
                    test(o != null);
                    test(o.ice_id().Equals("::Test::SBase"));
                    SBase sb = (SBase) o;
                    test(sb != null);
                    test(sb.sb.Equals("SBase.sb"));
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            Ice.Value o = testPrx.SBaseAsObjectAsync().Result;
            test(o != null);
            test(o.ice_id().Equals("::Test::SBase"));
            SBase sb = (SBase)o;
            test(sb != null);
            test(sb.sb.Equals("SBase.sb"));
        }
        WriteLine("ok");

        Write("base as base... ");
        Flush();
        {
            SBase sb;
            try
            {
                sb = testPrx.SBaseAsSBase();
                test(sb.sb.Equals("SBase.sb"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("base as base (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_SBaseAsSBase().whenCompleted(
                (SBase sb) =>
                {
                    test(sb.sb.Equals("SBase.sb"));
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }

        {
            SBase sb = testPrx.SBaseAsSBaseAsync().Result;
            test(sb.sb.Equals("SBase.sb"));
        }
        WriteLine("ok");

        Write("base with known derived as base... ");
        Flush();
        {
            SBase sb;
            SBSKnownDerived sbskd = null;
            try
            {
                sb = testPrx.SBSKnownDerivedAsSBase();
                test(sb.sb.Equals("SBSKnownDerived.sb"));
                sbskd = (SBSKnownDerived) sb;
            }
            catch(Exception)
            {
                test(false);
            }
            test(sbskd != null);
            test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
        }
        WriteLine("ok");

        Write("base with known derived as base (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_SBSKnownDerivedAsSBase().whenCompleted(
                (SBase sb) =>
                {
                    test(sb.sb.Equals("SBSKnownDerived.sb"));
                    SBSKnownDerived sbskd = (SBSKnownDerived) sb;
                    test(sbskd != null);
                    test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            SBase sb = testPrx.SBSKnownDerivedAsSBaseAsync().Result;
            test(sb.sb.Equals("SBSKnownDerived.sb"));
            SBSKnownDerived sbskd = (SBSKnownDerived)sb;
            test(sbskd != null);
            test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
        }
        WriteLine("ok");

        Write("base with known derived as known derived... ");
        Flush();
        {
            SBSKnownDerived sbskd;
            try
            {
                sbskd = testPrx.SBSKnownDerivedAsSBSKnownDerived();
                test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("base with known derived as known derived (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_SBSKnownDerivedAsSBSKnownDerived().whenCompleted(
                (SBSKnownDerived sbskd) =>
                {
                    test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            SBSKnownDerived sbskd = testPrx.SBSKnownDerivedAsSBSKnownDerivedAsync().Result;
            test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
        }
        WriteLine("ok");

        Write("base with unknown derived as base... ");
        Flush();
        {
            SBase sb;
            try
            {
                sb = testPrx.SBSUnknownDerivedAsSBase();
                test(sb.sb.Equals("SBSUnknownDerived.sb"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
        {
            try
            {
                SBase sb = testPrx.SBSUnknownDerivedAsSBaseCompact();
                test(sb.sb.Equals("SBSUnknownDerived.sb"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        else
        {
            try
            {
                //
                // This test fails when using the compact format because the instance cannot
                // be sliced to a known type.
                //
                testPrx.SBSUnknownDerivedAsSBaseCompact();
                test(false);
            }
            catch(Ice.NoValueFactoryException)
            {
                // Expected.
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("base with unknown derived as base (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_SBSUnknownDerivedAsSBase().whenCompleted(
                (SBase sb) =>
                {
                    test(sb.sb.Equals("SBSUnknownDerived.sb"));
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            SBase sb = testPrx.SBSUnknownDerivedAsSBaseAsync().Result;
            test(sb.sb.Equals("SBSUnknownDerived.sb"));
        }
        if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
        {
            //
            // This test succeeds for the 1.0 encoding.
            //
            {
                Callback cb = new Callback();
                testPrx.begin_SBSUnknownDerivedAsSBaseCompact().whenCompleted(
                    (SBase sb) =>
                    {
                        test(sb.sb.Equals("SBSUnknownDerived.sb"));
                        cb.called();
                    },
                    (Ice.Exception ex) =>
                    {
                        test(false);
                    });
                cb.check();
            }
            {
                SBase sb = testPrx.SBSUnknownDerivedAsSBaseCompactAsync().Result;
                test(sb.sb.Equals("SBSUnknownDerived.sb"));
            }
        }
        else
        {
            //
            // This test fails when using the compact format because the instance cannot
            // be sliced to a known type.
            //
            {
                Callback cb = new Callback();
                testPrx.begin_SBSUnknownDerivedAsSBaseCompact().whenCompleted(
                    (SBase sb) =>
                    {
                        test(false);
                    },
                    (Ice.Exception ex) =>
                    {
                        test(ex is Ice.NoValueFactoryException);
                        cb.called();
                    });
                cb.check();
            }

            try
            {
                SBase sb = testPrx.SBSUnknownDerivedAsSBaseCompactAsync().Result;
            }
            catch(AggregateException ae)
            {
                test(ae.InnerException is Ice.NoValueFactoryException);
            }
        }
        WriteLine("ok");

        Write("unknown with Object as Object... ");
        Flush();
        {
            try
            {
                Ice.Value o = testPrx.SUnknownAsObject();
                test(!testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0));
                test(o is Ice.UnknownSlicedValue);
                test((o as Ice.UnknownSlicedValue).getUnknownTypeId().Equals("::Test::SUnknown"));
                testPrx.checkSUnknown(o);
            }
            catch(Ice.NoValueFactoryException)
            {
                test(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("unknown with Object as Object (AMI)... ");
        Flush();
        {
            try
            {
                Callback cb = new Callback();
                if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
                {
                    {
                        testPrx.begin_SUnknownAsObject().whenCompleted(
                            (Ice.Value o) =>
                            {
                                test(false);
                            },
                            (Ice.Exception ex) =>
                            {
                                test(ex.GetType().FullName.Equals("Ice.NoValueFactoryException"));
                                cb.called();
                            });
                    }

                    try
                    {
                        var o = testPrx.SUnknownAsObjectAsync().Result;
                    }
                    catch(AggregateException ae)
                    {
                        try
                        {
                            throw ae.InnerException;
                        }
                        catch(Ice.Exception ex)
                        {
                            test(ex.GetType().FullName.Equals("Ice.NoValueFactoryException"));
                        }
                    }
                }
                else
                {
                    {
                        testPrx.begin_SUnknownAsObject().whenCompleted(
                            (Ice.Value o) =>
                            {
                                test(o is Ice.UnknownSlicedValue);
                                test((o as Ice.UnknownSlicedValue).getUnknownTypeId().Equals("::Test::SUnknown"));
                                cb.called();
                            },
                            (Ice.Exception ex) =>
                            {
                                test(false);
                            });
                    }

                    try
                    {
                        var o = testPrx.SUnknownAsObjectAsync().Result;
                        test(o is Ice.UnknownSlicedValue);
                        test((o as Ice.UnknownSlicedValue).getUnknownTypeId().Equals("::Test::SUnknown"));
                    }
                    catch(AggregateException)
                    {
                        test(false);
                    }
                }
                cb.check();
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("one-element cycle... ");
        Flush();
        {
            try
            {
                B b = testPrx.oneElementCycle();
                test(b != null);
                test(b.ice_id().Equals("::Test::B"));
                test(b.sb.Equals("B1.sb"));
                test(b.pb == b);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("one-element cycle (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_oneElementCycle().whenCompleted(
                (B b) =>
                {
                    test(b != null);
                    test(b.ice_id().Equals("::Test::B"));
                    test(b.sb.Equals("B1.sb"));
                    test(b.pb == b);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            var b = testPrx.oneElementCycleAsync().Result;
            test(b != null);
            test(b.ice_id().Equals("::Test::B"));
            test(b.sb.Equals("B1.sb"));
            test(b.pb == b);
        }
        WriteLine("ok");

        Write("two-element cycle... ");
        Flush();
        {
            try
            {
                B b1 = testPrx.twoElementCycle();
                test(b1 != null);
                test(b1.ice_id().Equals("::Test::B"));
                test(b1.sb.Equals("B1.sb"));

                B b2 = b1.pb;
                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B"));
                test(b2.sb.Equals("B2.sb"));
                test(b2.pb == b1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("two-element cycle (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_twoElementCycle().whenCompleted(
                (B b1) =>
                {
                    test(b1 != null);
                    test(b1.ice_id().Equals("::Test::B"));
                    test(b1.sb.Equals("B1.sb"));

                    B b2 = b1.pb;
                    test(b2 != null);
                    test(b2.ice_id().Equals("::Test::B"));
                    test(b2.sb.Equals("B2.sb"));
                    test(b2.pb == b1);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            B b1 = testPrx.twoElementCycleAsync().Result;
            test(b1 != null);
            test(b1.ice_id().Equals("::Test::B"));
            test(b1.sb.Equals("B1.sb"));

            B b2 = b1.pb;
            test(b2 != null);
            test(b2.ice_id().Equals("::Test::B"));
            test(b2.sb.Equals("B2.sb"));
            test(b2.pb == b1);
        }
        WriteLine("ok");

        Write("known derived pointer slicing as base... ");
        Flush();
        {
            try
            {
                B b1;
                b1 = testPrx.D1AsB();
                test(b1 != null);
                test(b1.ice_id().Equals("::Test::D1"));
                test(b1.sb.Equals("D1.sb"));
                test(b1.pb != null);
                test(b1.pb != b1);
                D1 d1 = (D1) b1;
                test(d1 != null);
                test(d1.sd1.Equals("D1.sd1"));
                test(d1.pd1 != null);
                test(d1.pd1 != b1);
                test(b1.pb == d1.pd1);

                B b2 = b1.pb;
                test(b2 != null);
                test(b2.pb == b1);
                test(b2.sb.Equals("D2.sb"));
                test(b2.ice_id().Equals("::Test::B"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("known derived pointer slicing as base (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_D1AsB().whenCompleted(
                (B b1) =>
                {
                    test(b1 != null);
                    test(b1.ice_id().Equals("::Test::D1"));
                    test(b1.sb.Equals("D1.sb"));
                    test(b1.pb != null);
                    test(b1.pb != b1);
                    D1 d1 = (D1) b1;
                    test(d1 != null);
                    test(d1.sd1.Equals("D1.sd1"));
                    test(d1.pd1 != null);
                    test(d1.pd1 != b1);
                    test(b1.pb == d1.pd1);

                    B b2 = b1.pb;
                    test(b2 != null);
                    test(b2.pb == b1);
                    test(b2.sb.Equals("D2.sb"));
                    test(b2.ice_id().Equals("::Test::B"));
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            B b1 = testPrx.D1AsBAsync().Result;
            test(b1 != null);
            test(b1.ice_id().Equals("::Test::D1"));
            test(b1.sb.Equals("D1.sb"));
            test(b1.pb != null);
            test(b1.pb != b1);
            D1 d1 = (D1)b1;
            test(d1 != null);
            test(d1.sd1.Equals("D1.sd1"));
            test(d1.pd1 != null);
            test(d1.pd1 != b1);
            test(b1.pb == d1.pd1);

            B b2 = b1.pb;
            test(b2 != null);
            test(b2.pb == b1);
            test(b2.sb.Equals("D2.sb"));
            test(b2.ice_id().Equals("::Test::B"));
        }
        WriteLine("ok");

        Write("known derived pointer slicing as derived... ");
        Flush();
        {
            try
            {
                D1 d1;
                d1 = testPrx.D1AsD1();
                test(d1 != null);
                test(d1.ice_id().Equals("::Test::D1"));
                test(d1.sb.Equals("D1.sb"));
                test(d1.pb != null);
                test(d1.pb != d1);

                B b2 = d1.pb;
                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B"));
                test(b2.sb.Equals("D2.sb"));
                test(b2.pb == d1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("known derived pointer slicing as derived (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_D1AsD1().whenCompleted(
                (D1 d1) =>
                {
                    test(d1 != null);
                    test(d1.ice_id().Equals("::Test::D1"));
                    test(d1.sb.Equals("D1.sb"));
                    test(d1.pb != null);
                    test(d1.pb != d1);

                    B b2 = d1.pb;
                    test(b2 != null);
                    test(b2.ice_id().Equals("::Test::B"));
                    test(b2.sb.Equals("D2.sb"));
                    test(b2.pb == d1);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }

        {
            D1 d1 = testPrx.D1AsD1Async().Result;
            test(d1 != null);
            test(d1.ice_id().Equals("::Test::D1"));
            test(d1.sb.Equals("D1.sb"));
            test(d1.pb != null);
            test(d1.pb != d1);

            B b2 = d1.pb;
            test(b2 != null);
            test(b2.ice_id().Equals("::Test::B"));
            test(b2.sb.Equals("D2.sb"));
            test(b2.pb == d1);
        }
        WriteLine("ok");

        Write("unknown derived pointer slicing as base... ");
        Flush();
        {
            try
            {
                B b2;
                b2 = testPrx.D2AsB();
                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B"));
                test(b2.sb.Equals("D2.sb"));
                test(b2.pb != null);
                test(b2.pb != b2);

                B b1 = b2.pb;
                test(b1 != null);
                test(b1.ice_id().Equals("::Test::D1"));
                test(b1.sb.Equals("D1.sb"));
                test(b1.pb == b2);
                D1 d1 = (D1) b1;
                test(d1 != null);
                test(d1.sd1.Equals("D1.sd1"));
                test(d1.pd1 == b2);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("unknown derived pointer slicing as base (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_D2AsB().whenCompleted(
                (B b2) =>
                {
                    test(b2 != null);
                    test(b2.ice_id().Equals("::Test::B"));
                    test(b2.sb.Equals("D2.sb"));
                    test(b2.pb != null);
                    test(b2.pb != b2);

                    B b1 = b2.pb;
                    test(b1 != null);
                    test(b1.ice_id().Equals("::Test::D1"));
                    test(b1.sb.Equals("D1.sb"));
                    test(b1.pb == b2);
                    D1 d1 = (D1) b1;
                    test(d1 != null);
                    test(d1.sd1.Equals("D1.sd1"));
                    test(d1.pd1 == b2);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }

        {
            B b2 = testPrx.D2AsBAsync().Result;
            test(b2 != null);
            test(b2.ice_id().Equals("::Test::B"));
            test(b2.sb.Equals("D2.sb"));
            test(b2.pb != null);
            test(b2.pb != b2);

            B b1 = b2.pb;
            test(b1 != null);
            test(b1.ice_id().Equals("::Test::D1"));
            test(b1.sb.Equals("D1.sb"));
            test(b1.pb == b2);
            D1 d1 = (D1)b1;
            test(d1 != null);
            test(d1.sd1.Equals("D1.sd1"));
            test(d1.pd1 == b2);
        }
        WriteLine("ok");

        Write("param ptr slicing with known first... ");
        Flush();
        {
            try
            {
                B b1;
                B b2;
                testPrx.paramTest1(out b1, out b2);

                test(b1 != null);
                test(b1.ice_id().Equals("::Test::D1"));
                test(b1.sb.Equals("D1.sb"));
                test(b1.pb == b2);
                D1 d1 = (D1) b1;
                test(d1 != null);
                test(d1.sd1.Equals("D1.sd1"));
                test(d1.pd1 == b2);

                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
                test(b2.sb.Equals("D2.sb"));
                test(b2.pb == b1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("param ptr slicing with known first (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_paramTest1().whenCompleted(
                (B b1, B b2) =>
                {
                    test(b1 != null);
                    test(b1.ice_id().Equals("::Test::D1"));
                    test(b1.sb.Equals("D1.sb"));
                    test(b1.pb == b2);
                    D1 d1 = (D1) b1;
                    test(d1 != null);
                    test(d1.sd1.Equals("D1.sd1"));
                    test(d1.pd1 == b2);

                    test(b2 != null);
                    test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
                    test(b2.sb.Equals("D2.sb"));
                    test(b2.pb == b1);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            var result = testPrx.paramTest1Async().Result;
            B b1 = result.p1;
            B b2 = result.p2;

            test(b1 != null);
            test(b1.ice_id().Equals("::Test::D1"));
            test(b1.sb.Equals("D1.sb"));
            test(b1.pb == b2);
            D1 d1 = (D1)b1;
            test(d1 != null);
            test(d1.sd1.Equals("D1.sd1"));
            test(d1.pd1 == b2);

            test(b2 != null);
            test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
            test(b2.sb.Equals("D2.sb"));
            test(b2.pb == b1);
        }
        WriteLine("ok");

        Write("param ptr slicing with unknown first... ");
        Flush();
        {
            try
            {
                B b2;
                B b1;
                testPrx.paramTest2(out b2, out b1);

                test(b1 != null);
                test(b1.ice_id().Equals("::Test::D1"));
                test(b1.sb.Equals("D1.sb"));
                test(b1.pb == b2);
                D1 d1 = (D1) b1;
                test(d1 != null);
                test(d1.sd1.Equals("D1.sd1"));
                test(d1.pd1 == b2);

                test(b2 != null);
                test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
                test(b2.sb.Equals("D2.sb"));
                test(b2.pb == b1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("param ptr slicing with unknown first (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_paramTest2().whenCompleted(
                (B b2, B b1) =>
                {
                    test(b1 != null);
                    test(b1.ice_id().Equals("::Test::D1"));
                    test(b1.sb.Equals("D1.sb"));
                    test(b1.pb == b2);
                    D1 d1 = (D1) b1;
                    test(d1 != null);
                    test(d1.sd1.Equals("D1.sd1"));
                    test(d1.pd1 == b2);

                    test(b2 != null);
                    test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
                    test(b2.sb.Equals("D2.sb"));
                    test(b2.pb == b1);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }

        {
            var result = testPrx.paramTest2Async().Result;
            B b2 = result.p2;
            B b1 = result.p1;
            test(b1 != null);
            test(b1.ice_id().Equals("::Test::D1"));
            test(b1.sb.Equals("D1.sb"));
            test(b1.pb == b2);
            D1 d1 = (D1)b1;
            test(d1 != null);
            test(d1.sd1.Equals("D1.sd1"));
            test(d1.pd1 == b2);

            test(b2 != null);
            test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
            test(b2.sb.Equals("D2.sb"));
            test(b2.pb == b1);
        }
        WriteLine("ok");

        Write("return value identity with known first... ");
        Flush();
        {
            try
            {
                B p1;
                B p2;
                B ret = testPrx.returnTest1(out p1, out p2);
                test(ret == p1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("return value identity with known first (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_returnTest1().whenCompleted(
                (B r, B p1, B p2) =>
                {
                    test(r == p1);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            var result = testPrx.returnTest1Async().Result;
            test(result.returnValue == result.p1);
        }
        WriteLine("ok");

        Write("return value identity with unknown first... ");
        Flush();
        {
            try
            {
                B p1;
                B p2;
                B ret = testPrx.returnTest2(out p1, out p2);
                test(ret == p1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("return value identity with unknown first (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_returnTest2().whenCompleted(
                (B r, B p1, B p2) =>
                {
                    test(r == p1);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            var result = testPrx.returnTest2Async().Result;
            test(result.returnValue == result.p2);
        }
        WriteLine("ok");

        Write("return value identity for input params known first... ");
        Flush();
        {
            try
            {
                D1 d1 = new D1();
                d1.sb = "D1.sb";
                d1.sd1 = "D1.sd1";
                D3 d3 = new D3();
                d3.pb = d1;
                d3.sb = "D3.sb";
                d3.sd3 = "D3.sd3";
                d3.pd3 = d1;
                d1.pb = d3;
                d1.pd1 = d3;

                B b1 = testPrx.returnTest3(d1, d3);

                test(b1 != null);
                test(b1.sb.Equals("D1.sb"));
                test(b1.ice_id().Equals("::Test::D1"));
                D1 p1 = (D1) b1;
                test(p1 != null);
                test(p1.sd1.Equals("D1.sd1"));
                test(p1.pd1 == b1.pb);

                B b2 = b1.pb;
                test(b2 != null);
                test(b2.sb.Equals("D3.sb"));
                test(b2.ice_id().Equals("::Test::B")); // Sliced by server
                test(b2.pb == b1);
                try
                {
                    D3 p3 = (D3) b2;
                    test(false);
                    D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable.
                }
                catch(InvalidCastException)
                {
                }

                test(b1 != d1);
                test(b1 != d3);
                test(b2 != d1);
                test(b2 != d3);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("return value identity for input params known first (AMI)... ");
        Flush();
        {
            D1 d1 = new D1();
            d1.sb = "D1.sb";
            d1.sd1 = "D1.sd1";
            D3 d3 = new D3();
            d3.pb = d1;
            d3.sb = "D3.sb";
            d3.sd3 = "D3.sd3";
            d3.pd3 = d1;
            d1.pb = d3;
            d1.pd1 = d3;

            B b1 = null;
            Callback cb = new Callback();
            testPrx.begin_returnTest3(d1, d3).whenCompleted(
                (B b) =>
                {
                    b1 = b;
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();

            test(b1 != null);
            test(b1.sb.Equals("D1.sb"));
            test(b1.ice_id().Equals("::Test::D1"));
            D1 p1 = (D1) b1;
            test(p1 != null);
            test(p1.sd1.Equals("D1.sd1"));
            test(p1.pd1 == b1.pb);

            B b2 = b1.pb;
            test(b2 != null);
            test(b2.sb.Equals("D3.sb"));
            test(b2.ice_id().Equals("::Test::B")); // Sliced by server
            test(b2.pb == b1);
            try
            {
                D3 p3 = (D3) b2;
                test(false);
                D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable.
            }
            catch(InvalidCastException)
            {
            }

            test(b1 != d1);
            test(b1 != d3);
            test(b2 != d1);
            test(b2 != d3);
        }

        {
            D1 d1 = new D1();
            d1.sb = "D1.sb";
            d1.sd1 = "D1.sd1";
            D3 d3 = new D3();
            d3.pb = d1;
            d3.sb = "D3.sb";
            d3.sd3 = "D3.sd3";
            d3.pd3 = d1;
            d1.pb = d3;
            d1.pd1 = d3;

            B b1 = testPrx.returnTest3Async(d1, d3).Result;

            test(b1 != null);
            test(b1.sb.Equals("D1.sb"));
            test(b1.ice_id().Equals("::Test::D1"));
            D1 p1 = (D1)b1;
            test(p1 != null);
            test(p1.sd1.Equals("D1.sd1"));
            test(p1.pd1 == b1.pb);

            B b2 = b1.pb;
            test(b2 != null);
            test(b2.sb.Equals("D3.sb"));
            test(b2.ice_id().Equals("::Test::B")); // Sliced by server
            test(b2.pb == b1);
            try
            {
                D3 p3 = (D3)b2;
                test(false);
                D3 tmp = p3;
                p3 = tmp; // Stop compiler warning about unused variable.
            }
            catch(InvalidCastException)
            {
            }

            test(b1 != d1);
            test(b1 != d3);
            test(b2 != d1);
            test(b2 != d3);
        }
        WriteLine("ok");

        Write("return value identity for input params unknown first... ");
        Flush();
        {
            try
            {
                D1 d1 = new D1();
                d1.sb = "D1.sb";
                d1.sd1 = "D1.sd1";
                D3 d3 = new D3();
                d3.pb = d1;
                d3.sb = "D3.sb";
                d3.sd3 = "D3.sd3";
                d3.pd3 = d1;
                d1.pb = d3;
                d1.pd1 = d3;

                B b1 = testPrx.returnTest3(d3, d1);

                test(b1 != null);
                test(b1.sb.Equals("D3.sb"));
                test(b1.ice_id().Equals("::Test::B")); // Sliced by server

                try
                {
                    D3 p1 = (D3) b1;
                    test(false);
                    D3 tmp = p1; p1 = tmp; // Stop compiler warning about unused variable.
                }
                catch(InvalidCastException)
                {
                }

                B b2 = b1.pb;
                test(b2 != null);
                test(b2.sb.Equals("D1.sb"));
                test(b2.ice_id().Equals("::Test::D1"));
                test(b2.pb == b1);
                D1 p3 = (D1) b2;
                test(p3 != null);
                test(p3.sd1.Equals("D1.sd1"));
                test(p3.pd1 == b1);

                test(b1 != d1);
                test(b1 != d3);
                test(b2 != d1);
                test(b2 != d3);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("return value identity for input params unknown first (AMI)... ");
        Flush();
        {
            D1 d1 = new D1();
            d1.sb = "D1.sb";
            d1.sd1 = "D1.sd1";
            D3 d3 = new D3();
            d3.pb = d1;
            d3.sb = "D3.sb";
            d3.sd3 = "D3.sd3";
            d3.pd3 = d1;
            d1.pb = d3;
            d1.pd1 = d3;

            B b1 = null;
            Callback cb = new Callback();
            testPrx.begin_returnTest3(d3, d1).whenCompleted(
                (B b) =>
                {
                    b1 = b;
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();

            test(b1 != null);
            test(b1.sb.Equals("D3.sb"));
            test(b1.ice_id().Equals("::Test::B")); // Sliced by server

            try
            {
                D3 p1 = (D3)b1;
                test(false);
                D3 tmp = p1;
                p1 = tmp; // Stop compiler warning about unused variable.
            }
            catch(InvalidCastException)
            {
            }

            B b2 = b1.pb;
            test(b2 != null);
            test(b2.sb.Equals("D1.sb"));
            test(b2.ice_id().Equals("::Test::D1"));
            test(b2.pb == b1);
            D1 p3 = (D1)b2;
            test(p3 != null);
            test(p3.sd1.Equals("D1.sd1"));
            test(p3.pd1 == b1);

            test(b1 != d1);
            test(b1 != d3);
            test(b2 != d1);
            test(b2 != d3);
        }

        {
            D1 d1 = new D1();
            d1.sb = "D1.sb";
            d1.sd1 = "D1.sd1";
            D3 d3 = new D3();
            d3.pb = d1;
            d3.sb = "D3.sb";
            d3.sd3 = "D3.sd3";
            d3.pd3 = d1;
            d1.pb = d3;
            d1.pd1 = d3;

            B b1 = testPrx.returnTest3Async(d3, d1).Result;

            test(b1 != null);
            test(b1.sb.Equals("D3.sb"));
            test(b1.ice_id().Equals("::Test::B")); // Sliced by server

            try
            {
                D3 p1 = (D3)b1;
                test(false);
                D3 tmp = p1;
                p1 = tmp; // Stop compiler warning about unused variable.
            }
            catch(InvalidCastException)
            {
            }

            B b2 = b1.pb;
            test(b2 != null);
            test(b2.sb.Equals("D1.sb"));
            test(b2.ice_id().Equals("::Test::D1"));
            test(b2.pb == b1);
            D1 p3 = (D1)b2;
            test(p3 != null);
            test(p3.sd1.Equals("D1.sd1"));
            test(p3.pd1 == b1);

            test(b1 != d1);
            test(b1 != d3);
            test(b2 != d1);
            test(b2 != d3);
        }
        WriteLine("ok");

        Write("remainder unmarshaling (3 instances)... ");
        Flush();
        {
            try
            {
                B p1;
                B p2;
                B ret = testPrx.paramTest3(out p1, out p2);

                test(p1 != null);
                test(p1.sb.Equals("D2.sb (p1 1)"));
                test(p1.pb == null);
                test(p1.ice_id().Equals("::Test::B"));

                test(p2 != null);
                test(p2.sb.Equals("D2.sb (p2 1)"));
                test(p2.pb == null);
                test(p2.ice_id().Equals("::Test::B"));

                test(ret != null);
                test(ret.sb.Equals("D1.sb (p2 2)"));
                test(ret.pb == null);
                test(ret.ice_id().Equals("::Test::D1"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("remainder unmarshaling (3 instances) (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_paramTest3().whenCompleted(
                (B ret, B p1, B p2) =>
                {
                    test(p1 != null);
                    test(p1.sb.Equals("D2.sb (p1 1)"));
                    test(p1.pb == null);
                    test(p1.ice_id().Equals("::Test::B"));

                    test(p2 != null);
                    test(p2.sb.Equals("D2.sb (p2 1)"));
                    test(p2.pb == null);
                    test(p2.ice_id().Equals("::Test::B"));

                    test(ret != null);
                    test(ret.sb.Equals("D1.sb (p2 2)"));
                    test(ret.pb == null);
                    test(ret.ice_id().Equals("::Test::D1"));
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            var result = testPrx.paramTest3Async().Result;

            B ret = result.returnValue;
            B p1 = result.p1;
            B p2 = result.p2;
            test(p1 != null);
            test(p1.sb.Equals("D2.sb (p1 1)"));
            test(p1.pb == null);
            test(p1.ice_id().Equals("::Test::B"));

            test(p2 != null);
            test(p2.sb.Equals("D2.sb (p2 1)"));
            test(p2.pb == null);
            test(p2.ice_id().Equals("::Test::B"));

            test(ret != null);
            test(ret.sb.Equals("D1.sb (p2 2)"));
            test(ret.pb == null);
            test(ret.ice_id().Equals("::Test::D1"));
        }
        WriteLine("ok");

        Write("remainder unmarshaling (4 instances)... ");
        Flush();
        {
            try
            {
                B b;
                B ret = testPrx.paramTest4(out b);

                test(b != null);
                test(b.sb.Equals("D4.sb (1)"));
                test(b.pb == null);
                test(b.ice_id().Equals("::Test::B"));

                test(ret != null);
                test(ret.sb.Equals("B.sb (2)"));
                test(ret.pb == null);
                test(ret.ice_id().Equals("::Test::B"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("remainder unmarshaling (4 instances) (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_paramTest4().whenCompleted(
                (B ret, B b) =>
                {
                    test(b != null);
                    test(b.sb.Equals("D4.sb (1)"));
                    test(b.pb == null);
                    test(b.ice_id().Equals("::Test::B"));

                    test(ret != null);
                    test(ret.sb.Equals("B.sb (2)"));
                    test(ret.pb == null);
                    test(ret.ice_id().Equals("::Test::B"));
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }

        {
            var result = testPrx.paramTest4Async().Result;
            B ret = result.returnValue;
            B b = result.p;

            test(b != null);
            test(b.sb.Equals("D4.sb (1)"));
            test(b.pb == null);
            test(b.ice_id().Equals("::Test::B"));

            test(ret != null);
            test(ret.sb.Equals("B.sb (2)"));
            test(ret.pb == null);
            test(ret.ice_id().Equals("::Test::B"));
        }
        WriteLine("ok");

        Write("param ptr slicing, instance marshaled in unknown derived as base... ");
        Flush();
        {
            try
            {
                B b1 = new B();
                b1.sb = "B.sb(1)";
                b1.pb = b1;

                D3 d3 = new D3();
                d3.sb = "D3.sb";
                d3.pb = d3;
                d3.sd3 = "D3.sd3";
                d3.pd3 = b1;

                B b2 = new B();
                b2.sb = "B.sb(2)";
                b2.pb = b1;

                B ret = testPrx.returnTest3(d3, b2);

                test(ret != null);
                test(ret.ice_id().Equals("::Test::B"));
                test(ret.sb.Equals("D3.sb"));
                test(ret.pb == ret);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("param ptr slicing, instance marshaled in unknown derived as base (AMI)... ");
        Flush();
        {
            B b1 = new B();
            b1.sb = "B.sb(1)";
            b1.pb = b1;

            D3 d3 = new D3();
            d3.sb = "D3.sb";
            d3.pb = d3;
            d3.sd3 = "D3.sd3";
            d3.pd3 = b1;

            B b2 = new B();
            b2.sb = "B.sb(2)";
            b2.pb = b1;

            B rv = null;
            Callback cb = new Callback();
            testPrx.begin_returnTest3(d3, b2).whenCompleted(
                (B b) =>
                {
                    rv = b;
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();

            test(rv != null);
            test(rv.ice_id().Equals("::Test::B"));
            test(rv.sb.Equals("D3.sb"));
            test(rv.pb == rv);
        }

        {
            B b1 = new B();
            b1.sb = "B.sb(1)";
            b1.pb = b1;

            D3 d3 = new D3();
            d3.sb = "D3.sb";
            d3.pb = d3;
            d3.sd3 = "D3.sd3";
            d3.pd3 = b1;

            B b2 = new B();
            b2.sb = "B.sb(2)";
            b2.pb = b1;

            B rv = testPrx.returnTest3Async(d3, b2).Result;

            test(rv != null);
            test(rv.ice_id().Equals("::Test::B"));
            test(rv.sb.Equals("D3.sb"));
            test(rv.pb == rv);
        }
        WriteLine("ok");

        Write("param ptr slicing, instance marshaled in unknown derived as derived... ");
        Flush();
        {
            try
            {
                D1 d11 = new D1();
                d11.sb = "D1.sb(1)";
                d11.pb = d11;
                d11.sd1 = "D1.sd1(1)";

                D3 d3 = new D3();
                d3.sb = "D3.sb";
                d3.pb = d3;
                d3.sd3 = "D3.sd3";
                d3.pd3 = d11;

                D1 d12 = new D1();
                d12.sb = "D1.sb(2)";
                d12.pb = d12;
                d12.sd1 = "D1.sd1(2)";
                d12.pd1 = d11;

                B ret = testPrx.returnTest3(d3, d12);
                test(ret != null);
                test(ret.ice_id().Equals("::Test::B"));
                test(ret.sb.Equals("D3.sb"));
                test(ret.pb == ret);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... ");
        Flush();
        {
            D1 d11 = new D1();
            d11.sb = "D1.sb(1)";
            d11.pb = d11;
            d11.sd1 = "D1.sd1(1)";

            D3 d3 = new D3();
            d3.sb = "D3.sb";
            d3.pb = d3;
            d3.sd3 = "D3.sd3";
            d3.pd3 = d11;

            D1 d12 = new D1();
            d12.sb = "D1.sb(2)";
            d12.pb = d12;
            d12.sd1 = "D1.sd1(2)";
            d12.pd1 = d11;

            B rv = null;
            Callback cb = new Callback();
            testPrx.begin_returnTest3(d3, d12).whenCompleted(
                (B b) =>
                {
                    rv = b;
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();

            test(rv != null);
            test(rv.ice_id().Equals("::Test::B"));
            test(rv.sb.Equals("D3.sb"));
            test(rv.pb == rv);
        }

        {
            D1 d11 = new D1();
            d11.sb = "D1.sb(1)";
            d11.pb = d11;
            d11.sd1 = "D1.sd1(1)";

            D3 d3 = new D3();
            d3.sb = "D3.sb";
            d3.pb = d3;
            d3.sd3 = "D3.sd3";
            d3.pd3 = d11;

            D1 d12 = new D1();
            d12.sb = "D1.sb(2)";
            d12.pb = d12;
            d12.sd1 = "D1.sd1(2)";
            d12.pd1 = d11;

            B rv = testPrx.returnTest3Async(d3, d12).Result;

            test(rv != null);
            test(rv.ice_id().Equals("::Test::B"));
            test(rv.sb.Equals("D3.sb"));
            test(rv.pb == rv);
        }
        WriteLine("ok");

        Write("sequence slicing... ");
        Flush();
        {
            try
            {
                SS3 ss;
                {
                    B ss1b = new B();
                    ss1b.sb = "B.sb";
                    ss1b.pb = ss1b;

                    D1 ss1d1 = new D1();
                    ss1d1.sb = "D1.sb";
                    ss1d1.sd1 = "D1.sd1";
                    ss1d1.pb = ss1b;

                    D3 ss1d3 = new D3();
                    ss1d3.sb = "D3.sb";
                    ss1d3.sd3 = "D3.sd3";
                    ss1d3.pb = ss1b;

                    B ss2b = new B();
                    ss2b.sb = "B.sb";
                    ss2b.pb = ss1b;

                    D1 ss2d1 = new D1();
                    ss2d1.sb = "D1.sb";
                    ss2d1.sd1 = "D1.sd1";
                    ss2d1.pb = ss2b;

                    D3 ss2d3 = new D3();
                    ss2d3.sb = "D3.sb";
                    ss2d3.sd3 = "D3.sd3";
                    ss2d3.pb = ss2b;

                    ss1d1.pd1 = ss2b;
                    ss1d3.pd3 = ss2d1;

                    ss2d1.pd1 = ss1d3;
                    ss2d3.pd3 = ss1d1;

                    SS1 ss1 = new SS1();
                    ss1.s = new B[3];
                    ss1.s[0] = ss1b;
                    ss1.s[1] = ss1d1;
                    ss1.s[2] = ss1d3;

                    SS2 ss2 = new SS2();
                    ss2.s = new B[3];
                    ss2.s[0] = ss2b;
                    ss2.s[1] = ss2d1;
                    ss2.s[2] = ss2d3;

                    ss = testPrx.sequenceTest(ss1, ss2);
                }

                test(ss.c1 != null);
                B ss1b2 = ss.c1.s[0];
                B ss1d2 = ss.c1.s[1];
                test(ss.c2 != null);
                B ss1d4 = ss.c1.s[2];

                test(ss.c2 != null);
                B ss2b2 = ss.c2.s[0];
                B ss2d2 = ss.c2.s[1];
                B ss2d4 = ss.c2.s[2];

                test(ss1b2.pb == ss1b2);
                test(ss1d2.pb == ss1b2);
                test(ss1d4.pb == ss1b2);

                test(ss2b2.pb == ss1b2);
                test(ss2d2.pb == ss2b2);
                test(ss2d4.pb == ss2b2);

                test(ss1b2.ice_id().Equals("::Test::B"));
                test(ss1d2.ice_id().Equals("::Test::D1"));
                test(ss1d4.ice_id().Equals("::Test::B"));

                test(ss2b2.ice_id().Equals("::Test::B"));
                test(ss2d2.ice_id().Equals("::Test::D1"));
                test(ss2d4.ice_id().Equals("::Test::B"));
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("sequence slicing (AMI)... ");
        Flush();
        {
            SS3 ss = null;
            {
                B ss1b = new B();
                ss1b.sb = "B.sb";
                ss1b.pb = ss1b;

                D1 ss1d1 = new D1();
                ss1d1.sb = "D1.sb";
                ss1d1.sd1 = "D1.sd1";
                ss1d1.pb = ss1b;

                D3 ss1d3 = new D3();
                ss1d3.sb = "D3.sb";
                ss1d3.sd3 = "D3.sd3";
                ss1d3.pb = ss1b;

                B ss2b = new B();
                ss2b.sb = "B.sb";
                ss2b.pb = ss1b;

                D1 ss2d1 = new D1();
                ss2d1.sb = "D1.sb";
                ss2d1.sd1 = "D1.sd1";
                ss2d1.pb = ss2b;

                D3 ss2d3 = new D3();
                ss2d3.sb = "D3.sb";
                ss2d3.sd3 = "D3.sd3";
                ss2d3.pb = ss2b;

                ss1d1.pd1 = ss2b;
                ss1d3.pd3 = ss2d1;

                ss2d1.pd1 = ss1d3;
                ss2d3.pd3 = ss1d1;

                SS1 ss1 = new SS1();
                ss1.s = new B[3];
                ss1.s[0] = ss1b;
                ss1.s[1] = ss1d1;
                ss1.s[2] = ss1d3;

                SS2 ss2 = new SS2();
                ss2.s = new B[3];
                ss2.s[0] = ss2b;
                ss2.s[1] = ss2d1;
                ss2.s[2] = ss2d3;

                Callback cb = new Callback();
                testPrx.begin_sequenceTest(ss1, ss2).whenCompleted(
                    (SS3 s) =>
                    {
                        ss = s;
                        cb.called();
                    },
                    (Ice.Exception ex) =>
                    {
                        test(false);
                    });
                cb.check();
            }
            test(ss.c1 != null);
            B ss1b3 = ss.c1.s[0];
            B ss1d5 = ss.c1.s[1];
            test(ss.c2 != null);
            B ss1d6 = ss.c1.s[2];

            test(ss.c2 != null);
            B ss2b3 = ss.c2.s[0];
            B ss2d5 = ss.c2.s[1];
            B ss2d6 = ss.c2.s[2];

            test(ss1b3.pb == ss1b3);
            test(ss1d6.pb == ss1b3);
            test(ss1d6.pb == ss1b3);

            test(ss2b3.pb == ss1b3);
            test(ss2d6.pb == ss2b3);
            test(ss2d6.pb == ss2b3);

            test(ss1b3.ice_id().Equals("::Test::B"));
            test(ss1d5.ice_id().Equals("::Test::D1"));
            test(ss1d6.ice_id().Equals("::Test::B"));

            test(ss2b3.ice_id().Equals("::Test::B"));
            test(ss2d5.ice_id().Equals("::Test::D1"));
            test(ss2d6.ice_id().Equals("::Test::B"));
        }

        {
            SS3 ss = null;
            {
                B ss1b = new B();
                ss1b.sb = "B.sb";
                ss1b.pb = ss1b;

                D1 ss1d1 = new D1();
                ss1d1.sb = "D1.sb";
                ss1d1.sd1 = "D1.sd1";
                ss1d1.pb = ss1b;

                D3 ss1d3 = new D3();
                ss1d3.sb = "D3.sb";
                ss1d3.sd3 = "D3.sd3";
                ss1d3.pb = ss1b;

                B ss2b = new B();
                ss2b.sb = "B.sb";
                ss2b.pb = ss1b;

                D1 ss2d1 = new D1();
                ss2d1.sb = "D1.sb";
                ss2d1.sd1 = "D1.sd1";
                ss2d1.pb = ss2b;

                D3 ss2d3 = new D3();
                ss2d3.sb = "D3.sb";
                ss2d3.sd3 = "D3.sd3";
                ss2d3.pb = ss2b;

                ss1d1.pd1 = ss2b;
                ss1d3.pd3 = ss2d1;

                ss2d1.pd1 = ss1d3;
                ss2d3.pd3 = ss1d1;

                SS1 ss1 = new SS1();
                ss1.s = new B[3];
                ss1.s[0] = ss1b;
                ss1.s[1] = ss1d1;
                ss1.s[2] = ss1d3;

                SS2 ss2 = new SS2();
                ss2.s = new B[3];
                ss2.s[0] = ss2b;
                ss2.s[1] = ss2d1;
                ss2.s[2] = ss2d3;

                ss = testPrx.sequenceTestAsync(ss1, ss2).Result;
            }
            test(ss.c1 != null);
            B ss1b3 = ss.c1.s[0];
            B ss1d5 = ss.c1.s[1];
            test(ss.c2 != null);
            B ss1d6 = ss.c1.s[2];

            test(ss.c2 != null);
            B ss2b3 = ss.c2.s[0];
            B ss2d5 = ss.c2.s[1];
            B ss2d6 = ss.c2.s[2];

            test(ss1b3.pb == ss1b3);
            test(ss1d6.pb == ss1b3);
            test(ss1d6.pb == ss1b3);

            test(ss2b3.pb == ss1b3);
            test(ss2d6.pb == ss2b3);
            test(ss2d6.pb == ss2b3);

            test(ss1b3.ice_id().Equals("::Test::B"));
            test(ss1d5.ice_id().Equals("::Test::D1"));
            test(ss1d6.ice_id().Equals("::Test::B"));

            test(ss2b3.ice_id().Equals("::Test::B"));
            test(ss2d5.ice_id().Equals("::Test::D1"));
            test(ss2d6.ice_id().Equals("::Test::B"));
        }
        WriteLine("ok");

        Write("dictionary slicing... ");
        Flush();
        {
            try
            {
                Dictionary<int, B> bin = new Dictionary<int, B>();
                Dictionary<int, B> bout;
                Dictionary<int, B> ret;
                int i;
                for(i = 0; i < 10; ++i)
                {
                    string s = "D1." + i.ToString();
                    D1 d1 = new D1();
                    d1.sb = s;
                    d1.pb = d1;
                    d1.sd1 = s;
                    bin[i] = d1;
                }

                ret = testPrx.dictionaryTest(bin, out bout);

                test(bout.Count == 10);
                for(i = 0; i < 10; ++i)
                {
                    B b = bout[i * 10];
                    test(b != null);
                    string s = "D1." + i.ToString();
                    test(b.sb.Equals(s));
                    test(b.pb != null);
                    test(b.pb != b);
                    test(b.pb.sb.Equals(s));
                    test(b.pb.pb == b.pb);
                }

                test(ret.Count == 10);
                for(i = 0; i < 10; ++i)
                {
                    B b = ret[i * 20];
                    test(b != null);
                    string s = "D1." + (i * 20).ToString();
                    test(b.sb.Equals(s));
                    test(b.pb == (i == 0 ? (B)null : ret[(i - 1) * 20]));
                    D1 d1 = (D1) b;
                    test(d1 != null);
                    test(d1.sd1.Equals(s));
                    test(d1.pd1 == d1);
                }
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("dictionary slicing (AMI)... ");
        Flush();
        {
            Dictionary<int, B> bin = new Dictionary<int, B>();
            Dictionary<int, B> bout = null;
            Dictionary<int, B> rv = null;
            int i;
            for(i = 0; i < 10; ++i)
            {
                string s = "D1." + i.ToString();
                D1 d1 = new D1();
                d1.sb = s;
                d1.pb = d1;
                d1.sd1 = s;
                bin[i] = d1;
            }

            Callback cb = new Callback();
            testPrx.begin_dictionaryTest(bin).whenCompleted(
                (Dictionary<int, B> r, Dictionary<int, B> b) =>
                {
                    rv = (Dictionary<int, B>)r;
                    bout = (Dictionary<int, B>)b;
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();

            test(bout.Count == 10);
            for(i = 0; i < 10; ++i)
            {
                B b = bout[i * 10];
                test(b != null);
                string s = "D1." + i.ToString();
                test(b.sb.Equals(s));
                test(b.pb != null);
                test(b.pb != b);
                test(b.pb.sb.Equals(s));
                test(b.pb.pb == b.pb);
            }

            test(rv.Count == 10);
            for(i = 0; i < 10; ++i)
            {
                B b = rv[i * 20];
                test(b != null);
                string s = "D1." + (i * 20).ToString();
                test(b.sb.Equals(s));
                test(b.pb == (i == 0 ? (B)null : rv[(i - 1) * 20]));
                D1 d1 = (D1) b;
                test(d1 != null);
                test(d1.sd1.Equals(s));
                test(d1.pd1 == d1);
            }
        }

        {
            Dictionary<int, B> bin = new Dictionary<int, B>();
            Dictionary<int, B> bout = null;
            Dictionary<int, B> rv = null;
            int i;
            for(i = 0; i < 10; ++i)
            {
                string s = "D1." + i.ToString();
                D1 d1 = new D1();
                d1.sb = s;
                d1.pb = d1;
                d1.sd1 = s;
                bin[i] = d1;
            }

            var result = testPrx.dictionaryTestAsync(bin).Result;
            rv = result.returnValue;
            bout = result.bout;

            test(bout.Count == 10);
            for(i = 0; i < 10; ++i)
            {
                B b = bout[i * 10];
                test(b != null);
                string s = "D1." + i.ToString();
                test(b.sb.Equals(s));
                test(b.pb != null);
                test(b.pb != b);
                test(b.pb.sb.Equals(s));
                test(b.pb.pb == b.pb);
            }

            test(rv.Count == 10);
            for(i = 0; i < 10; ++i)
            {
                B b = rv[i * 20];
                test(b != null);
                string s = "D1." + (i * 20).ToString();
                test(b.sb.Equals(s));
                test(b.pb == (i == 0 ? (B)null : rv[(i - 1) * 20]));
                D1 d1 = (D1)b;
                test(d1 != null);
                test(d1.sd1.Equals(s));
                test(d1.pd1 == d1);
            }
        }
        WriteLine("ok");

        Write("base exception thrown as base exception... ");
        Flush();
        {
            try
            {
                testPrx.throwBaseAsBase();
                test(false);
            }
            catch(BaseException e)
            {
                test(e.GetType().FullName.Equals("Test.BaseException"));
                test(e.sbe.Equals("sbe"));
                test(e.pb != null);
                test(e.pb.sb.Equals("sb"));
                test(e.pb.pb == e.pb);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("base exception thrown as base exception (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_throwBaseAsBase().whenCompleted(
                () =>
                {
                    test(false);
                },
                (Ice.Exception ex) =>
                {
                    try
                    {
                        BaseException e = (BaseException)ex;
                        test(e.sbe.Equals("sbe"));
                        test(e.pb != null);
                        test(e.pb.sb.Equals("sb"));
                        test(e.pb.pb == e.pb);
                    }
                    catch(Exception)
                    {
                        test(false);
                    }
                    cb.called();
                });
            cb.check();
        }
        {
            try
            {
                testPrx.throwBaseAsBaseAsync().Wait();
            }
            catch(AggregateException ae)
            {
                try
                {
                    BaseException e = (BaseException)ae.InnerException;
                    test(e.sbe.Equals("sbe"));
                    test(e.pb != null);
                    test(e.pb.sb.Equals("sb"));
                    test(e.pb.pb == e.pb);
                }
                catch(Exception)
                {
                    test(false);
                }
            }
        }
        WriteLine("ok");

        Write("derived exception thrown as base exception... ");
        Flush();
        {
            try
            {
                testPrx.throwDerivedAsBase();
                test(false);
            }
            catch(DerivedException e)
            {
                test(e.GetType().FullName.Equals("Test.DerivedException"));
                test(e.sbe.Equals("sbe"));
                test(e.pb != null);
                test(e.pb.sb.Equals("sb1"));
                test(e.pb.pb == e.pb);
                test(e.sde.Equals("sde1"));
                test(e.pd1 != null);
                test(e.pd1.sb.Equals("sb2"));
                test(e.pd1.pb == e.pd1);
                test(e.pd1.sd1.Equals("sd2"));
                test(e.pd1.pd1 == e.pd1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("derived exception thrown as base exception (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_throwDerivedAsBase().whenCompleted(
                () =>
                {
                    test(false);
                },
                (Ice.Exception ex) =>
                {
                    try
                    {
                        DerivedException e = (DerivedException)ex;
                        test(e.sbe.Equals("sbe"));
                        test(e.pb != null);
                        test(e.pb.sb.Equals("sb1"));
                        test(e.pb.pb == e.pb);
                        test(e.sde.Equals("sde1"));
                        test(e.pd1 != null);
                        test(e.pd1.sb.Equals("sb2"));
                        test(e.pd1.pb == e.pd1);
                        test(e.pd1.sd1.Equals("sd2"));
                        test(e.pd1.pd1 == e.pd1);
                    }
                    catch(Exception)
                    {
                        test(false);
                    }
                    cb.called();
                });
            cb.check();
        }

        {
            try
            {
                testPrx.throwDerivedAsBaseAsync().Wait();
            }
            catch(AggregateException ae)
            {
                try
                {
                    DerivedException e = (DerivedException)ae.InnerException;
                    test(e.sbe.Equals("sbe"));
                    test(e.pb != null);
                    test(e.pb.sb.Equals("sb1"));
                    test(e.pb.pb == e.pb);
                    test(e.sde.Equals("sde1"));
                    test(e.pd1 != null);
                    test(e.pd1.sb.Equals("sb2"));
                    test(e.pd1.pb == e.pd1);
                    test(e.pd1.sd1.Equals("sd2"));
                    test(e.pd1.pd1 == e.pd1);
                }
                catch(Exception)
                {
                    test(false);
                }
            }
        }
        WriteLine("ok");

        Write("derived exception thrown as derived exception... ");
        Flush();
        {
            try
            {
                testPrx.throwDerivedAsDerived();
                test(false);
            }
            catch(DerivedException e)
            {
                test(e.GetType().FullName.Equals("Test.DerivedException"));
                test(e.sbe.Equals("sbe"));
                test(e.pb != null);
                test(e.pb.sb.Equals("sb1"));
                test(e.pb.pb == e.pb);
                test(e.sde.Equals("sde1"));
                test(e.pd1 != null);
                test(e.pd1.sb.Equals("sb2"));
                test(e.pd1.pb == e.pd1);
                test(e.pd1.sd1.Equals("sd2"));
                test(e.pd1.pd1 == e.pd1);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("derived exception thrown as derived exception (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_throwDerivedAsDerived().whenCompleted(
                () =>
                {
                    test(false);
                },
                (Ice.Exception ex) =>
                {
                    try
                    {
                        DerivedException e = (DerivedException)ex;
                        test(e.sbe.Equals("sbe"));
                        test(e.pb != null);
                        test(e.pb.sb.Equals("sb1"));
                        test(e.pb.pb == e.pb);
                        test(e.sde.Equals("sde1"));
                        test(e.pd1 != null);
                        test(e.pd1.sb.Equals("sb2"));
                        test(e.pd1.pb == e.pd1);
                        test(e.pd1.sd1.Equals("sd2"));
                        test(e.pd1.pd1 == e.pd1);
                    }
                    catch(Exception)
                    {
                        test(false);
                    }
                    cb.called();
                });
            cb.check();
        }

        {
            try
            {
                testPrx.throwDerivedAsDerivedAsync().Wait();
            }
            catch(AggregateException ae)
            {
                try
                {
                    DerivedException e = (DerivedException)ae.InnerException;
                    test(e.sbe.Equals("sbe"));
                    test(e.pb != null);
                    test(e.pb.sb.Equals("sb1"));
                    test(e.pb.pb == e.pb);
                    test(e.sde.Equals("sde1"));
                    test(e.pd1 != null);
                    test(e.pd1.sb.Equals("sb2"));
                    test(e.pd1.pb == e.pd1);
                    test(e.pd1.sd1.Equals("sd2"));
                    test(e.pd1.pd1 == e.pd1);
                }
                catch(Exception)
                {
                    test(false);
                }
            }
        }
        WriteLine("ok");

        Write("unknown derived exception thrown as base exception... ");
        Flush();
        {
            try
            {
                testPrx.throwUnknownDerivedAsBase();
                test(false);
            }
            catch(BaseException e)
            {
                test(e.GetType().FullName.Equals("Test.BaseException"));
                test(e.sbe.Equals("sbe"));
                test(e.pb != null);
                test(e.pb.sb.Equals("sb d2"));
                test(e.pb.pb == e.pb);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("unknown derived exception thrown as base exception (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_throwUnknownDerivedAsBase().whenCompleted(
                () =>
                {
                    test(false);
                },
                (Ice.Exception ex) =>
                {
                    try
                    {
                        BaseException e = (BaseException)ex;
                        test(e.sbe.Equals("sbe"));
                        test(e.pb != null);
                        test(e.pb.sb.Equals("sb d2"));
                        test(e.pb.pb == e.pb);
                    }
                    catch(Exception)
                    {
                        test(false);
                    }
                    cb.called();
                });
            cb.check();
        }

        {
            try
            {
                testPrx.throwUnknownDerivedAsBaseAsync().Wait();
            }
            catch(AggregateException ae)
            {
                try
                {
                    BaseException e = (BaseException)ae.InnerException;
                    test(e.sbe.Equals("sbe"));
                    test(e.pb != null);
                    test(e.pb.sb.Equals("sb d2"));
                    test(e.pb.pb == e.pb);
                }
                catch(Exception)
                {
                    test(false);
                }
            }
        }
        WriteLine("ok");

        Write("forward-declared class... ");
        Flush();
        {
            try
            {
                Forward f;
                testPrx.useForward(out f);
                test(f != null);
            }
            catch(Exception)
            {
                test(false);
            }
        }
        WriteLine("ok");

        Write("forward-declared class (AMI)... ");
        Flush();
        {
            Callback cb = new Callback();
            testPrx.begin_useForward().whenCompleted(
                (Forward f) =>
                {
                    test(f != null);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }
        {
            test(testPrx.useForwardAsync().Result != null);
        }
        WriteLine("ok");

        Write("preserved classes... ");
        Flush();

        //
        // Register a factory in order to substitute our own subclass of Preserved. This provides
        // an easy way to determine how many unmarshaled instances currently exist.
        //
        // TODO: We have to install this now (even though it's not necessary yet), because otherwise
        // the Ice run time will install its own internal factory for Preserved upon receiving the
        // first instance.
        //
        communicator.getValueFactoryManager().add(PreservedFactoryI, Preserved.ice_staticId());

        try
        {
            //
            // Server knows the most-derived class PDerived.
            //
            PDerived pd = new PDerived();
            pd.pi = 3;
            pd.ps = "preserved";
            pd.pb = pd;

            PBase r = testPrx.exchangePBase(pd);
            PDerived p2 = r as PDerived;
            test(p2.pi == 3);
            test(p2.ps.Equals("preserved"));
            test(p2.pb == p2);
        }
        catch(Ice.OperationNotExistException)
        {
        }

        try
        {
            //
            // Server only knows the base (non-preserved) type, so the object is sliced.
            //
            PCUnknown pu = new PCUnknown();
            pu.pi = 3;
            pu.pu = "preserved";

            PBase r = testPrx.exchangePBase(pu);
            test(!(r is PCUnknown));
            test(r.pi == 3);
        }
        catch(Ice.OperationNotExistException)
        {
        }

        try
        {
            //
            // Server only knows the intermediate type Preserved. The object will be sliced to
            // Preserved for the 1.0 encoding; otherwise it should be returned intact.
            //
            PCDerived pcd = new PCDerived();
            pcd.pi = 3;
            pcd.pbs = new PBase[] { pcd };

            PBase r = testPrx.exchangePBase(pcd);
            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                test(!(r is PCDerived));
                test(r.pi == 3);
            }
            else
            {
                PCDerived p2 = r as PCDerived;
                test(p2.pi == 3);
                test(p2.pbs[0] == p2);
            }
        }
        catch(Ice.OperationNotExistException)
        {
        }

        try
        {
            //
            // Server only knows the intermediate type Preserved. The object will be sliced to
            // Preserved for the 1.0 encoding; otherwise it should be returned intact.
            //
            CompactPCDerived pcd = new CompactPCDerived();
            pcd.pi = 3;
            pcd.pbs = new PBase[] { pcd };

            PBase r = testPrx.exchangePBase(pcd);
            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                test(!(r is CompactPCDerived));
                test(r.pi == 3);
            }
            else
            {
                CompactPCDerived p2 = r as CompactPCDerived;
                test(p2.pi == 3);
                test(p2.pbs[0] == p2);
            }
        }
        catch(Ice.OperationNotExistException)
        {
        }

        try
        {
            //
            // Send an object that will have multiple preserved slices in the server.
            // The object will be sliced to Preserved for the 1.0 encoding.
            //
            PCDerived3 pcd = new PCDerived3();
            pcd.pi = 3;
            //
            // Sending more than 254 objects exercises the encoding for object ids.
            //
            pcd.pbs = new PBase[300];
            int i;
            for(i = 0; i < 300; ++i)
            {
                PCDerived2 p2 = new PCDerived2();
                p2.pi = i;
                p2.pbs = new PBase[] { null }; // Nil reference. This slice should not have an indirection table.
                p2.pcd2 = i;
                pcd.pbs[i] = p2;
            }
            pcd.pcd2 = pcd.pi;
            pcd.pcd3 = pcd.pbs[10];

            PBase r = testPrx.exchangePBase(pcd);
            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                test(!(r is PCDerived3));
                test(r is Preserved);
                test(r.pi == 3);
            }
            else
            {
                PCDerived3 p3 = r as PCDerived3;
                test(p3.pi == 3);
                for(i = 0; i < 300; ++i)
                {
                    PCDerived2 p2 = p3.pbs[i] as PCDerived2;
                    test(p2.pi == i);
                    test(p2.pbs.Length == 1);
                    test(p2.pbs[0] == null);
                    test(p2.pcd2 == i);
                }
                test(p3.pcd2 == p3.pi);
                test(p3.pcd3 == p3.pbs[10]);
            }
        }
        catch(Ice.OperationNotExistException)
        {
        }

        try
        {
            //
            // Obtain an object with preserved slices and send it back to the server.
            // The preserved slices should be excluded for the 1.0 encoding, otherwise
            // they should be included.
            //
            Preserved p = testPrx.PBSUnknownAsPreserved();
            testPrx.checkPBSUnknown(p);
            if(!testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                (testPrx.ice_encodingVersion(Ice.Util.Encoding_1_0) as TestIntfPrx).checkPBSUnknown(p);
            }
        }
        catch(Ice.OperationNotExistException)
        {
        }

        WriteLine("ok");

        Write("preserved classes (AMI)... ");
        Flush();
        {
            //
            // Server knows the most-derived class PDerived.
            //
            PDerived pd = new PDerived();
            pd.pi = 3;
            pd.ps = "preserved";
            pd.pb = pd;

            Callback cb = new Callback();
            testPrx.begin_exchangePBase(pd).whenCompleted(
                (PBase r) =>
                {
                    PDerived p2 = (PDerived)r;
                    test(p2.pi == 3);
                    test(p2.ps.Equals("preserved"));
                    test(p2.pb == p2);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }

        {
            //
            // Server knows the most-derived class PDerived.
            //
            PDerived pd = new PDerived();
            pd.pi = 3;
            pd.ps = "preserved";
            pd.pb = pd;

            PDerived p2 = (PDerived)testPrx.exchangePBaseAsync(pd).Result;
            test(p2.pi == 3);
            test(p2.ps.Equals("preserved"));
            test(p2.pb == p2);
        }

        {
            //
            // Server only knows the base (non-preserved) type, so the object is sliced.
            //
            PCUnknown pu = new PCUnknown();
            pu.pi = 3;
            pu.pu = "preserved";

            Callback cb = new Callback();
            testPrx.begin_exchangePBase(pu).whenCompleted(
                (PBase r) =>
                {
                    test(!(r is PCUnknown));
                    test(r.pi == 3);
                    cb.called();
                },
                (Ice.Exception ex) =>
                {
                    test(false);
                });
            cb.check();
        }

        {
            //
            // Server only knows the base (non-preserved) type, so the object is sliced.
            //
            PCUnknown pu = new PCUnknown();
            pu.pi = 3;
            pu.pu = "preserved";

            PBase r = testPrx.exchangePBaseAsync(pu).Result;
            test(!(r is PCUnknown));
            test(r.pi == 3);
        }

        {
            //
            // Server only knows the intermediate type Preserved. The object will be sliced to
            // Preserved for the 1.0 encoding; otherwise it should be returned intact.
            //
            PCDerived pcd = new PCDerived();
            pcd.pi = 3;
            pcd.pbs = new PBase[] { pcd };

            Callback cb = new Callback();
            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                testPrx.begin_exchangePBase(pcd).whenCompleted(
                    (PBase r) =>
                    {
                        test(!(r is PCDerived));
                        test(r.pi == 3);
                        cb.called();
                    },
                    (Ice.Exception ex) =>
                    {
                        test(false);
                    });
            }
            else
            {
                testPrx.begin_exchangePBase(pcd).whenCompleted(
                    (PBase r) =>
                    {
                        PCDerived p2 = r as PCDerived;
                        test(p2.pi == 3);
                        test(p2.pbs[0] == p2);
                        cb.called();
                    },
                    (Ice.Exception ex) =>
                    {
                        test(false);
                    });
            }
            cb.check();
        }

        {
            //
            // Server only knows the intermediate type Preserved. The object will be sliced to
            // Preserved for the 1.0 encoding; otherwise it should be returned intact.
            //
            PCDerived pcd = new PCDerived();
            pcd.pi = 3;
            pcd.pbs = new PBase[] { pcd };

            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                PBase r = testPrx.exchangePBaseAsync(pcd).Result;
                test(!(r is PCDerived));
                test(r.pi == 3);
            }
            else
            {
                PBase r = testPrx.exchangePBaseAsync(pcd).Result;
                PCDerived p2 = r as PCDerived;
                test(p2.pi == 3);
                test(p2.pbs[0] == p2);
            }
        }

        {
            //
            // Server only knows the intermediate type Preserved. The object will be sliced to
            // Preserved for the 1.0 encoding; otherwise it should be returned intact.
            //
            CompactPCDerived pcd = new CompactPCDerived();
            pcd.pi = 3;
            pcd.pbs = new PBase[] { pcd };

            Callback cb = new Callback();
            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                testPrx.begin_exchangePBase(pcd).whenCompleted(
                    (PBase r) =>
                    {
                        test(!(r is CompactPCDerived));
                        test(r.pi == 3);
                        cb.called();
                    },
                    (Ice.Exception ex) =>
                    {
                        test(false);
                    });
            }
            else
            {
                testPrx.begin_exchangePBase(pcd).whenCompleted(
                    (PBase r) =>
                    {
                        CompactPCDerived p2 = r as CompactPCDerived;
                        test(p2.pi == 3);
                        test(p2.pbs[0] == p2);
                        cb.called();
                    },
                    (Ice.Exception ex) =>
                    {
                        test(false);
                    });
            }
            cb.check();
        }

        {
            //
            // Server only knows the intermediate type Preserved. The object will be sliced to
            // Preserved for the 1.0 encoding; otherwise it should be returned intact.
            //
            CompactPCDerived pcd = new CompactPCDerived();
            pcd.pi = 3;
            pcd.pbs = new PBase[] { pcd };

            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                PBase r = testPrx.exchangePBaseAsync(pcd).Result;
                test(!(r is CompactPCDerived));
                test(r.pi == 3);
            }
            else
            {
                PBase r = testPrx.exchangePBaseAsync(pcd).Result;
                CompactPCDerived p2 = r as CompactPCDerived;
                test(p2.pi == 3);
                test(p2.pbs[0] == p2);
            }
        }

        {
            //
            // Send an object that will have multiple preserved slices in the server.
            // The object will be sliced to Preserved for the 1.0 encoding.
            //
            PCDerived3 pcd = new PCDerived3();
            pcd.pi = 3;
            //
            // Sending more than 254 objects exercises the encoding for object ids.
            //
            pcd.pbs = new PBase[300];
            for(int i = 0; i < 300; ++i)
            {
                PCDerived2 p2 = new PCDerived2();
                p2.pi = i;
                p2.pbs = new PBase[] { null }; // Nil reference. This slice should not have an indirection table.
                p2.pcd2 = i;
                pcd.pbs[i] = p2;
            }
            pcd.pcd2 = pcd.pi;
            pcd.pcd3 = pcd.pbs[10];

            Callback cb = new Callback();
            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                testPrx.begin_exchangePBase(pcd).whenCompleted(
                    (PBase r) =>
                    {
                        test(!(r is PCDerived3));
                        test(r is Preserved);
                        test(r.pi == 3);
                        cb.called();
                    },
                    (Ice.Exception ex) =>
                    {
                        test(false);
                    });
            }
            else
            {
                testPrx.begin_exchangePBase(pcd).whenCompleted(
                    (PBase r) =>
                    {
                        PCDerived3 p3 = r as PCDerived3;
                        test(p3.pi == 3);
                        for(int i = 0; i < 300; ++i)
                        {
                            PCDerived2 p2 = p3.pbs[i] as PCDerived2;
                            test(p2.pi == i);
                            test(p2.pbs.Length == 1);
                            test(p2.pbs[0] == null);
                            test(p2.pcd2 == i);
                        }
                        test(p3.pcd2 == p3.pi);
                        test(p3.pcd3 == p3.pbs[10]);
                        cb.called();
                    },
                    (Ice.Exception ex) =>
                    {
                        test(false);
                    });
            }
            cb.check();
        }

        {
            //
            // Send an object that will have multiple preserved slices in the server.
            // The object will be sliced to Preserved for the 1.0 encoding.
            //
            PCDerived3 pcd = new PCDerived3();
            pcd.pi = 3;
            //
            // Sending more than 254 objects exercises the encoding for object ids.
            //
            pcd.pbs = new PBase[300];
            for(int i = 0; i < 300; ++i)
            {
                PCDerived2 p2 = new PCDerived2();
                p2.pi = i;
                p2.pbs = new PBase[] { null }; // Nil reference. This slice should not have an indirection table.
                p2.pcd2 = i;
                pcd.pbs[i] = p2;
            }
            pcd.pcd2 = pcd.pi;
            pcd.pcd3 = pcd.pbs[10];

            if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                PBase r = testPrx.exchangePBaseAsync(pcd).Result;
                test(!(r is PCDerived3));
                test(r is Preserved);
                test(r.pi == 3);
            }
            else
            {
                PBase r = testPrx.exchangePBaseAsync(pcd).Result;
                PCDerived3 p3 = r as PCDerived3;
                test(p3.pi == 3);
                for(int i = 0; i < 300; ++i)
                {
                    PCDerived2 p2 = p3.pbs[i] as PCDerived2;
                    test(p2.pi == i);
                    test(p2.pbs.Length == 1);
                    test(p2.pbs[0] == null);
                    test(p2.pcd2 == i);
                }
                test(p3.pcd2 == p3.pi);
                test(p3.pcd3 == p3.pbs[10]);
            }
        }

        try
        {
            //
            // Obtain an object with preserved slices and send it back to the server.
            // The preserved slices should be excluded for the 1.0 encoding, otherwise
            // they should be included.
            //
            Preserved p = testPrx.PBSUnknownAsPreserved();
            testPrx.checkPBSUnknown(p);
            if(!testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0))
            {
                (testPrx.ice_encodingVersion(Ice.Util.Encoding_1_0) as TestIntfPrx).checkPBSUnknown(p);
            }
        }
        catch(Ice.OperationNotExistException)
        {
        }

        WriteLine("ok");

        Write("garbage collection for preserved classes... ");
        Flush();
        try
        {
            //
            // Register a factory in order to substitute our own subclass of PNode. This provides
            // an easy way to determine how many unmarshaled instances currently exist.
            //
            communicator.getValueFactoryManager().add((string id) =>
            {
                if(id.Equals(PNode.ice_staticId()))
                {
                    return new PNodeI();
                }
                return null;
            }, PNode.ice_staticId());

            //
            // Relay a graph through the server.
            //
            {
                PNode c = new PNode();
                c.next = new PNode();
                c.next.next = new PNode();
                c.next.next.next = c;

                test(PNodeI.counter == 0);
                PNode n = testPrx.exchangePNode(c);

                test(PNodeI.counter == 3);
                PNodeI.counter = 0;
                n.next = null;
            }

            //
            // Obtain a preserved object from the server where the most-derived
            // type is unknown. The preserved slice refers to a graph of PNode
            // objects.
            //
            {
                test(PNodeI.counter == 0);
                Preserved p = testPrx.PBSUnknownAsPreservedWithGraph();
                testPrx.checkPBSUnknownWithGraph(p);
                test(PNodeI.counter == 3);
                PNodeI.counter = 0;
            }

            //
            // Obtain a preserved object from the server where the most-derived
            // type is unknown. A data member in the preserved slice refers to the
            // outer object, so the chain of references looks like this:
            //
            // outer.slicedData.outer
            //
            {
                PreservedI.counter = 0;
                Preserved p = testPrx.PBSUnknown2AsPreservedWithGraph();
                testPrx.checkPBSUnknown2WithGraph(p);
                test(PreservedI.counter == 1);
                PreservedI.counter = 0;
            }

            //
            // Throw a preserved exception where the most-derived type is unknown.
            // The preserved exception slice contains a class data member. This
            // object is also preserved, and its most-derived type is also unknown.
            // The preserved slice of the object contains a class data member that
            // refers to itself.
            //
            // The chain of references looks like this:
            //
            // ex.slicedData.obj.slicedData.obj
            //
            try
            {
                test(PreservedI.counter == 0);

                try
                {
                    testPrx.throwPreservedException();
                }
                catch(PreservedException)
                {
                    test(PreservedI.counter == 1);
                }

                PreservedI.counter = 0;
            }
            catch(Exception)
            {
                test(false);
            }
        }
        catch(Ice.OperationNotExistException)
        {
        }

        WriteLine("ok");
        return testPrx;
    }
コード例 #51
0
        private ByteString GetAccountItems(D3.GameMessage.GetAccountItems request)
        {
            Logger.Trace("GetAccountItems()");

            var itemList = D3.Items.ItemList.CreateBuilder();
            return itemList.Build().ToByteString();
        }
コード例 #52
0
 private ByteString CreateHero(D3.OnlineService.HeroCreateParams createPrams)
 {
     int hashCode = ToonManager.GetUnusedHashCodeForToonName(createPrams.Name);
     var newToon = new Toon(createPrams.Name, hashCode, createPrams.GbidClass, createPrams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 1, Client.Account.CurrentGameAccount);
     if (ToonManager.SaveToon(newToon))
     {
         Logger.Trace("CreateHero() {0}", newToon);
         return newToon.D3EntityID.ToByteString();
     }
     return ByteString.Empty;
 }
コード例 #53
0
        private ByteString GetHeroProfiles(D3.GameMessage.GetHeroProfiles profiles)
        {
            Logger.Trace("GetHeroProfiles()");

            var profileList = D3.Profile.HeroProfileList.CreateBuilder();
            if (profiles.HeroIdsCount > 0)
            {
                foreach (var hero in profiles.HeroIdsList)
                {
                    var toon = ToonManager.GetToonByLowID(hero.IdLow);
                    profileList.AddHeros(toon.Profile);
                }
            }
            else
            {
                var heroList = GameAccountManager.GetAccountByPersistentID(profiles.AccountId.IdLow).Toons;
                foreach (var hero in heroList.Values)
                {
                    profileList.AddHeros(hero.Profile);
                }
            }

            return profileList.Build().ToByteString();
        }
コード例 #54
0
        private ByteString DeleteHero(D3.OnlineService.EntityId hero)
        {
            var deleteToon = ToonManager.GetToonByLowID(hero.IdLow);
            ToonManager.DeleteToon(deleteToon);

            Logger.Trace("DeleteHero() {0}", deleteToon);
            return ByteString.Empty;
        }
コード例 #55
0
        private ByteString GetHeroDigestList(D3.GameMessage.HeroDigestListRequest request)
        {
            Logger.Trace("GetHeroDigestList()");

            var ListResponse = D3.GameMessage.HeroDigestListResponse.CreateBuilder();
            foreach (var toon in request.ToonIdList)
            {
                var digest = ToonManager.GetToonByLowID(toon.IdLow).Digest;
                ListResponse.AddDigestList(
                D3.GameMessage.HeroDigestResponse.CreateBuilder()
                    .SetToonId(toon)
                    .SetSuccess(true)
                    .SetHeroDigest(digest)
                    .Build()
                    );
            }
            return ListResponse.Build().ToByteString();
        }
コード例 #56
0
        private ByteString SelectHero(D3.OnlineService.EntityId hero)
        {
            this.Client.Account.CurrentGameAccount.CurrentToon = ToonManager.GetToonByLowID(hero.IdLow);

            Logger.Trace("SelectToon() {0}", this.Client.Account.CurrentGameAccount.CurrentToon);
            this.Client.Account.LastSelectedHeroField.Value = this.Client.Account.CurrentGameAccount.CurrentToon.D3EntityID;
            this.Client.Account.CurrentGameAccount.NotifyUpdate();
            this.Client.Account.SaveToDB();
            return this.Client.Account.CurrentGameAccount.CurrentToon.D3EntityID.ToByteString();
        }