internal static void Dereference() { if (--_refCount == 0) { Backing.Instance().Dispose(); } }
public object Clone() { VariableValueArray clone = new VariableValueArray(BitsPerValue, Capacity); Backing.Copy(0, Backing, 0, Backing.Length); return(clone); }
/// <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(); }
/// <summary> /// Release all resources. /// </summary> public virtual void Dispose() { if (Backing != null && !KeepAlive) { Backing.Dispose(); Backing = null; } }
/// <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)); }
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); } }
/// <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)); }
/// <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)); } }
/// <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)); } }
/// <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); }
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); }
/// <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); } } } }
public override Instruction[] StoreValue() { Debug.Assert(Backing != null); return(Backing.StoreValue()); }
/// <inheritdoc/> public int IndexOf(T item) { using (Lock.ReadUsing()) return(Backing.IndexOf(item)); }
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); }
/// <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)); }
public static Backing Instance() => _instance ?? (_instance = new Backing());
public static T Inject <T>(T target) where T : StrictDispose => Backing.Instance().InjectItem(target);
public override void SetLength(long value) { Backing.SetLength(value); }
public override void Flush() { Backing.Flush(); }
public override Instruction[] GetValue() { Debug.Assert(Param != null); return(Backing?.GetValue() ?? new[] { Instruction.Create(OpCodes.Ldarg, Param) }); }
public override long Seek(long offset, SeekOrigin origin) { return(Backing.Seek(offset, origin)); }