本文整理汇总了C#中Net类的典型用法代码示例。如果您正苦于以下问题:C# Net类的具体用法?C# Net怎么用?C# Net使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Net类属于命名空间,在下文中一共展示了Net类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacketPong
public static void HandlePacketPong(Client client, Net.Paket.PongPaket pp)
{
if(pp.Message == Settings.Default.ServerName)
{
client._nextActivityCheck = DateTime.Now + TimeSpan.FromSeconds(30);
}
}
示例2: GetAnalyzer
protected override Analyzer GetAnalyzer(Net.Util.Version version)
{
var a = new PerFieldAnalyzerWrapper(base.GetAnalyzer(version));
a.AddAnalyzer("Version", new KeywordAnalyzer());
a.AddAnalyzer("Flag", new KeywordAnalyzer());
return a;
}
示例3: Main
public static void Main(string[] args)
{
QApplication.initialize(args);
// Parse any command-line arguments we're interested in.
// For now, we just assume all arguments are hostnames
// or IP addresses of peers we want to connect to.
// This might change if/when we need more interesting options.
ushort port = 0; // 0 means system-chosen port (default)
foreach (string arg in args) {
if (arg.StartsWith("-port:")) {
port = UInt16.Parse(arg.Substring(6));
} else if (arg.StartsWith("-")) {
Console.WriteLine(
"Unknown command-line option" + arg);
} else // Interpret the argument as a peer name.
initPeers.Add(arg);
}
// Create the Net object implementing our network protocol
// and our peer-to-peer system state model.
Net net = new Net(port, initPeers);
// Create and show the main GUI window
// The Gui object can "see" the Net object but not vice versa.
// This is intentional: we want to keep Net independent of Gui,
// so that (for example) we can run a non-graphical instance
// of our peer-to-peer system controlled some other way,
// e.g., as a daemon or via command-line or Web-based control.
Gui gui = new Gui(net);
gui.show();
QApplication.exec();
}
示例4: GetAnalyzer
protected override Analyzer GetAnalyzer(Net.Util.Version version)
{
var analyzer = new PerFieldAnalyzerWrapper(base.GetAnalyzer(version));
analyzer.AddAnalyzer("Path", new CaseInsensitiveKeywordAnalyzer());
analyzer.AddAnalyzer("Key", new KeywordAnalyzer());
return analyzer;
}
示例5: OnTargeted
public override void OnTargeted(Players.Player player, Net.GS.Message.Definitions.World.TargetMessage message)
{
World.BroadcastIfRevealed(new PlayAnimationMessage
{
ActorID = this.DynamicID,
Field1 = 5,
Field2 = 0,
tAnim = new Net.GS.Message.Fields.PlayAnimationMessageSpec[]
{
new Net.GS.Message.Fields.PlayAnimationMessageSpec()
{
Duration = 50,
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening],
PermutationIndex = 0,
Speed = 1
}
}
}, this);
World.BroadcastIfRevealed(new SetIdleAnimationMessage
{
ActorID = this.DynamicID,
AnimationSNO = AnimationSetKeys.Open.ID
}, this);
this.Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true;
this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID);
this.Attributes[GameAttribute.Gizmo_State] = 1;
Attributes.BroadcastChangedIfRevealed();
base.OnTargeted(player, message);
}
示例6: RemovePlayerFromGame
public static void RemovePlayerFromGame(Net.GS.GameClient gameClient)
{
if (gameClient == null || gameClient.Game == null) return;
var gameId = gameClient.Game.GameId;
if (!Games.ContainsKey(gameId)) return;
var game = Games[gameId];
if (!game.Players.ContainsKey(gameClient)) return;
Player p = null;
if (!game.Players.TryRemove(gameClient, out p))
{
Logger.Error("Can't remove player ({0}) from game with id: {1}", gameClient.Player.Toon.Name, gameId);
}
if (p != null)
{
var toon = p.Toon;
toon.TimePlayed += DateTimeExtensions.ToUnixTime(DateTime.UtcNow) - toon.LoginTime;
toon.SaveToDB();
// Remove Player From World
if (p.InGameClient != null)
p.World.Leave(p);
}
if (game.Players.Count == 0)
{
Games.Remove(gameId); // we should be also disposing it /raist.
}
}
示例7: GetAnalyzer
protected override Analyzer GetAnalyzer(Net.Util.Version version)
{
analyzer = new PerFieldAnalyzerWrapper(base.GetAnalyzer(version));
analyzer.AddAnalyzer<SampleDocument>(t => t.Id, new KeywordAnalyzer());
analyzer.AddAnalyzer<SampleDocument>(t => t.Key, new CaseInsensitiveKeywordAnalyzer());
return analyzer;
}
示例8: OnTargeted
public override void OnTargeted(Player player, Net.GS.Message.Definitions.World.TargetMessage message)
{
var world = player.World;
world.BroadcastIfRevealed(new PlayAnimationMessage()
{
ActorID = this.DynamicID,
Field1 = 5,
Field2 = 0f,
tAnim = new[]
{
new PlayAnimationMessageSpec()
{
Duration = 4,
AnimationSNO = 0x2f761,
PermutationIndex = 0,
Speed = 1f,
}
}
}, this);
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenWaypointSelectionWindowMessage)
{
ActorID = this.DynamicID
});
}
示例9: handleMsg
public override void handleMsg(Net.Message msg)
{
EventArgs e = new EventArgs();
switch (msg.head)
{
case "in":
join(client);
msg.data = client.loginName + " is in";
break;
case "talk":
string content = msg.data;
msg.data = client.loginName + " : " + content;
break;
case "exit":
msg.data = client.loginName + " is out";
break;
default:
addText(e, "client trigger a undefined event!");
break;
}
for (int i = 0; i < roomChatter.Count; i++)
{
roomChatter[i].sw.Write(serializeStream(msg));
roomChatter[i].sw.Flush();
//AddItemToListBox("To " + user.loginName + ":" + message);
}
}
示例10: OnTargeted
public override void OnTargeted(Player player, Net.GS.Message.Definitions.World.TargetMessage message)
{
var world = player.World;
world.BroadcastIfRevealed(new PlayAnimationMessage()
{
ActorID = this.DynamicID,
Field1 = 5,
Field2 = 0f,
tAnim = new[]
{
new PlayAnimationMessageSpec()
{
Duration = 4,
AnimationSNO = 0x2f761,
PermutationIndex = 0,
Speed = 1f,
}
}
}, this);
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenWaypointSelectionWindowMessage)
{
ActorID = this.DynamicID
});
//erekose we set the flag for "operated"
this.Attributes[Net.GS.Message.GameAttribute.Gizmo_Has_Been_Operated] = true;
}
示例11: NNBasicStrategy
public NNBasicStrategy(Net.Net net, double eps = .9, double lambda = .5)
{
this.net = net;
this.eps = eps;
this.lambda = .5;
r = new Random();
}
示例12: OnTargeted
public override void OnTargeted(Players.Player player, Net.GS.Message.Definitions.World.TargetMessage message)
{
Logger.Warn("Healthwell has no function, Powers not implemented");
this.Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true;
this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID);
this.Attributes[GameAttribute.Gizmo_State] = 1;
Attributes.BroadcastChangedIfRevealed();
}
示例13: Write
private void Write (String data, Net.IRequestListener requestListener)
{
try {
File.AppendAllText (tracesFile, data);
requestListener.Result ("");
} catch (Exception e) {
requestListener.Error (e.Message);
}
}
示例14: GetNet
private Net GetNet()
{
if (m_Net == null)
{
m_Net = new Net();
}
return m_Net;
}
示例15: Route
public async Task<string> Route(ControllerActionParts parts, Net.Api.RequestType requestType)
{
var path = parts.OriginalPath;
path = path.Replace("/", ".");
//path = path.Replace("-", "_");
var resourceName = string.Format("Scrutiny.{0}", path);
var content = await Resources.GetStringAsync(resourceName);
return content;
}