本文整理汇总了C#中Net类的典型用法代码示例。如果您正苦于以下问题:C# Net类的具体用法?C# Net怎么用?C# Net使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Net类属于命名空间,在下文中一共展示了Net类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:Promichel,项目名称:IrcSharp,代码行数:7,代码来源:Client.Recv.cs
示例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;
}
开发者ID:dpvreony-forks,项目名称:Lucene.Net.Linq,代码行数:7,代码来源:OrderByTests.cs
示例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();
}
开发者ID:jyale,项目名称:group-chat,代码行数:34,代码来源:main.cs
示例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;
}
开发者ID:Zaixu,项目名称:Lucene.Net.Linq,代码行数:7,代码来源:AllowSpecialCharactersTests.cs
示例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);
}
开发者ID:vrobel,项目名称:mooege,代码行数:33,代码来源:Door.cs
示例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.
}
}
开发者ID:spookywizz,项目名称:mooege,代码行数:32,代码来源:GameManager.cs
示例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;
}
开发者ID:Zaixu,项目名称:Lucene.Net.Linq,代码行数:7,代码来源:SelectTests.cs
示例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
});
}
开发者ID:ralje,项目名称:mooege,代码行数:26,代码来源:Waypoint.cs
示例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);
}
}
开发者ID:Like-Jean,项目名称:ChatApplication,代码行数:27,代码来源:ServerChatRoom.cs
示例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;
}
开发者ID:erekos3,项目名称:mooege,代码行数:30,代码来源:Waypoint.cs
示例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();
}
开发者ID:JFerguson20,项目名称:BlackJack,代码行数:7,代码来源:NNBasicStrategy.cs
示例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();
}
开发者ID:n3rus,项目名称:mooege,代码行数:9,代码来源:Healthwell.cs
示例13: Write
private void Write (String data, Net.IRequestListener requestListener)
{
try {
File.AppendAllText (tracesFile, data);
requestListener.Result ("");
} catch (Exception e) {
requestListener.Error (e.Message);
}
}
开发者ID:gorco,项目名称:LaCortesiaDeEspa-a,代码行数:9,代码来源:LocalStorage.cs
示例14: GetNet
private Net GetNet()
{
if (m_Net == null)
{
m_Net = new Net();
}
return m_Net;
}
开发者ID:wuhuichun,项目名称:Frame,代码行数:9,代码来源:Game.cs
示例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;
}
开发者ID:aquamoth,项目名称:Scrutiny,代码行数:9,代码来源:FallbackRouter.cs
示例16: Route
public async Task<string> Route(ControllerActionParts parts, Net.Api.RequestType requestType)
{
var apiControllers = loadApiControllersFromConfig();
var controllersMap = createCaseInsensitiveDictionaryOf(apiControllers);
var controllerType = controllersMap[parts.Action];
var response = callMethod(controllerType, requestType.ToString(), parts.Value);
return Json(response);
}
开发者ID:aquamoth,项目名称:Scrutiny,代码行数:10,代码来源:ApiRouter.cs
示例17: HandlePacketUser
public static void HandlePacketUser(Client client, Net.Paket.UserPaket up)
{
client.ClientInfo.Username = up.Username;
client.ClientInfo.RealName = up.RealName;
client.ClientInfo.Host = up.Hostname;
if(client.ClientInfo.Nickname != null)
{
client.ClientInfo.IsRegistered = true;
RegisterUser(client);
}
}
开发者ID:Promichel,项目名称:IrcSharp,代码行数:11,代码来源:Client.Recv.cs
示例18: handleMsg
public override void handleMsg(Net.Message msg)
{
EventArgs e = new EventArgs();
switch (msg.head)
{
case "0":
client.loginName = msg.data;
break;
case "1":
if (am.addUser(client.loginName, msg.data))
{
msg.data = "registe successfully,welcome!" + client.loginName;
addText(e, client.loginName + " is regist!");
msg.head = "11";
sendMessage(msg);
}
else
{
msg.data = "this name is already used";
msg.head = "10";
sendMessage(msg);
}
break;
case "2":
client.loginName = msg.data;
break;
case "3":
if (am.authentify(client.loginName, msg.data))
{
msg.data = "login successfully,welcome!" + client.loginName;
addText(e, client.loginName + " is login!");
msg.head = "31";
sendMessage(msg);
}
else
{
msg.data = "fail to login,username or password is wrong";
msg.head = "30";
sendMessage(msg);
}
break;
case "4":
am.removeUser(msg.data);
//sendMessage(msg);//tell user who out
break;
case "talk":
sendMessage(msg);
break;
// default:
//AddItemToListBox("什么意思啊:" + receiveString);
}
}
开发者ID:Like-Jean,项目名称:ChatApplication,代码行数:53,代码来源:ServerGestTopics.cs
示例19: Send
public void Send (String data, Net.IRequestListener flushListener)
{
string tmpData = data.Replace("{\"actor", "${\"actor").Replace("[", "").Replace("]", "");
string[] tmpArray = tmpData.Split('$');
foreach (string action in tmpArray)
{
if (action != "")
{
Log.L().AddLogLine(action);
}
}
net.POST (host + track, System.Text.Encoding.UTF8.GetBytes (data), trackHeaders, flushListener);
}
开发者ID:e-ucm,项目名称:rage-analytics-games,代码行数:13,代码来源:NetStorage.cs
示例20: HandlePacketNick
public static void HandlePacketNick(Client client, Net.Paket.NickPaket np)
{
var nickClient = client.Server.GetClientByNickname(np.Nickname.ToUpper());
if(nickClient != null)
{
client.SendPacket(new NickNameInUseResponse {NickName = np.Nickname});
return;
}
client.ClientInfo.Nickname = np.Nickname;
client.Server.Nicknames.Add(np.Nickname.ToUpper(), client);
RegisterUser(client);
}
开发者ID:Promichel,项目名称:IrcSharp,代码行数:13,代码来源:Client.Recv.cs
注:本文中的Net类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论