本文整理汇总了C#中Network类的典型用法代码示例。如果您正苦于以下问题:C# Network类的具体用法?C# Network怎么用?C# Network使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Network类属于命名空间,在下文中一共展示了Network类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DrivenNode
public DrivenNode(NodeDefinition nd, Network net, int instnc)
: base(nd, net, instnc)
{
visualNotificationDeferrals = 0;
visualsNeedNotification = false;
handlingLongMessage = false;
}
开发者ID:BackupTheBerlios,项目名称:opendx2,代码行数:7,代码来源:DrivenNode.cs
示例2: GenerateWif
private static string GenerateWif(Key key, string password, Network network)
{
var vch = key.ToBytes();
//Compute the Bitcoin address (ASCII),
var addressBytes = Encoders.ASCII.DecodeData(key.PubKey.GetAddress(network).ToWif());
// and take the first four bytes of SHA256(SHA256()) of it. Let's call this "addresshash".
var addresshash = Hashes.Hash256(addressBytes).ToBytes().SafeSubarray(0, 4);
var derived = SCrypt.BitcoinComputeDerivedKey(Encoding.UTF8.GetBytes(password), addresshash);
var encrypted = EncryptKey(vch, derived);
var version = network.GetVersionBytes(Base58Type.ENCRYPTED_SECRET_KEY_NO_EC);
byte flagByte = 0;
flagByte |= 0x0C0;
flagByte |= (key.IsCompressed ? (byte)0x20 : (byte)0x00);
var bytes = version
.Concat(new[] { flagByte })
.Concat(addresshash)
.Concat(encrypted).ToArray();
return Encoders.Base58Check.EncodeData(bytes);
}
开发者ID:xcrash,项目名称:NBitcoin,代码行数:25,代码来源:BitcoinEncryptedSecret.cs
示例3: EdgesTest
public void EdgesTest()
{
Network network = new Network();
NetworkEdge networkEdge;
network.Nodes.Add();
network.Nodes.Add();
Assert.AreEqual(2, network.Nodes.Count);
for (int i = 0; i < 5; i++)
{
networkEdge = network.Edges.Add(network.Nodes[0], network.Nodes[1]);
Assert.IsNotNull(networkEdge);
//Проверим, существует ли другие вершины или дуги с таким же индексом.
CheckNetworkObjectId(networkEdge);
}
Assert.AreEqual(5, network.Edges.Count);
network.Edges.RemoveAt(0);
network.Edges.RemoveAt(1);
Assert.AreEqual(3, network.Edges.Count);
network.Nodes.RemoveAt(0);
Assert.AreEqual(1, network.Nodes.Count);
network.Nodes.Add();
Assert.AreEqual(2, network.Nodes.Count);
networkEdge = network.Edges.Add(network.Nodes[0], network.Nodes[1]);
Assert.IsNotNull(networkEdge);
CheckNetworkObjectId(networkEdge);
}
开发者ID:GilbertTeam,项目名称:Tales-Generator,代码行数:35,代码来源:NetworkTest.cs
示例4: NodeServerTester
public NodeServerTester(Network network = null)
{
int retry = 0;
network = network ?? Network.TestNet;
while(true)
{
try
{
var a = _Rand.Next(4000, 60000);
var b = _Rand.Next(4000, 60000);
_Server1 = new NodeServer(network, internalPort: a);
_Server1.AllowLocalPeers = true;
_Server1.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1").MapToIPv6Ex(), a);
_Server1.Listen();
_Server2 = new NodeServer(network, internalPort: b);
_Server2.AllowLocalPeers = true;
_Server2.ExternalEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1").MapToIPv6Ex(), b);
_Server2.Listen();
break;
}
catch(Exception)
{
if(_Server1 != null)
_Server1.Dispose();
if(_Server2 != null)
_Server2.Dispose();
retry++;
if(retry == 5)
throw;
}
}
}
开发者ID:vebin,项目名称:NBitcoin,代码行数:32,代码来源:ProtocolTests.cs
示例5: Base58Data
protected Base58Data(byte[] rawBytes, Network network)
{
if(network == null)
throw new ArgumentNullException("network");
_Network = network;
SetData(rawBytes);
}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:7,代码来源:Base58Data.cs
示例6: BoostCaract
public static void BoostCaract(Network.WorldClient client, int type)
{
Engines.Stats.SingleStats Stat = client.Character.Stats.GetStats(type);
if (client.Character.CaractPoint <= 0)
return;
Database.Records.BreedRecord breed = Helper.BreedHelper.GetBreed(client.Character.Breed);
if (breed == null)
return;
Engines.Breeds.StatFloor floor = breed.Engine.GetFloorForValue((Enums.StatsTypeEnum)type, Stat.Base);
if (floor == null)
return;
if (client.Character.CaractPoint < floor.Cost)
return;
Stat.Base += floor.Value;
client.Character.CaractPoint -= floor.Cost;
if ((Enums.StatsTypeEnum)type == Enums.StatsTypeEnum.Life)
client.Character.CurrentLife += floor.Value;
}
开发者ID:nightwolf93,项目名称:Crystal,代码行数:25,代码来源:AccountHandler.cs
示例7: Bot_OnMessage
void Bot_OnMessage(Network n, Irc.IrcEventArgs e)
{
if (IsMatch("^autoop \\?$", e.Data.Message)) {
AnswerWithNotice(n, e, FormatBold("Use of AutoOp plugin:"));
AnswerWithNotice(n, e, "No remote commands available. All configuration has to be done manually in the Configuration.xml.");
}
}
开发者ID:BackupTheBerlios,项目名称:abbot-svn,代码行数:7,代码来源:AutoOp.cs
示例8: Run
public static void Run()
{
var trainingSets = GenerateTrainingSets(100);
Network network;
double error = 0;
do
{
Console.WriteLine("Optimizing...");
network = new Network(trainingSets[0].Inputs.Length, 2, 10, trainingSets[0].Outputs.Length);
network.Weights = BruteOptimizer.OptimizeMulti(network, trainingSets);
error = network.Error(trainingSets, network.Weights);
Console.WriteLine("Error from last optimization attempt: " + error);
} while (error > 3);
Console.WriteLine("Optimization complete!");
while (true)
{
Console.Write("Enter space-separated inputs: ");
var inputs = Console.ReadLine().Split(' ');
if (inputs.Length == 1)
{
break;
}
var inputArray = new double[] { double.Parse(inputs[0].Trim()), double.Parse(inputs[1].Trim()) };
Console.WriteLine(network.Pulse(inputArray)[0]);
}
}
开发者ID:matthewsot,项目名称:zoltar,代码行数:28,代码来源:SignMatch.cs
示例9: LightContentDialog
public LightContentDialog(HueLamp light, Network network)
{
this.InitializeComponent();
this.light = light;
this.network = network;
this.DataContext = light;
}
开发者ID:xrgman,项目名称:HueZooi,代码行数:7,代码来源:LightContentDialog.xaml.cs
示例10: MainPage
public MainPage()
{
this.InitializeComponent();
Network network = new Network();
var mainViewModel = new MainViewModel();
mainViewModel.MenuItems.Add(new SimpleNavMenuItem
{
Label = "Lights",
DestinationPage = typeof(LightsPage),
Symbol = (Symbol)Convert.ToChar(""),
Arguments = network
});
mainViewModel.MenuItems.Add(new SimpleNavMenuItem
{
Label = "Room",
DestinationPage = typeof(RoomPage),
Symbol = Symbol.Street,
Arguments = network
});
mainViewModel.MenuItems.Add(new SimpleNavMenuItem
{
Label = "Settings",
DestinationPage = typeof(SettingsPage),
Symbol = Symbol.Setting,
Arguments = network
});
DataContext = mainViewModel;
}
开发者ID:xrgman,项目名称:HueZooi,代码行数:29,代码来源:MainPage.xaml.cs
示例11: GetWrappedBase58
public static string GetWrappedBase58(string base58, Network network)
{
var coloredVersion = network.GetVersionBytes(Base58Type.COLORED_ADDRESS);
var inner = Encoders.Base58Check.DecodeData(base58);
inner = inner.Skip(coloredVersion.Length).ToArray();
return Encoders.Base58Check.EncodeData(inner);
}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:7,代码来源:BitcoinColoredAddress.cs
示例12: PrefixForNetwork
public static char PrefixForNetwork(Network network) {
switch(network) {
case Network.Bitcoin:
return '1';
case Network.Testnet:
return '2';
case Network.Friendly:
return 'F';
case Network.Litecoin:
return 'L';
case Network.Namecoin:
return 'N';
case Network.Fairbrix:
return 'f';
case Network.GeistGeld:
return 'g';
case Network.I0coin:
return 'j';
case Network.Solidcoin:
return 's';
case Network.Tenebrix:
return 't';
default:
throw new ArgumentException(String.Format("No known network prefix for network {0}", network));
}
}
开发者ID:kylewlacy,项目名称:electrolyte.net,代码行数:26,代码来源:Address.cs
示例13: Bot_OnMessage
void Bot_OnMessage(Network network, Irc.IrcEventArgs e)
{
if (IsMatch("^seen \\?$", e.Data.Message)) {
AnswerWithNotice(network, e, FormatBold("Use of Seen plugin:"));
AnswerWithNotice(network, e, FormatItalic("seen <nick>") + " - Displays information when the Bot last saw <nick>.");
}
else if (IsMatch("^seen (?<nick>.*)$", e.Data.Message)) {
SeenInfo i = FindName(network.Name, Matches["nick"].ToString(), l);
if (i == null)
Answer(network, e, "I never saw " + Matches["nick"].ToString() + " before.");
else if (i.Ident == e.Data.Ident)
Answer(network, e, "Looking for yourself, eh?");
else {
string hour = "hours";
string minute = "minutes";
TimeSpan t = (TimeSpan)(DateTime.Now - i.Date);
if (t.TotalHours == 1)
hour = "hour";
if (t.Minutes == 1)
minute = "minute";
Answer(network, e, "I saw " + Matches["nick"].ToString() + " " + Convert.ToInt16(t.TotalHours).ToString() + " " + hour + " and " + t.Minutes.ToString() + " " + minute + " ago, " + i.Text + ".");
}
}
NewSeen(network.Name, e.Data.Nick, e.Data.Ident, "on " + e.Data.Channel + ", saying " + e.Data.Message);
}
开发者ID:BackupTheBerlios,项目名称:abbot-svn,代码行数:26,代码来源:Seen.cs
示例14: AddRemoveNode
public AddRemoveNode(NodeChangeType nodeChangeType, Node node, Node parent1, Node parent2, List<Node> outputs, Network network)
{
if (node == null)
throw new ArgumentNullException("node");
if (parent1 == null)
throw new ArgumentNullException("parent1");
if (parent2 == null)
throw new ArgumentNullException("parent2");
if (outputs == null)
throw new ArgumentNullException("output");
//if (node == parent1 || node == parent2 || node == outputs || //TODO: FIX THIS checker
// parent1 == parent2 || parent1 == outputs || parent2 == outputs)
// throw new ArgumentException();
nodeChangeType_ = nodeChangeType;
node_ = node;
parent1_ = parent1;
parent2_ = parent2;
outputs_ = outputs;
network_ = network;
// NODE: it is only way I was able to create to make parent 2 children stay in same order after revert
parent2NodeToInsertAfter_ = null;
if (nodeChangeType == NodeChangeType.Remove)
{
LinkedListNode<Node> parent2LinkedListNodeToInsertAfter = parent2_.Outputs.Find(node_).Previous;
if (parent2LinkedListNodeToInsertAfter != null)
{
parent2NodeToInsertAfter_ = parent2_.Outputs.Find(node_).Previous.Value;
}
}
}
开发者ID:Spawek,项目名称:trendpredictortester,代码行数:32,代码来源:AddRemoveNode.cs
示例15: addnetwork_button_Click
protected void addnetwork_button_Click(object sender, EventArgs e)
{
if (addnetwork_name.Text != "" && addnetwork_pattern.Text != "")
{
String name = addnetwork_name.Text;
bool exists = false;
for (int i = 0; i < Results.Items.Count; i++)
{
if(Results.Items[i].Text.Equals(name) ){
exists = true;
break;
}
}
if(exists) {
addnetwork_label.Text = "Network already exists!";
}
else {
Network network = new Network(addnetwork_name.Text.ToString(), addnetwork_pattern.Text.ToString());
Network savedNetwork = NetworkDataService.addNetwork(network);
// Results.Items.Add(new ListItem(savedNetwork.name, savedNetwork.id.ToString()));
addnetwork_label.Text = "Network Added Successfully!";
}
}
else
{
addnetwork_label.Text = "Please fill in both fields";
}
}
开发者ID:bduong,项目名称:toms-list,代码行数:29,代码来源:Networks.aspx.cs
示例16: Engine
public Engine()
{
mRenderer = new vRenderer();
mInput = new Input();
mNetwork = new Network();
mScript = new Script();
mWorld = new cWorld();
bool other = false;
for (int y = 0; y < 10; y++)
{
for (int x = 0; x < 10; x++)
{
World_Geom geom = new World_Geom(new Vector2(x*64, y*64), "tex_bookshelf.bmp");
if (!other)
{
//geom = new World_Geom(new Vector2(x, y), "tex2.bmp");
e_pillar door = new e_pillar(new Vector2(x+0.5f, y+0.5f), "tex_3.bmp");
mWorld.AddEntity(door);
}
mWorld.AddGeometry(geom);
other = !other;
}
other = !other;
}
}
开发者ID:rvIceBreaker,项目名称:Crawler,代码行数:31,代码来源:Engine.cs
示例17: IRenderableMaze
public void IRenderableMaze(Network network, PictureBox renderBox)
{
if (bmp != null)
{
bmp.Dispose();
}
colBackground = backgroundPanel.BackColor;
colCorridor = corridorPanel.BackColor;
colWall = wallPanel.BackColor;
worldScale = (float)scaleCtrl.Value;
worldOffset.X = 0.0f;
worldOffset.Y = 0.0f;
corridorWidth = (float)corridorWidthCtrl.Value;
wallWidth = (float)wallWidthCtrl.Value;
//corrWidth = (float)10.0f;
if (network is ShapeNetwork)
{
RenderShapeNetwork(network);
}
else if(network is PolarNetwork)
{
RenderPolarNetwork((PolarNetwork)network);
}
renderBox.Image = bmp;
}
开发者ID:OctoOsmo,项目名称:MazeGenerator,代码行数:30,代码来源:uiPathRenderer.cs
示例18: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="version">The version.</param>
/// <remarks></remarks>
protected override void OnReceive(Network.BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
Reason = reader.ReadClassicString();
}
开发者ID:splitice,项目名称:Pdelvo.Minecraft,代码行数:13,代码来源:DisconnectPlayer.cs
示例19: CopyNetwork
public static Network CopyNetwork(Network original)
{
Network ret = new Network(original.Transform);
original.UpdateIndices();
//Creating Neurons
for (int i = 0; i < original.Inputs.Count; i++)
{
ret.CreatePerceptron(original.Inputs[i].Transform);
}
for (int i = 0; i < original.Body.Count; i++)
{
ret.CreateNeuron(original.Body[i].Threshhold, original.Body[i].Transform);
}
for (int i = 0; i < original.Outputs.Count; i++)
{
ret.CreateConsolidator(original.Outputs[i].Transform);
}
//Creating connections
for(int i = 0; i < ret.Neurons.Count; i++)
{
Neuron orig = original.Neurons[i];
Neuron inp = ret.Neurons[i];
for(int j = 0; j < orig.Outputs.Count; j++)
{
Neuron outp = ret.Neurons[orig.Outputs[j].Output.GlobIndex];
ret.CreateDendron(inp, outp, orig.Outputs[j].Factor);
}
}
return ret;
}
开发者ID:CWBlumey,项目名称:NeuralNetwork,代码行数:30,代码来源:NetworkFactory.cs
示例20: initializeData
private void initializeData(Network network)
{
Weights = new double[network.Nodes.Length][][];
this.InputLayerSize = network.Nodes[0][0].Weights.Length - 1; // -bias
int weightCnt = this.InputLayerSize + 1;
var layerCnt = network.Nodes.Length;
// for each layer
for (int i = 0; i < layerCnt; ++i)
{
var layerSize = network.Nodes[i].Length;
Weights[i] = new double[layerSize][];
// for each node
for (int j = layerSize - 1; j >= 0; --j)
{
Weights[i][j] = new double[weightCnt];
// for each weight
for (int k = weightCnt - 1; k >= 0; --k)
Weights[i][j][k] = network.Nodes[i][j].Weights[k];
}
// prepare weightCnt for next layer
weightCnt = layerSize + 1;
}
}
开发者ID:SamuelKupferschmid,项目名称:neural-network,代码行数:27,代码来源:NetworkSnapshot.cs
注:本文中的Network类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论