public virtual void WriteTypeInfo(IWriteContext context, ArrayInfo info)
        {
            BitMap4 typeInfoBitmap = new BitMap4(2);

            typeInfoBitmap.Set(0, info.Primitive());
            typeInfoBitmap.Set(1, info.Nullable());
            context.WriteByte(typeInfoBitmap.GetByte(0));
        }
Example #2
0
        private ITypeHandler4 CorrectHandlerVersion(IDefragmentContext context, ITypeHandler4
                                                    handler, ArrayInfo info)
        {
            var classMetadata = ClassMetadata(context, info
                                              );

            return(HandlerRegistry.CorrectHandlerVersion(context, handler, classMetadata));
        }
Example #3
0
 public _IRunnable_80(ArrayHandler _enclosing, AbstractBufferContext context, ArrayInfo
                      info, IRunnable elementRunnable)
 {
     this._enclosing      = _enclosing;
     this.context         = context;
     this.info            = info;
     this.elementRunnable = elementRunnable;
 }
Example #4
0
        protected virtual ArrayInfo ForEachElement(AbstractBufferContext context, IRunnable
                                                   elementRunnable)
        {
            ArrayInfo info = NewArrayInfo();

            WithContent(context, new _IRunnable_80(this, context, info, elementRunnable));
            return(info);
        }
        public virtual void ReadTypeInfo(Transaction trans, IReadBuffer buffer, ArrayInfo
                                         info, int classID)
        {
            BitMap4 typeInfoBitmap = new BitMap4(buffer.ReadByte());

            info.Primitive(typeInfoBitmap.IsTrue(0));
            info.Nullable(typeInfoBitmap.IsTrue(1));
        }
Example #6
0
        public void CreateArrayOfInt()
        {
            ObjectCreator target = new ObjectCreator();
            ArrayInfo     info   = CreateIntArrayInfo();
            var           result = (int[])target.CreateArray(info);

            Assert.IsTrue(result.SequenceEqual(_simpleIntArray));
        }
Example #7
0
        public virtual object Read(IReadContext context)
        {
            ArrayInfo info  = NewArrayInfo();
            object    array = ReadCreate(context.Transaction(), context, info);

            ReadElements(context, info, array);
            return(array);
        }
Example #8
0
        protected override void AnalyzeDimensions(ObjectContainerBase container, object obj
                                                  , ArrayInfo info)
        {
            var dim = ArrayReflector(container).Dimensions(obj);

            ((MultidimensionalArrayInfo)info).Dimensions(dim);
            info.ElementCount(ElementCount(dim));
        }
 public virtual bool HasNullBitmap(ArrayInfo info)
 {
     if (info.Nullable())
     {
         return(true);
     }
     return(!info.Primitive());
 }
Example #10
0
        public virtual void Write(IWriteContext context, object obj)
        {
            ArrayInfo info = NewArrayInfo();

            Analyze(Container(context), obj, info);
            WriteInfo(context, info);
            WriteElements(context, obj, info);
        }
