Example #1
0
        /// <summary>
        /// Opens and return <see cref="Archive"/> of <paramref name="file"/>.
        /// </summary>
        /// <param name="file">Archive file to open.</param>
        /// <param name="owner">Used with <see cref="MessageBox.Show(IWin32Window, string)"/>.</param>
        public static Archive OpenArchive(string file, IWin32Window owner = null)
        {
            Archive archive;

            try
            {
                string   extension = Path.GetExtension(file);
                Encoding encoding  = Encoding.GetEncoding(Settings.Default.EncodingCodePage);

                // ToDo: Read file header to find archive type, not just extension
                switch (extension.ToLower())
                {
                case ".bsa":
                case ".dat":
                    if (BSA.IsSupportedVersion(file, encoding) == false)
                    {
                        if (Common.ShowMessageBoxInvoke(owner,
                                                        "Archive has an unknown version number.\n" + "Attempt to open anyway?",
                                                        "Warning",
                                                        MessageBoxButtons.YesNo) != DialogResult.Yes)
                        {
                            return(null);
                        }
                    }

                    archive = new BSA(file, encoding, Settings.Default.RetrieveRealSize)
                    {
                        MatchLastWriteTime = Settings.Default.MatchLastWriteTime
                    };
                    break;

                case ".ba2":
                    archive = new BA2(file, encoding, Settings.Default.RetrieveRealSize)
                    {
                        MatchLastWriteTime = Settings.Default.MatchLastWriteTime
                    };

                    if (archive.Type == ArchiveTypes.BA2_GNMF)
                    {
                        // Check if extensions for GNF textures should be replaced
                        Common.ReplaceGNFExtensions(archive.Files.OfType <BA2GNFEntry>(), Settings.Default.ReplaceGNFExt);
                    }
                    break;

                default:
                    throw new Exception($"Unrecognized archive file type ({extension}).");
                }
            }
            catch (Exception ex)
            {
                Common.ShowMessageBoxInvoke(owner,
                                            "An error occured trying to open the archive. Changing the Encoding in Options can help, please try before reporting.\n\n" + ex.ToStringInvariant(),
                                            "Error",
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                return(null);
            }

            return(archive);
        }
Example #2
0
    public void BA2b()
    {
        Question.GetComponent <Text>().text += "\n\nФин: " + BA2.GetComponentInChildren <Text>().text;
        Question.GetComponent <Text>().text += "\n\n*Во взгляде путника сразу видно разочарование и он терят к вам какой-то бы ни было интерес.*";

        BA2.gameObject.SetActive(false);
        SA1.gameObject.SetActive(false);
        EA1.gameObject.SetActive(true);


        EA1.GetComponentInChildren <Text>().text = "Конец диалога.";
    }
Example #3
0
    public void BA7b()
    {
        Question.GetComponent <Text>().text += "\n\nФин: " + BA7.GetComponentInChildren <Text>().text;
        Question.GetComponent <Text>().text += "\n\nПутник: Вам бы поучиться манерам, молодой человек.";

        BA7.gameObject.SetActive(false);
        NA4.gameObject.SetActive(false);
        BA2.gameObject.SetActive(true);
        SA1.gameObject.SetActive(true);


        BA2.GetComponentInChildren <Text>().text = "Ты мне мозги не трепи, старик!";
        SA1.GetComponentInChildren <Text>().text = "Извини, у меня украли дочь, поэтому я на взводе.";
    }
Example #4
0
        public void 透明拦截()
        {
            BA2 __IA = H容器.透明拦截(new BA2());

            __IA.E1 += Console.WriteLine;
            Console.WriteLine(__IA.P1);
            __IA.P1 = 1;
            Console.WriteLine(__IA.P1);
            __IA.M1();
            __IA.M2(1, "A");
            string __arg1;
            string __arg2 = "2";

            Console.WriteLine(__IA.M3(new DTO {
                P1 = 2, P2 = "S"
            }, out __arg1, ref __arg2));
            __IA.OnE1(new DTO {
                P1 = 3, P2 = "SS"
            });
        }