﻿// Decompiled with JetBrains decompiler
// Type: System.Data.RelatedDataView
// Assembly: System.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: C838B317-B488-40F5-BE1A-F899721E7A38
// Assembly location: C:\Users\CGA Computer\Desktop\LEGO Universe Stuff\LOCO Server\Unity Web Player Extractor\Saved Files\LOCO Server.unity3d_unpacked\System.Data.dll

using Mono.Data.SqlExpressions;

namespace System.Data
{
  internal class RelatedDataView : DataView, IExpression
  {
    private object[] _keyValues;
    private DataColumn[] _columns;

    internal override IExpression FilterExpression
    {
      get
      {
        return (IExpression) this;
      }
    }

    internal RelatedDataView(DataColumn[] relatedColumns, object[] keyValues)
    {
      this.dataTable = relatedColumns[0].Table;
      this.rowState = DataViewRowState.CurrentRows;
      this._columns = relatedColumns;
      this._keyValues = keyValues;
      this.Open();
    }

    void IExpression.ResetExpression()
    {
    }

    public virtual bool Equals(object obj)
    {
      if (!(obj is RelatedDataView))
      {
        if (base.FilterExpression == null)
          return false;
        return base.FilterExpression.Equals(obj);
      }
      RelatedDataView relatedDataView = (RelatedDataView) obj;
      if (this._columns.Length != relatedDataView._columns.Length)
        return false;
      for (int index = 0; index < this._columns.Length; ++index)
      {
        if (!((object) this._columns[index]).Equals((object) relatedDataView._columns[index]) || !this._keyValues[index].Equals(relatedDataView._keyValues[index]))
          return false;
      }
      return relatedDataView.FilterExpression.Equals((object) base.FilterExpression);
    }

    public virtual int GetHashCode()
    {
      int num = 0;
      for (int index = 0; index < this._columns.Length; ++index)
        num = num ^ ((object) this._columns[index]).GetHashCode() ^ this._keyValues[index].GetHashCode();
      if (base.FilterExpression != null)
        num ^= base.FilterExpression.GetHashCode();
      return num;
    }

    public object Eval(DataRow row)
    {
      return (object) (bool) (this.EvalBoolean(row) ? 1 : 0);
    }

    public bool EvalBoolean(DataRow row)
    {
      for (int index = 0; index < this._columns.Length; ++index)
      {
        if (!row[this._columns[index]].Equals(this._keyValues[index]))
          return false;
      }
      IExpression filterExpression = base.FilterExpression;
      if (filterExpression != null)
        return filterExpression.EvalBoolean(row);
      return true;
    }

    public bool DependsOn(DataColumn other)
    {
      for (int index = 0; index < this._columns.Length; ++index)
      {
        if (this._columns[index] == other)
          return true;
      }
      IExpression filterExpression = base.FilterExpression;
      if (filterExpression != null)
        return filterExpression.DependsOn(other);
      return false;
    }
  }
}