Example #11
0
        }   // BeginTest method


        /// <summary>
        /// Create a report of the contents of the deserialized response in
        /// <paramref name="timeSeriesDailyResponse"/>.
        /// </summary>
        /// <param name="timeSeriesDailyResponse">
        /// The populated TimeSeriesDailyResponse instance returned by the JSON
        /// deserializer.
        /// </param>
        internal static void ConsumeResponse (
            string pstrReportFileName ,
            TimeSeriesDailyResponse timeSeriesDailyResponse )
        {
            Console.WriteLine (
                Properties.Resources.MSG_RESPONSE_METADATA ,                    // Format control string
                new object [ ]
                {
                    timeSeriesDailyResponse.Meta_Data.Information ,             // Format item 0: Information   = {0}
                    timeSeriesDailyResponse.Meta_Data.Symbol ,                  // Format Item 1: Symbol        = {1}
                    timeSeriesDailyResponse.Meta_Data.LastRefreshed ,           // Format Item 2: LastRefreshed = {2}
                    timeSeriesDailyResponse.Meta_Data.OutputSize ,              // Format Item 3: OutputSize    = {3}
                    timeSeriesDailyResponse.Meta_Data.TimeZone ,                // Format Item 4: TimeZone      = {4}
                    timeSeriesDailyResponse.Time_Series_Daily.Length ,          // Format Item 5: Detail Count  = {5}
                    Environment.NewLine                                         // Format Item 6: Platform-dependent newline
                } );

            string strAbsoluteInputFileName = AssembleAbsoluteFileName ( pstrReportFileName );

            using ( StreamWriter swTimeSeriesDetail = new StreamWriter ( strAbsoluteInputFileName ,
                                                                         FileIOFlags.FILE_OUT_CREATE ,
                                                                         System.Text.Encoding.ASCII ,
                                                                         MagicNumbers.CAPACITY_08KB ) )
            {
                string strLabelRow = Properties.Resources.MSG_RESPONSE_DETAILS_LABELS.ReplaceEscapedTabsInStringFromResX ( );
                swTimeSeriesDetail.WriteLine ( strLabelRow );
                string strDetailRowFormatString = ReportHelpers.DetailTemplateFromLabels ( strLabelRow );

                for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ;
                          intJ < timeSeriesDailyResponse.Time_Series_Daily.Length ;
                          intJ++ )
                {
                    Time_Series_Daily daily = timeSeriesDailyResponse.Time_Series_Daily [ intJ ];
                    swTimeSeriesDetail.WriteLine (
                        strDetailRowFormatString ,
                        new object [ ]
                        {
                            ArrayInfo.OrdinalFromIndex ( intJ ) ,               // Format Item 0: Item
                            Beautify ( daily.Activity_Date) ,                   // Format Item 1: Activity_Date
                            Beautify ( daily.Open ) ,                           // Format Item 2: Open
                            Beautify ( daily.High ) ,                           // Format Item 3: High
                            Beautify ( daily.Low ) ,                            // Format Item 4: Low
                            Beautify ( daily.Close ) ,                          // Format Item 5: Close
                            Beautify ( daily.AdjustedClose ) ,                  // Format Item 6: AdjustedClose
                            Beautify ( daily.Volume ) ,                         // Format Item 7: Volume
                            Beautify ( daily.DividendAmount ) ,                 // Format Item 8: DividendAmount
                            Beautify ( daily.SplitCoefficient )                 // Format Item 9: SplitCoefficient
                        } );
                }   // for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; intJ < timeSeriesDailyResponse.Time_Series_Daily.Length ; intJ++ )
            }   // using ( StreamWriter swTimeSeriesDetail = new StreamWriter ( strAbsoluteInputFileName , FileIOFlags.FILE_OUT_CREATE , System.Text.Encoding.ASCII , MagicNumbers.CAPACITY_08KB ) )

            Console.WriteLine (
                ShowFileDetails (                                               // Print the returned string.
                    Properties.Resources.FILE_LABEL_CONTENT_REPORT ,            // string pstrLabel
                    strAbsoluteInputFileName ,                                  // string pstrFileName
                    true ,                                                      // bool   pfPrefixWithNewline = false
                    false ) );                                                  // bool   pfSuffixWithNewline = true
        }   // private static void ConsumeResponse
		}	// InitializeInstance

        /// <summary>
        /// Enumeate missing configuration values, if any.
        /// </summary>
        /// <returns>
        /// This method returns a message suitable for display on a console or a
        /// Windows message box. The returned message summarises the state of
        /// affairs, even when all defined values are represented in the
        /// configuration file.
        /// </returns>
        public string EnumerateMissingConfigurationValues ( )
        {
            MissingConfigSettings = MissingConfigSettings ?? UnconfiguredDLLSettings.TheOnlyInstance;
            List<UnconfiguredDLLSettings.UnconfiguredSetting> missing = MissingConfigSettings.GetMissingPropsForFile (
                System.IO.Path.GetFileName (
                    _strAssemblyLocation ) );

            if ( missing.Count > ListInfo.LIST_IS_EMPTY )
            {
                System.Text.StringBuilder sbMessages = new System.Text.StringBuilder ( MagicNumbers.CAPACITY_04KB );

                //  ------------------------------------------------------------
                //  Start with a heading.
                //  ------------------------------------------------------------

                sbMessages.AppendFormat (
                    Properties.Resources.MSG_SOME_CONFIG_SETTINGS_OMITTED ,
                    MissingConfigSettings.Count ,
                    _DllConfigSettings.Count ,
                    AssemblyLocation ,
                    Environment.NewLine );

                //  ------------------------------------------------------------
                //  List each item in turn.
                //  ------------------------------------------------------------

                for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ;
                          intJ < MissingConfigSettings.Count ;
                          intJ++ )
                {
                    sbMessages.AppendFormat (
                        Properties.Resources.MSG_ACCEPTED_DEFAULT_VALUE ,       // Format Control String: {0} of {1}: {2} = {3}{4}
                        ArrayInfo.OrdinalFromIndex ( intJ ) ,                   // Format Item 0: {0} of
                        MissingConfigSettings.Count ,                           // Format Item 1: of {1}
                        missing [ intJ ].PropName ,                             // Format Item 2: : {2}
                        missing [ intJ ].PropValue ,                            // Format Item 3: = {3}
                        Environment.NewLine );                                  // Format Item 4: newline
                }   // for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; intJ < MissingConfigSettings.Count ; intJ++ )

                //  ------------------------------------------------------------
                //  End with a footing.
                //  ------------------------------------------------------------

                sbMessages.AppendFormat (
                    Properties.Resources.MSG_ACCEPTED_LIST_END ,
                    Environment.NewLine );

                return sbMessages.ToString ( );
            }   // TRUE (One or more settings is missing from the configuration file.) block, if ( base.MissingConfigSettings.Count > ListInfo.LIST_IS_EMPTY )
            else
            {
                return string.Format (
                    Properties.Resources.MSG_ALL_CONFIG_SETTINGS_COVERED ,
                    _DllConfigSettings.Count ,
                    AssemblyLocation );
            }   // FALSE (All configuration settings are covered by the configuration file.) block, if ( base.MissingConfigSettings.Count > ListInfo.LIST_IS_EMPTY )
        }   // public string EnumerateMissingConfigurationValues
