// Decompiled with JetBrains decompiler
// Type: SE0085.StCl.CascadingLevels7Deep
// Assembly: SE0085StCl, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null
// MVID: 2F536775-F65D-4A2A-A94A-55B55F096E84
// Assembly location: C:\Users\Abishek\Downloads\SchneiderCode_Breaker_09292016\Breaker Schedule-20160930T014118Z\Breaker Schedule\Solution for gathering Breaker Data\DMS\bin\Debug\SE0085StCl.dll

using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Collections;

namespace SE0085.StCl
{
  public class CascadingLevels7Deep
  {
    private long _CompositeOfLevels;
    private ArrayList _Levels;
    private ArrayList _scLevels;
    private string _stCCLChain;
    private string _stCCLNameChain;
    private long _SearchUpper;
    private long[] _MaskValues;
    private long[] _MaskLevelsValues;

    public long CompositeOfLevels
    {
      get
      {
        int num1 = 0;
        int num2 = checked (this._Levels.Count - 1);
        int index = num1;
        while (index <= num2)
        {
          this.set_CCLevelValue((long) index, Conversions.ToLong(this._Levels[index]));
          checked { ++index; }
        }
        return this._CompositeOfLevels;
      }
      set
      {
        this._CompositeOfLevels = value;
        this._Levels[0] = (object) ((value & 9151314442816847872L) >> 56);
        this._Levels[1] = (object) ((value & 71776119061217280L) >> 48);
        this._Levels[2] = (object) ((value & 280375465082880L) >> 40);
        this._Levels[3] = (object) ((value & 1095216660480L) >> 32);
        this._Levels[4] = (object) ((value & 4278190080L) >> 24);
        this._Levels[5] = (object) ((value & 16711680L) >> 16);
        this._Levels[6] = (object) ((value & 65280L) >> 8);
        this._Levels[7] = (object) ((value & (long) byte.MaxValue) >> 0);
      }
    }

    public long Level0
    {
      get
      {
        return Conversions.ToLong(this._Levels[0]);
      }
      set
      {
        if (!(0L <= value & value < 256L))
          return;
        this._Levels[0] = (object) value;
        this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[0];
        this._CompositeOfLevels = this._CompositeOfLevels | value << 56;
      }
    }

    public long Level1
    {
      get
      {
        return Conversions.ToLong(this._Levels[1]);
      }
      set
      {
        if (!(0L <= value & value < 256L))
          return;
        this._Levels[1] = (object) value;
        this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[1];
        this._CompositeOfLevels = this._CompositeOfLevels | value << 48;
      }
    }

    public long Level2
    {
      get
      {
        return Conversions.ToLong(this._Levels[2]);
      }
      set
      {
        if (!(0L <= value & value < 256L))
          return;
        this._Levels[2] = (object) value;
        this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[2];
        this._CompositeOfLevels = this._CompositeOfLevels | value << 40;
      }
    }

    public long Level3
    {
      get
      {
        return Conversions.ToLong(this._Levels[3]);
      }
      set
      {
        if (!(0L <= value & value < 256L))
          return;
        this._Levels[3] = (object) value;
        this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[3];
        this._CompositeOfLevels = this._CompositeOfLevels | value << 32;
      }
    }

    public long Level4
    {
      get
      {
        return Conversions.ToLong(this._Levels[4]);
      }
      set
      {
        if (!(0L <= value & value < 256L))
          return;
        this._Levels[4] = (object) value;
        this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[4];
        this._CompositeOfLevels = this._CompositeOfLevels | value << 24;
      }
    }

    public long Level5
    {
      get
      {
        return Conversions.ToLong(this._Levels[5]);
      }
      set
      {
        if (!(0L <= value & value < 256L))
          return;
        this._Levels[5] = (object) value;
        this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[5];
        this._CompositeOfLevels = this._CompositeOfLevels | value << 16;
      }
    }

    public long Level6
    {
      get
      {
        return Conversions.ToLong(this._Levels[6]);
      }
      set
      {
        if (!(0L <= value & value < 256L))
          return;
        this._Levels[6] = (object) value;
        this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[6];
        this._CompositeOfLevels = this._CompositeOfLevels | value << 8;
      }
    }

    public long Level7
    {
      get
      {
        return Conversions.ToLong(this._Levels[7]);
      }
      set
      {
        if (!(0L <= value & value < 256L))
          return;
        this._Levels[7] = (object) value;
        this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[7];
        this._CompositeOfLevels = this._CompositeOfLevels | value << 0;
      }
    }

