hello,
this is the code, and I'm interested how can i convert the bolded functions to c#
i found this function IPdxWriter , but i didnt figure it out.. see link bellow.
http://www.vmware.com/support/developer/vfabric-gemfire/nc36-csharp-api/html/45418841.htm
public class _-Q2 extends Object implements _-99
{
private var _version:int = 0;
public var userID:int = 0;
public var sessionID:String = "";
public var version:String = "";
private var factionID:int;
public static const ID:int = 3;
public function _-Q2(param1:int = 0, param2:String = "", param3:String = "", param4:int = 0)
{
this.userID = param1;
this.sessionID = param2;
this.version = param3;
this.factionID = param4;
return;
}// end function
public function _-2F() : int
{
return ID;
}// end function
public function _-hx() : int
{
return 0;
}// end function
public function _-wk() : int
{
return this._version;
}// end function
public function _-wx() : int
{
return 8;
}// end function
public function _-ME(param1:IDataInput) : void
{
this._version = param1.readShort();
this.userID = param1.readInt();
this.userID = param1.readShort();
this.sessionID = param1.readUTF();
this.version = param1.readUTF();
return;
}// end function
public function _-Oc(param1:IDataOutput) : void
{
param1.writeShort(ID);
param1.writeShort(this._-hx());
param1.writeInt(this.userID);
param1.writeShort(this.factionID);
param1.writeUTF(this.sessionID);
param1.writeUTF(this.version);
return;
}// end function
}
Loading
VulpesPosted Jan 17, 2012, 6:40 PM
andrei hoobaPosted Jan 17, 2012, 5:18 PM
the problem is now:
i have declared this 2 public void's:
public void _ME(DataInput param1)
{
_version = param1.ReadInt16();
userID = param1.ReadInt32();
userID = param1.ReadInt16();
sessionID = param1.ReadUTF();
version = param1.ReadUTF();
ID = param1.ReadInt32();
ID = param1.ReadInt16();
}
public void _Oc(DataOutput param1)
{
param1.WriteInt32(ID);
param1.WriteInt32(hx);
param1.WriteInt32(userID);
param1.WriteInt32(factionID);
param1.WriteUTF(sessionID);
param1.WriteUTF(version);
}
problem is that i must declare another static void for
static void Main(string[] args)
{
}
for something like this:
static void Main(string[] args)
{
doit();
}
static void doit()
{
Console.WriteLine(ID + hx + userID + factionID + sessionID + version);
}
errors: An object reference is required for the non-static field, method, or property 'test1.Program.userID'
there is an error for ID, hx, factionID, sessionID, version too.....
attached you can find GemStone.GemFire.Cache.dll .
VulpesPosted Jan 17, 2012, 2:50 PM
andrei hoobaPosted Jan 17, 2012, 2:31 PM
i will google it for that dll later, but there is no other way that i could use readUTF, writeUTF functions in c#?
VulpesPosted Jan 17, 2012, 12:08 PM
http://www.vmware.com/support/developer/vfabric-gemfire/nc36-csharp-api/html/45418841.htm
I assume therefore that you must have GemStone.GemFire.Cache.dll somewhere on your machine.
If it's not showing up in the Add Reference dialog box under either the .NET or COM tabs, I'd try doing a search for it and then browsing to the folder where it's stored.
andrei hoobaPosted Jan 17, 2012, 11:58 AM
VulpesPosted Jan 17, 2012, 4:41 AM
andrei hoobaPosted Jan 16, 2012, 6:49 PM
VulpesPosted Jan 16, 2012, 2:04 PM
using GemStone.GemFire.Cache.Generic;
andrei hoobaPosted Jan 16, 2012, 1:12 PM
i tryied to make a console application but i've got errors.
i just want to see how some things are changed.
here is the code, could you help me ?
or maybe you have any other opinion/solution?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public string sessionID = "562354156";
public string version = "1.2";
int _version = 0;
int ID = 3;
int userID = 554433;
int factionID = 3;
int _hx = 3;
static void Main(string[] args)
{
_ME();
_OC();
}
public void _ME(DataInput param1)
{
this._version = param1.ReadInt16();
this.userID = param1.ReadInt32();
this.userID = param1.ReadInt16();
this.sessionID = param1.ReadUTF();
this.version = param1.ReadUTF();
}
public void _Oc(DataOutput param1)
{
param1.WriteInt16(ID);
param1.WriteInt16(this._hx());
param1.WriteInt32(this.userID);
param1.WriteInt16(this.factionID);
param1.WriteUTF(this.sessionID);
param1.WriteUTF(this.version);
Console.WriteLine(ID + this._hx + this.userID + this.factionID + this.sessionID + this.version);
}
}
}
VulpesPosted Jan 11, 2012, 6:13 PM
andrei hoobaPosted Jan 11, 2012, 4:14 PM
but how can I include these 2 functions in a defined class already?
because for DataInput it needed to be defined a class ...
VulpesPosted Jan 11, 2012, 2:32 PM
http://www.vmware.com/support/developer/vfabric-gemfire/nc36-csharp-api/html/3D9317B9.htm
http://www.vmware.com/support/developer/vfabric-gemfire/nc36-csharp-api/html/F7114692.htm
VulpesPosted Jan 11, 2012, 1:54 PM
I don't recognize which language the code is written in but, if you're going to convert it to C#, then you'll need to get rid of the hyphens in the identifiers. C# supports underscores but not hyphens.
Subject to that, I would guess that the two methods you've highlighted would translate as follows:
public void _ME(IDataInput param1)
{
this._version = param1.readShort();
this.userID = param1.readInt();
this.userID = param1.readShort();
this.sessionID = param1.readUTF();
this.version = param1.readUTF();
}
public void _Oc(IDataOutput param1)
{
param1.writeShort(ID);
param1.writeShort(this._hx());
param1.writeInt(this.userID);
param1.writeShort(this.factionID);
param1.writeUTF(this.sessionID);
param1.writeUTF(this.version);
}
Having 'return' as the last statement of a void method is unnecessary in C#.