Example #13
0
        public void CreateArrayWithReferenceToSameObject()
        {
            ArrayInfo info   = CreateSampleClassArrayInfoWithRefs();
            var       result = (SampleClass[])_target.CreateArray(info);

            Assert.AreEqual(3, result.Length);
            Assert.AreSame(result[1], result[2]);
            Assert.AreNotSame(result[1], result[0]);
        }
Example #14
0
        public object CreateArray(ArrayInfo arrayInfo)
        {
            var elementType = arrayInfo.ElementType;
            var objArray    = arrayInfo.Array.Cast <ICreationInfo>().Select(o => o.GetInstance(this)).ToArray();
            var targetArray = Array.CreateInstance(elementType, arrayInfo.Array.Length);

            objArray.CopyTo(targetArray, 0);
            return(targetArray);
        }
Example #15
0
 private int ReducedCountForNullBitMap(ArrayInfo info, IReadBuffer context)
 {
     if (!HasNullBitmap(info))
     {
         return(0);
     }
     return(ReducedCountForNullBitMap(info.ElementCount(), ReadNullBitmap(context, info
                                                                          .ElementCount())));
 }
Example #16
0
 protected IReflectClass NewInstanceReflectClass(IReflector reflector, ArrayInfo info
                                                 )
 {
     if (_usePrimitiveClassReflector)
     {
         return(PrimitiveClassReflector(reflector));
     }
     return(info.ReflectClass());
 }
Example #17
0
        byte[] DecryptArray(ArrayInfo aryInfo)
        {
            var ary       = new byte[aryInfo.arySize * aryInfo.arrayType.ElementType.GetPrimitiveSize()];
            int dataIndex = aryInfo.index;
            int len       = DeobUtils.ReadVariableLengthInt32(constantsData, ref dataIndex);

            Buffer.BlockCopy(constantsData, dataIndex, ary, 0, len);
            return(ary);
        }
