• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Communicator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Communicator的典型用法代码示例。如果您正苦于以下问题:C# Communicator类的具体用法?C# Communicator怎么用?C# Communicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Communicator类属于命名空间,在下文中一共展示了Communicator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Main

    public static void Main(string[] args)
    {
        Console.WriteLine("GoBang 0.001");
        string host;
        int port;
        if (args.Length < 2)
        {
            host = "localhost";
            port = 7777;

        }
        else
        {
            host = args[0];
            port = int.Parse(args[1]);
        }
        Player one = new NewAiPlayer();
        //Player two = new NewAiPlayer();
        Player two = new Communicator(host, port);

        string color = two.AskColor();
        int size = two.AskSize();

        if (color == "white")
        {
            one.SetColor("white");
            two.SetColor("black");
        }
        else
        {
            Player tmp = one;
            one = two;
            two = tmp;
            one.SetColor("white");
            two.SetColor("black");
        }
        one.SetSize(size);
        two.SetSize(size);

        int[,] board = new int[size, size];
        Coordinate move;
        while (true) {
            move = one.GetMove();
            Console.WriteLine("Got move from player 1: {0}", move);
            if (!valid(board,move))
                throw new Exception("Invalid move " + move);
            board[move.X, move.Y] = 1;
            printBoard(board);
            if (winning(board, 1)) throw new Exception("white has won");
            two.RegOppMove(move);
            move = two.GetMove();
            Console.WriteLine("Got move from player 2: {0}", move);
            if (!valid(board,move))
                throw new Exception("Invalid move " + move);
            board[move.X, move.Y] = -1;
            printBoard(board);
            if (winning(board, -1)) throw new Exception("black has won");
            one.RegOppMove(move);
        }
    }
开发者ID:gomoku,项目名称:Stahlfaust---Gomoku-AI-player,代码行数:60,代码来源:GoBang.cs


示例2: Operations

        public Operations(Communicator communicator)
        {
            this.communicator = communicator;

            databaseConnectionSessionID = this.communicator.CurrentSessionID;
            databaseConnectionCallback = this.communicator.ClientList[databaseConnectionSessionID];
        }
开发者ID:ieuan0928,项目名称:vumva,代码行数:7,代码来源:Operations.cs


示例3: MainWindow

 public MainWindow()
     : base(Gtk.WindowType.Toplevel)
 {
     Build ();
     this._com = new Communicator (new TcpClient ("192.168.0.10", 8888));
     this._vm = new ValueManager (555);
 }
开发者ID:TheOperator,项目名称:OperatorServer,代码行数:7,代码来源:MainWindow.cs


示例4: Main

        static void Main()
        {
            try
            {
                _log.InfoFormat("User: {0}", Environment.UserName);

                while (CommunicatorNotRunning())
                {
                    _log.Info("Communicator is not running. Will try again in 5 seconds");
                    System.Threading.Thread.Sleep(5000);
                }

                var communicator = new Communicator(GetRecordHistoryInterval());
                communicator.ConversationEnded += (s, e) => new SaveConversationToFile(_historyFile).Save(e.EventData);

                var notifyIcon = MakeNotifyIcon();
                notifyIcon.Visible = true;
                Application.Run();
                notifyIcon.Visible = false;
                communicator.Dispose();
            }
            catch (Exception e)
            {
                _log.Error("Exception caught", e);
            }
        }
开发者ID:paulyoder,项目名称:CommunicatorHistory,代码行数:26,代码来源:Program.cs


示例5: MessageHandler

 // Receive in a seperate thread
 public MessageHandler(MainGrid active_grid)
 {
     c = Communicator.GetInstance(active_grid);
     ThreadStart ts = new ThreadStart(c.ReceiveData);
     Thread t = new Thread(ts,50000000);
     t.Start();
 }
开发者ID:anuradhawick,项目名称:NukeIt-Tanker-Game,代码行数:8,代码来源:MessageHandler.cs


