本文整理汇总了C#中Communicator类的典型用法代码示例。如果您正苦于以下问题:C# Communicator类的具体用法?C# Communicator怎么用?C# Communicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Communicator类属于命名空间,在下文中一共展示了Communicator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: Operations
public Operations(Communicator communicator)
{
this.communicator = communicator;
databaseConnectionSessionID = this.communicator.CurrentSessionID;
databaseConnectionCallback = this.communicator.ClientList[databaseConnectionSessionID];
}
示例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);
}
示例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);
}
}
示例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();
}
示例6: PluginManagerI
public PluginManagerI(Communicator communicator)
{
_communicator = communicator;
_plugins = new Hashtable();
_initOrder = new ArrayList();
_initialized = false;
}
示例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");
}
示例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();
} */
}
示例9: MainForm
public MainForm()
{
InitializeComponent();
_communicator = Communicator.getInstance();
_activeTalks = new List<Talk>();
}
示例10: getInstance
public static Communicator getInstance()
{
if (instance == null)
{
instance = new Communicator();
}
return instance;
}
示例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);
}
示例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);
});
}
示例13: PingTimesForm
public PingTimesForm(Communicator comm)
{
InitializeComponent();
_pingTimes.ClearData(ClearDataFlag.Values);
_pingTimes.AxisX.Min = 0;
Text += ": " + comm;
_observed = comm;
_statsObserver = CommunicationStatisticsObserver<Communicator>.On(comm);
}
示例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); }
});
}
示例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); }
});
}