summaryrefslogtreecommitdiff
path: root/dotnet/client-010/client
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2009-06-19 20:27:57 +0000
committerTed Ross <tross@apache.org>2009-06-19 20:27:57 +0000
commit0e4711571f523869472fea0cfc04be737ef31bf7 (patch)
treeac8fcbfa53ac0327f59bb5ff4bd8d084a5e6f0bc /dotnet/client-010/client
parentfdb23707352b96986daf36db3b47538a307a2888 (diff)
downloadqpid-python-0e4711571f523869472fea0cfc04be737ef31bf7.tar.gz
QPID-1906 - C# QMF console from Bryan Kearney
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@786655 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/client-010/client')
-rw-r--r--dotnet/client-010/client/Properties/AssemblyInfo.cs2
-rw-r--r--dotnet/client-010/client/transport/codec/AbstractDecoder.cs9
-rw-r--r--dotnet/client-010/client/transport/codec/AbstractEncoder.cs8
-rw-r--r--dotnet/client-010/client/transport/codec/Decoder.cs11
-rw-r--r--dotnet/client-010/client/transport/codec/Encoder.cs10
-rw-r--r--dotnet/client-010/client/transport/codec/MSDecoder.cs30
-rw-r--r--dotnet/client-010/client/transport/codec/MSEncoder.cs33
-rw-r--r--dotnet/client-010/client/transport/util/ByteEncoder.cs25
8 files changed, 120 insertions, 8 deletions
diff --git a/dotnet/client-010/client/Properties/AssemblyInfo.cs b/dotnet/client-010/client/Properties/AssemblyInfo.cs
index 5ab0be9a99..2b6c525b86 100644
--- a/dotnet/client-010/client/Properties/AssemblyInfo.cs
+++ b/dotnet/client-010/client/Properties/AssemblyInfo.cs
@@ -52,5 +52,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("0.10.0.0")]
+[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/dotnet/client-010/client/transport/codec/AbstractDecoder.cs b/dotnet/client-010/client/transport/codec/AbstractDecoder.cs
index 44aecb0933..411813fe99 100644
--- a/dotnet/client-010/client/transport/codec/AbstractDecoder.cs
+++ b/dotnet/client-010/client/transport/codec/AbstractDecoder.cs
@@ -86,6 +86,13 @@ namespace org.apache.qpid.transport.codec
return l;
}
+ public abstract short readInt8();
+ public abstract int readInt16();
+ public abstract long readInt32() ;
+ public abstract long readInt64();
+ public abstract float readFloat() ;
+ public abstract double readDouble() ;
+
public long readDatetime()
{
return readUint64();
@@ -389,4 +396,4 @@ namespace org.apache.qpid.transport.codec
}
}
}
-} \ No newline at end of file
+}
diff --git a/dotnet/client-010/client/transport/codec/AbstractEncoder.cs b/dotnet/client-010/client/transport/codec/AbstractEncoder.cs
index c89b96462e..2e5ba56c28 100644
--- a/dotnet/client-010/client/transport/codec/AbstractEncoder.cs
+++ b/dotnet/client-010/client/transport/codec/AbstractEncoder.cs
@@ -115,6 +115,12 @@ namespace org.apache.qpid.transport.codec
}
}
+ public abstract void writeInt8(short b) ;
+ public abstract void writeInt16(int s) ;
+ public abstract void writeInt32(long i) ;
+ public abstract void writeInt64(long l) ;
+ public abstract void writeFloat(float f) ;
+ public abstract void writeDouble(double d) ;
public void writeDatetime(long l)
{
@@ -580,4 +586,4 @@ namespace org.apache.qpid.transport.codec
}
}
}
-} \ No newline at end of file
+}
diff --git a/dotnet/client-010/client/transport/codec/Decoder.cs b/dotnet/client-010/client/transport/codec/Decoder.cs
index 207bd60df1..f0de3f61ef 100644
--- a/dotnet/client-010/client/transport/codec/Decoder.cs
+++ b/dotnet/client-010/client/transport/codec/Decoder.cs
@@ -38,7 +38,14 @@ namespace org.apache.qpid.transport.codec
int readUint16();
long readUint32();
long readUint64();
-
+
+ short readInt8();
+ int readInt16();
+ long readInt32();
+ long readInt64();
+
+ double readDouble() ;
+ float readFloat() ;
long readDatetime();
UUID readUuid();
@@ -62,4 +69,4 @@ namespace org.apache.qpid.transport.codec
Struct readStruct(int type);
}
-} \ No newline at end of file
+}
diff --git a/dotnet/client-010/client/transport/codec/Encoder.cs b/dotnet/client-010/client/transport/codec/Encoder.cs
index 32950ee02e..c071c4cbaf 100644
--- a/dotnet/client-010/client/transport/codec/Encoder.cs
+++ b/dotnet/client-010/client/transport/codec/Encoder.cs
@@ -37,6 +37,14 @@ namespace org.apache.qpid.transport.codec
void writeUint16(int s);
void writeUint32(long i);
void writeUint64(long l);
+
+ void writeInt8(short b);
+ void writeInt16(int s);
+ void writeInt32(long i);
+ void writeInt64(long l);
+
+ void writeFloat(float f) ;
+ void writeDouble(double d) ;
void writeDatetime(long l);
void writeUuid(UUID uuid);
@@ -59,4 +67,4 @@ namespace org.apache.qpid.transport.codec
void writeStruct(int type, Struct s);
}
-} \ No newline at end of file
+}
diff --git a/dotnet/client-010/client/transport/codec/MSDecoder.cs b/dotnet/client-010/client/transport/codec/MSDecoder.cs
index cc8971d38b..68d73232c5 100644
--- a/dotnet/client-010/client/transport/codec/MSDecoder.cs
+++ b/dotnet/client-010/client/transport/codec/MSDecoder.cs
@@ -78,5 +78,33 @@ namespace org.apache.qpid.transport.codec
{
return (long) ByteEncoder.GetBigEndian(reader.ReadInt64());
}
+
+ public override short readInt8()
+ {
+ return (short) (0xFF & reader.ReadByte());
+ }
+
+ public override int readInt16()
+ {
+ return ByteEncoder.GetBigEndian((Int16) reader.ReadInt16());
+ }
+
+ public override long readInt32()
+ {
+ return ByteEncoder.GetBigEndian((Int32) reader.ReadInt32());
+ }
+
+ public override long readInt64()
+ {
+ return (long) ByteEncoder.GetBigEndian(reader.ReadInt64());
+ }
+
+ public override double readDouble() {
+ return (double) ByteEncoder.GetBigEndian(reader.ReadDouble()) ;
+ }
+
+ public override float readFloat() {
+ return (float) reader.ReadSingle() ;
+ }
}
-} \ No newline at end of file
+}
diff --git a/dotnet/client-010/client/transport/codec/MSEncoder.cs b/dotnet/client-010/client/transport/codec/MSEncoder.cs
index b2ccbb89ae..127b9c73ba 100644
--- a/dotnet/client-010/client/transport/codec/MSEncoder.cs
+++ b/dotnet/client-010/client/transport/codec/MSEncoder.cs
@@ -93,6 +93,37 @@ namespace org.apache.qpid.transport.codec
_writer.Write(ByteEncoder.GetBigEndian(l));
}
+ public override void writeInt8(short b)
+ {
+ Debug.Assert(b < 0x100);
+ _writer.Write((byte) b);
+ }
+
+ public override void writeInt16(int s)
+ {
+ Debug.Assert(s < 0x10000);
+ _writer.Write(ByteEncoder.GetBigEndian((Int16) s));
+ }
+
+ public override void writeInt32(long i)
+ {
+ Debug.Assert(i < 0x100000000L);
+ _writer.Write(ByteEncoder.GetBigEndian((Int32) i));
+ }
+
+ public override void writeInt64(long l)
+ {
+ _writer.Write(ByteEncoder.GetBigEndian(l));
+ }
+
+ public override void writeFloat(float f) {
+ _writer.Write(f) ;
+ }
+
+ public override void writeDouble(double d) {
+ _writer.Write(ByteEncoder.GetBigEndian(d)) ;
+ }
+
protected override int beginSize8()
{
int pos = (int) _out.Position;
@@ -138,4 +169,4 @@ namespace org.apache.qpid.transport.codec
_out.Seek(cur, SeekOrigin.Begin);
}
}
-} \ No newline at end of file
+}
diff --git a/dotnet/client-010/client/transport/util/ByteEncoder.cs b/dotnet/client-010/client/transport/util/ByteEncoder.cs
index ac493a9b62..c900e3adae 100644
--- a/dotnet/client-010/client/transport/util/ByteEncoder.cs
+++ b/dotnet/client-010/client/transport/util/ByteEncoder.cs
@@ -80,6 +80,15 @@ namespace org.apache.qpid.transport.util
}
return value;
}
+
+ public static double GetBigEndian(double value)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ return swapByteOrder(value);
+ }
+ return value;
+ }
/// <summary>
/// Returns the value encoded in Little Endian (x86, NDR) format.
@@ -136,6 +145,15 @@ namespace org.apache.qpid.transport.util
}
return swapByteOrder(value);
}
+
+ public static double GetLittleEndian(double value)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ return value;
+ }
+ return swapByteOrder(value);
+ }
/// <summary>
/// Swaps the Byte order of an <see cref="Int32"/>.
@@ -187,6 +205,13 @@ namespace org.apache.qpid.transport.util
Array.Reverse(buffer, 0, buffer.Length);
return BitConverter.ToInt64(buffer, 0);
}
+
+ private static double swapByteOrder(double value)
+ {
+ Byte[] buffer = BitConverter.GetBytes(value);
+ Array.Reverse(buffer, 0, buffer.Length);
+ return BitConverter.ToDouble(buffer,0) ;
+ }
#endregion
}