private void GetSurnames(string html, int tableNumber) { HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); Player[] node = new Player[8]; // N W E S string[] surnames = new string[8]; HtmlNodeCollection team = doc.DocumentNode.SelectNodes("//a[@href]"); int[] id = new int[100]; string home = team[0].InnerText; string away = team[1].InnerText; //Home Team HtmlNodeCollection links = doc.DocumentNode.SelectNodes(ticker_HomeTeam); int idx = 0; foreach (var link in links) { surnames[idx++] = link.ChildNodes[1].InnerHtml.ToString().Split('&')[1].ToString().Substring(5); } links = doc.DocumentNode.SelectNodes(ticker_AwayTeam); foreach (var link in links) { surnames[idx++] = link.ChildNodes[1].InnerHtml.ToString().Split('&')[1].ToString().Substring(5); } TablesData data_ = new TablesData(); data_.nr = tableNumber; data_.players = surnames; data_.TeamHome = home; data_.TeamAway = away; data.Add(data_); //for (int i = 0; i < 4; i++) //{ // Player tmp = new Player(); // tmp.nazwisko = surnames[i]; // tmp.team_your = home; // tmp.team_against = away; // node[i] = tmp; //} //for (int i = 4; i < 8; i++) //{ // Player tmp = new Player(); // tmp.nazwisko = surnames[i]; // tmp.team_your = away; // tmp.team_against = home; // node[i] = tmp; //} // nazwiska.Add(node); }
protected override void Seed(Training03.Data.NhlContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // context.Teams.AddOrUpdate( t => t.TeamName, TablesData.getTeams().ToArray()); context.SaveChanges(); context.PLayers.AddOrUpdate( p => new { p.FirstName, p.LastName }, TablesData.getPlayers(context).ToArray()); }
public SelectOrDelete() { InitializeComponent(); tablesData = new TablesData(); comboBoxValue.SelectedIndex = 0; }
public void Deserialize( UPackageStream stream ) { // Read as one variable due Big Endian Encoding. Version = stream.ReadUInt32(); LicenseeVersion = (ushort)(Version >> 16); Version = (Version & 0xFFFFU); Console.WriteLine( "\tPackage Version:" + Version + "/" + LicenseeVersion ); Build = new GameBuild( this ); Console.WriteLine( "\tBuild:" + Build.Name ); stream.BuildDetected( Build ); if( Version >= VHeaderSize ) { #if BIOSHOCK if( Build == GameBuild.BuildName.Bioshock_Infinite ) { var unk = stream.ReadInt32(); } #endif #if MKKE if( Build == GameBuild.BuildName.MKKE ) { stream.Skip( 8 ); } #endif #if TRANSFORMERS if( Build == GameBuild.BuildName.Transformers && LicenseeVersion >= 55 ) { if( LicenseeVersion >= 181 ) { stream.Skip( 16 ); } stream.Skip( 4 ); } #endif // Offset to the first class(not object) in the package. HeaderSize = stream.ReadUInt32(); Console.WriteLine( "\tHeader Size: " + HeaderSize ); if( Version >= VGroup ) { // UPK content category e.g. Weapons, Sounds or Meshes. Group = stream.ReadText(); } } // Bitflags such as AllowDownload. PackageFlags = stream.ReadUInt32(); Console.WriteLine( "\tPackage Flags:" + PackageFlags ); // Summary data such as ObjectCount. _TablesData = new TablesData(); _TablesData.Deserialize( stream ); if( Version < 68 ) { int heritageCount = stream.ReadInt32(); int heritageOffset = stream.ReadInt32(); stream.Seek( heritageOffset, SeekOrigin.Begin ); _Heritages = new List<ushort>( heritageCount ); for( var i = 0; i < heritageCount; ++ i ) { _Heritages.Add( stream.ReadUShort() ); } } else { #if THIEFDEADLYSHADOWS if( Build == GameBuild.BuildName.Thief_DS ) { stream.Skip( 4 ); } #endif #if BORDERLANDS if( Build == GameBuild.BuildName.Borderlands ) { stream.Skip( 4 ); } #endif #if MKKE if( Build == GameBuild.BuildName.MKKE ) { stream.Skip( 4 ); } #endif GUID = stream.ReadGuid(); Console.Write( "\r\n\tGUID:" + GUID + "\r\n" ); #if TERA if( Build == GameBuild.BuildName.Tera ) { stream.Position -= 4; } #endif #if MKKE if( Build != GameBuild.BuildName.MKKE ) { #endif int generationCount = stream.ReadInt32(); Generations = new UArray<UGenerationTableItem>( stream, generationCount ); Console.WriteLine( "Deserialized {0} generations", Generations.Count ); #if MKKE } #endif #if TERA if( Build == GameBuild.BuildName.Tera ) { _TablesData.NamesCount = (uint)Generations.Last().NamesCount; } #endif if( Version >= VEngineVersion ) { // The Engine Version this package was created with EngineVersion = stream.ReadInt32(); Console.WriteLine( "\tEngineVersion:" + EngineVersion ); if( Version >= VCOOKEDPACKAGES ) { // The Cooker Version this package was cooked with CookerVersion = stream.ReadInt32(); Console.WriteLine( "\tCookerVersion:" + CookerVersion ); // Read compressed info? if( Version >= VCompression ) { if( IsCooked() ) { CompressionFlags = stream.ReadUInt32(); Console.WriteLine( "\tCompressionFlags:" + CompressionFlags ); CompressedChunks = new UArray<CompressedChunk>{Capacity = stream.ReadInt32()}; //long uncookedSize = stream.Position; if( CompressedChunks.Capacity > 0 ) { CompressedChunks.Deserialize( stream, CompressedChunks.Capacity ); return; //try //{ // UPackageStream outStream = new UPackageStream( packagePath + ".dec", System.IO.FileMode.Create, FileAccess.ReadWrite ); // //File.SetAttributes( packagePath + ".dec", FileAttributes.Temporary ); // outStream.Package = pkg; // outStream._BigEndianCode = stream._BigEndianCode; // var headerBytes = new byte[uncookedSize]; // stream.Seek( 0, SeekOrigin.Begin ); // stream.Read( headerBytes, 0, (int)uncookedSize ); // outStream.Write( headerBytes, 0, (int)uncookedSize ); // foreach( var chunk in pkg.CompressedChunks ) // { // chunk.Decompress( stream, outStream ); // } // outStream.Flush(); // pkg.Stream = outStream; // stream = outStream; // return pkg; //} //catch( Exception e ) //{ // throw new DecompressPackageException(); //} } } } } } } // Read the name table if( _TablesData.NamesCount > 0 ) { Console.WriteLine( "P: " + stream.Position + " NP: " + _TablesData.NamesOffset ); stream.Seek( _TablesData.NamesOffset, SeekOrigin.Begin ); Names = new List<UNameTableItem>( (int)_TablesData.NamesCount ); for( var i = 0; i < _TablesData.NamesCount; ++ i ) { var nameEntry = new UNameTableItem{Offset = (int)stream.Position, Index = i}; nameEntry.Deserialize( stream ); nameEntry.Size = (int)(stream.Position - nameEntry.Offset); Names.Add( nameEntry ); } Console.WriteLine( "Deserialized {0} names", Names.Count ); } // Read Import Table if( _TablesData.ImportsCount > 0 ) { Console.WriteLine( "P: " + stream.Position + " IP: " + _TablesData.ImportsOffset ); stream.Seek( _TablesData.ImportsOffset, SeekOrigin.Begin ); Imports = new List<UImportTableItem>( (int)_TablesData.ImportsCount ); for( var i = 0; i < _TablesData.ImportsCount; ++ i ) { var imp = new UImportTableItem{Offset = (int)stream.Position, Index = i, Owner = this}; imp.Deserialize( stream ); imp.Size = (int)(stream.Position - imp.Offset); Imports.Add( imp ); } Console.WriteLine( "Deserialized {0} imports", Imports.Count ); } // Read Export Table if( _TablesData.ExportsCount > 0 ) { Console.WriteLine( "P: " + stream.Position + " EP: " + _TablesData.ExportsOffset ); stream.Seek( _TablesData.ExportsOffset, SeekOrigin.Begin ); Exports = new List<UExportTableItem>( (int)_TablesData.ExportsCount ); for( var i = 0; i < _TablesData.ExportsCount; ++ i ) { var exp = new UExportTableItem{Offset = (int)stream.Position, Index = i, Owner = this}; // For the GetObjectName like functions try { exp.Deserialize( stream ); } catch { Console.WriteLine( "Failed to deserialize export object at index:" + i ); break; } finally { exp.Size = (int)(stream.Position - exp.Offset); Exports.Add( exp ); } } Console.WriteLine( "Deserialized {0} exports", Exports.Count ); } /*if( pkg.Data.DependsOffset > 0 ) { stream.Seek( pkg.Data.DependsOffset, SeekOrigin.Begin ); pkg._DependsTableList = new List<UnrealDependsTable>( (int)pkg.Data.DependsCount ); for( var i = 0; i < pkg.Data.DependsCount; ++ i ) { var dep = new UnrealDependsTable{TableOffset = stream.Position, TableIndex = i, Owner = pkg}; dep.Deserialize( stream ); dep.TableSize = (int)(stream.Position - dep.TableOffset); pkg.DependsTableList.Add( dep ); } Console.WriteLine( "Deserialized {0} dependencies", pkg.DependsTableList.Count ); }*/ HeaderSize = stream.Position; }