public void SetLayoutDirectionTest() { // Arrange ResTable_config c = new ResTable_config(); // Act c.ScreenConfigLayoutDirection = ConfigScreenLayoutDirection.LAYOUTDIR_RTL; // Assert Assert.Equal(0x80, c.ScreenConfigScreenLayout); }
public virtual void Write(ResTable_config data) { _writer.Write(data.Size); _writer.Write(data.IMSI); _writer.Write(data.Locale); _writer.Write(data.ScreenType); _writer.Write(data.Input); _writer.Write(data.ScreenSize); _writer.Write(data.Version); _writer.Write(data.ScreenConfig); _writer.Write(data.ScreenSizeDp); }
public void GetLayoutDirectionTest() { // Arrange ResTable_config c = new ResTable_config(); c.ScreenConfigScreenLayout = 0x80; // Act var value = c.ScreenConfigLayoutDirection; // Assert Assert.Equal(ConfigScreenLayoutDirection.LAYOUTDIR_RTL, value); }
public virtual void Write(ResTable_config data) { _writer.Write(data.Size); _writer.Write(data.IMSI_MCC); _writer.Write(data.IMSI_MNC); _writer.Write(Encoding.ASCII.GetBytes(data.LocaleLanguage)); _writer.Write(Encoding.ASCII.GetBytes(data.LocaleCountry)); _writer.Write((byte)data.ScreenTypeOrientation); _writer.Write((byte)data.ScreenTypeTouchscreen); _writer.Write((ushort)data.ScreenTypeDensity); _writer.Write((byte)data.InputKeyboard); _writer.Write((byte)data.InputNavigation); _writer.Write(data.InputFlags); _writer.Write(data.Input_Pad0); _writer.Write(data.ScreenSizeWidth); _writer.Write(data.ScreenSizeHeight); _writer.Write(data.VersionSdk); _writer.Write(data.VersionMinor); _writer.Write(data.ScreenConfigScreenLayout); _writer.Write(data.ScreenConfigUIMode); _writer.Write(data.ScreenConfigSmallestScreenWidthDp); _writer.Write(Encoding.ASCII.GetBytes(data.LocaleScript)); _writer.Write(Encoding.ASCII.GetBytes(data.LocaleVariant)); _writer.Write(data.ScreenLayout2); _writer.Write(data.ScreenConfigPad1); _writer.Write(data.ScreenConfigPad2); }
public virtual ResTable_config ReadResTable_config(uint size) { // There are different versions of this table, each differing in length. // Depending on the size, we should not read all data. var value = new ResTable_config { Size = ReadUInt32(), IMSI_MCC = ReadUInt16(), IMSI_MNC = ReadUInt16(), LocaleLanguage = new[] { (char)ReadByte(), (char)ReadByte() }, LocaleCountry = new[] { (char)ReadByte(), (char)ReadByte() }, ScreenTypeOrientation = (ConfigOrientation)ReadByte(), ScreenTypeTouchscreen = (ConfigTouchscreen)ReadByte(), ScreenTypeDensity = (ConfigDensity)ReadUInt16(), InputKeyboard = (ConfigKeyboard)ReadByte(), InputNavigation = (ConfigNavigation)ReadByte(), InputFlags = ReadByte(), Input_Pad0 = ReadByte(), ScreenSizeWidth = ReadUInt16(), ScreenSizeHeight = ReadUInt16(), VersionSdk = ReadUInt16(), VersionMinor = ReadUInt16() }; // Read 7 uints, which is 7 * 4 = 28 bytes worth of data. This is // also the minimal size of this table; so really old file formats // will stop reading here (i.e. they don't have values for ScreenConfig // and ScreenSizeDp) if (size <= 28) { return(value); } value.ScreenConfigScreenLayout = ReadByte(); value.ScreenConfigUIMode = ReadByte(); value.ScreenConfigSmallestScreenWidthDp = ReadUInt16(); // The screen size was another addition, so not all files may // have this value if (size <= 32) { return(value); } value.ScreenSizeDpWidth = ReadUInt16(); value.ScreenSizeDpHeight = ReadUInt16(); if (size <= 36) { return(value); } value.LocaleScript = Encoding.ASCII.GetString(ReadBytes(4)).ToCharArray(); value.LocaleVariant = Encoding.ASCII.GetString(ReadBytes(8)).ToCharArray(); if (size <= 48) { return(value); } value.ScreenLayout2 = ReadByte(); value.ScreenConfigPad1 = ReadByte(); value.ScreenConfigPad2 = ReadUInt16(); if (size > 52) { // New fields have been added that we don't know about; // padding. ReadBytes((int)size - 52); } return(value); }