﻿// Decompiled with JetBrains decompiler
// Type: MongoDB.Bson.BsonBoolean
// Assembly: MongoDB.Bson, Version=1.6.1.21837, Culture=neutral, PublicKeyToken=f686731cfb9cc103
// MVID: 93880221-3735-46FB-8891-84D897158E28
// Assembly location: C:\Users\CGA Computer\Desktop\LEGO Universe Stuff\LOCO Server\Unity Web Player Extractor\Saved Files\LOCO Server.unity3d_unpacked\MongoDB.Bson.dll

using System;
using System.Xml;

namespace MongoDB.Bson
{
  [Serializable]
  public class BsonBoolean : BsonValue, IComparable<BsonBoolean>, IEquatable<BsonBoolean>
  {
    private static BsonBoolean __falseInstance = new BsonBoolean(false);
    private static BsonBoolean __trueInstance = new BsonBoolean(true);
    private bool _value;

    public static BsonBoolean False
    {
      get
      {
        return BsonBoolean.__falseInstance;
      }
    }

    public static BsonBoolean True
    {
      get
      {
        return BsonBoolean.__trueInstance;
      }
    }

    public override object RawValue
    {
      get
      {
        return (object) (bool) (this._value ? 1 : 0);
      }
    }

    public bool Value
    {
      get
      {
        return this._value;
      }
    }

    private BsonBoolean(bool value)
      : base(BsonType.Boolean)
    {
      this._value = value;
    }

    public static implicit operator BsonBoolean(bool value)
    {
      return BsonBoolean.Create(value);
    }

    public static bool operator !=(BsonBoolean lhs, BsonBoolean rhs)
    {
      return !(lhs == rhs);
    }

    public static bool operator ==(BsonBoolean lhs, BsonBoolean rhs)
    {
      if (object.ReferenceEquals((object) lhs, (object) null))
        return object.ReferenceEquals((object) rhs, (object) null);
      return lhs.Equals(rhs);
    }

    public static BsonBoolean Create(bool value)
    {
      if (!value)
        return BsonBoolean.__falseInstance;
      return BsonBoolean.__trueInstance;
    }

    public static BsonBoolean Create(object value)
    {
      if (value != null)
        return (BsonBoolean) BsonTypeMapper.MapToBsonValue(value, BsonType.Boolean);
      return (BsonBoolean) null;
    }

    public int CompareTo(BsonBoolean other)
    {
      if (other == (BsonBoolean) null)
        return 1;
      return (this._value ? 1 : 0).CompareTo(other._value ? 1 : 0);
    }

    public override int CompareTo(BsonValue other)
    {
      if (other == (BsonValue) null)
        return 1;
      BsonBoolean bsonBoolean = other as BsonBoolean;
      if (bsonBoolean != (BsonBoolean) null)
        return (this._value ? 1 : 0).CompareTo(bsonBoolean._value ? 1 : 0);
      return this.CompareTypeTo(other);
    }

    public bool Equals(BsonBoolean rhs)
    {
      if (object.ReferenceEquals((object) rhs, (object) null) || this.GetType() != rhs.GetType())
        return false;
      return this._value == rhs._value;
    }

    public override bool Equals(object obj)
    {
      return this.Equals(obj as BsonBoolean);
    }

    public override int GetHashCode()
    {
      return 37 * (37 * 17 + this.BsonType.GetHashCode()) + this._value.GetHashCode();
    }

    public override string ToString()
    {
      return XmlConvert.ToString(this._value);
    }
  }
}
