Permalink
Browse files

Used compiler macros to include changes into single file for WInPhone7.

  • Loading branch information...
1 parent 19288eb commit bbba2c060cc63b93f74a88db2e628993aca6fb08 @zeeshandad committed Mar 16, 2011
Showing with 178 additions and 7,160 deletions.
  1. +23 −0 src/CIAPI.Phone7/CIAPI.Phone7.csproj
  2. +1 −3 src/JsonClient.Phone7/JsonClient.Phone7.csproj
  3. BIN src/SampleApps/Silverlight/CIAPI.CS.Streaming.Samples.Web/ClientBin/CIAPI.CS.Streaming.Samples.xap
  4. BIN src/SampleApps/Silverlight/SilverlightSpike.Web/ClientBin/CIAPI.CS.Streaming.Samples.xap
  5. +0 −170 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/BatchManager.cs
  6. +0 −61 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/BatchMonitor.cs
  7. +0 −227 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/BatchingHttpProvider.cs
  8. +0 −16 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ClientException.cs
  9. +0 −244 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/CollectionsSupport.cs
  10. +0 −64 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ConnectionConstraints.cs
  11. +0 −355 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ConnectionInfo.cs
  12. +0 −143 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/Constants.cs
  13. +0 −123 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ExtConnectionListener.cs
  14. +0 −105 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ExtendedTableInfo.cs
  15. +0 −201 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ExtendedTableManager.cs
  16. +0 −524 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/FullTableManager.cs
  17. +0 −276 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/HttpProvider.cs
  18. +0 −18 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/IConnectionListener.cs
  19. +0 −16 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/IExtendedTableListener.cs
  20. +0 −14 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/IFastItemsListener.cs
  21. +0 −14 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/IHandyTableListener.cs
  22. +0 −12 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ISetSupport.cs
  23. +0 −14 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ISimpleTableListener.cs
  24. +0 −35 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ITableManager.cs
  25. +0 −10 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/IThreadRunnable.cs
  26. +0 −31 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/IUpdateInfo.cs
  27. +0 −460 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/LSClient.cs
  28. +0 −7 ...ent.Phone7.Lightstreamer/Lightstreamer.Phone7/LoggingTypes/com/lightstreamer/ls_client/actions.cs
  29. +0 −7 ...nt.Phone7.Lightstreamer/Lightstreamer.Phone7/LoggingTypes/com/lightstreamer/ls_client/protocol.cs
  30. +0 −7 ...ent.Phone7.Lightstreamer/Lightstreamer.Phone7/LoggingTypes/com/lightstreamer/ls_client/session.cs
  31. +0 −6 ...ient.Phone7.Lightstreamer/Lightstreamer.Phone7/LoggingTypes/com/lightstreamer/ls_client/stream.cs
  32. +0 −293 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/MyServerListener.cs
  33. +0 −100 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/NotificationQueue.cs
  34. +0 −12 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/PhaseException.cs
  35. +0 −16 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/PushConnException.cs
  36. +0 −35 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/PushEndException.cs
  37. +0 −23 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/PushLengthException.cs
  38. +0 −60 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/PushServerException.cs
  39. +0 −606 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/PushServerProxy.cs
  40. +0 −769 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/PushServerTranslator.cs
  41. +0 −23 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/PushUserException.cs
  42. +0 −684 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ServerManager.cs
  43. +0 −149 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ServerUpdateEvent.cs
  44. +0 −255 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/SimpleTableInfo.cs
  45. +0 −175 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/SimpleTableManager.cs
  46. +0 −12 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/SubscrException.cs
  47. +0 −28 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/SubscribedTableKey.cs
  48. +0 −109 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ThreadSupport.cs
  49. +0 −46 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/TimerSupport.cs
  50. +0 −174 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/UpdateInfoImpl.cs
  51. +0 −380 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/VirtualTableManager.cs
  52. +147 −48 src/StreamingClient.Phone7.Lightstreamer/StreamingClient.Phone7.Lightstreamer.csproj
  53. +6 −0 src/StreamingClient.Silverlight.Lightstreamer/Lightstreamer.Silverlight/HttpProvider.cs
  54. +1 −0 src/StreamingClient.Silverlight.Lightstreamer/StreamingClient.Silverlight.Lightstreamer.csproj
