Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sb"></param>
 public void SetSSM(SSM sb)
 {
     _ssm = sb;
     mxListBox1.DataSource = sb.Sounds;
     tbSSMName.DataBindings.Clear();
     tbSSMName.DataBindings.Add("Text", _ssm, "Name");
 }
Пример #2
0
        public SettingsManager()
        {
            _programSettingsPath = Path.Combine(ProgramManager.GetConfigPath(), _programSettingsFileName);
            _ssmFile             = new SSM_File(_programSettingsPath, SSM_File.Mode.SQLite);
            _ssm = new SSM(_ssmFile);

            InitSSM();
            UpdateSSM();
        }
Пример #3
0
        public virtual string GetDataRow()
        {
            return(String.Join(",", new[]
            {
                FullTimeMode?Time.ToString() : Time.TotalSeconds.ToString(CultureInfo.InvariantCulture),
                    TRT.ToString(),
                    RPM.ToString(),
                    RPM40.ToString(),
                    RPM_GBC_RT.ToString(),
                    UFRXX.ToString(),
                    SSM.ToString(),
                    TWAT.ToString(),
                    TAIR.ToString(),
                    ALF.ToString("0.#", CultureInfo.InvariantCulture),
                    AFR.ToString("0.#", CultureInfo.InvariantCulture),
                    LC1_ALF.ToString("0.###", CultureInfo.InvariantCulture),
                    LC1_AFR.ToString("0.#", CultureInfo.InvariantCulture),
                    COEFF.ToString("0.###", CultureInfo.InvariantCulture),
                    DGTC_RICH.ToString("0.###", CultureInfo.InvariantCulture),
                    DGTC_LEAN.ToString("0.###", CultureInfo.InvariantCulture),
                    UOZ.ToString("0.#", CultureInfo.InvariantCulture),
                    KUOZ1.ToString("0.#", CultureInfo.InvariantCulture),
                    KUOZ2.ToString("0.#", CultureInfo.InvariantCulture),
                    KUOZ3.ToString("0.#", CultureInfo.InvariantCulture),
                    KUOZ4.ToString("0.#", CultureInfo.InvariantCulture),
                    Faza.ToString(),
                    INJ.ToString("0.###", CultureInfo.InvariantCulture),
                    FUSE.ToString("0.#", CultureInfo.InvariantCulture),
                    AIR.ToString("0.#", CultureInfo.InvariantCulture),
                    GBC.ToString("0.##", CultureInfo.InvariantCulture),
                    SPD.ToString(),
                    ADCKNOCK.ToString("0.###", CultureInfo.InvariantCulture),
                    ADCMAF.ToString("0.###", CultureInfo.InvariantCulture),
                    ADCTWAT.ToString("0.###", CultureInfo.InvariantCulture),
                    ADCTAIR.ToString("0.###", CultureInfo.InvariantCulture),
                    ADCTPS.ToString("0.###", CultureInfo.InvariantCulture),
                    ADCUBAT.ToString("0.###", CultureInfo.InvariantCulture),
                    ADCLAM.ToString("0.###", CultureInfo.InvariantCulture),
                    ErrorCount.ToString(),
                    fSTOP ? "1" : "0",
                    fXX ? "1" : "0",
                    fXXPrev ? "1" : "0",
                    fXXFix ? "1" : "0",
                    fPOW ? "1" : "0",
                    fFUELOFF ? "1" : "0",
                    fDETZONE ? "1" : "0",
                    fDET ? "1" : "0",
                    fADS ? "1" : "0",
                    fLAMREG ? "1" : "0",
                    fLAM ? "1" : "0",
                    fLEARN ? "1" : "0",
                    fLAMRDY ? "1" : "0",
                    fLAMHEAT ? "1" : "0"
            }

                               ));
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath"></param>
        private void Save(string filePath)
        {
            FilePath = filePath;

            var ssm = new SSM();

            ssm.StartIndex = StartIndex;
            ssm.Sounds     = Sounds.ToArray();
            ssm.Save(filePath);
        }
Пример #5
0
        /// <summary>
        /// Melee's sound format
        /// </summary>
        /// <param name="filePath"></param>
        private void OpenSSM(string filePath)
        {
            var ssm = new SSM();

            StartIndex = ssm.StartIndex;
            ssm.Open(filePath);
            foreach (var s in ssm.Sounds)
            {
                Sounds.Add(s);
            }
        }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        public void LoadFromStream(Stream s)
        {
            using (BinaryReaderExt r = new BinaryReaderExt(s))
            {
                if (s.Length < 0x14)
                {
                    return;
                }

                if (new string(r.ReadChars(4)) != "SPKG")
                {
                    return;
                }

                GroupFlags = r.ReadUInt32();
                Flags      = r.ReadUInt32();

                var ssmSize = r.ReadInt32();
                ScriptBank         = new SEMBank();
                ScriptBank.Scripts = new SEMBankScript[r.ReadInt32()];

                for (int i = 0; i < ScriptBank.Scripts.Length; i++)
                {
                    ScriptBank.Scripts[i] = new SEMBankScript();
                    ScriptBank.Scripts[i].Decompile(r.GetSection(r.ReadUInt32(), r.ReadInt32()));
                }

                var name = r.ReadString(r.ReadByte());

                if (ssmSize == 0)
                {
                    SoundBank = null;
                }
                else
                {
                    SoundBank = new SSM();
                    using (MemoryStream ssmStream = new MemoryStream(r.ReadBytes(ssmSize)))
                        SoundBank.Open(name, ssmStream);
                }
            }
        }
Пример #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="scriptBank"></param>
 /// <param name="soundBank"></param>
 public MEXSoundBank(SEMBank scriptBank, SSM soundBank)
 {
     ScriptBank = scriptBank;
     SoundBank  = soundBank;
 }
Пример #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sb"></param>
 public void SetSSM(SSM sb)
 {
     _ssm = sb;
     mxListBox1.DataSource = sb.Sounds;
 }
Пример #9
0
        static void Main(string[] args)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            for (int i = 0; i < args.Length; i++)
            {
                string strippedArg = args[i].ToLower();

                if (Directory.Exists(args[i]))
                {
                    _directory = args[i];
                }
                else if (File.Exists(args[i]))
                {
                    _directory = args[i];
                }

                strippedArg = strippedArg.TrimStart('-', '/', '\\');

                if (strippedArg == "verbose" || strippedArg == "v" || strippedArg == "developer" || strippedArg == "dev" || strippedArg == "debug")
                {
                    _verbose = true;
                }
                else if (strippedArg == "password" || strippedArg == "p" && !string.IsNullOrEmpty(args[i + 1]))
                {
                    _password = args[i + 1];
                }
                else if (string.IsNullOrEmpty(_passwordHint) && (strippedArg == "hint" || strippedArg == "passwordhint" || strippedArg == "h") && !string.IsNullOrEmpty(args[i + 1]))
                {
                    _passwordHint = args[i + 1];
                }
                else if (strippedArg == "purgetemp" || strippedArg == "deletetemp")
                {
                    _purgeTemp = true;
                }
                else if (strippedArg == "headless" || strippedArg == "cli" || strippedArg == "commandline")
                {
                    _headless = true;
                }
                else if (strippedArg == "showprogress" || strippedArg == "progress" || strippedArg == "prog")
                {
                    if (!string.IsNullOrEmpty(args[i + 1]) && UInt16.TryParse(args[i + 1], out _progressSleep))
                    {
                    }
                    _showProgress = true;
                }
                else if (strippedArg == "faesversion" || strippedArg == "faes" || strippedArg == "faesver")
                {
                    _getFaesVersion = true;
                }
                else if (strippedArg == "faesguiversion" || strippedArg == "faesguiver" || strippedArg == "faesgui" || strippedArg == "guiver" || strippedArg == "ver")
                {
                    _getVersion     = true;
                    _getFaesVersion = true;
                }
                else if (string.IsNullOrEmpty(_compressionMethod) && (strippedArg == "compression" || strippedArg == "compressionmethod" || strippedArg == "c") && !string.IsNullOrEmpty(args[i + 1]))
                {
                    _compressionMethod = args[i + 1].ToUpper();
                }
                else if ((strippedArg == "level" || strippedArg == "compressionlevel" || strippedArg == "l") && !string.IsNullOrEmpty(args[i + 1]))
                {
                    Int32.TryParse(args[i + 1], out _compressionLevel);
                }
                else if (strippedArg == "overwrite" || strippedArg == "overwriteduplicates" || strippedArg == "o")
                {
                    _overwriteDuplicates = true;
                }
                else if (strippedArg == "preserveoriginal" || strippedArg == "original" || strippedArg == "po")
                {
                    _deleteOriginalFile = false;
                }
                else if (strippedArg == "genfullinstallconfig")
                {
                    _genFullInstallConfig = true;
                }
                else if (strippedArg == "associatefiletypes" || strippedArg == "filetypes")
                {
                    _associateFileTypes = true;
                }
                else if (strippedArg == "startmenushortcuts" || strippedArg == "startmenu")
                {
                    _startMenuShortcuts = true;
                }
                else if (strippedArg == "contextmenus" || strippedArg == "context")
                {
                    _contextMenus = true;
                }
                else if (strippedArg == "installbranch" && !string.IsNullOrEmpty(args[i + 1]))
                {
                    _installBranch = args[i + 1];
                }
                else if (strippedArg == "peek" || strippedArg == "filepeek")
                {
                    _doFilePeek = true;
                }

                _strippedArgs.Add(strippedArg);
            }
            FileAES_Utilities.SetVerboseLogging(_verbose);
            SSM.SetVerboseLogging(_verbose);

            try
            {
                if (File.Exists("FAES-Updater.exe"))
                {
                    File.Delete("FAES-Updater.exe");
                }
            }
            catch
            {
                // ignored
            }

            if (_purgeTemp)
            {
                FileAES_Utilities.PurgeTempFolder();
            }

            if (_getVersion)
            {
                Console.WriteLine("Current FileAES Version: {0}", GetVersion());
                Console.WriteLine("Current FileAES Build Date: {0}", GetBuildDateFormatted());
            }

            if (_getFaesVersion)
            {
                Console.WriteLine("Current FAES Version: {0}", FileAES_Utilities.GetVersion());
            }

            if (!string.IsNullOrEmpty(_directory) && !string.IsNullOrEmpty(_password) && _headless)
            {
                faesFile = new FAES_File(_directory);

                Console.WriteLine("FileAES-GUI (FileAES) only has basic command-line support. Use FileAES-CLI for improved command-line functionality.");

                try
                {
                    if (_compressionLevel < 0 || _compressionLevel > 9)
                    {
                        Console.WriteLine("You have not specified a valid compression level! Please choose a value between 0 and 9.");
                    }
                    else
                    {
                        if (faesFile.IsFileEncryptable())
                        {
                            FileAES_Encrypt encrypt = new FileAES_Encrypt(faesFile, _password, _passwordHint, Optimise.Balanced, null, _deleteOriginalFile, _overwriteDuplicates);

                            if (!string.IsNullOrEmpty(_compressionMethod))
                            {
                                switch (_compressionMethod)
                                {
                                case "ZIP":
                                    encrypt.SetCompressionMode(CompressionMode.ZIP, _compressionLevel);
                                    break;

                                case "TAR":
                                    encrypt.SetCompressionMode(CompressionMode.TAR, _compressionLevel);
                                    break;

                                case "LZMA":
                                    encrypt.SetCompressionMode(CompressionMode.LZMA, _compressionLevel);
                                    break;

                                case "GZIP":
                                    encrypt.SetCompressionMode(CompressionMode.GZIP, _compressionLevel);
                                    break;

                                case "LGYZIP":
                                case "LEGACYZIP":
                                case "LEGACY":
                                    encrypt.SetCompressionMode(CompressionMode.LGYZIP, _compressionLevel);
                                    break;

                                default:
                                    Console.WriteLine("Unknown Compression Method: {0}", _compressionMethod);
                                    return;
                                }
                            }

                            Thread progressThread = new Thread(() =>
                            {
                                while (_showProgress)
                                {
                                    ushort percentComplete = Convert.ToUInt16(encrypt.GetEncryptionPercentComplete());
                                    Console.WriteLine(_verbose ? "[INFO] Progress: {0}%" : "Progress: {0}%", percentComplete);
                                    Thread.Sleep(_progressSleep);
                                }
                            });

                            Thread eThread = new Thread(() =>
                            {
                                try
                                {
                                    if (encrypt.EncryptFile())
                                    {
                                        if (_showProgress)
                                        {
                                            Console.WriteLine(_verbose ? "[INFO] Progress: 100%" : "Progress: 100%");
                                        }

                                        Console.WriteLine("Encryption on {0} succeeded!", faesFile.getFaesType().ToLower());
                                    }
                                    else
                                    {
                                        Console.WriteLine("Encryption on {0} failed!", faesFile.getFaesType().ToLower());
                                    }
                                }
                                catch (Exception e)
                                {
                                    progressThread.Abort();
                                    HandleException(e);
                                }
                            });

                            if (_showProgress)
                            {
                                progressThread.Start();
                            }
                            eThread.Start();

                            while (eThread.ThreadState == ThreadState.Running)
                            {
                            }

                            progressThread.Abort();
                        }
                        else
                        {
                            FileAES_Decrypt decrypt = new FileAES_Decrypt(faesFile, _password, _deleteOriginalFile, _overwriteDuplicates);

                            Thread progressThread = new Thread(() =>
                            {
                                while (_showProgress)
                                {
                                    ushort percentComplete = Convert.ToUInt16(decrypt.GetDecryptionPercentComplete());

                                    Console.WriteLine(_verbose ? "[INFO] Progress: {0}%" : "Progress: {0}%", percentComplete);
                                    Thread.Sleep(_progressSleep);
                                }
                            });

                            Thread dThread = new Thread(() =>
                            {
                                try
                                {
                                    if (decrypt.DecryptFile())
                                    {
                                        if (_showProgress)
                                        {
                                            Console.WriteLine(_verbose ? "[INFO] Progress: 100%" : "Progress: 100%");
                                        }

                                        Console.WriteLine("Decryption on {0} succeeded!", faesFile.getFaesType().ToLower());
                                    }
                                    else
                                    {
                                        Console.WriteLine("Decryption on {0} failed!", faesFile.getFaesType().ToLower());
                                        Console.WriteLine("Ensure that you entered the correct password!");
                                        Console.WriteLine("Password Hint: {0}", faesFile.GetPasswordHint());
                                    }
                                }
                                catch (Exception e)
                                {
                                    progressThread.Abort();
                                    HandleException(e);
                                }
                            });

                            if (_showProgress)
                            {
                                progressThread.Start();
                            }
                            dThread.Start();

                            while (dThread.ThreadState == ThreadState.Running)
                            {
                            }

                            progressThread.Abort();
                        }
                    }
                }
                catch (Exception e)
                {
                    HandleException(e);
                }
            }
            else if (_genFullInstallConfig)
            {
                programManager = new ProgramManager(ProgramManager.InstallType.FullInstall);
                programManager.SetBranch(_installBranch);
                programManager.SetAssociateFileTypes(_associateFileTypes);
                programManager.SetStartMenuShortcuts(_startMenuShortcuts);
                programManager.SetContextMenus(_contextMenus);

                Application.Exit();
            }
            else
            {
                programManager = new ProgramManager();
                if (!FileAES_Utilities.GetVerboseLogging())
                {
                    FileAES_Utilities.SetVerboseLogging(programManager.GetDevMode());
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (!string.IsNullOrEmpty(_directory))
                {
                    faesFile = new FAES_File(_directory);

                    if (faesFile.IsFileEncryptable())
                    {
                        Application.Run(new EncryptForm(faesFile));
                    }
                    else if (faesFile.IsFileDecryptable())
                    {
                        if (_doFilePeek && IsFileValidForPeek(faesFile))
                        {
                            Application.Run(new PeekForm(faesFile));
                        }
                        else
                        {
                            Application.Run(new DecryptForm(faesFile));
                        }
                    }
                }
                else
                {
                    Application.Run(new MainForm());
                }
            }
        }