public void Serialize(Stream output, Endian endian, IStringTable stringTable)
 {
     output.WriteValueU32(stringTable.Put(this.Name));
     output.WriteValueU32(this.Size, endian);
     output.WriteValueU32(this.Flags, endian);
     output.WriteValueU32(this.Unknown0C, endian);
 }
Example #2
0
 internal SymbolTable(SectionHeader header, Func <EndianBinaryReader> readerSource, IStringTable table, ELF <T> elf)
     : base(header, readerSource)
 {
     this.table = table;
     this.elf   = elf;
     ReadSymbols();
 }
Example #3
0
 public LocalizedTypeDescriptor(Type type, ICustomTypeDescriptor parent)
     : base(parent)
 {
     baseProperties  = parent.GetProperties();
     typeStringTable = LocalizationProvider.Default.GetTypeDescriptionStringTable(type);
     this.type       = type;
 }
        public void Deserialize(Stream input, Endian endian, IStringTable stringTable)
        {
            var nameIndex = input.ReadValueU32(endian);

            this.Name = stringTable.Get(nameIndex);

            uint fileCount      = input.ReadValueU32(endian);
            uint directoryCount = input.ReadValueU32(endian);
            uint unknown        = input.ReadValueU32(endian);

            if (unknown != 0)
            {
                throw new InvalidOperationException();
            }

            this.Directories.Clear();
            for (uint i = 0; i < directoryCount; i++)
            {
                var dir = new DirectoryEntry(this);
                dir.Deserialize(input, endian, stringTable);
                this.Directories.Add(dir);
            }

            this.Files.Clear();
            for (uint i = 0; i < fileCount; i++)
            {
                var file = new FileEntry(this);
                file.Deserialize(input, endian, stringTable);
                this.Files.Add(file);
            }
        }
Example #5
0
 // TODO: make elf consts file with things like SHT_LOUSER
 internal SectionHeader(EndianBinaryReader reader, Class elfClass, IStringTable table = null)
 {
     this.reader   = reader;
     this.table    = table;
     this.elfClass = elfClass;
     ReadSectionHeader();
 }
Example #6
0
        // TODO: make elf consts file with things like SHT_LOUSER
        internal SectionHeader(EndianBinaryReader reader, Class elfClass, IStringTable table = null)
        {
            this.reader = reader;
            this.table = table;
			this.elfClass = elfClass;
            ReadSectionHeader();
        }
 // TODO: make elf consts file with things like SHT_LOUSER
 internal SectionHeader(SimpleEndianessAwareReader reader, Class elfClass, IStringTable table = null)
 {
     this.reader   = reader;
     this.table    = table;
     this.elfClass = elfClass;
     ReadSectionHeader();
 }
