private bool Read() { if (Ems == null) { throw new NullReferenceException($"Ems is null, Are u miss calling 'UpdateReader` Or Set 'MainEms' !!"); } if (!Ems.ReadClass(this, BaseAddress)) { return(false); } int count = ReadInfo.UseMaxAsReadCount ? Max : Count; if (count > MaxCountTArrayCanCarry) { return(false); } // TODO: Change This Logic try { if (count <= 0) { return(false); } if (Items.Count > count) { Items.RemoveRange(count, Items.Count - count); } else if (Items.Count < count) { Enumerable.Range(Items.Count, count).ToList().ForEach(num => { var instance = (T)Activator.CreateInstance(typeof(T), Ems, (UIntPtr)0x0); Items.Add(instance); }); } } catch { return(false); } return(true); }
/// <summary> /// Set Data On This Class (Doesn't Call ReadMemory Callback) <para /> /// Be Careful When Using This Function /// </summary> /// <param name="fullClassBytes">Full <see cref="ExternalClass"/> Bytes</param> public virtual bool UpdateData(byte[] fullClassBytes) { return(BaseAddress != UIntPtr.Zero && Ems.ReadClass(this, BaseAddress, fullClassBytes)); }
/// <summary> /// Read Data And Set It On This Class /// </summary> public virtual bool UpdateData() { return(BaseAddress != UIntPtr.Zero && Ems.ReadClass(this, BaseAddress)); }