示例6: PluginManagerI

 public PluginManagerI(Communicator communicator)
 {
     _communicator = communicator;
     _plugins = new Hashtable();
     _initOrder = new ArrayList();
     _initialized = false;
 }
开发者ID:bholl,项目名称:zeroc-ice,代码行数:7,代码来源:PluginManagerI.cs


示例7: TempCommunicator

        public TempCommunicator(string configFileClasspath)
        {
            log("Constructor called");
            try
            {
                InitializationData initData = new InitializationData();
                initData.properties = Util.createProperties();
                initData.properties.load(configFileClasspath);
                communicator = Util.initialize(initData);
                log("Properties Loaded!");
            }
            catch (Exception e)
            {
                log(e.ToString());
                throw e;
            }
            string proxy1 = "'::TeRK::TeRKUser':tcp -h 127.0.0.1 -p 10101";
            log("Calling stringToProxy on " + proxy1);
            communicator.stringToProxy(proxy1);
            log("Complete!");

            string proxy2 = "'::TeRK::TeRKUser':tcp -h 192.168.0.16 -p 10101";
            log("Calling stringToProxy on " + proxy2);
            communicator.stringToProxy(proxy2);
            log("Complete!");

            log("Constructor terminated");
            writeLog("C:\\tempCommLog.txt");
        }
开发者ID:CMU-CREATE-Lab,项目名称:terk-legacy,代码行数:29,代码来源:TempCommunicator.cs


示例8: client_ConnexionRemoved

 private void client_ConnexionRemoved(Communicator c, IConnexion conn)
 {
     /* if (!IsDisposed && client.Connexions.Count == 0)
     {
         MessageBox.Show(this, "Disconnected from server", Text);
         Close();
     } */
 }
开发者ID:pichiliani,项目名称:CoMusic,代码行数:8,代码来源:ClienteGT.cs


示例9: MainForm

        public MainForm()
        {
            InitializeComponent();            

            _communicator = Communicator.getInstance();

            _activeTalks = new List<Talk>();            
        }
开发者ID:skubisz,项目名称:komunikator-lpp,代码行数:8,代码来源:MainForm.cs


示例10: getInstance

    public static Communicator getInstance()
    {
        if (instance == null)
        {
            instance = new Communicator();
        }

        return instance;
    }
开发者ID:skubisz,项目名称:komunikator-lpp,代码行数:9,代码来源:Communicator.cs


示例11: Main

 static void Main(string[] args)
 {
     Console.WriteLine("Server started.");
     var settings = LoadSettings("Settings.txt");
     GameStateServer gameState = new GameStateServer(settings.Map);
     Communicator communicator = new Communicator(settings.ServerPort, settings.ServerConnectionPort, gameState);
     Console.ReadKey();
     System.Threading.Thread.Sleep(5000);
 }
开发者ID:virvar,项目名称:StillAlive,代码行数:9,代码来源:Program.cs


示例12: GetGameConfiguration

 public void GetGameConfiguration(Action<Response<GameConfiguration>> callback)
 {
     var payload = new Dictionary<string, object>(0);
      var communicator = new Communicator(this);
      communicator.SendPayload<GameConfiguration>(Communicator.POST, "conf", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<GameConfiguration>(r.Raw); }
     callback(r);
      });
 }
开发者ID:intfrr,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs


示例13: PingTimesForm

        public PingTimesForm(Communicator comm)
        {
            InitializeComponent();
            _pingTimes.ClearData(ClearDataFlag.Values);
            _pingTimes.AxisX.Min = 0;

            Text += ": " + comm;
            _observed = comm;
            _statsObserver = CommunicationStatisticsObserver<Communicator>.On(comm);
        }
开发者ID:briandealwis,项目名称:gt,代码行数:10,代码来源:PingTimesForm.cs


