本文整理汇总了C#中System.Net.Player.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Equals方法的具体用法?C# Player.Equals怎么用?C# Player.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Player
的用法示例。
在下文中一共展示了Player.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadByesFromFile
public void ReadByesFromFile(int nextRound)
{
//read players file
//if player already registered
//check if his participation changed
string tLn = "";
string fin = workDirectory + "players.txt";
using (StreamReader reader = new StreamReader (fin)) {
for (int i = 0; i < 6; i++)
tLn = reader.ReadLine(); //trip through headers
while ((tLn = reader.ReadLine ()) != null) {
String[] split = tLn.Split(new char[] {',','\t'});
try {
int pine = int.Parse (split [0]);
int rats = int.Parse (split [2]);
bool[] bull = new bool[nRounds]; //not set via input file
for(int k=0; k<bull.Length; k++)
bull[k]=true;
if(split.Length > 6)
for (int i = 6; i < split.Length; i++) {
if (split [i].Equals ("") == false) {
try{
int byeRound = int.Parse(split[i].Trim());
if(byeRound > nRounds){
Console.WriteLine("A bye cannot be allocated for a round which does not exist");
Console.WriteLine(tLn);
}
else
bull[byeRound-1]=false; //0 based
}
catch(Exception e){Console.WriteLine(e.Message);}
}
}
Player j = new Player (pine, split [1], rats, split [3], split [4], bull, split[5]);
if (AllPlayers.Contains (j) == true) {
for(int ap = 0; ap<AllPlayers.Count; ap++)
if(j.Equals(AllPlayers[ap]))
for(int i2=nextRound-1; i2<nRounds; i2++) //0 based
AllPlayers[ap].SetParticipation(i2, bull[i2]);
}
} catch (Exception e) {
Console.WriteLine ("An exception was encountered in ReadByesFromFile" + e.Message);
Console.WriteLine (tLn);
}
}
}
}