ArtemisComm.VariablePackage.Initialize C# (CSharp) Метод

Initialize() приватный Метод

private Initialize ( Stream stream, int index ) : void
stream Stream
index int
Результат void
        void Initialize(Stream stream, int index)
        {
            if (stream != null)
            {
                if (stream.CanRead)
                {
                    stream.Position = index;
                }
                _rawData = stream.GetMemoryStream(index);
                if (stream.CanRead)
                {
                    stream.Position = index;
                }
                _rawData.Position = 0;
                ID = _rawData.ToInt32();
                

                List<PropertyInfo> propertyList = new List<PropertyInfo>();

                Type t = this.GetType();
                PropertyInfo[] properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance);
                foreach (PropertyInfo prop in properties)
                {
                    bool skip = false;
                    foreach (System.Attribute attrib in prop.GetCustomAttributes(true))
                    {
                        if (attrib is ArtemisExcludedAttribute)
                        {
                            skip = true;
                            break;
                        }
                    }
                    if (!skip)
                    {
                        if (prop.Name != "ID" && prop.Name != "IncludedFields")
                        {
                            propertyList.Add(prop);
                        }
                    }
                }

                IncludedFields = new ReadOnlyCollection<bool>(ProcessBitFlags(propertyList.Count, _rawData, 4));
                int flagsize = (propertyList.Count - 1)/ 8 + 1;

                int position = 4 + flagsize;

                errors = ProcessVariableData(propertyList.ToArray(), this, _rawData, position, IncludedFields.ToArray<bool>());
                
            }
            
        }