Example #18
0
 protected override void WriteDimensions(IWriteContext context, ArrayInfo info)
 {
     int[] dim = ((MultidimensionalArrayInfo)info).Dimensions();
     context.WriteInt(dim.Length);
     for (int i = 0; i < dim.Length; i++)
     {
         context.WriteInt(dim[i]);
     }
 }
		}   // TestFormatItemCounters


		private static void ListAllErrors ( List<FormatStringError> plstAllErrors )
		{
			const int ORDINAL_FROM_SUBSCRIPT = ArrayInfo.INDEX_FROM_ORDINAL;
			const int POS_LABEL = ArrayInfo.ARRAY_FIRST_ELEMENT;
			const int POS_VALUE = ArrayInfo.ARRAY_SECOND_ELEMENT;
			const char DELIMITER = FormatStringError.LABEL_VALUE_DELIMITER;

			ReportDetail.DetailFormat = "{3}    {0} = {1}";

			int intErrorCount = plstAllErrors.Count;

			for ( int intI = ArrayInfo.ARRAY_FIRST_ELEMENT ;
					  intI < intErrorCount ;
					  intI++ )
			{
				FormatStringError fse = plstAllErrors [ intI ];
				string [ ] astrErrorDetails = fse.Split ( );
				int intNDetails = astrErrorDetails.Length;						// Save a trip into the collection.
				ReportDetails rptDtlsColl = new ReportDetails ( intNDetails );

				string [ ] astrErrorSummaryFirst = new string [ ]
                { 
                    string.Format (
                        Properties.Resources.MSG_FORMAT_ERROR_DETAILS ,			// Format template string
                        FormatItem.XofY (										// Format Item 0
                            intI + ORDINAL_FROM_SUBSCRIPT ,						//		X = Item Number
                            intErrorCount ) )									//		Y = Item Count
                };  // string [ ] astrErrorSummaryFirst

				//  ------------------------------------------------------------
				//  Maybe there is a better way to accompish this. Nevertheless,
				//  this method works for generating a completely blank string
				//  of a length that must be determined at runtime.
				//  ------------------------------------------------------------

				string [ ] astrErrorSummaryAllOthers = new string [ ]
                {
                    string.Empty.PadRight ( astrErrorSummaryFirst [ ArrayInfo.ARRAY_FIRST_ELEMENT ].Length )
                };  // string [ ] astrErrorSummaryAllOthers

				for ( int intJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; intJ < intNDetails ; intJ++ )
				{
					string [ ] astrLabelAndValue = astrErrorDetails [ intJ ].Split ( DELIMITER );
					rptDtlsColl.Add (
						new ReportDetail (
							astrLabelAndValue [ POS_LABEL ].Trim ( ) ,								// Label (Format Item = 0)
							astrLabelAndValue [ POS_VALUE ].Trim ( ) ,								// Value (Format Item = 1) as String
							( ReportDetail.ItemDisplayOrder ) ArrayInfo.OrdinalFromIndex ( intJ ) ,	// Item Number (Format Item = 2) - The arithmetic operation casts it to int (signed), so it must be forcibly cast back to unsigned int.
							null ,																	// Individual Format String (Null = Use Default from static property)
							( intJ == ArrayInfo.ARRAY_FIRST_ELEMENT )								// Additional Details - Condition
								? astrErrorSummaryFirst												//		Value if Condition is True
								: astrErrorSummaryAllOthers ) );									//		Value if Condition is False
				}   // for ( uint uintJ = ArrayInfo.ARRAY_FIRST_ELEMENT ; uintJ < intNDetails ; uintJ++ )

				rptDtlsColl.ListAllItems ( );
			}   // for ( int intI = ArrayInfo.ARRAY_FIRST_ELEMENT ; intI < intErrorCount ; intI++ )
		}   // ListAllErrors
Example #20
0
 public virtual object NewInstance(IReflectClass componentType, ArrayInfo info)
 {
     componentType = componentType.GetDelegate();
     if (componentType is GenericClass)
     {
         var length = info.ElementCount();
         return new GenericArray(((GenericClass) componentType).ArrayClass(), length);
     }
     return _delegate.NewInstance(componentType, info);
 }
Example #21
0
        public virtual int ClassIDFromInfo(ObjectContainerBase container, ArrayInfo info)
        {
            ClassMetadata classMetadata = container.ProduceClassMetadata(info.ReflectClass());

            if (classMetadata == null)
            {
                return(0);
            }
            return(classMetadata.GetID());
        }
Example #22
0
 public virtual object NewInstance(IReflectClass componentType, ArrayInfo info)
 {
     componentType = componentType.GetDelegate();
     if (componentType is GenericClass)
     {
         var length = info.ElementCount();
         return(new GenericArray(((GenericClass)componentType).ArrayClass(), length));
     }
     return(_delegate.NewInstance(componentType, info));
 }
Example #23
0
        private ArrayInfo CreateSampleClassArrayInfo()
        {
            ICreationInfo[] arr  = { CreateSimpleInfo(), CreateSimpleInfo() };
            var             info = new ArrayInfo
            {
                ElementType = typeof(SampleClass),
                Array       = arr
            };

            return(info);
        }
Example #24
0
        private ArrayInfo CreateIntArrayInfo()
        {
            var arr  = _simpleIntArray.Select(o => (ICreationInfo) new SimpleTypeInfo(o)).ToArray();
            var info = new ArrayInfo
            {
                ElementType = typeof(int),
                Array       = arr
            };

            return(info);
        }