    public scLevels scLevel0
    {
      get
      {
        return (scLevels) this._scLevels[0];
      }
      set
      {
        this._scLevels[0] = (object) value;
        this._Levels[0] = (object) value.LevelValue;
      }
    }

    public scLevels scLevel1
    {
      get
      {
        return (scLevels) this._scLevels[1];
      }
      set
      {
        this._scLevels[1] = (object) value;
        this._Levels[1] = (object) value.LevelValue;
      }
    }

    public scLevels scLevel2
    {
      get
      {
        return (scLevels) this._scLevels[2];
      }
      set
      {
        this._scLevels[2] = (object) value;
        this._Levels[2] = (object) value.LevelValue;
      }
    }

    public scLevels scLevel3
    {
      get
      {
        return (scLevels) this._scLevels[3];
      }
      set
      {
        this._scLevels[3] = (object) value;
        this._Levels[3] = (object) value.LevelValue;
      }
    }

    public scLevels scLevel4
    {
      get
      {
        return (scLevels) this._scLevels[4];
      }
      set
      {
        this._scLevels[4] = (object) value;
        this._Levels[4] = (object) value.LevelValue;
      }
    }

    public scLevels scLevel5
    {
      get
      {
        return (scLevels) this._scLevels[5];
      }
      set
      {
        this._scLevels[5] = (object) value;
        this._Levels[5] = (object) value.LevelValue;
      }
    }

    public scLevels scLevel6
    {
      get
      {
        return (scLevels) this._scLevels[6];
      }
      set
      {
        this._scLevels[6] = (object) value;
        this._Levels[6] = (object) value.LevelValue;
      }
    }

    public scLevels scLevel7
    {
      get
      {
        return (scLevels) this._scLevels[7];
      }
      set
      {
        this._scLevels[7] = (object) value;
        this._Levels[7] = (object) value.LevelValue;
      }
    }

