Merging changes
This commit is contained in:
1 parent
c4216d2272
commit
797816be7e
437 files changed
+54228
-28
No files matched your search
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BCG
|
||||
{
|
||||
public delegate void PubSubTagURLChangeDelegate(List<string> tagsMoving, string newURL);
|
||||
|
||||
public interface IPubSubRouter
|
||||
{
|
||||
|
||||
event PubSubTagURLChangeDelegate onSubURLTagRouteChange;
|
||||
event PubSubTagURLChangeDelegate onPubURLTagRouteChange;
|
||||
List<string> getAllPubSubSubURLs();
|
||||
List<string> getAllPubSubPubURLs();
|
||||
string getSubURLForTag(string tag);
|
||||
string getPubURLForTag(string tag);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// //using ProtoBuf;
|
||||
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// //using System.Windows;
|
||||
// //using System.Windows.Media;
|
||||
|
||||
// namespace mbts
|
||||
// {
|
||||
// // TODO move it out or replace it with Tuple
|
||||
// [Serializable]
|
||||
// public class Pair<F, S>
|
||||
// {
|
||||
// public F first;
|
||||
// public S second;
|
||||
|
||||
// public Pair() { }
|
||||
// public Pair(F f, S s)
|
||||
// {
|
||||
// first = f;
|
||||
// second = s;
|
||||
// }
|
||||
|
||||
// public Pair(KeyValuePair<F, S> kvp)
|
||||
// : this(kvp.Key, kvp.Value) { }
|
||||
|
||||
// public override string ToString()
|
||||
// {
|
||||
// return String.Format("{0},{1}", first != null ? first.ToString() : "NULL",
|
||||
// second != null ? second.ToString() : "NULL");
|
||||
// }
|
||||
|
||||
// public override int GetHashCode()
|
||||
// {
|
||||
// return ToString().GetHashCode();
|
||||
// }
|
||||
|
||||
// public override bool Equals(object obj)
|
||||
// {
|
||||
// return obj != null && obj is Pair<F, S> && ToString() == obj.ToString();
|
||||
// }
|
||||
// }
|
||||
|
||||
// [Serializable]
|
||||
// public class Triplet<F, S, T>
|
||||
// {
|
||||
// public F first;
|
||||
// public S second;
|
||||
// public T third;
|
||||
|
||||
// public Triplet() { }
|
||||
|
||||
// public Triplet(Tuple<F, S, T> tp)
|
||||
// {
|
||||
// first = tp.Item1;
|
||||
// second = tp.Item2;
|
||||
// third = tp.Item3;
|
||||
// }
|
||||
|
||||
// public Triplet(F f, S s, T t)
|
||||
// {
|
||||
// first = f;
|
||||
// second = s;
|
||||
// third = t;
|
||||
// }
|
||||
|
||||
// public static Triplet<F, S, T> from_tuple(Tuple<F, S, T> t) { return new Triplet<F, S, T>(t.Item1, t.Item2, t.Item3); }
|
||||
|
||||
// public override string ToString()
|
||||
// {
|
||||
// return String.Format("{0},{1},{2}", first != null ? first.ToString() : "NULL",
|
||||
// second != null ? second.ToString() : "NULL",
|
||||
// third != null ? third.ToString() : "NULL");
|
||||
// }
|
||||
|
||||
// public override bool Equals(object obj)
|
||||
// {
|
||||
// return obj != null && obj is Triplet<F, S, T> && ToString() == obj.ToString();
|
||||
// }
|
||||
|
||||
// public override int GetHashCode()
|
||||
// {
|
||||
// return ToString().GetHashCode();
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
@@ -0,0 +1,339 @@
|
||||
// using System;
|
||||
// using System.IO;
|
||||
// using System.Collections;
|
||||
|
||||
// namespace BCG
|
||||
// {
|
||||
// public class SerializationUtilityMethods
|
||||
// {
|
||||
// private static IDictionary mySerializationDispatchTable,
|
||||
// myDeserializationDispatchTable;
|
||||
// private delegate void MySerialize (object data, BinaryWriter bw);
|
||||
// private delegate object MyDeserialize (Type t, BinaryReader br);
|
||||
|
||||
// static SerializationUtilityMethods ()
|
||||
// {
|
||||
// mySerializationDispatchTable = new Hashtable ();
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.BOOL.Name] =
|
||||
// new MySerialize (mySerializeBool);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.BYTE.Name] =
|
||||
// new MySerialize (mySerializeByte);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.CHAR.Name] =
|
||||
// new MySerialize (mySerializeChar);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.DATETIME.Name] =
|
||||
// new MySerialize (mySerializeDateTime);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.DECIMAL.Name] =
|
||||
// new MySerialize (mySerializeDecimal);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.DOUBLE.Name] =
|
||||
// new MySerialize (mySerializeDouble);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.INT.Name] =
|
||||
// new MySerialize (mySerializeInt32);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.ISERIALIZEDTYPE.Name] =
|
||||
// new MySerialize (mySerializeISerializedType);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.LONG.Name] =
|
||||
// new MySerialize (mySerializeLong);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.SBYTE.Name] =
|
||||
// new MySerialize (mySerializeSByte);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.STRING.Name] =
|
||||
// new MySerialize (mySerializeString);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.BYTEARRAY.Name] =
|
||||
// new MySerialize (mySerializeByteArray);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.UINT.Name] =
|
||||
// new MySerialize (mySerializeUInt);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.ULONG.Name] =
|
||||
// new MySerialize (mySerializeULong);
|
||||
// mySerializationDispatchTable [BlueDataValidTypes.SINGLE.Name] =
|
||||
// new MySerialize (mySerializeSingle);
|
||||
|
||||
// myDeserializationDispatchTable = new Hashtable ();
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.BOOL.Name] =
|
||||
// new MyDeserialize (myDeserializeBool);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.BYTE.Name] =
|
||||
// new MyDeserialize (myDeserializeByte);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.CHAR.Name] =
|
||||
// new MyDeserialize (myDeserializeChar);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.DATETIME.Name] =
|
||||
// new MyDeserialize (myDeserializeDateTime);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.DECIMAL.Name] =
|
||||
// new MyDeserialize (myDeserializeDecimal);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.DOUBLE.Name] =
|
||||
// new MyDeserialize (myDeserializeDouble);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.INT.Name] =
|
||||
// new MyDeserialize (myDeserializeInt32);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.ISERIALIZEDTYPE.Name] =
|
||||
// new MyDeserialize (myDeserializeISerializedType);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.LONG.Name] =
|
||||
// new MyDeserialize (myDeserializeLong);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.SBYTE.Name] =
|
||||
// new MyDeserialize (myDeserializeSByte);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.STRING.Name] =
|
||||
// new MyDeserialize (myDeserializeString);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.BYTEARRAY.Name] =
|
||||
// new MyDeserialize (myDeserializeByteArray);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.UINT.Name] =
|
||||
// new MyDeserialize (myDeserializeUInt);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.ULONG.Name] =
|
||||
// new MyDeserialize (myDeserializeULong);
|
||||
// myDeserializationDispatchTable [BlueDataValidTypes.SINGLE.Name] =
|
||||
// new MyDeserialize (myDeserializeSingle);
|
||||
// }
|
||||
|
||||
// public static int getObjectSerializedSize (object o)
|
||||
// {
|
||||
// Type t = o.GetType ();
|
||||
// if (t == BlueDataValidTypes.STRING)
|
||||
// {
|
||||
// int l = (o as string).Length;
|
||||
// if (l < 128)
|
||||
// return l + 1;
|
||||
// if (l < 16384)
|
||||
// return l + 2;
|
||||
// if (l < 2097152)
|
||||
// return l + 3;
|
||||
// if (l < Math.Pow (2, 28))
|
||||
// return l + 4;
|
||||
// throw new ApplicationException ("String too big");
|
||||
// }
|
||||
// else if (t == BlueDataValidTypes.BYTEARRAY)
|
||||
// {
|
||||
// return getFixedLengthTypeSize (BlueDataValidTypes.INT) +
|
||||
// (o as byte[]).Length;
|
||||
// }
|
||||
// else if (isSerializedType (t))
|
||||
// {
|
||||
// return (o as ISerializedType).getSerializedSize ();
|
||||
// }
|
||||
// return getFixedLengthTypeSize (t);
|
||||
// }
|
||||
|
||||
// public static int getFixedLengthTypeSize (Type t)
|
||||
// {
|
||||
// if (t == BlueDataValidTypes.BOOL ||
|
||||
// t == BlueDataValidTypes.BYTE ||
|
||||
// t == BlueDataValidTypes.CHAR ||
|
||||
// t == BlueDataValidTypes.SBYTE)
|
||||
// return 1;
|
||||
// else if (t == BlueDataValidTypes.INT ||
|
||||
// t == BlueDataValidTypes.UINT||
|
||||
// t == BlueDataValidTypes.SINGLE)
|
||||
// return 4;
|
||||
// else if (t == BlueDataValidTypes.DOUBLE ||
|
||||
// t == BlueDataValidTypes.LONG ||
|
||||
// t== BlueDataValidTypes.ULONG)
|
||||
// return 8;
|
||||
// else if (t == BlueDataValidTypes.DECIMAL)
|
||||
// return 16;
|
||||
// else if (t == BlueDataValidTypes.DATETIME)
|
||||
// //as objects of type DateTime are stored as doubles
|
||||
// return getFixedLengthTypeSize (typeof(long));
|
||||
// else
|
||||
// throw new ApplicationException (t.FullName + " is not a supported type");
|
||||
|
||||
// }
|
||||
|
||||
// public static bool isFixedLengthType (Type t)
|
||||
// {
|
||||
// return !(t.Equals (BlueDataValidTypes.STRING) || t.Equals (BlueDataValidTypes.BYTEARRAY) ||
|
||||
// isSerializedType (t));
|
||||
// }
|
||||
|
||||
// public static bool isSerializedType (Type t)
|
||||
// {
|
||||
// return t.GetInterface ("BCG.ISerializedType") != null;
|
||||
// }
|
||||
|
||||
// #region Serialization
|
||||
// public static void serializeValue (object data, BinaryWriter bw)
|
||||
// {
|
||||
// Type t = data.GetType ();
|
||||
// if (isSerializedType (t))
|
||||
// (mySerializationDispatchTable [typeof(ISerializedType).Name]
|
||||
// as MySerialize)(data, bw);
|
||||
// else
|
||||
// (mySerializationDispatchTable [t.Name] as MySerialize) (data, bw);
|
||||
// }
|
||||
// public static void serializeEnum(object data, BinaryWriter bw)
|
||||
// {
|
||||
// mySerializeInt32(data, bw);
|
||||
// }
|
||||
// private static void mySerializeInt32 (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((Int32)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeDouble (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((double)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeString (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write (data as string);
|
||||
// }
|
||||
|
||||
// private static void mySerializeByteArray (object data, BinaryWriter bw)
|
||||
// {
|
||||
// byte[] bs = data as byte[];
|
||||
// bw.Write (bs.Length);
|
||||
// bw.Write (bs);
|
||||
// }
|
||||
|
||||
|
||||
// private static void mySerializeSingle (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((Single)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeChar (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((char)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeLong (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((long)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeSByte (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((sbyte)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeBool (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((bool)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeByte (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((byte)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeDecimal (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((decimal)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeUInt (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((uint)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeULong (object data, BinaryWriter bw)
|
||||
// {
|
||||
// bw.Write ((ulong)data);
|
||||
// }
|
||||
|
||||
// private static void mySerializeDateTime (object data, BinaryWriter bw)
|
||||
// {
|
||||
// //DateTime is written is serialiazed as OADATE
|
||||
// bw.Write (((DateTime)data).ToOADate());
|
||||
// }
|
||||
|
||||
// private static void mySerializeISerializedType (object data, BinaryWriter bw)
|
||||
// {
|
||||
// (data as ISerializedType).serialize (bw);
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region Deserialization
|
||||
|
||||
// public static object deserializeValue(Type t, BinaryReader br)
|
||||
// {
|
||||
// return myDeserialize(t, br);
|
||||
// }
|
||||
// private static object myDeserialize (Type t, BinaryReader br)
|
||||
// {
|
||||
// return isSerializedType (t) ?
|
||||
// (myDeserializationDispatchTable [typeof(ISerializedType).Name]
|
||||
// as MyDeserialize)(t, br)
|
||||
// :
|
||||
// (myDeserializationDispatchTable [t.Name] as MyDeserialize) (t, br);
|
||||
// }
|
||||
|
||||
// public static object deserializeEnum(Type t, BinaryReader br)
|
||||
// {
|
||||
// return myDeserializeInt32(t, br);
|
||||
// }
|
||||
|
||||
// private static object myDeserializeInt32 (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadInt32 ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeISerializedType (Type t, BinaryReader br)
|
||||
// {
|
||||
// ISerializedType o = Activator.CreateInstance (t)
|
||||
// as ISerializedType;
|
||||
// o.deserialze (br);
|
||||
// return o;
|
||||
// }
|
||||
|
||||
// private static object myDeserializeDouble (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadDouble ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeString (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadString ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeByteArray (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadBytes (br.ReadInt32 ());
|
||||
// }
|
||||
|
||||
// private static object myDeserializeSingle (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadSingle ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeChar (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadChar ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeLong (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadInt64 ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeSByte (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadSByte ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeBool (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadBoolean ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeByte (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadByte ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeDecimal (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadDecimal ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeUInt (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadUInt32 ();
|
||||
// }
|
||||
|
||||
// private static object myDeserializeDateTime (Type t, BinaryReader br)
|
||||
// {
|
||||
// return DateTime.FromOADate(br.ReadDouble());
|
||||
// //return new DateTime(br.ReadInt64());
|
||||
// }
|
||||
|
||||
// private static object myDeserializeULong (Type t, BinaryReader br)
|
||||
// {
|
||||
// return br.ReadUInt64 ();
|
||||
// }
|
||||
// #endregion
|
||||
// }
|
||||
// }
|
||||
Reference in new issue
Block a user