コード例 #1
0
ファイル: Data.cs プロジェクト: silkroadlegend/SilkroadScript
        private static IEnumerable <DivisionServer> DivisionInfo()
        {
            var dataReader = new BinaryReader(_reader.GetFileStream("DIVISIONINFO.TXT"));

            var locale        = dataReader.ReadByte(); //Server Locale
            var divisionCount = dataReader.ReadByte();

            for (var i = 1; i <= divisionCount; i++)
            {
                var divisonNameLen   = dataReader.ReadInt32();
                var divisionNameShit = dataReader.ReadChars(divisonNameLen);

                dataReader.ReadByte(); //UNKNOWN

                var division    = new DivisionServer(new string(divisionNameShit), locale);
                var serverCount = dataReader.ReadByte();
                for (var iS = 1; iS <= serverCount; iS++)
                {
                    var serverNameLen  = dataReader.ReadInt32();
                    var serverNameShit = dataReader.ReadChars(serverNameLen);

                    division.LoginServers.Add(new string(serverNameShit));
                    dataReader.ReadByte();
                }
                yield return(division);
            }
        }
コード例 #2
0
 public void StartGame(DivisionServer divisionserver, string ip)
 {
     DivisionServer = divisionserver;
     GamePort       = GetFreePort(15770);
     Start(GamePort, ip);
     Loader.Inject(Data.SilkroadPath, GamePort, DivisionServer.Locale);
 }