View
23 src/CIAPI.Phone7/CIAPI.Phone7.csproj
@@ -55,9 +55,24 @@
<Compile Include="..\CIAPI.CodeGeneration\ROUTES.cs">
<Link>ROUTES.cs</Link>
</Compile>
+ <Compile Include="..\CIAPI\PrettyPrinterExtensions.cs">
+ <Link>PrettyPrinterExtensions.cs</Link>
+ </Compile>
<Compile Include="..\ciapi\rpc\ApiClient.cs">
<Link>Rpc\ApiClient.cs</Link>
</Compile>
+ <Compile Include="..\ciapi\streaming\lightstreamer\LightStreamerClient.cs">
+ <Link>Streaming\Lightstreamer\LightStreamerClient.cs</Link>
+ </Compile>
+ <Compile Include="..\ciapi\streaming\lightstreamer\LightstreamerDtoConverter.cs">
+ <Link>Streaming\Lightstreamer\LightstreamerDtoConverter.cs</Link>
+ </Compile>
+ <Compile Include="..\ciapi\streaming\lightstreamer\LightStreamerListener.cs">
+ <Link>Streaming\Lightstreamer\LightStreamerListener.cs</Link>
+ </Compile>
+ <Compile Include="..\ciapi\streaming\StreamingClientFactory.cs">
+ <Link>Streaming\StreamingClientFactory.cs</Link>
+ </Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -69,6 +84,14 @@
<Project>{DB3089D5-44AC-441C-845C-3596C21C5E34}</Project>
<Name>JsonClient.Phone7</Name>
</ProjectReference>
+ <ProjectReference Include="..\StreamingClient.Phone7.Lightstreamer\StreamingClient.Phone7.Lightstreamer.csproj">
+ <Project>{C37541C1-15D3-4A67-A885-95E84CE486CA}</Project>
+ <Name>StreamingClient.Phone7.Lightstreamer</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\StreamingClient.Phone7\StreamingClient.Phone7.csproj">
+ <Project>{D3078D16-B8F3-4E0B-80ED-EAC7CD4F9046}</Project>
+ <Name>StreamingClient.Phone7</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
View
4 src/JsonClient.Phone7/JsonClient.Phone7.csproj
@@ -42,9 +42,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json.Silverlight">
- <HintPath>..\packages\Newtonsoft.Json.3.5.8\lib\SL\Newtonsoft.Json.Silverlight.dll</HintPath>
- </Reference>
+ <Reference Include="Newtonsoft.Json.Silverlight, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
View
BIN ...eApps/Silverlight/CIAPI.CS.Streaming.Samples.Web/ClientBin/CIAPI.CS.Streaming.Samples.xap
Binary file not shown.
View
BIN src/SampleApps/Silverlight/SilverlightSpike.Web/ClientBin/CIAPI.CS.Streaming.Samples.xap
Binary file not shown.
View
170 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/BatchManager.cs
@@ -1,170 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using Common.Logging;
- using System;
- using System.Collections;
- using System.IO;
- using System.Text;
-
- internal class BatchManager
- {
- private BatchingHttpProvider batchingProvider;
- private long limit = 0L;
- private static ILog protLogger = LogManager.GetLogger(typeof(com.lightstreamer.ls_client.protocol));
-
- internal virtual void AbortBatch()
- {
- lock (this)
- {
- if (this.batchingProvider != null)
- {
- this.batchingProvider.Abort(new SubscrException("requests batch aborted"));
- this.batchingProvider = null;
- }
- }
- }
-
- internal virtual void CloseBatch()
- {
- BatchingHttpProvider batchingProvider;
- lock (this)
- {
- batchingProvider = this.batchingProvider;
- this.batchingProvider = null;
- }
- if (batchingProvider != null)
- {
- DoAsyncPost(batchingProvider);
- }
- }
-
- private static void DoAsyncPost(BatchingHttpProvider batchToClose)
- {
- new AnonymousClassThread(batchToClose).Start();
- }
-
- internal virtual StreamReader GetAnswer(string controlUrl, IDictionary parameters, BatchMonitor batch)
- {
- BatchingHttpProvider batchToClose = null;
- BatchingHttpProvider.BufferedReaderMonitor monitor = null;
- bool flag = false;
- lock (batch)
- {
- lock (this)
- {
- if (!batch.Filled)
- {
- batch.UseOne();
- if (this.batchingProvider != null)
- {
- protLogger.Info("Batching control request");
- if (protLogger.IsDebugEnabled)
- {
- protLogger.Debug("Control params: " + CollectionsSupport.ToString(parameters));
- }
- monitor = this.batchingProvider.AddCall(parameters);
- if (monitor != null)
- {
- if (batch.Filled)
- {
- batchToClose = this.batchingProvider;
- this.batchingProvider = null;
- }
- }
- else if (this.batchingProvider.Empty)
- {
- protLogger.Info("Batching failed; trying without batch");
- if (batch.Filled)
- {
- this.batchingProvider = null;
- }
- }
- else
- {
- protLogger.Info("Batching failed; trying a new batch");
- batchToClose = this.batchingProvider;
- batch.Expand(1);
- this.batchingProvider = new BatchingHttpProvider(controlUrl, this.limit);
- flag = true;
- }
- }
- }
- else if (this.batchingProvider != null)
- {
- this.batchingProvider.Abort(new SubscrException("wrong requests batch"));
- this.batchingProvider = null;
- }
- }
- }
- if (batchToClose != null)
- {
- DoAsyncPost(batchToClose);
- }
- if (monitor != null)
- {
- return monitor.GetReader();
- }
- if (flag)
- {
- return this.GetAnswer(controlUrl, parameters, batch);
- }
- return this.GetNotBatchedAnswer(controlUrl, parameters);
- }
-
- internal virtual StreamReader GetNotBatchedAnswer(string controlUrl, IDictionary parameters)
- {
- HttpProvider provider = new HttpProvider(controlUrl);
- protLogger.Info("Opening control connection");
- if (protLogger.IsDebugEnabled)
- {
- protLogger.Debug("Control params: " + CollectionsSupport.ToString(parameters));
- }
- return new StreamReader(provider.DoHTTP(parameters, true), Encoding.UTF8);
- }
-
- internal virtual void StartBatch(string controlUrl)
- {
- lock (this)
- {
- if (this.batchingProvider != null)
- {
- this.batchingProvider.Abort(new SubscrException("requests batch discarded"));
- }
- this.batchingProvider = new BatchingHttpProvider(controlUrl, this.limit);
- }
- }
-
- internal virtual long Limit
- {
- set
- {
- this.limit = value;
- }
- }
-
- private class AnonymousClassThread : ThreadSupport
- {
- private BatchingHttpProvider batchToClose;
-
- public AnonymousClassThread(BatchingHttpProvider batchToClose)
- {
- this.batchToClose = batchToClose;
- }
-
- public override void Run()
- {
- try
- {
- BatchManager.protLogger.Info("Opening control connection to send batched requests");
- this.batchToClose.DoPosts();
- }
- catch (Exception exception)
- {
- BatchManager.protLogger.Error("Error in batch operation: " + exception.Message);
- this.batchToClose.Abort(exception);
- }
- }
- }
- }
-}
-
View
61 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/BatchMonitor.cs
@@ -1,61 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using System;
-
- internal class BatchMonitor
- {
- private int pendingCalls = 0;
- private bool unlimitedBatch = false;
-
- internal virtual void Clear()
- {
- lock (this)
- {
- this.unlimitedBatch = false;
- this.pendingCalls = 0;
- }
- }
-
- internal virtual void Expand(int batchSize)
- {
- lock (this)
- {
- if (batchSize <= 0)
- {
- this.unlimitedBatch = true;
- }
- else if (!this.unlimitedBatch)
- {
- this.pendingCalls += batchSize;
- }
- }
- }
-
- internal virtual void UseOne()
- {
- lock (this)
- {
- if (!(this.unlimitedBatch || (this.pendingCalls <= 0)))
- {
- this.pendingCalls--;
- }
- }
- }
-
- internal virtual bool Filled
- {
- get
- {
- lock (this)
- {
- if (this.unlimitedBatch)
- {
- return false;
- }
- return (this.pendingCalls == 0);
- }
- }
- }
- }
-}
-
View
227 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/BatchingHttpProvider.cs
@@ -1,227 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using Common.Logging;
- using System;
- using System.Collections;
- using System.IO;
- using System.Net;
- using System.Text;
- using System.Threading;
-
- internal class BatchingHttpProvider : HttpProvider
- {
- private bool consumed;
- private BufferedReaderMonitor firstReader;
- private BufferedReaderMonitor lastReader;
- private long limit;
- private static ILog streamLogger = LogManager.GetLogger(typeof(com.lightstreamer.ls_client.stream));
-
- public BatchingHttpProvider(string address, long limit) : base(address)
- {
- this.consumed = false;
- this.limit = limit;
- }
-
- public virtual void Abort(Exception error)
- {
- BufferedReaderMonitor firstReader;
- lock (this)
- {
- if (this.consumed)
- {
- }
- this.consumed = true;
- firstReader = this.firstReader;
- }
- if (firstReader != null)
- {
- firstReader.Error = error;
- }
- }
-
- public virtual BufferedReaderMonitor AddCall(IDictionary parameters)
- {
- lock (this)
- {
- if (this.consumed)
- {
- throw new SubscrException("Illegal use of a batch");
- }
- if (!this.AddLine(parameters, this.limit))
- {
- return null;
- }
- BufferedReaderMonitor monitor = new BufferedReaderMonitor();
- if (this.lastReader == null)
- {
- this.firstReader = monitor;
- }
- else
- {
- this.lastReader.Next = monitor;
- }
- this.lastReader = monitor;
- return monitor;
- }
- }
-
- public virtual void DoPosts()
- {
- BufferedReaderMonitor firstReader;
- lock (this)
- {
- if (this.consumed)
- {
- return;
- }
- this.consumed = true;
- firstReader = this.firstReader;
- }
- if (firstReader != null)
- {
- Stream stream;
- try
- {
- stream = this.DoHTTP(true);
- }
- catch (IOException exception)
- {
- streamLogger.Error("Error in batch operation: " + exception.Message);
- this.Abort(exception);
- return;
- }
- catch (WebException exception2)
- {
- streamLogger.Error("Error in batch operation: " + exception2.Message);
- this.Abort(exception2);
- return;
- }
- MyReader answer = new MyReader(new StreamReader(stream, Encoding.UTF8));
- firstReader.SetReader(answer);
- }
- }
-
- internal virtual bool Empty
- {
- get
- {
- lock (this)
- {
- return (this.firstReader == null);
- }
- }
- }
-
- public class BufferedReaderMonitor
- {
- private BatchingHttpProvider.MyReader answer;
- private static AutoResetEvent autoEvent = new AutoResetEvent(false);
- private Exception error;
- private BatchingHttpProvider.BufferedReaderMonitor next;
-
- public virtual StreamReader GetReader()
- {
- lock (this)
- {
- while ((this.answer == null) && (this.error == null))
- {
- try
- {
- Monitor.Wait(this);
- }
- catch (Exception)
- {
- }
- }
- if (this.error != null)
- {
- if (this.error is IOException)
- {
- throw ((IOException) this.error);
- }
- if (this.error is WebException)
- {
- throw ((WebException) this.error);
- }
- if (this.error is SubscrException)
- {
- throw ((SubscrException) this.error);
- }
- throw new SubscrException(string.Concat(new object[] { "Unexpected ", this.error.GetType(), " :", this.error.Message }));
- }
- return this.answer;
- }
- }
-
- public bool OnReaderClose()
- {
- if (this.next != null)
- {
- this.next.SetReader(this.answer);
- return true;
- }
- return false;
- }
-
- public void SetReader(BatchingHttpProvider.MyReader answer)
- {
- lock (this)
- {
- this.answer = answer;
- answer.Master = this;
- Monitor.Pulse(this);
- }
- }
-
- public virtual Exception Error
- {
- set
- {
- lock (this)
- {
- this.error = value;
- Monitor.Pulse(this);
- }
- if (this.next != null)
- {
- this.next.Error = value;
- }
- }
- }
-
- public virtual BatchingHttpProvider.BufferedReaderMonitor Next
- {
- set
- {
- this.next = value;
- }
- }
- }
-
- internal class MyReader : StreamReader
- {
- private BatchingHttpProvider.BufferedReaderMonitor master;
-
- public MyReader(StreamReader reader) : base(reader.BaseStream, reader.CurrentEncoding)
- {
- }
-
- public override void Close()
- {
- if (!this.master.OnReaderClose())
- {
- BatchingHttpProvider.streamLogger.Debug("Closing control connection");
- base.Close();
- }
- }
-
- public virtual BatchingHttpProvider.BufferedReaderMonitor Master
- {
- set
- {
- this.master = value;
- }
- }
- }
- }
-}
View
16 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ClientException.cs
@@ -1,16 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using System;
-
- public class ClientException : Exception
- {
- internal ClientException(string message) : base(message)
- {
- }
-
- internal ClientException(string message, Exception innerException) : base(message, innerException)
- {
- }
- }
-}
-
View
244 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/CollectionsSupport.cs
@@ -1,244 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using System;
- using System.Collections;
- using System.Reflection;
- using System.Text;
-
- internal class CollectionsSupport
- {
- public static bool Add(ICollection c, object obj)
- {
- bool flag = false;
- try
- {
- MethodInfo method = c.GetType().GetMethod("Add");
- if (method == null)
- {
- method = c.GetType().GetMethod("add");
- }
- int num = (int) method.Invoke(c, new object[] { obj });
- if (num >= 0)
- {
- flag = true;
- }
- }
- catch (Exception exception)
- {
- throw exception;
- }
- return flag;
- }
-
- public static void Clear(ICollection c)
- {
- try
- {
- MethodInfo method = c.GetType().GetMethod("Clear");
- if (method == null)
- {
- method = c.GetType().GetMethod("clear");
- }
- method.Invoke(c, new object[0]);
- }
- catch (Exception exception)
- {
- throw exception;
- }
- }
-
- public static bool Contains(ICollection c, object obj)
- {
- bool flag = false;
- try
- {
- MethodInfo method = c.GetType().GetMethod("Contains");
- if (method == null)
- {
- method = c.GetType().GetMethod("contains");
- }
- flag = (bool) method.Invoke(c, new object[] { obj });
- }
- catch (Exception exception)
- {
- throw exception;
- }
- return flag;
- }
-
- public static bool ContainsAll(ICollection target, ICollection c)
- {
- IEnumerator enumerator = c.GetEnumerator();
- bool flag = false;
- try
- {
- MethodInfo method = target.GetType().GetMethod("containsAll");
- if (method != null)
- {
- return (bool) method.Invoke(target, new object[] { c });
- }
- method = target.GetType().GetMethod("Contains");
- while (enumerator.MoveNext())
- {
- if (!(flag = (bool) method.Invoke(target, new object[] { enumerator.Current })))
- {
- return flag;
- }
- }
- }
- catch (Exception exception)
- {
- throw exception;
- }
- return flag;
- }
-
- public static void Copy(IList SourceList, IList TargetList)
- {
- for (int i = 0; i < SourceList.Count; i++)
- {
- TargetList[i] = SourceList[i];
- }
- }
-
- public static void Fill(IList List, object Element)
- {
- for (int i = 0; i < List.Count; i++)
- {
- List[i] = Element;
- }
- }
-
- public static bool Remove(ICollection c, object obj)
- {
- bool flag = false;
- try
- {
- MethodInfo method = c.GetType().GetMethod("remove");
- if (method != null)
- {
- method.Invoke(c, new object[] { obj });
- return flag;
- }
- flag = (bool) c.GetType().GetMethod("Contains").Invoke(c, new object[] { obj });
- c.GetType().GetMethod("Remove").Invoke(c, new object[] { obj });
- }
- catch (Exception exception)
- {
- throw exception;
- }
- return flag;
- }
-
- public static void Shuffle(IList List)
- {
- Random randomList = new Random((int) DateTime.Now.Ticks);
- Shuffle(List, randomList);
- }
-
- public static void Shuffle(IList List, Random RandomList)
- {
- object obj2 = null;
- int num = 0;
- for (int i = 0; i < List.Count; i++)
- {
- num = RandomList.Next(List.Count);
- obj2 = List[i];
- List[i] = List[num];
- List[num] = obj2;
- }
- }
-
- public static object[] ToArray(ICollection c)
- {
- int num = 0;
- object[] objArray = new object[c.Count];
- IEnumerator enumerator = c.GetEnumerator();
- while (enumerator.MoveNext())
- {
- objArray[num++] = enumerator.Current;
- }
- return objArray;
- }
-
- public static object[] ToArray(ICollection c, object[] objects)
- {
- int num = 0;
- object[] objArray = (object[]) Array.CreateInstance(objects.GetType().GetElementType(), c.Count);
- IEnumerator enumerator = c.GetEnumerator();
- while (enumerator.MoveNext())
- {
- objArray[num++] = enumerator.Current;
- }
- if (objects.Length >= c.Count)
- {
- objArray.CopyTo(objects, 0);
- }
- return objArray;
- }
-
- public static string ToString(ICollection c)
- {
- StringBuilder builder = new StringBuilder();
- if (c != null)
- {
- int index = 0;
- object[] objArray = new object[c.Count];
- IEnumerator enumerator = c.GetEnumerator();
- while (enumerator.MoveNext())
- {
- objArray[index++] = enumerator.Current;
- }
- bool flag = ((c is BitArray) || (c is IDictionary)) || ((objArray.Length > 0) && (objArray[0] is DictionaryEntry));
- for (index = 0; index < objArray.Length; index++)
- {
- object obj2 = objArray[index];
- if (obj2 == null)
- {
- builder.Append("null");
- }
- else if (obj2 is DictionaryEntry)
- {
- DictionaryEntry entry = (DictionaryEntry) obj2;
- builder.Append(entry.Key);
- builder.Append("=");
- entry = (DictionaryEntry) obj2;
- builder.Append(entry.Value);
- }
- else
- {
- builder.Append(obj2);
- }
- if (index < (objArray.Length - 1))
- {
- builder.Append(", ");
- }
- }
- if (flag)
- {
- builder.Insert(0, "{");
- builder.Append("}");
- }
- else
- {
- builder.Insert(0, "[");
- builder.Append("]");
- }
- }
- else
- {
- builder.Insert(0, "null");
- }
- return builder.ToString();
- }
-
- private class CompareCharValues : IComparer
- {
- public int Compare(object x, object y)
- {
- return string.CompareOrdinal((string) x, (string) y);
- }
- }
- }
-}
-
View
64 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ConnectionConstraints.cs
@@ -1,64 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using System;
-
- public class ConnectionConstraints
- {
- [Obsolete("Use the MaxBandwidth property instead of the maxBandwidth member.")]
- public double maxBandwidth = -1.0;
-
- public virtual object Clone()
- {
- return (ConnectionConstraints) base.MemberwiseClone();
- }
-
- public override bool Equals(object other)
- {
- if (other != this)
- {
- if (other == null)
- {
- return false;
- }
- ConnectionConstraints constraints = (ConnectionConstraints) other;
- if (!(constraints.maxBandwidth == this.maxBandwidth))
- {
- return false;
- }
- }
- return true;
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- public override string ToString()
- {
- string str = null;
- if (!(this.maxBandwidth == -1.0))
- {
- str = "BW = " + this.maxBandwidth;
- }
- if (str != null)
- {
- return str;
- }
- return "NO CONSTRAINTS";
- }
-
- public double MaxBandwidth
- {
- get
- {
- return this.maxBandwidth;
- }
- set
- {
- this.maxBandwidth = value;
- }
- }
- }
-}
-
View
355 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ConnectionInfo.cs
@@ -1,355 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using System;
-
- public class ConnectionInfo
- {
- [Obsolete("Use the Adapter property instead of the adapter member.")]
- public string adapter = null;
- [Obsolete("Use the Constraints property instead of the constraints member; the configuration object should be modified rather than replaced.")]
- public ConnectionConstraints constraints = new ConnectionConstraints();
- [Obsolete("Use the ContentLength property instead of the contentLength member.")]
- public int contentLength = 0x2faf080;
- [Obsolete("Use the EnableStreamSense property instead of the enableStreamSense member.")]
- public bool enableStreamSense = true;
- [Obsolete("Use the Polling property instead of the isPolling member.")]
- public bool isPolling = false;
- [Obsolete("Use the KeepaliveMillis property instead of the keepaliveMillis member.")]
- public long keepaliveMillis = 0L;
- [Obsolete("Use the Password property instead of the password member.")]
- public string password = null;
- [Obsolete("Use the PollingIdleMillis property instead of the pollingIdleMillis member.")]
- public long pollingIdleMillis = 0x7530L;
- [Obsolete("Use the PollingMillis property instead of the pollingMillis member.")]
- public long pollingMillis = 0L;
- [Obsolete("Use the ProbeTimeoutMillis property instead of the probeTimeoutMillis member.")]
- public long probeTimeoutMillis = 0x3a98L;
- [Obsolete("Use the ProbeWarningMillis property instead of the probeWarningMillis member.")]
- public long probeWarningMillis = 0x7d0L;
- [Obsolete("Use the PushServerControlUrl property instead of the pushServerControlUrl member.")]
- public string pushServerControlUrl = null;
- [Obsolete("Use the PushServerUrl property instead of the pushServerUrl member.")]
- public string pushServerUrl = null;
- [Obsolete("Use the ReconnectionTimeoutMillis property instead of the reconnectionTimeoutMillis member.")]
- public long reconnectionTimeoutMillis = 0x1388L;
- [Obsolete("Use the StreamingTimeoutMillis property instead of the streamingTimeoutMillis member.")]
- public long streamingTimeoutMillis = 0x1388L;
- internal bool useGetForStreaming = false;
- [Obsolete("Use the User property instead of the user member.")]
- public string user = null;
-
- public virtual object Clone()
- {
- ConnectionInfo info = (ConnectionInfo) base.MemberwiseClone();
- info.constraints = (ConnectionConstraints) info.constraints.Clone();
- return info;
- }
-
- public override bool Equals(object other)
- {
- if (other != this)
- {
- if (other == null)
- {
- return false;
- }
- ConnectionInfo info = (ConnectionInfo) other;
- if (info.probeTimeoutMillis != this.probeTimeoutMillis)
- {
- return false;
- }
- if (info.probeWarningMillis != this.probeWarningMillis)
- {
- return false;
- }
- if (info.keepaliveMillis != this.keepaliveMillis)
- {
- return false;
- }
- if (info.reconnectionTimeoutMillis != this.reconnectionTimeoutMillis)
- {
- return false;
- }
- if (info.enableStreamSense != this.enableStreamSense)
- {
- return false;
- }
- if (info.streamingTimeoutMillis != this.streamingTimeoutMillis)
- {
- return false;
- }
- if (info.contentLength != this.contentLength)
- {
- return false;
- }
- if (info.isPolling != this.isPolling)
- {
- return false;
- }
- if (info.useGetForStreaming != this.useGetForStreaming)
- {
- return false;
- }
- if (info.pollingMillis != this.pollingMillis)
- {
- return false;
- }
- if (info.pollingIdleMillis != this.pollingIdleMillis)
- {
- return false;
- }
- if (!this.Equals(info.pushServerUrl, this.pushServerUrl))
- {
- return false;
- }
- if (!this.Equals(info.pushServerControlUrl, this.pushServerControlUrl))
- {
- return false;
- }
- if (!this.Equals(info.user, this.user))
- {
- return false;
- }
- if (!this.Equals(info.password, this.password))
- {
- return false;
- }
- if (!this.Equals(info.GetAdapterSet(), this.GetAdapterSet()))
- {
- return false;
- }
- if (!this.Equals(info.constraints, this.constraints))
- {
- return false;
- }
- }
- return true;
- }
-
- private bool Equals(object o1, object o2)
- {
- if ((o1 == null) && (o2 == null))
- {
- return true;
- }
- if ((o1 == null) || (o2 == null))
- {
- return false;
- }
- return o1.Equals(o2);
- }
-
- internal string GetAdapterSet()
- {
- if (this.adapter != null)
- {
- return this.adapter;
- }
- return "DEFAULT";
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- internal bool StartsWithPoll()
- {
- return (this.isPolling || this.useGetForStreaming);
- }
-
- public override string ToString()
- {
- return (this.pushServerUrl + " - " + this.constraints.ToString());
- }
-
- public string Adapter
- {
- get
- {
- return this.adapter;
- }
- set
- {
- this.adapter = value;
- }
- }
-
- public ConnectionConstraints Constraints
- {
- get
- {
- return this.constraints;
- }
- }
-
- public int ContentLength
- {
- get
- {
- return this.contentLength;
- }
- set
- {
- this.contentLength = value;
- }
- }
-
- public bool EnableStreamSense
- {
- get
- {
- return this.enableStreamSense;
- }
- set
- {
- this.enableStreamSense = value;
- }
- }
-
- public long KeepaliveMillis
- {
- get
- {
- return this.keepaliveMillis;
- }
- set
- {
- this.keepaliveMillis = value;
- }
- }
-
- public string Password
- {
- get
- {
- return this.password;
- }
- set
- {
- this.password = value;
- }
- }
-
- public bool Polling
- {
- get
- {
- return this.isPolling;
- }
- set
- {
- this.isPolling = value;
- }
- }
-
- public long PollingIdleMillis
- {
- get
- {
- return this.pollingIdleMillis;
- }
- set
- {
- this.pollingIdleMillis = value;
- }
- }
-
- public long PollingMillis
- {
- get
- {
- return this.pollingMillis;
- }
- set
- {
- this.pollingMillis = value;
- }
- }
-
- public long ProbeTimeoutMillis
- {
- get
- {
- return this.probeTimeoutMillis;
- }
- set
- {
- this.probeTimeoutMillis = value;
- }
- }
-
- public long ProbeWarningMillis
- {
- get
- {
- return this.probeWarningMillis;
- }
- set
- {
- this.probeWarningMillis = value;
- }
- }
-
- public string PushServerControlUrl
- {
- get
- {
- return this.pushServerControlUrl;
- }
- set
- {
- this.pushServerControlUrl = value;
- }
- }
-
- public string PushServerUrl
- {
- get
- {
- return this.pushServerUrl;
- }
- set
- {
- this.pushServerUrl = value;
- }
- }
-
- public long ReconnectionTimeoutMillis
- {
- get
- {
- return this.reconnectionTimeoutMillis;
- }
- set
- {
- this.reconnectionTimeoutMillis = value;
- }
- }
-
- public long StreamingTimeoutMillis
- {
- get
- {
- return this.streamingTimeoutMillis;
- }
- set
- {
- this.streamingTimeoutMillis = value;
- }
- }
-
- public string User
- {
- get
- {
- return this.user;
- }
- set
- {
- this.user = value;
- }
- }
- }
-}
-
View
143 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/Constants.cs
@@ -1,143 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using System;
- using System.Reflection;
- using System.Runtime.InteropServices;
-
- internal class Constants
- {
- public static string localVersion = getLocalVersion();
- public const string pushServerBindCmd = "/lightstreamer/bind_session.txt";
- public const string pushServerCmd = "/lightstreamer/create_session.txt";
- public const string pushServerControlCmd = "/lightstreamer/control.txt";
- public const string pushServerSendMessageCmd = "/lightstreamer/send_message.txt";
- public const string requestContentType = "application/x-www-form-urlencoded";
- public const string requestUserAgent = "Lightstreamer .NET Client";
-
- private static string getLocalVersion()
- {
- try
- {
- object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(false);
- for (int i = 0; i < customAttributes.Length; i++)
- {
- if (customAttributes[i] is AssemblyFileVersionAttribute)
- {
- return ((AssemblyFileVersionAttribute) customAttributes[i]).Version;
- }
- }
- }
- catch (Exception)
- {
- }
- return "0.0";
- }
-
- public class CommandMode
- {
- public const string addCommand = "ADD";
- public const string commandField = "command";
- public const string deleteCommand = "DELETE";
- public const string keyField = "key";
- public const string updateCommand = "UPDATE";
- }
-
- public class ConnectionConstraints
- {
- public const double maxBandwidthNotSet = -1.0;
- }
-
- [StructLayout(LayoutKind.Sequential, Size=1)]
- public struct FastItemsListener
- {
- public static readonly string UNCHANGED;
- static FastItemsListener()
- {
- UNCHANGED = Lightstreamer.DotNet.Client.ServerUpdateEvent.UNCHANGED;
- }
- }
-
- public class PushServerPage
- {
- public const string controlAddress = "ControlAddress:";
- public const string endCommand = "END";
- public const string eosMarker = "EOS";
- public const string errorCommand = "ERROR";
- public const string keepaliveMillis = "KeepaliveMillis:";
- public const string loopCommand = "LOOP";
- public const string maxBandwidth = "MaxBandwidth:";
- public const string okCommand = "OK";
- public const string overflowMarker = "OV";
- public const string probeCommand = "PROBE";
- public const string requestLimit = "RequestLimit:";
- public const string sessionId = "SessionId:";
- public const string syncErrorCommand = "SYNC ERROR";
- }
-
- public class PushServerQuery
- {
- public const string adapterSetKey = "LS_adapter_set";
- public const string contentLengthKey = "LS_content_length";
- public const string dataAdapterKey = "LS_data_adapter";
- public const string itemNameBase = "LS_id";
- public const string keepaliveMillisKey = "LS_keepalive_millis";
- public const string maxBandwidthKey = "LS_requested_max_bandwidth";
- public const string messageKey = "LS_message";
- public const string opAdd = "add";
- public const string opConstrain = "constrain";
- public const string opDelete = "delete";
- public const string opDestroy = "destroy";
- public const string opKey = "LS_op";
- public const string passwordKey = "LS_password";
- public const string pollingIdleKey = "LS_idle_millis";
- public const string pollingKey = "LS_polling";
- public const string pollingMillisKey = "LS_polling_millis";
- public const string pushModeBase = "LS_mode";
- public const string reportKey = "LS_report_info";
- public const string schemaKey = "LS_schema";
- public const string selectorKey = "LS_selector";
- public const string sessionIdKey = "LS_session";
- public const string silverlightLibKey = "LS_silverlight_version";
- public const string snapshotKey = "LS_Snapshot";
- public const string snapshotOn = "true";
- public const string tableBufferSizeKey = "LS_requested_buffer_size";
- public const string tableCodeBase = "LS_table";
- public const string tableEndKey = "LS_end";
- public const string tableFrequencyKey = "LS_requested_max_frequency";
- public const string tableStartKey = "LS_start";
- public const string unfilteredDispatching = "unfiltered";
- public const string userIdKey = "LS_user";
- }
-
- public class ServerUpdateEvent
- {
- public const int itemCodeNotSet = -1;
- public const int tableCodeNotSet = -1;
- }
-
- [StructLayout(LayoutKind.Sequential, Size=1)]
- public struct SimpleTableListener
- {
- public static readonly string UNCHANGED;
- static SimpleTableListener()
- {
- UNCHANGED = Lightstreamer.DotNet.Client.ServerUpdateEvent.UNCHANGED;
- }
- }
-
- public class SubscribedTableKey
- {
- public const int keyValueNotSet = -1;
- }
-
- public class TableManager
- {
- public const int bufferSizeNotSet = -1;
- public const int distinctSnapshotLengthNotSet = -1;
- public const int endNotSet = -1;
- public const double maxFrequencyNotSet = -1.0;
- public const int startNotSet = -1;
- }
- }
-}
-
View
123 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ExtConnectionListener.cs
@@ -1,123 +0,0 @@
-
-namespace Lightstreamer.DotNet.Client
-{
- using System;
- using System.Threading;
-
- internal class ExtConnectionListener : IConnectionListener
- {
- private Exception connFailure = null;
- private NotificationQueue queue = new NotificationQueue("Stream-sense queue", false);
- private bool streamingAppended = false;
- private ManualResetEvent streamingTested = new ManualResetEvent(false);
- private IConnectionListener target;
-
- public ExtConnectionListener(IConnectionListener target)
- {
- this.target = target;
- }
-
- public void FlushAndStart()
- {
- this.queue.Start();
- }
-
- public void OnActivityWarning(bool warningOn)
- {
- this.queue.Add(delegate {
- this.target.OnActivityWarning(warningOn);
- });
- }
-
- public void OnClose()
- {
- this.queue.Add(delegate {
- this.target.OnClose();
- });
- this.queue.End();
- }
-
- public void OnConnectException(Exception e)
- {
- this.connFailure = e;
- this.streamingTested.Set();
- }
-
- public void OnConnectionEstablished()
- {
- this.queue.Add(delegate {
- this.target.OnConnectionEstablished();
- });
- }
-
- public void OnConnectTimeout(PushServerException e)
- {
- this.streamingAppended = true;
- this.streamingTested.Set();
- this.queue.Add(delegate {
- this.target.OnFailure(e);
- });
- }
-
- public void OnDataError(PushServerException e)
- {
- this.queue.Add(delegate {
- this.target.OnDataError(e);
- });
- }
-
- public void OnEnd(int cause)
- {
- this.queue.Add(delegate {
- this.target.OnEnd(cause);
- });
- this.streamingTested.Set();
- }
-
- public void OnFailure(PushConnException e)
- {
- this.queue.Add(delegate {
- this.target.OnFailure(e);
- });
- this.streamingTested.Set();
- }
-
- public void OnFailure(PushServerException e)
- {
- this.queue.Add(delegate {
- this.target.OnFailure(e);
- });
- this.streamingTested.Set();
- }
-
- public void OnNewBytes(long bytes)
- {
- this.queue.Add(delegate {
- this.target.OnNewBytes(bytes);
- });
- }
-
- public void OnSessionStarted(bool isPolling)
- {
- this.queue.Add(delegate {
- this.target.OnSessionStarted(isPolling);
- });
- }
-
- public void OnStreamingReturned()
- {
- this.streamingTested.Set();
- }
-
- public bool WaitStreamingTimeoutAnswer()
- {
- streamingTested.WaitOne();
- if (this.connFailure != null)
- {
- throw this.connFailure;
- }
- return this.streamingAppended;
- }
- }
-}
-
View
105 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ExtendedTableInfo.cs
@@ -1,105 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using System;
- using System.Text;
-
- public class ExtendedTableInfo : SimpleTableInfo
- {
- internal string[] fields;
- internal string[] items;
-
- public ExtendedTableInfo(string[] items, string mode, string[] fields, bool snapshot) : base(GetGroupName(items), mode, GetSchemaName(fields), snapshot)
- {
- this.items = (string[]) items.Clone();
- this.fields = (string[]) fields.Clone();
- }
-
- public override object Clone()
- {
- return base.MemberwiseClone();
- }
-
- [Obsolete("Use the Fields property instead of the GetFields method.")]
- public virtual string[] GetFields()
- {
- return (string[]) this.fields.Clone();
- }
-
- [Obsolete("Use the Group property instead of the GetGroup method.")]
- public override string GetGroup()
- {
- return base.group;
- }
-
- private static string GetGroupName(string[] items)
- {
- StringBuilder builder = new StringBuilder(items[0]);
- for (int i = 1; i < items.Length; i++)
- {
- builder.Append(' ');
- builder.Append(items[i]);
- }
- return builder.ToString();
- }
-
- [Obsolete("Use the Items property instead of the GetItems method.")]
- public virtual string[] GetItems()
- {
- return (string[]) this.items.Clone();
- }
-
- [Obsolete("Use the Schema property instead of the GetSchema method.")]
- public override string GetSchema()
- {
- return base.schema;
- }
-
- private static string GetSchemaName(string[] fields)
- {
- StringBuilder builder = new StringBuilder(fields[0]);
- for (int i = 1; i < fields.Length; i++)
- {
- builder.Append(' ');
- builder.Append(fields[i]);
- }
- return builder.ToString();
- }
-
- public override void SetRange(int start, int end)
- {
- }
-
- public virtual string[] Fields
- {
- get
- {
- return this.GetFields();
- }
- }
-
- public override string Group
- {
- get
- {
- return base.group;
- }
- }
-
- public virtual string[] Items
- {
- get
- {
- return this.GetItems();
- }
- }
-
- public override string Schema
- {
- get
- {
- return base.schema;
- }
- }
- }
-}
-
View
201 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/ExtendedTableManager.cs
@@ -1,201 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using Common.Logging;
- using System;
- using System.Collections;
-
- internal class ExtendedTableManager : ITableManager
- {
- private static ILog actionsLogger = LogManager.GetLogger(typeof(com.lightstreamer.ls_client.actions));
- private IExtendedTableListener listener;
- private ExtendedTableInfo table;
-
- internal ExtendedTableManager(ExtendedTableInfo table, IExtendedTableListener listener)
- {
- this.table = (ExtendedTableInfo) table.Clone();
- this.listener = listener;
- }
-
- public virtual void DoUpdate(ServerUpdateEvent values)
- {
- int itemCode = values.ItemCode;
- if ((itemCode <= 0) || (itemCode > this.table.items.Length))
- {
- throw new PushServerException(2);
- }
- ProcessUpdate(values, itemCode - 1, this.table, this.listener);
- }
-
- public virtual void NotifyUnsub()
- {
- for (int i = 0; i < this.table.items.Length; i++)
- {
- try
- {
- this.listener.OnUnsubscr(this.table.items[i]);
- }
- catch (Exception)
- {
- }
- }
- try
- {
- this.listener.OnUnsubscrAll();
- }
- catch (Exception)
- {
- }
- }
-
- internal static void ProcessUpdate(ServerUpdateEvent values, int itemIndex, ExtendedTableInfo table, IExtendedTableListener listener)
- {
- string item = table.items[itemIndex];
- if (values.EOS)
- {
- try
- {
- listener.OnSnapshotEnd(item);
- }
- catch (Exception)
- {
- }
- }
- else if (values.Overflow > 0)
- {
- if (!table.hasUnfilteredData())
- {
- throw new PushServerException(7);
- }
- actionsLogger.Warn("Got notification of updates lost for item " + item);
- try
- {
- listener.OnRawUpdatesLost(item, values.Overflow);
- }
- catch (Exception)
- {
- }
- }
- else
- {
- if (values.Size != table.fields.Length)
- {
- throw new PushServerException(3);
- }
- IDictionary map = values.GetMap(table.fields);
- if (actionsLogger.IsDebugEnabled)
- {
- actionsLogger.Debug("Got event for item " + item + " with values " + CollectionsSupport.ToString(map));
- }
- try
- {
- listener.OnUpdate(item, map);
- }
- catch (Exception)
- {
- }
- }
- }
-
- public override string ToString()
- {
- return (this.Mode + " table [" + this.Group + " ; " + this.Schema + "]");
- }
-
- public virtual string DataAdapter
- {
- get
- {
- return this.table.dataAdapter;
- }
- }
-
- public virtual int DistinctSnapshotLength
- {
- get
- {
- return this.table.distinctSnapshotLength;
- }
- }
-
- public virtual int End
- {
- get
- {
- return this.table.end;
- }
- }
-
- public virtual string Group
- {
- get
- {
- return this.table.group;
- }
- }
-
- public virtual int MaxBufferSize
- {
- get
- {
- return this.table.bufferSize;
- }
- }
-
- public virtual double MaxFrequency
- {
- get
- {
- return this.table.maxFrequency;
- }
- }
-
- public virtual string Mode
- {
- get
- {
- return this.table.mode;
- }
- }
-
- public virtual string Schema
- {
- get
- {
- return this.table.schema;
- }
- }
-
- public virtual string Selector
- {
- get
- {
- return this.table.selector;
- }
- }
-
- public virtual bool Snapshot
- {
- get
- {
- return this.table.snapshot;
- }
- }
-
- public virtual int Start
- {
- get
- {
- return this.table.start;
- }
- }
-
- public virtual bool Unfiltered
- {
- get
- {
- return this.table.unfiltered;
- }
- }
- }
-}
-
View
524 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/FullTableManager.cs
@@ -1,524 +0,0 @@
-namespace Lightstreamer.DotNet.Client
-{
- using Common.Logging;
- using System;
- using System.Collections;
- using System.Collections.Generic;
-
- internal class FullTableManager : ITableManager
- {
- private static ILog actionsLogger = LogManager.GetLogger(typeof(com.lightstreamer.ls_client.actions));
- private SimpleTableInfo baseInfo;
- private ExtendedTableInfo extInfo;
- private IDictionary fieldIndexMap = new Dictionary<string, int>();
- private bool isCommandLogic;
- private IList itemInfos = new List<ItemInfo>();
- private IHandyTableListener listener;
- private static object nullPlaceholder = new object();
- private bool unsubscrDone = false;
-
- internal FullTableManager(SimpleTableInfo table, IHandyTableListener listener, bool doCommandLogic)
- {
- this.baseInfo = (SimpleTableInfo) table.Clone();
- this.isCommandLogic = doCommandLogic;
- if (table is ExtendedTableInfo)
- {
- this.extInfo = (ExtendedTableInfo) this.baseInfo;
- this.fieldIndexMap = new Dictionary<string, int>();
- for (int i = 0; i < this.extInfo.fields.Length; i++)
- {
- this.fieldIndexMap[this.extInfo.fields[i]] = i;
- }
- }
- else
- {
- this.extInfo = null;
- this.fieldIndexMap = null;
- }
- this.listener = listener;
- }
-
- public virtual void DoUpdate(ServerUpdateEvent values)
- {
- int itemCode = values.ItemCode;
- int itemIndex = itemCode - 1;
- this.ProcessUpdate(values, itemCode, itemIndex);
- }
-
- public virtual void NotifyUnsub()
- {
- ItemInfo[] objects = new ItemInfo[this.itemInfos.Count];
- lock (this.itemInfos)
- {
- objects = (ItemInfo[]) CollectionsSupport.ToArray(this.itemInfos, objects);
- this.unsubscrDone = true;
- }
- for (int i = 0; i < objects.Length; i++)
- {
- if (objects[i] != null)
- {
- this.NotifyUnsubForItem(objects[i].pos, objects[i].name);
- }
- }
- try
- {
- this.listener.OnUnsubscrAll();
- }
- catch (Exception)
- {
- }
- }
-
- internal void NotifyUnsubForItem(int itemPos, string itemName)
- {
- try
- {
- this.listener.OnUnsubscr(itemPos, itemName);
- }
- catch (Exception)
- {
- }
- }
-
- internal void ProcessUpdate(ServerUpdateEvent values, int itemPos, int itemIndex)
- {
- string name = null;
- ItemInfo info;
- if (this.extInfo != null)
- {
- if ((itemIndex < 0) || (itemIndex >= this.extInfo.items.Length))
- {
- throw new PushServerException(2);
- }
- name = this.extInfo.items[itemIndex];
- }
- lock (this.itemInfos)
- {
- if (this.unsubscrDone)
- {
- return;
- }
- while (this.itemInfos.Count <= itemIndex)
- {
- this.itemInfos.Add(null);
- }
- info = (ItemInfo) this.itemInfos[itemIndex];
- if (info == null)
- {
- if (this.isCommandLogic)
- {
- info = new CommandLogicItemInfo(this, itemPos, name);
- }
- else
- {
- info = new ItemInfo(this, itemPos, name);
- }
- this.itemInfos[itemIndex] = info;
- }
- }
- if (values.EOS)
- {
- info.snapshotPending = false;
- try
- {
- this.listener.OnSnapshotEnd(itemPos, name);
- }
- catch (Exception)
- {
- }
- }
- else if (values.Overflow > 0)
- {
- if (!this.baseInfo.hasUnfilteredData())
- {
- throw new PushServerException(7);
- }
- actionsLogger.Warn("Got notification of updates lost for item " + info);
- try
- {
- this.listener.OnRawUpdatesLost(itemPos, name, values.Overflow);
- }
- catch (Exception)
- {
- }
- }
- else
- {
- if ((this.extInfo != null) && (values.Size != this.extInfo.fields.Length))
- {
- throw new PushServerException(3);
- }
- string[] array = values.Array;
- if (actionsLogger.IsDebugEnabled)
- {
- actionsLogger.Debug(string.Concat(new object[] { "Got event for item ", info, " with values ", CollectionsSupport.ToString(array) }));
- }
- bool snapshotPending = info.snapshotPending;
- string[] prevState = info.Update(array);
- if (prevState != null)
- {
- IUpdateInfo update = new UpdateInfoImpl(info, prevState, array, snapshotPending);
- if (actionsLogger.IsDebugEnabled)
- {
- actionsLogger.Debug(string.Concat(new object[] { "Notifying event for item ", info, " with values ", update }));
- }
- try
- {
- this.listener.OnUpdate(itemPos, name, update);
- }
- catch (Exception)
- {
- }
- }
- }
- }
-
- public override string ToString()
- {
- return (this.Mode + " table [" + this.Group + " ; " + this.Schema + "]");
- }
-
- public virtual string DataAdapter
- {
- get
- {
- return this.baseInfo.dataAdapter;
- }
- }
-
- public virtual int DistinctSnapshotLength
- {
- get
- {
- return this.baseInfo.distinctSnapshotLength;
- }
- }
-
- public virtual int End
- {
- get
- {
- return this.baseInfo.end;
- }
- }
-
- public virtual string Group
- {
- get
- {
- return this.baseInfo.group;
- }
- }
-
- public virtual int MaxBufferSize
- {
- get
- {
- return this.baseInfo.bufferSize;
- }
- }
-
- public virtual double MaxFrequency
- {
- get
- {
- return this.baseInfo.maxFrequency;
- }
- }
-
- public virtual string Mode
- {
- get
- {
- return this.baseInfo.mode;
- }
- }
-
- public virtual string Schema
- {
- get
- {
- return this.baseInfo.schema;
- }
- }
-
- public virtual string Selector
- {
- get
- {
- return this.baseInfo.selector;
- }
- }
-
- public virtual bool Snapshot
- {
- get
- {
- return this.baseInfo.snapshot;
- }
- }
-
- public virtual int Start
- {
- get
- {
- return this.baseInfo.start;
- }
- }
-
- public virtual bool Unfiltered
- {
- get
- {
- return this.baseInfo.unfiltered;
- }
- }
-
- private class CommandLogicItemInfo : FullTableManager.ItemInfo
- {
- private int commandIndex;
- private int keyIndex;
- private IDictionary keyStates;
-
- public CommandLogicItemInfo(FullTableManager enclosingInstance, int pos, string name) : base(enclosingInstance, pos, name)
- {
- this.keyStates = new Dictionary<object, string[]>();
- if (enclosingInstance.extInfo != null)
- {
- if (enclosingInstance.fieldIndexMap.Contains("key"))
- {
- this.keyIndex = (int) enclosingInstance.fieldIndexMap["key"];
- }
- else
- {
- this.keyIndex = -1;
- }
- if (enclosingInstance.fieldIndexMap.Contains("command"))
- {
- this.commandIndex = (int) enclosingInstance.fieldIndexMap["command"];
- }
- else
- {
- this.commandIndex = -1;
- }
- }
- else
- {
- this.keyIndex = 0;
- this.commandIndex = 1;
- }
- }
-
- public override string[] Update(string[] updEvent)
- {
- int num;
- base.Update(updEvent);
- string str = "ADD";
- string str2 = "UPDATE";
- string str3 = "DELETE";
- object nullPlaceholder = FullTableManager.nullPlaceholder;
- if ((this.keyIndex >= 0) && (this.keyIndex < base.currState.Length))
- {
- nullPlaceholder = base.currState[this.keyIndex];
- }
- else
- {
- FullTableManager.actionsLogger.Warn("key field not subscribed for item " + this + " - null key forced for command logic");
- }
- string str4 = null;
- if ((this.commandIndex >= 0) && (this.commandIndex < base.currState.Length))
- {
- str4 = base.currState[this.commandIndex];
- if (str4 == null)
- {
- FullTableManager.actionsLogger.Warn("No value found for command field for item " + this + " - trying to add/update for command logic");
- }
- else if (str4.Equals(str3))
- {
- str4 = str3;
- }
- else if (str4.Equals(str))
- {
- str4 = str;
- }
- else if (str4.Equals(str2))
- {
- str4 = str2;
- }
- else
- {
- FullTableManager.actionsLogger.Warn("Invalid value for command field for item " + this + " - trying to add/update for command logic");
- }
- }
- else
- {
- FullTableManager.actionsLogger.Warn("command field not subscribed for item " + this + " - trying to add/update for command logic");
- }
- string[] strArray = (string[]) this.keyStates[nullPlaceholder];
- if (str4 == str3)
- {
- if (FullTableManager.actionsLogger.IsDebugEnabled)
- {
- FullTableManager.actionsLogger.Debug(string.Concat(new object[] { "Processing DELETE event in COMMAND logic for item ", this, " and key ", (nullPlaceholder != FullTableManager.nullPlaceholder) ? nullPlaceholder : "null" }));
- }
- if (strArray == null)
- {
- FullTableManager.actionsLogger.Warn("Unexpected DELETE command for item " + this + " - discarding the command");
- return null;
- }
- this.keyStates.Remove(nullPlaceholder);
- for (num = 0; num < base.currState.Length; num++)
- {
- if (num == this.keyIndex)
- {
- updEvent[num] = ServerUpdateEvent.UNCHANGED;
- }
- else if (num == this.commandIndex)
- {
- updEvent[num] = str3;
- }
- else
- {
- updEvent[num] = null;
- }
- }
- return strArray;
- }
- if (FullTableManager.actionsLogger.IsDebugEnabled)
- {
- FullTableManager.actionsLogger.Debug(string.Concat(new object[] { "Processing ADD/UPDATE event in COMMAND logic for item ", this, " and key ", (nullPlaceholder != FullTableManager.nullPlaceholder) ? nullPlaceholder : "null" }));
- }
- if (strArray == null)
- {
- if (str4 == str2)
- {
- FullTableManager.actionsLogger.Warn("Unexpected UPDATE command for item " + this + " - command changed into ADD");
- }
- for (num = 0; num < base.currState.Length; num++)
- {
- if (num == this.commandIndex)
- {
- updEvent[num] = str;
- }
- else
- {
- updEvent[num] = base.currState[num];
- }
- }
- this.keyStates[nullPlaceholder] = updEvent;
- return new string[base.currState.Length];
- }
- if (str4 == str)
- {
- FullTableManager.actionsLogger.Warn("Unexpected ADD command for item " + this + " - command changed into UPDATE");
- }
- for (num = 0; num < base.currState.Length; num++)
- {
- if (num == this.keyIndex)
- {
- updEvent[num] = ServerUpdateEvent.UNCHANGED;
- }
- else if (num == this.commandIndex)
- {
- updEvent[num] = (strArray[num] == str) ? str2 : ServerUpdateEvent.UNCHANGED;
- }
- else if ((base.currState[num] == null) && (strArray[num] == null))
- {
- updEvent[num] = ServerUpdateEvent.UNCHANGED;
- }
- else if ((base.currState[num] == null) || (strArray[num] == null))
- {
- updEvent[num] = base.currState[num];
- }
- else if (base.currState[num].Equals(strArray[num]))
- {
- updEvent[num] = ServerUpdateEvent.UNCHANGED;
- }
- else
- {
- updEvent[num] = base.currState[num];
- }
- }
- if (str4 == str2)
- {
- this.keyStates[nullPlaceholder] = base.currState;
- }
- else
- {
- string[] strArray2 = new string[base.currState.Length];
- for (num = 0; num < base.currState.Length; num++)
- {
- if (num == this.commandIndex)
- {
- strArray2[num] = str2;
- }
- else
- {
- strArray2[num] = base.currState[num];
- }
- }
- this.keyStates[nullPlaceholder] = strArray2;
- }
- return strArray;
- }
- }
-
- internal class ItemInfo
- {
- protected string[] currState;
- protected FullTableManager enclosingInstance;
- public string name;
- public int pos;
- public bool snapshotPending;
-
- public ItemInfo(FullTableManager enclosingInstance, int pos, string name)
- {
- this.enclosingInstance = enclosingInstance;
- this.pos = pos;
- this.name = name;
- this.snapshotPending = enclosingInstance.baseInfo.snapshot;
- }
-
- public IDictionary GetFieldIndexMap()
- {
- return this.enclosingInstance.fieldIndexMap;
- }
-
- public override string ToString()
- {
- if (this.name != null)
- {
- return this.name;
- }
- return this.pos.ToString();
- }
-
- public virtual string[] Update(string[] updEvent)
- {
- if (this.currState == null)
- {
- this.currState = new string[updEvent.Length];
- }
- string[] currState = this.currState;
- this.currState = new string[this.currState.Length];
- for (int i = 0; i < this.currState.Length; i++)
- {
- if (updEvent[i] != ServerUpdateEvent.UNCHANGED)
- {
- this.currState[i] = updEvent[i];
- }
- else
- {
- this.currState[i] = currState[i];
- }
- }
- if (this.snapshotPending && this.enclosingInstance.baseInfo.mode.Equals("MERGE"))
- {
- this.snapshotPending = false;
- }
- return currState;
- }
- }
- }
-}
-
View
276 src/StreamingClient.Phone7.Lightstreamer/Lightstreamer.Phone7/HttpProvider.cs
@@ -1,276 +0,0 @@
-
-using StreamingClient.Lightstreamer;
-
-namespace Lightstreamer.DotNet.Client
-{
- using Common.Logging;
- using System;
- using System.Collections;
- using System.IO;
- using System.Net;
- using System.Security;
- using System.Text;
- using System.Threading;
-
-
- internal class HttpProvider
- {
- private string address;
- private static ILog protLogger = LogManager.GetLogger(typeof(com.lightstreamer.ls_client.protocol));
- private string request;
- private static ILog streamLogger = LogManager.GetLogger(typeof(com.lightstreamer.ls_client.stream));
-
- public HttpProvider(string address)
- {
- this.address = address;
- }
-
- protected internal virtual bool AddLine(IDictionary parameters, long limit)
- {
- string str2;
- string str = this.HashToString(parameters);
- if (this.request == null)
- {
- str2 = str;
- }
- else
- {
- str2 = this.request + "\r\n" + str;
- }
- if ((limit > 0L) && (str2.Length > limit))
- {
- return false;
- }
- this.request = str2;
- return true;
- }
-
- internal virtual Stream DoHTTP(bool isPost)
- {
- HttpWebRequest request;
- Stream responseStream;
- if (isPost)
- {
- request = this.SendPost();
- }
- else
- {
- request = this.SendGet();
- }
- WebResponse response = null;
- try
- {
- MyRequestState state = new MyRequestState {
- request = request
- };
- IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpProvider.ReadCallback), state);
- state.allDone.WaitOne();
-
- if (state.ioException != null)
- {
- throw state.ioException;
- }
- if (state.webException != null)
- {
- throw state.webException;
- }
- response = state.response;
- responseStream = response.GetResponseStream();
- }
- catch (Exception exception)
- {
- if (response != null)
- {
- try
- {
- response.Close();
- }
- catch (Exception)
- {
- }
- }
- throw exception;
- }
- return responseStream;
- }
-
- public virtual Stream DoHTTP(IDictionary parameters, bool isPost)
- {
- this.AddLine(parameters, 0L);
- return this.DoHTTP(isPost);
- }
-
- private string HashToString(IDictionary parameters)
- {
- StringBuilder builder = new StringBuilder();