Example #8
0
 public LocalizedPropertyDescriptor(PropertyDescriptor actual, IStringTable typeStringTable)
     : base(actual)
 {
     this.actual          = actual;
     this.typeStringTable = typeStringTable;
     category             = typeStringTable[actual.Category + "$Category"] ?? actual.Category;
     description          = typeStringTable[actual.Description + "$Description"] ?? actual.Description;
     displayName          = typeStringTable[actual.DisplayName + "$Name"] ?? actual.DisplayName;
 }
        private void SetSiteTitleFromStringTable(string?currentPath, IStringTable stringTable)
        {
            var siteTitle = stringTable.GetItem(SiteTitleStringTableVariableName);

            if (string.IsNullOrEmpty(siteTitle))
            {
                return;
            }

            if (string.IsNullOrEmpty(currentPath) || currentPath == "/" || currentPath !.StartsWith("/?") || !_dataCollector.IsDataExist(_dataCollector.TitleVariableName))
            {
                _dataCollector.Add(_dataCollector.TitleVariableName, siteTitle);
            }
        public void Serialize(Stream output, Endian endian, IStringTable stringTable)
        {
            output.WriteValueU32(stringTable.Put(this.Name), endian);
            output.WriteValueS32(this.Files.Count, endian);
            output.WriteValueS32(this.Directories.Count, endian);
            output.WriteValueS32(0, endian);

            foreach (var dir in this.Directories)
            {
                dir.Serialize(output, endian, stringTable);
            }

            foreach (var file in this.Files)
            {
                file.Serialize(output, endian, stringTable);
            }
        }
Example #11
0
        public void Deserialize(Stream input, Endian endian, IStringTable stringTable)
        {
            var nameIndex = input.ReadValueU32(endian);

            this.Name = stringTable.Get(nameIndex);

            this.Size      = input.ReadValueU32(endian);
            this.Flags     = input.ReadValueU32(endian);
            this.Unknown0C = input.ReadValueU32(endian);

            if (this.OffsetCount != 1)
            {
                throw new FormatException();
            }

            if (this.Unknown0C != 0)
            {
                throw new FormatException();
            }
        }
Example #12
0
 /// <summary>
 /// Constructs a new instance of DecoderFactory.
 /// </summary>
 /// <param name="stringTable">The IStringTable implementation to construct the decoder with.</param>
 public DecoderFactory(IStringTable stringTable)
 {
     this.stringTable = stringTable;
 }
Example #13
0
 internal SymbolTable(SectionHeader header, SimpleEndianessAwareReader Reader, IStringTable table, ELF <T> elf) : base(header, Reader)
 {
     this.table = table;
     this.elf   = elf;
     ReadSymbols();
 }
Example #14
0
 public ListsGenerator(IStringTable stringTable)
 {
     _stringTable = stringTable;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StringTableItemsSetter"/> class.
 /// </summary>
 /// <param name="dataCollector">The data collector.</param>
 /// <param name="stringTable">The string table.</param>
 public StringTableItemsSetter(IDataCollector dataCollector, IStringTable stringTable)
 {
     _dataCollector = dataCollector;
     _stringTable   = stringTable;
 }
Example #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataCollector"/> class.
 /// </summary>
 /// <param name="mainContentVariableName">Name of the main content variable.</param>
 /// <param name="titleVariableName">Name of the title variable.</param>
 /// <param name="stringTable">The string table.</param>
 public DataCollector(string mainContentVariableName, string titleVariableName, IStringTable stringTable)
 {
     _mainContentVariableName = mainContentVariableName;
     TitleVariableName        = titleVariableName;
     _stringTable             = stringTable;
 }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageBoxHandler"/> class.
 /// </summary>
 /// <param name="templateFactory">The template factory.</param>
 /// <param name="stringTable">The string table.</param>
 /// <param name="dataCollector">The data collector.</param>
 public MessageBoxHandler(ITemplateFactory templateFactory, IStringTable stringTable, IDataCollector dataCollector)
 {
     _templateFactory = templateFactory;
     _stringTable     = stringTable;
     _dataCollector   = dataCollector;
 }
Example #18
0
 public void IsFullShouldReturnTrueWhenTableIsFull()
 {
     target = CreateTarget(256);
     Assert.IsTrue(target.IsFull);
 }
Example #19
0
 /// <summary>
 /// Constructs a new LzwDecoder instance with the given input, output and string table instances.
 /// </summary>
 /// <param name="input">An IDecoderInput implementation to read codes from.</param>
 /// <param name="output">An IDecoderOutput implementation to write strings to.</param>
 /// <param name="stringTable">An IStringTable implementation to translate read codes into strings.</param>
 public LzwDecoder(IDecoderInput input, IDecoderOutput output, IStringTable stringTable)
 {
     this.input = input;
     this.output = output;
     this.stringTable = stringTable;
 }
 public LocalizerWithCollector()
 {
     new LocalizedStringService();
         gStringTable = (AppDomain.CurrentDomain.GetData("LocalizedStringService") as IStringTable);
 }
Example #21
0
 public void IsFullShouldReturnFalseWhenTableIsNotFull()
 {
     target = CreateTarget(257);
     Assert.IsFalse(target.IsFull);
 }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageBox"/> class.
 /// </summary>
 /// <param name="templateFactory">The template factory.</param>
 /// <param name="stringTable">The string table.</param>
 /// <param name="dataCollector">The data collector.</param>
 public MessageBox(ITemplateFactory templateFactory, IStringTable stringTable, IDataCollector dataCollector)
 {
     _templateFactory = templateFactory;
     _stringTable = stringTable;
     _dataCollector = dataCollector;
 }
Example #23
0
		/// <summary>
		/// Initializes a new instance of the <see cref="DataCollector"/> class.
		/// </summary>
		/// <param name="mainContentVariableName">Name of the main content variable.</param>
		/// <param name="titleVariableName">Name of the title variable.</param>
		/// <param name="stringTable">The string table.</param>
		public DataCollector(string mainContentVariableName, string titleVariableName, IStringTable stringTable)
		{
			_mainContentVariableName = mainContentVariableName;
			TitleVariableName = titleVariableName;
			_stringTable = stringTable;
		}
        private void SetSiteTitleFromStringTable(string currentPath, IStringTable stringTable)
        {
            var siteTitle = stringTable.GetItem(SiteTitleStringTableVariableName);

            if (string.IsNullOrEmpty(siteTitle))
                return;

            if (string.IsNullOrEmpty(currentPath) || currentPath == "/" || currentPath.StartsWith("/?") || !_dataCollector.IsDataExist(_dataCollector.TitleVariableName))
                _dataCollector.Add(_dataCollector.TitleVariableName, siteTitle);
            else
                _dataCollector.Add(_dataCollector.TitleVariableName, " - " + siteTitle);
        }
 private void CreateTableFromJSON(string i_tableJSON)
 {
     mTable = new StringTable(i_tableJSON);
 }
Example #26
0
 public void SetUp()
 {
     target = CreateTarget(258);
 }
 public LocalizerWithCollector()
 {
     new LocalizedStringService();
     gStringTable = (AppDomain.CurrentDomain.GetData("LocalizedStringService") as IStringTable);
 }
Example #28
0
 public QuizletImporter()
     : this(null) {
     cts         = new CancellationTokenSource();
     stringTable = LocalizationProvider.Default.GetStringTable("Quizlet");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StringTableItemsSetter"/> class.
 /// </summary>
 /// <param name="dataCollector">The data collector.</param>
 /// <param name="stringTable">The string table.</param>
 public StringTableItemsSetter(IDataCollector dataCollector, IStringTable stringTable)
 {
     _dataCollector = dataCollector;
     _stringTable = stringTable;
 }
Example #30
0
 public LocalizedTypeDescriptor(Type type)
 {
     baseProperties  = TypeDescriptor.GetProvider(typeof(Object)).GetTypeDescriptor(type).GetProperties();
     typeStringTable = LocalizationProvider.Default.GetTypeDescriptionStringTable(type);
     this.type       = type;
 }