    public string CCLChain
    {
      get
      {
        string str = "?";
        if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[0], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
        {
          str = Conversions.ToString(Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[0], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null)));
          if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[1], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
          {
            str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[1], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
            if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[2], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
            {
              str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[2], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
              if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[3], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
              {
                str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[3], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[4], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                {
                  str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[4], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                  if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[5], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                  {
                    str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[5], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                    if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[6], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                    {
                      str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[6], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                      if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[7], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                        str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[7], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                    }
                  }
                }
              }
            }
          }
        }
        return str;
      }
    }

    public string CCLNameChain
    {
      get
      {
        string str = "?";
        if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[0], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
        {
          str = Conversions.ToString(Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[0], (Type) null, "LevelName", new object[0], (string[]) null, (Type[]) null, (bool[]) null)));
          if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[1], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
          {
            str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[1], (Type) null, "LevelName", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
            if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[2], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
            {
              str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[2], (Type) null, "LevelName", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
              if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[3], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
              {
                str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[3], (Type) null, "LevelName", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[4], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                {
                  str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[4], (Type) null, "LevelName", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                  if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[5], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                  {
                    str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[5], (Type) null, "LevelName", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                    if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[6], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                    {
                      str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[6], (Type) null, "LevelName", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                      if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[7], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                        str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject((object) "->", NewLateBinding.LateGet(this._scLevels[7], (Type) null, "LevelName", new object[0], (string[]) null, (Type[]) null, (bool[]) null))));
                    }
                  }
                }
              }
            }
          }
        }
        return str;
      }
    }

    public long SearchUpperLimit
    {
      get
      {
        return !Operators.ConditionalCompareObjectGreater(this._Levels[7], (object) 0, false) ? (!Operators.ConditionalCompareObjectGreater(this._Levels[6], (object) 0, false) ? (!Operators.ConditionalCompareObjectGreater(this._Levels[5], (object) 0, false) ? (!Operators.ConditionalCompareObjectGreater(this._Levels[4], (object) 0, false) ? (!Operators.ConditionalCompareObjectGreater(this._Levels[3], (object) 0, false) ? (!Operators.ConditionalCompareObjectGreater(this._Levels[2], (object) 0, false) ? (!Operators.ConditionalCompareObjectGreater(this._Levels[1], (object) 0, false) ? (!Operators.ConditionalCompareObjectGreater(this._Levels[0], (object) 0, false) ? 0L : this._CompositeOfLevels | checked (72057594037927936L - 1L)) : this._CompositeOfLevels | checked (281474976710656L - 1L)) : this._CompositeOfLevels | checked (1099511627776L - 1L)) : this._CompositeOfLevels | checked (4294967296L - 1L)) : this._CompositeOfLevels | checked (16777216L - 1L)) : this._CompositeOfLevels | checked (65536L - 1L)) : this._CompositeOfLevels | checked (256L - 1L)) : this._CompositeOfLevels;
      }
    }

    public CascadingLevels7Deep()
    {
      this._Levels = new ArrayList();
      this._scLevels = new ArrayList();
      this._MaskValues = new long[8];
      this._MaskLevelsValues = new long[8];
      this.InitCCL7D();
    }

    public void InitCCL7D()
    {
      this._CompositeOfLevels = 0L;
      ArrayList arrayList = new ArrayList();
      long num1 = 0;
      this._Levels.Clear();
      this._scLevels.Clear();
      int num2 = 0;
      do
      {
        this._Levels.Add((object) num1);
        this._scLevels.Add((object) new scLevels());
        checked { ++num2; }
      }
      while (num2 <= 7);
      this._stCCLChain = "?";
      this._stCCLNameChain = "?";
      this._MaskValues[0] = 72057594037927935L;
      this._MaskValues[1] = 9151595917793558527L;
      this._MaskValues[2] = 9223091661389692927L;
      this._MaskValues[3] = 9223370941638115327L;
      this._MaskValues[4] = 9223372032576585727L;
      this._MaskValues[5] = 9223372036838064127L;
      this._MaskValues[6] = 9223372036854710527L;
      this._MaskValues[7] = 9223372036854775552L;
      this._MaskLevelsValues[0] = 0L;
      this._MaskLevelsValues[1] = 9151314442816847872L;
      this._MaskLevelsValues[2] = 9223090561878065152L;
      this._MaskLevelsValues[3] = 9223370937343148032L;
      this._MaskLevelsValues[4] = 9223372032559808512L;
      this._MaskLevelsValues[5] = 9223372036837998592L;
      this._MaskLevelsValues[6] = 9223372036854710272L;
      this._MaskLevelsValues[7] = 9223372036854775552L;
    }

    public void StepUp1Level()
    {
      int index = 7;
      while (!Operators.ConditionalCompareObjectGreater(this._Levels[index], (object) 0, false))
      {
        checked { index += -1; }
        if (index < 1)
          return;
      }
      this._Levels[index] = (object) 0;
    }

    public long get_CCLevelValue(long Level)
    {
      if (Level <= 7L)
        return Conversions.ToLong(this._Levels[checked ((int) Level)]);
      return 0;
    }

    public void set_CCLevelValue(long Level, long value)
    {
      if (Level > 7L || !(0L <= value & value < 256L))
        return;
      this._Levels[checked ((int) Level)] = (object) value;
      this._CompositeOfLevels = this._CompositeOfLevels & this._MaskValues[checked ((int) Level)];
      this._CompositeOfLevels = this._CompositeOfLevels | value << checked ((int) ((7L - Level) * 8L));
    }

    public scLevels get_stCCLLevels(long Level)
    {
      return (scLevels) this._scLevels[checked ((int) Level)];
    }

    public void set_stCCLLevels(long Level, scLevels value)
    {
      this._scLevels[checked ((int) Level)] = (object) value;
      this._Levels[checked ((int) Level)] = (object) value.LevelValue;
    }

    public override string ToString()
    {
      string str = "";
      if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[0], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
      {
        str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject(NewLateBinding.LateGet(this._scLevels[0], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) " --> ")));
        if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[1], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
        {
          str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject(NewLateBinding.LateGet(this._scLevels[1], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) " --> ")));
          if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[2], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
          {
            str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject(NewLateBinding.LateGet(this._scLevels[2], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) " --> ")));
            if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[3], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
            {
              str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject(NewLateBinding.LateGet(this._scLevels[3], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) " --> ")));
              if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[4], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
              {
                str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject(NewLateBinding.LateGet(this._scLevels[4], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) " --> ")));
                if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[5], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                {
                  str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject(NewLateBinding.LateGet(this._scLevels[5], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) " --> ")));
                  if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[6], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                  {
                    str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject(NewLateBinding.LateGet(this._scLevels[6], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) " --> ")));
                    if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(this._scLevels[7], (Type) null, "LevelValue", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
                      str = Conversions.ToString(Operators.AddObject((object) str, Operators.ConcatenateObject(NewLateBinding.LateGet(this._scLevels[7], (Type) null, "LevelAbbrv", new object[0], (string[]) null, (Type[]) null, (bool[]) null), (object) " --> ")));
                  }
                }
              }
            }
          }
        }
      }
      return str;
    }
  }
}
