Guest User

Untitled

a guest
Jul 27th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Reflection;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace SwgohHelpApi
  10. {
  11. using ApiHelper = DareWare.SWGoH.Data.WebServices.SwgohHelp.ApiHelper;
  12.  
  13. class Program
  14. {
  15. private static string ExeName => Assembly.GetEntryAssembly().Location.Split( Path.DirectorySeparatorChar ).Last();
  16.  
  17. static void Main( string[] args )
  18. {
  19. if ( args.Length < 2 )
  20. {
  21. Console.WriteLine( "Usage: " + ExeName + " <ApiUserName> <ApiPassword> [<AllyCode>]" );
  22. return;
  23. }
  24.  
  25. var api = new ApiHelper()
  26. {
  27. Username = args[0],
  28. Password = args[1]
  29. };
  30.  
  31. var events = api.GetEvents();
  32. var heists = events.Where( e => e.id.Contains("CREDIT_HEIST") );
  33. if ( heists.Any() )
  34. {
  35. Console.WriteLine( "The next credit heist starts at " + heists.First().schedule.First().Start.ToLocalTime() );
  36. }
  37. else
  38. {
  39. Console.WriteLine( "No credit heists coming up" );
  40. }
  41.  
  42. if ( args.Length >= 3 )
  43. {
  44. var me = api.GetPlayer( args[2] );
  45. Console.WriteLine( $"As of {me.Updated.ToLocalTime()}, {me.name} is #{me.arena._char.rank} in Squad Arena and #{me.arena.ship.rank} in Fleet Arena" );
  46. }
  47.  
  48. Console.WriteLine( "Please press the any key to continue..." );
  49. Console.ReadKey();
  50. }
  51. }
  52. }
Add Comment
Please, Sign In to add comment