Advertisement
yallie

ChristianKe / server

Feb 29th, 2012
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. // C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc server.cs /r:Zyan.Communication.dll
  2.  
  3. using System;
  4. using Zyan.Communication;
  5.  
  6. namespace DBAccess
  7. {
  8.    public interface IDBAccess
  9.    {
  10.       event Action<int, string> DataRecv;
  11.  
  12.       void SetData(int Idx, string text);
  13.       string GetData(int Idx);
  14.    }
  15.  
  16.    public class CDBAccess : IDBAccess
  17.    {
  18.       string[] Array = new string[100];
  19.  
  20.       public event Action<int, string> DataRecv;
  21.  
  22.       public void SetData(int Idx, string text)
  23.       {
  24.          Array[Idx] = text;
  25.  
  26.          if (DataRecv != null)
  27.             DataRecv(Idx, text);
  28.       }
  29.  
  30.       public string GetData(int Idx)
  31.       {
  32.          return Array[Idx];
  33.       }
  34.    }
  35.  
  36.    class Program
  37.    {
  38.     static void Main()
  39.     {
  40.             var host = new ZyanComponentHost("DBAccess", 9010);
  41.             host.RegisterComponent<IDBAccess, CDBAccess>(ActivationType.Singleton);
  42.             Console.ReadLine();
  43.     }
  44.    }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement