Example #1
0
 public LocalizationEntry(ClientLocalizationLanguage lng, int index, long offset, long length)
 {
     Language = lng;
     Index    = index;
     Offset   = offset;
     Length   = length;
 }
Example #2
0
 public LocalizationEntry(ClientLocalizationLanguage lng, int index, long offset, long length)
 {
     Language = lng;
     Index = index;
     Offset = offset;
     Length = length;
 }
Example #3
0
        public string GetRawString(ClientLocalizationLanguage lng, int index)
        {
            if (_tables.ContainsKey(lng) && _tables[lng] != null && !_tables[lng].IsNullOrEmpty(index))
            {
                return(_tables[lng][index].Text);
            }

            return(String.Empty);
        }
Example #4
0
        public ClilocInfo GetCliloc(ClientLocalizationLanguage lng, int index)
        {
            if (_tables.ContainsKey(lng) && _tables[lng] != null)
            {
                return(_tables[lng].Lookup(index));
            }

            return(null);
        }
Example #5
0
        public Task <T> GetClilocAsync <T>(ClientLocalizationLanguage lng, int index)
        {
            return(Task.Run(async() =>
            {
                var adapter = await GetAdapterAsync <IClilocStorageAdapter <T> >().ConfigureAwait(false);

                return await adapter.GetClilocAsync(lng, index).ConfigureAwait(false);
            }));
        }
Example #6
0
        public string GetString(ClientLocalizationLanguage lng, int index, params string[] args)
        {
            ClilocInfo info = GetCliloc(lng, index);

            if (info == null)
            {
                return(String.Empty);
            }

            return(info.ToString(args));
        }
Example #7
0
        public string GetString(ClientLocalizationLanguage lng, int index, string args)
        {
            var info = GetCliloc(lng, index);

            if (info == null)
            {
                return(Empty);
            }

            return(info.ToString(args));
        }
Example #8
0
        public void Load(FileInfo file)
        {
            if (Loaded)
            {
                return;
            }

            try
            {
                ClientLocalizationLanguage lng = ClientLocalizationLanguage.NULL;

                if (!Enum.TryParse(file.Extension.TrimStart('.'), true, out lng))
                {
                    throw new FileLoadException("Could not detect language for: " + file.FullName);
                }

                Language  = lng;
                InputFile = file;

                using (BinaryReader reader = new BinaryReader(InputFile.OpenRead(), Encoding.UTF8))
                {
                    long size = reader.BaseStream.Seek(0, SeekOrigin.End);
                    reader.BaseStream.Seek(0, SeekOrigin.Begin);

                    reader.ReadInt32();
                    reader.ReadInt16();

                    while (reader.BaseStream.Position < size)
                    {
                        int index = reader.ReadInt32();
                        reader.ReadByte();
                        int  length = reader.ReadInt16();
                        long offset = reader.BaseStream.Position;
                        reader.BaseStream.Seek(length, SeekOrigin.Current);

                        if (_table.ContainsKey(index))
                        {
                            _table[index] = new LocalizationEntry(Language, index, offset, length);
                        }
                        else
                        {
                            _table.Add(index, new LocalizationEntry(Language, index, offset, length));
                        }
                    }
                }

                Loaded = true;
            }
            catch (Exception e)
            {
                Tracer.Error(e);
            }
        }
Example #9
0
 public ClilocInfo(ClientLocalizationLanguage lng, int index, string text)
 {
     Language = lng;
     Index = index;
     Text = text;
 }
Example #10
0
 public T GetCliloc <T>(ClientLocalizationLanguage lng, int index)
 {
     return(GetAdapter <IClilocStorageAdapter <T> >().GetCliloc(lng, index));
 }
Example #11
0
 public ClilocInfo(ClientLocalizationLanguage lng, int index, string text)
 {
     Language = lng;
     Index    = index;
     Text     = text;
 }
Example #12
0
 public Task <ClilocInfo> GetClilocAsync(ClientLocalizationLanguage lng, int index)
 {
     return(Task.FromResult(GetCliloc(lng, index)));
 }