﻿// Decompiled with JetBrains decompiler
// Type: Wb.Lpw.Platform.Protocol.PlatformIdentity
// Assembly: Wb.Lpw.Protocol, Version=2.13.83.0, Culture=neutral, PublicKeyToken=null
// MVID: A621984F-C936-438B-B744-D121BF336087
// Assembly location: C:\Users\CGA Computer\Desktop\LEGO Universe Stuff\LOCO Server\Unity Web Player Extractor\Saved Files\LOCO Server.unity3d_unpacked\Wb.Lpw.Protocol.dll

using System;
using Wb.Lpw.Platform.Protocol.Deserializer;

namespace Wb.Lpw.Platform.Protocol
{
  [Serializable]
  public class PlatformIdentity
  {
    public IdentityType Type;
    public string Data;

    private PlatformIdentity()
    {
    }

    public override string ToString()
    {
      return string.Format("{{ Type: {0}, Data: {1} }}", (object) this.Type, (object) this.Data);
    }

    public static PlatformIdentity FromWBNET(string username, string password)
    {
      string str = Serializer.ToJson((object) new WBNETIdentityData()
      {
        Username = username,
        Password = password
      });
      return new PlatformIdentity()
      {
        Type = IdentityType.WBNET,
        Data = str
      };
    }

    public static PlatformIdentity FromLego(string loginToken, string userId)
    {
      string str = Serializer.ToJson((object) new LegoIdentityData()
      {
        LoginToken = loginToken,
        UserId = userId
      });
      return new PlatformIdentity()
      {
        Type = IdentityType.Lego,
        Data = str
      };
    }

    internal T ExtractData<T>()
    {
      return Serializer.FromJson<T>(this.Data);
    }
  }
}
