Esempio n. 1
0
 private Language GetLanguage()
 {
     if (File != null)
     {
         return(LotdFile.GetLanguageFromFileName(File.Name));
     }
     else if (ZibFile != null)
     {
         return(LotdFile.GetLanguageFromFileName(ZibFile.FileName));
     }
     return(Language.Unknown);
 }
Esempio n. 2
0
        public ZibFile GetLocalizedFile(Language language)
        {
            if (LotdFile.GetLanguageFromFileName(FileName) == language)
            {
                return(this);
            }

            string fileName = LotdFile.GetFileNameWithLanguage(FileName, language);

            if (!string.IsNullOrEmpty(fileName))
            {
                ZibFile file;
                Owner.Files.TryGetValue(fileName, out file);
                return(file);
            }

            return(null);
        }
Esempio n. 3
0
        public FileData LoadData(bool cache)
        {
            FileData fileData = LotdFile.CreateFileData(LotdFile.GetFileTypeFromExtension(FileName, Extension));

            if (IsFileOnDisk)
            {
                if (!File.Exists(FilePathOnDisk))
                {
                    return(null);
                }
                fileData.Load(FilePathOnDisk);
                return(fileData);
            }
            else if (Owner != null && Owner.File != null && Offset > 0 && Length > 0)
            {
                fileData.ZibFile = this;
                Owner.File.Archive.Reader.BaseStream.Position = Owner.File.ArchiveOffset + Offset;
                fileData.Load(Owner.File.Archive.Reader, Length);
                return(fileData);
            }

            return(null);
        }