Guest User

Character Wallpaper

a guest
Sep 25th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.42 KB | None | 0 0
  1. Imports EveAI
  2. Imports EveAI.Live
  3. Imports EveAI.Live.Character
  4.  
  5. Public Class Form1
  6.     Dim auth As New AuthenticationData
  7.  
  8.     Sub SetAuth()
  9.         With auth
  10.             .VCode = My.Settings.VCode
  11.             .KeyID = My.Settings.KeyID
  12.             .CharacterID = My.Settings.CharacterID
  13.         End With
  14.     End Sub
  15.  
  16.     Function GetProxy() As Net.WebProxy
  17.         If My.Settings.ProxyHost.Length > 2 Then
  18.             Return New System.Net.WebProxy(My.Settings.ProxyHost, My.Settings.ProxyPort)
  19.         Else
  20.             Return Nothing
  21.         End If
  22.     End Function
  23.  
  24.     Function GetBalance() As Double
  25.         Dim api As New CharacterSheetApi
  26.         api.Configuration.Proxy = GetProxy()
  27.         api.AuthenticationData = auth
  28.         api.UpdateData(EveApiBase.UpdateCharaceristics.Default)
  29.         Dim charsheet As Character.CharacterSheet = api.Data
  30.         Return charsheet.Balance
  31.     End Function
  32.  
  33.     Function GetSkillInfo(TypeID As Integer) As EveAI.Live.Skill
  34.         Dim api As New EveAI.Live.Generic.SkillTreeApi()
  35.         api.UpdateData()
  36.         Dim skills As List(Of EveAI.Live.Skill) = api.Data
  37.         For Each sk As EveAI.Live.Skill In skills
  38.             If sk.TypeID = TypeID Then
  39.                 Return sk
  40.             End If
  41.         Next
  42.         Return Nothing
  43.     End Function
  44.  
  45.     Function GetSKillTraining() As String
  46.         Dim api As New CharacterSkillQueueApi
  47.         Dim skQ As List(Of SkillInTraining)
  48.         Dim sb As New System.Text.StringBuilder
  49.         Dim sk As EveAI.Live.Skill
  50.         api.Configuration.Proxy = GetProxy()
  51.         api.AuthenticationData = auth
  52.         api.UpdateData(EveApiBase.UpdateCharaceristics.Default)
  53.         skQ = api.Data
  54.         For Each st As SkillInTraining In skQ
  55.             sk = GetSkillInfo(st.SkillTypeID)
  56.             sb.AppendLine(String.Format("{0}: {1:ddd dd MMM HH:mm}", sk.Name, st.TrainingEndLocalTime))
  57.         Next
  58.         Return sb.ToString
  59.     End Function
  60.  
  61.     Function GetCharacterImage() As Image
  62.         Dim strURL As String = String.Format(My.Settings.ImgURL, My.Settings.CharacterID)
  63.         Dim wc As New Net.WebClient
  64.         With wc
  65.             If My.Settings.ProxyHost.Length > 2 Then
  66.                 .Proxy = GetProxy()
  67.             End If
  68.         End With
  69.         Dim img As Image = Image.FromStream(wc.OpenRead(strURL))
  70.         Return img
  71.     End Function
  72.  
  73.     Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  74.         SetAuth()
  75.         Dim bmpOut As New Bitmap(My.Settings.ImgBase)
  76.         Dim brush As New SolidBrush(Color.White)
  77.         Dim dblBal As Double = GetBalance()
  78.         Dim gfx As Graphics = Graphics.FromImage(bmpOut)
  79.         gfx.DrawString(String.Format("Balance: {0:#,#} ISK", dblBal), New Font("Arial", 24), brush, New Point(My.Settings.InfoPosX + 101, My.Settings.InfoPosY))
  80.         gfx.DrawString(String.Format("{0}", GetSKillTraining), New Font("Arial", 24), brush, New Point(My.Settings.InfoPosX + 101, My.Settings.InfoPosY+31))
  81.         gfx.DrawString(String.Format("Updated: {0:dd, MMM HH:mm}", Now), New Font("Arial", 12), brush, New Point(My.Settings.InfoPosX, My.Settings.InfoPosY + 108))
  82.         gfx.DrawImage(GetCharacterImage, New Point(My.Settings.InfoPosX, My.Settings.InfoPosY))
  83.         bmpOut.Save(My.Settings.ImgBase.Replace("1280.jpg", "1280_new.png"), Imaging.ImageFormat.Png)
  84.         bmpOut.Dispose()
  85.         Me.Close()
  86.     End Sub
  87. End Class
Advertisement
Add Comment
Please, Sign In to add comment