Exemplo n.º 1
0
 internal static void Dereference()
 {
     if (--_refCount == 0)
     {
         Backing.Instance().Dispose();
     }
 }
Exemplo n.º 2
0
        public object Clone()
        {
            VariableValueArray clone = new VariableValueArray(BitsPerValue, Capacity);

            Backing.Copy(0, Backing, 0, Backing.Length);
            return(clone);
        }
Exemplo n.º 3
0
    /// <summary>
    /// Informa  a la barra de que puede retroceder a su posición inicial.
    /// Se queda en espera hasta que la barra haya bajado.
    /// </summary>
    public void PlayerLose()
    {
        player.GetComponent <PlayerController>().BackingPlayer(true);
        Backing backing = player.GetComponent <Backing>();

        backing.ActiveBacking();
    }
Exemplo n.º 4
0
 /// <summary>
 /// Release all resources.
 /// </summary>
 public virtual void Dispose()
 {
     if (Backing != null && !KeepAlive)
     {
         Backing.Dispose();
         Backing = null;
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sorts the list using the given comparer./>
 /// </summary>
 public void Sort(IComparer <T> comparer)
 {
     using (DeferredUpdate())
         using (Lock.WriteUsing())
         {
             Backing.Sort(comparer);
         }
     OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move));
 }
Exemplo n.º 6
0
            protected virtual void WriteRest(Stream to)
            {
                byte[] buffer = new byte[BlockSize];
                int    rd;

                while ((rd = Backing.Read(buffer, 0, BlockSize)) > 0)
                {
                    WriteBlock(to, buffer, rd);
                }
            }
Exemplo n.º 7
0
 /// <summary>
 /// Sorts the list using the given selector and comparer./>
 /// </summary>
 public void Sort <TKey>(Func <T, TKey> selector, IComparer <TKey> comparer = null)
 {
     using (DeferredUpdate())
         using (Lock.WriteUsing())
         {
             comparer = comparer ?? Comparer <TKey> .Default;
             Backing.Sort(new TransformComparer <T, TKey>(selector, comparer));
         }
     OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move));
 }
Exemplo n.º 8
0
 /// <inheritdoc/>
 public void Insert(int index, T item)
 {
     using (Lock.WriteUsing())
     {
         Backing.Insert(index, item);
         MarkSnapshotsDirty();
         OnPropertyChanged(nameof(Count));
         OnCollectionChanged(
             new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
     }
 }
Exemplo n.º 9
0
 /// <inheritdoc/>
 public void RemoveAt(int index)
 {
     using (Lock.WriteUsing())
     {
         T old = Backing[index];
         Backing.RemoveAt(index);
         MarkSnapshotsDirty();
         OnPropertyChanged(nameof(Count));
         OnCollectionChanged(
             new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, old, index));
     }
 }
Exemplo n.º 10
0
 /// <inheritdoc/>
 int IList.Add(object value)
 {
     if (value is T t)
     {
         using (Lock.WriteUsing())
         {
             int index = Backing.Count;
             Backing.Add(t);
             return(index);
         }
     }
     return(-1);
 }
Exemplo n.º 11
0
            protected int ReadBlock(Stream from, byte[] buffer, ref long read)
            {
                int rd;

                if (StreamLength - read < BlockSize)
                {
                    rd = from.Read(buffer, 0, (int)(StreamLength % BlockSize));
                }
                else
                {
                    rd = from.Read(buffer, 0, BlockSize);
                }
                if (rd > 0)
                {
                    Backing.Write(buffer, 0, rd);
                    read += rd;
                }
                return(rd);
            }