示例14: AchievementEarned

 public void AchievementEarned(string achievementId, string userName, string uniqueIdentifier, Action<Response<Achievement>> callback)
 {
     var payload = new Dictionary<string, object> { { "aid", achievementId }, { "username", userName }, { "userkey", uniqueIdentifier } };
      var communicator = new Communicator(this);
      communicator.SendPayload<Achievement>(Communicator.Post, "achievements", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<Achievement>(r.Raw); }
     if (callback != null) { callback(r); }
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs


示例15: GetAssets

 public void GetAssets(Action<Response<IList<Asset>>> callback)
 {
     var payload = new Dictionary<string, object> {{"key", Key}};
      var communicator = new Communicator(this);
      communicator.SendPayload<IList<Asset>>(Communicator.Get, "assets", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<IList<Asset>> (r.Raw); }
     if (callback != null) { callback(r); }
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs


示例16: MainWindow

 public MainWindow()
 {
     InitializeComponent();
     comm = Communicator.Instance;
     this.Background = ThemeParser.GetColor(ThemeParser.Colors.Background);
     comm.ConnectionStatusChanged += new EventHandler<ConnectionStatusChangedEventArgs>(comm_ConnectionStatusChanged);
     comm.DataRecieved += new EventHandler<DataReceivedEventArgs>(comm_DataRecieved);
     mHandler.NewIncomingMessage += new EventHandler<NewIncomingMessageEventArgs>(mHandler_NewIncomingMessage);
     this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
     this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
 }
开发者ID:nutrii,项目名称:cecs-550-monopoly,代码行数:11,代码来源:MainWindow.xaml.cs


示例17: LogAsync

 public void LogAsync(string message, Action<LogResponse> callback)
 {
     var communicator = new Communicator(this);
     var callbackWrapper = callback == null ? (Action<Response>) null : r =>
     {
     if (r.Success)
     {
         callback(JsonConvert.DeserializeObject<LogResponse>(r.Raw));
     }
     };
     communicator.SendPayload(Communicator.POST, string.Concat("inputs/", _inputKey), message, callbackWrapper);
 }
开发者ID:EAAppFoundry,项目名称:loggly-csharp,代码行数:12,代码来源:Logger.cs


示例18: ThreadHookPlugin

     ThreadHookPlugin(Communicator communicator, ThreadNotification threadHook)
     {
         if(communicator == null)
         {
             PluginInitializationException ex = new PluginInitializationException();
             ex.reason = "Communicator cannot be null";
             throw ex;
         }
 
         IceInternal.Instance instance = IceInternal.Util.getInstance(communicator);
         instance.setThreadHook(threadHook);
     }
开发者ID:joshmoore,项目名称:ice,代码行数:12,代码来源:ThreadHookPlugin.cs


示例19: GetGameVersion

 public void GetGameVersion(Action<Response<int>> callback)
 {
     var payload = new Dictionary<string, object>(0);
      var communicator = new Communicator(this);
      communicator.SendPayload<int>(Communicator.POST, "conf/version", payload, r =>
      {
     if (r.Success)
     {
        var container = ((JContainer) JsonConvert.DeserializeObject(r.Raw))["version"];
        r.Data = container == null ? 0 : container.Value<int>();
     }
     callback(r);
      });
 }
开发者ID:intfrr,项目名称:mogade-csharp,代码行数:14,代码来源:Driver.cs


示例20: TestWrite

 public void TestWrite()
 {
     using (MemoryStream stream = new MemoryStream())
     {
         Communicator communicator = new Communicator(
             new StreamSimpleCommunicator<object>(stream, null));
         foreach (object message in
             new object[] { new A { UIntValue = 1 }, new A { UIntValue = 2 } })
         {
             communicator.Send(message);
         }
         AssertExtensions.AreEqual(
             new byte[] { 0x02, 0x08, 0x01, 0x02, 0x08, 0x02 },
             stream.ToArray());
     }
 }
开发者ID:eigenein,项目名称:cloudy,代码行数:16,代码来源:CommunicatorTest.cs



注:本文中的Communicator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CompactBinaryReader类代码示例发布时间:2022-05-24
下一篇:
C# CommunicationState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap