Example #1
0
 private FileSystemEntry ConvertEntry(FPS4.Entry Entry)
 {
     return(new FileSystemEntry(this, Entry.Name)
     {
         Size = Entry.EntryStruct.LengthReal,
         Type = FileSystemEntry.EntryType.File,
     });
 }
Example #2
0
        protected void HandleEntry(Regex SelectAll, Func <String, String, String> ReplaceSuffixName, FPS4.Entry EnglishEntry)
        {
            //Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
            using (EnglishEntry)
            {
                //Console.WriteLine("[1]");
                var BaseName    = SelectAll.Match(EnglishEntry.Name).Groups[1].Value;
                var SpanishName = ReplaceSuffixName(EnglishEntry.Name, "ES");
                Console.WriteLine("{0} : {1}", SpanishName, Thread.CurrentThread.ManagedThreadId);

                var ACMEFiles = ACME1.FilesByIndex.Where(Item => Item.Name.Contains(BaseName));
                if (ACMEFiles.Count() == 1)
                {
                    //Console.WriteLine("[2]");

                    var EsTempFile = TestOutputFolder + @"\" + SpanishName;

#if REUSE_PAK
                    if (!File.Exists(EsTempFile))
#endif
                    {
                        using (var CompressedSkitPAKStream = File.Open(EsTempFile, FileMode.Create))
                        {
                            //Console.WriteLine("[3]");
                            var ACMEFile = ACMEFiles.ElementAt(0);
                            //Console.WriteLine(SpanishName);
                            using (var SkitPAK = new FPS4(TalesCompression.DecompressStream(EnglishEntry.Open())))
                                using (var chtx = new TO8CHTX(SkitPAK[3].Open()))
                                {
                                    //Console.WriteLine("[4]");
                                    try
                                    {
                                        chtx.TranslateWithAcmeFile(ACMEFile);
                                    }
                                    catch (Exception Exception)
                                    {
                                        Console.Error.WriteLine(Exception);
                                        Console.ReadKey();
                                    }

                                    //Console.WriteLine("[5]");
                                    using (var NewChtxStream = new MemoryStream())
                                        using (var SkitPAKStream = new MemoryStream())
                                        {
                                            chtx.Save(NewChtxStream);
                                            SkitPAK[3].SetStream(NewChtxStream);

                                            //Console.WriteLine("[6]");
                                            SkitPAK.Save(SkitPAKStream);

                                            TalesCompression.EncodeFile(SkitPAKStream, CompressedSkitPAKStream);
                                        }
                                }
                        }
                    }
                    var SpanishEntry = PAK.CreateEntry(SpanishName, File.Open(EsTempFile, FileMode.Open));
                }
                else
                {
                    Console.WriteLine("WARNING. Untranslated Skit: ACMEFiles.Count() : {0} : {1}", ACMEFiles.Count(), BaseName);
                    var SpanishEntry = PAK.CreateEntry(SpanishName, EnglishEntry.Open());
                }
            }
        }