Exemplo n.º 12
0
 /// <summary>
 /// Sorts the list using the given selector and comparer./>
 /// </summary>
 public void Sort <TKey>(Func <T, TKey> selector, IComparer <TKey> comparer = null)
 {
     using (DeferredUpdate())
         using (Lock.WriteUsing())
         {
             comparer = comparer ?? Comparer <TKey> .Default;
             if (Backing is List <T> lst)
             {
                 lst.Sort(new TransformComparer <T, TKey>(selector, comparer));
             }
             else
             {
                 List <T> sortedItems = Backing.OrderBy(selector, comparer).ToList();
                 Backing.Clear();
                 foreach (T v in sortedItems)
                 {
                     Backing.Add(v);
                 }
             }
         }
 }
Exemplo n.º 13
0
 public override Instruction[] StoreValue()
 {
     Debug.Assert(Backing != null);
     return(Backing.StoreValue());
 }
Exemplo n.º 14
0
 /// <inheritdoc/>
 public int IndexOf(T item)
 {
     using (Lock.ReadUsing())
         return(Backing.IndexOf(item));
 }
Exemplo n.º 15
0
        protected override void Calculate()
        {
            #region Read clay masonry table data

            var SampleValue         = new { Density = "", BackingDescription = "", BackingId = "", Weight = "" }; // sample
            var ComponentWeightList = ListFactory.MakeList(SampleValue);

            using (StringReader reader = new StringReader(Resources.DeadLoadGFRC))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    string[] Vals = line.Split(',');
                    if (Vals.Count() == 4)
                    {
                        string Density            = (string)Vals[0];
                        string BackingDescription = (string)Vals[1];
                        string BackingId          = (string)Vals[2];
                        string Weight             = (string)Vals[3];

                        ComponentWeightList.Add(new
                        {
                            Density            = Density,
                            BackingDescription = BackingDescription,
                            BackingId          = BackingId,
                            Weight             = Weight
                        });
                    }
                }
            }

            #endregion

            double q_Gfrc      = 0.0;
            string Description = null;

            var DataValues = from weightEntry in ComponentWeightList where (weightEntry.Density == Density.ToString() && weightEntry.BackingId == Backing.ToString()) select weightEntry;
            var ResultList = (DataValues.ToList());

            try
            {
                if (ResultList.FirstOrDefault() != null)
                {
                    double LoadVal;
                    if (Double.TryParse(ResultList.FirstOrDefault().Weight, out LoadVal))
                    {
                        q_Gfrc      = LoadVal;
                        Description = ResultList.FirstOrDefault().BackingDescription;
                    }
                }
            }
            catch
            {
            }

            string DensityString = null;
            switch (Density)
            {
            case GfrcMaterialDensity.d120pcf:
                DensityString = "120 pcf";
                break;

            case GfrcMaterialDensity.d140pcf:
                DensityString = "140 pcf";
                break;

            default:
                break;
            }

            base.Weight = q_Gfrc;
            base.Notes  = string.Format("GFRC with {0} density = {1} ", Description, DensityString);
        }
Exemplo n.º 16
0
 /// <summary>
 /// Searches the entire list for an element using the specified comparer and returns the zero-based index of the element.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="comparer"></param>
 /// <returns></returns>
 public int BinarySearch(T item, IComparer <T> comparer = null)
 {
     using (Lock.ReadUsing())
         return(Backing.BinarySearch(item, comparer ?? Comparer <T> .Default));
 }
Exemplo n.º 17
0
 public static Backing Instance() => _instance ?? (_instance = new Backing());
Exemplo n.º 18
0
 public static T Inject <T>(T target) where T : StrictDispose => Backing.Instance().InjectItem(target);
Exemplo n.º 19
0
 public override void SetLength(long value)
 {
     Backing.SetLength(value);
 }
Exemplo n.º 20
0
 public override void Flush()
 {
     Backing.Flush();
 }
Exemplo n.º 21
0
 public override Instruction[] GetValue()
 {
     Debug.Assert(Param != null);
     return(Backing?.GetValue() ?? new[] { Instruction.Create(OpCodes.Ldarg, Param) });
 }
Exemplo n.º 22
0
 public override long Seek(long offset, SeekOrigin origin)
 {
     return(Backing.Seek(offset, origin));
 }