Example #25
0
 private void ReadDimensions(ArrayInfo info, IReadBuffer buffer, int dimensionCount
                             )
 {
     int[] dim = new int[dimensionCount];
     for (int i = 0; i < dim.Length; i++)
     {
         dim[i] = buffer.ReadInt();
     }
     ((MultidimensionalArrayInfo)info).Dimensions(dim);
     info.ElementCount(ElementCount(dim));
 }
        }               // public FileInfo GetFirstFileInfo

        /// <summary>
        /// Unless the list is empty, return the oldest file in it, which is the
        /// last file in the list, since it is reverse sorted by LastWriteTime.
        /// </summary>
        /// <returns>
        /// The returned FileInfo object represents the oldest file in the list,
        /// which occupies its last slot, since the list is sorted in reverse
        /// order by LastWriteTimeUTC.
        /// </returns>
        public FileInfo GetLastFileInfo( )
        {
            if (_lstMatchingFiles.Count > ListInfo.LIST_IS_EMPTY)
            {           // Unless the list is empty, there must be a "first" item to return.
                return(_lstMatchingFiles [ArrayInfo.OrdinalFromIndex(_lstMatchingFiles.Count)].Details);
            }           // TRUE (anticipated outcome) block, if ( _lstMatchingFiles.Count > ListInfo.LIST_IS_EMPTY )
            else
            {           // Since FileInfo is a nullable type, the degenerate case returns a null reference.
                return(null);
            }           // FALSE (unanticipated outcome) block, if ( _lstMatchingFiles.Count > ListInfo.LIST_IS_EMPTY )
        }               // public FileInfo GetLastFileInfo
Example #27
0
        protected virtual bool HandleAsByteArray(IBufferContext context)
        {
            int       offset = context.Offset();
            ArrayInfo info   = NewArrayInfo();

            ReadInfo(context.Transaction(), context, info);
            bool isByteArray = context.Transaction().Reflector().ForClass(typeof(byte)).Equals
                                   (info.ReflectClass());

            context.Seek(offset);
            return(isByteArray);
        }
Example #28
0
 protected override void ReadElements(IReadContext context, ArrayInfo info, object
                                      array)
 {
     if (array == null)
     {
         return;
     }
     object[] objects = new object[info.ElementCount()];
     ReadInto(context, info, objects);
     ArrayReflector(Container(context)).Shape(objects, 0, array, ((MultidimensionalArrayInfo
                                                                   )info).Dimensions(), 0);
 }
Example #29
0
        protected virtual object ReadCreate(Transaction trans, IReadBuffer buffer, ArrayInfo
                                            info)
        {
            ReadInfo(trans, buffer, info);
            IReflectClass clazz = NewInstanceReflectClass(trans.Reflector(), info);

            if (clazz == null)
            {
                return(null);
            }
            return(NewInstance(ArrayReflector(Container(trans)), info, clazz));
        }
Example #30
0
        public ObjectArrayTable(Database.Schema schema, SnapshotObjectDataFormatter formatter, CachedSnapshot snapshot, ManagedData crawledData, ObjectData arrayData, ObjectMetaType metaType)
            : base(schema, formatter, snapshot, crawledData, metaType)
        {
            this.arrayData = arrayData;

            if (arrayData.isManaged)
            {
                arrayInfo = ArrayTools.GetArrayInfo(snapshot, arrayData.managedObjectData, arrayData.managedTypeIndex);
            }

            InitObjectList();
        }
Example #31
0
        }   // public static char LastCharacterOfString


        /// <summary>
        /// Returns the character at the Nth position in a string.
        /// </summary>
        /// <param name="pstrIn">
        /// Specify the string from which to return the last character.
        /// </param>
        /// <param name="pintOrdinalPosition">
        /// Specify the ordinal position of the desired character. Unlike array
        /// subscripts, which start at zero, ordinals start at one.
        /// </param>
        /// <returns>
        /// Unless the input string is empty (or null), or pintOrdinalPosition
        /// is less than 1 or greater than the length of the string, the return
        /// value is the character at the specified (Nth) position.
        /// 
        /// If the function cannot return the requested character, the return
        /// value is SpecialCharacters.NUL, the null character.
        /// </returns>
        public static char NthCharacterOfString (
            string pstrIn ,
            int pintOrdinalPosition )
        {
            if ( string.IsNullOrEmpty ( pstrIn ) )
                return SpecialCharacters.NULL_CHAR;
            else
                if ( pintOrdinalPosition <= ArrayInfo.ARRAY_FIRST_ELEMENT || pintOrdinalPosition > pstrIn.Length )
                    return SpecialCharacters.NULL_CHAR;
                else
                    return pstrIn [ ArrayInfo.IndexFromOrdinal ( pintOrdinalPosition ) ];
        }   // public static char NthCharacterOfString
