﻿// Decompiled with JetBrains decompiler
// Type: Wb.Lpw.Platform.Protocol.LogCodes.LogCode
// 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;

namespace Wb.Lpw.Platform.Protocol.LogCodes
{
  [Serializable]
  public class LogCode
  {
    public int DbId;
    public string System;
    public string SubSystem;
    public string Action;
    public Severity Severity;
    public string Name;

    public LogCode()
    {
    }

    public LogCode(string system, string subSystem, string action, Severity severity, string name, int dbId)
    {
      this.DbId = dbId;
      this.System = system;
      this.SubSystem = subSystem;
      this.Action = action;
      this.Severity = severity;
      this.Name = name;
    }

    public LogCode(Severity severity, int id, string name)
      : this(string.Empty, string.Empty, string.Empty, severity, name, id)
    {
    }

    public LogCode(int id, string name)
      : this(Severity.Error, id, name)
    {
    }

    public static bool operator ==(LogCode a, LogCode b)
    {
      if (object.ReferenceEquals((object) a, (object) b))
        return true;
      if (object.ReferenceEquals((object) a, (object) null) || object.ReferenceEquals((object) b, (object) null) || (a.DbId != b.DbId || !(a.System == b.System)) || (!(a.SubSystem == b.SubSystem) || a.Severity != b.Severity))
        return false;
      return a.Action == b.Action;
    }

    public static bool operator !=(LogCode a, LogCode b)
    {
      return !(a == b);
    }

    public override string ToString()
    {
      return string.Format("{0}{1} ({2})", !string.IsNullOrEmpty(this.System) ? (object) string.Format("{0}.{1}.{2}.", (object) this.System, (object) this.SubSystem, (object) this.Action) : (object) string.Empty, (object) this.Name, (object) this.DbId);
    }

    public override int GetHashCode()
    {
      return (int) ((Severity) this.DbId ^ this.Severity);
    }

    public override bool Equals(object obj)
    {
      if (obj is LogCode)
        return this == (LogCode) obj;
      return false;
    }
  }
}