Example #32
0
 public override object NewInstance(IReflectClass componentType, ArrayInfo info)
 {
     Type type = GetNetType(componentType);
     if (info.Nullable())
     {
         type = NullableType(type);
     }
     MultidimensionalArrayInfo multiDimensionalInfo = info as MultidimensionalArrayInfo;
     if (multiDimensionalInfo == null)
     {
         return System.Array.CreateInstance(type, info.ElementCount());
     }
     int[] dimensions = multiDimensionalInfo.Dimensions();
     if (dimensions.Length == 1)
     {
         return UnfoldArrayCreation(type, dimensions, 0);
     }
     return UnfoldArrayCreation(GetArrayType(type, dimensions.Length - 1), dimensions, 0);
 }
Example #33
0
 public virtual void Analyze(object obj, ArrayInfo info)
 {
     _delegate.Analyze(obj, info);
 }
Example #34
0
		byte[] DecryptArray(ArrayInfo aryInfo) {
			var ary = new byte[aryInfo.arySize * aryInfo.arrayType.ElementType.GetPrimitiveSize()];
			int dataIndex = aryInfo.index;
			int len = DeobUtils.ReadVariableLengthInt32(constantsData, ref dataIndex);
			Buffer.BlockCopy(constantsData, dataIndex, ary, 0, len);
			return ary;
		}
Example #35
0
 public virtual void Analyze(object obj, ArrayInfo info)
 {
 }
Example #36
0
 public abstract void Analyze(object arg1, ArrayInfo arg2);
Example #37
0
 public abstract object NewInstance(IReflectClass arg1, ArrayInfo arg2);
			public bool Initialize() {
				if (!FindMagic(Method, out arg1, out arg2, out magic))
					return false;

				fields = GetFields(Method);
				if (fields == null)
					return false;

				arrayInfo = GetArrayInfo(cctor);
				if (arrayInfo == null)
					return false;

				if (arrayInfo.initField.InitialValue.Length % 2 == 1)
					return false;
				encryptedData = new ushort[arrayInfo.initField.InitialValue.Length / 2];
				Buffer.BlockCopy(arrayInfo.initField.InitialValue, 0, encryptedData, 0, arrayInfo.initField.InitialValue.Length);

				decryptType = GetDecryptType(Method);
				keyShift = FindKeyShift(cctor);
				key = FindKey();
				if (key == null || key.Length == 0)
					return false;

				return true;
			}
Example #39
0
 public virtual object NewInstance(IReflectClass componentType, ArrayInfo info)
 {
     // TODO: implement multidimensional arrays.
     var length = info.ElementCount();
     return NewInstance(componentType, length);
 }
Example #40
0
		public ArraySizeAttribute(int size) {
			this.size = size;
			this.info = ArrayInfo.FixedSize;
		}
Example #41
0
		public ArraySizeAttribute(string sizeFunction) {
			this.getSize = sizeFunction;
			this.info = ArrayInfo.AnotherMemberGivesSize;
		}
Example #42
0
		// This is for saying the array length is determined somehow
		public ArraySizeAttribute(ArrayProperty prop) {
			this.info = (ArrayInfo)Enum.Parse(typeof(ArrayInfo), prop.ToString());
		}
Example #43
0
            public bool initialize()
            {
                if (!findMagic(Method, out arg1, out arg2, out magic))
                    return false;

                fields = getFields(Method);
                if (fields == null)
                    return false;

                arrayInfo = getArrayInfo(cctor);
                if (arrayInfo == null)
                    return false;

                if (arrayInfo.initField.InitialValue.Length % 2 == 1)
                    return false;
                encryptedData = new ushort[arrayInfo.initField.InitialValue.Length / 2];
                Buffer.BlockCopy(arrayInfo.initField.InitialValue, 0, encryptedData, 0, arrayInfo.initField.InitialValue.Length);

                isTrial = !DeobUtils.hasInteger(Method, 0xFFF0);
                keyShift = findKeyShift(cctor);
                key = findKey();
                if (key == null || key.Length == 0)
                    return false;

                return true;
            }
Example #44
0
 public override void Analyze(object obj, ArrayInfo info)
 {
     info.Nullable(IsNullableType(obj.GetType()));
 }