public void GrantPrivilege_DatabaseDoenstExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer  = ObjectConstructor.CreateDatabaseContainer();
            string             randomDatabaseName = VariousFunctions.GenerateRandomString(8);

            while (databaseContainer.ExistDatabase(randomDatabaseName))
            {
                randomDatabaseName = VariousFunctions.GenerateRandomString(8);
            }
            GrantPrivilege grantPrivilege = CreateGrantPrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnTablesTableName);

            grantPrivilege.SetData(SystemeConstants.InsertPrivilegeName, SystemeConstants.DefaultProfile, randomDatabaseName, "aaa");
            Assert.IsFalse(grantPrivilege.ValidateParameters());
        }
Example #2
0
        public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags,
                          ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _parentMetaContainer = parentContainer;
            _tag          = tag;
            _tags         = tags;
            _buildInfo    = buildInfo;
            _cache        = cache;
            _fileManager  = streamManager;
            _rteProvider  = rteProvider;
            _searchTimer  = new Timer(SearchTimer);
            _stringIdTrie = stringIDTrie;

            // Load Plugin Path
            string groupName = VariousFunctions.SterilizeTagGroupName(CharConstant.ToString(tag.RawTag.Group.Magic)).Trim();

            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                        _buildInfo.Settings.GetSetting <string>("plugins"), groupName);

            if (_buildInfo.Settings.PathExists("fallbackPlugins"))
            {
                _fallbackPluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                                    _buildInfo.Settings.GetSetting <string>("fallbackPlugins"), groupName);
            }

            // Set Option boxes
            cbShowInvisibles.IsChecked  = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles;
            cbShowComments.IsChecked    = App.AssemblyStorage.AssemblySettings.PluginsShowComments;
            cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation;

            cbEnumPrefix.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.PluginsEnumPrefix;

            // Load Meta
            RefreshEditor(MetaReader.LoadType.File);

            // Load Info
            lblTagName.Text = tag.TagFileName != null
                                ? tag.TagFileName + "." + tag.GroupName
                                : "0x" + tag.RawTag.Index.Value.ToString("X");

            lblDatum.Text   = string.Format("{0}", tag.RawTag.Index);
            lblAddress.Text = string.Format("0x{0:X8}", tag.RawTag.MetaLocation.AsPointer());
            lblOffset.Text  = string.Format("0x{0:X}", tag.RawTag.MetaLocation.AsOffset());

            // Set init finished
            hasInitFinished = true;
        }
Example #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

#if !DEBUG
            Current.DispatcherUnhandledException += (o, args) =>
            {
                MetroException.Show(args.Exception);

                args.Handled = true;
            };
#endif

            // Create Assembly Storage
            AssemblyStorage = new Storage();

            // Update Assembly Protocol
            AssemblyProtocol.UpdateProtocol();

            // Create jumplist
            JumpLists.UpdateJumplists();

            // Create XBDM Instance
            AssemblyStorage.AssemblySettings.Xbdm = new Xbdm(AssemblyStorage.AssemblySettings.XdkNameIp);

            // Try and delete all temp data
            VariousFunctions.EmptyUpdaterLocations();

            // Dubs, checkem
            _0xabad1dea.CheckServerStatus();

            // Update File Defaults
            FileDefaults.UpdateFileDefaults();

            // Set closing method
            Current.Exit += (o, args) =>
            {
                // Update Settings with Window Width/Height
                AssemblyStorage.AssemblySettings.ApplicationSizeMaximize =
                    (AssemblyStorage.AssemblySettings.HomeWindow.WindowState == WindowState.Maximized);
                if (AssemblyStorage.AssemblySettings.ApplicationSizeMaximize)
                {
                    return;
                }

                AssemblyStorage.AssemblySettings.ApplicationSizeWidth  = AssemblyStorage.AssemblySettings.HomeWindow.Width;
                AssemblyStorage.AssemblySettings.ApplicationSizeHeight = AssemblyStorage.AssemblySettings.HomeWindow.Height;
            };
        }
Example #4
0
        private void lstSong_DragDrop(object sender, DragEventArgs e)
        {
            var file = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (Path.GetExtension(file[0]).ToLowerInvariant() == ".mid")
            {
                if (UpgradeMidis.Contains(file[0]))
                {
                    DisplayConflict(file[0], "an upgrade MIDI");
                    return;
                }
                SongInstruments.Clear();
                lstSong.Items.Clear();
                orig_con  = "";
                orig_midi = file[0];
                Log("Received MIDI file " + Path.GetFileName(orig_midi));
            }
            else if (VariousFunctions.ReadFileType(file[0]) == XboxFileType.STFS)
            {
                SongInstruments.Clear();
                orig_con = file[0];
                Log("Received CON file " + Path.GetFileName(orig_con) + ", searching for MIDI to extract");
                orig_midi = ExtractMIDI(file[0], false);
                if (string.IsNullOrWhiteSpace(orig_midi) || !File.Exists(orig_midi))
                {
                    orig_con  = "";
                    orig_midi = "";
                    return;
                }
                lstSong.Items.Clear();
                Log("Extracted MIDI file " + Path.GetFileName(orig_midi));
                lstSong.Items.Add("CON File: " + Path.GetFileName(orig_con));
                lstSong.Items.Add("DTA File: songs.dta");
                lstSong.Items.Add("Song ID: " + songID);
                lstSong.Items.Add("Internal Name: " + song_int_name);
            }
            else
            {
                NotValid(file[0]);
                return;
            }

            lstSong.Items.Add("MIDI File: " + Path.GetFileName(orig_midi));
            Log("Reading MIDI file for contents...");
            ReadMIDIForContents(orig_midi, lstSong, "..........");

            Log("Ready");
            ValidateBundleButton();
        }
        public FATXFileStream(string Path, System.IO.FileMode fmode, File file)
        {
            //Underlying.Close();
            if (file.Size == 0)
            {
                throw new Exception("Null files not supported");
            }
            xFile = file;
            // Set our position
            long off = VariousFunctions.GetBlockOffset(xFile.BlocksOccupied[0], xFile);

            Underlying = new FileStream(Path, fmode);
            //Underlying.Position = off;
            Position = 0;
        }
        public FATXFileStream(int DeviceIndex, System.IO.FileAccess fa, File file)
        {
            //Underlying.Close();
            if (file.Size == 0)
            {
                throw new Exception("Null files not supported");
            }
            xFile = file;
            // Set our position to the beginning of the file
            long off = VariousFunctions.GetBlockOffset(xFile.BlocksOccupied[0], xFile);

            Underlying = new FileStream(VariousFunctions.CreateHandle(DeviceIndex), fa);
            //Underlying.Position = off;
            Position = 0;
        }
        public void GrantDatabasePrivilege_ProfileDoenstExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            string             randomProfileName = VariousFunctions.GenerateRandomString(8);
            Column             column            = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.ProfilesTableName).GetColumn(SystemeConstants.ProfileNameColumn);

            while (column.ExistCells(randomProfileName))
            {
                randomProfileName = VariousFunctions.GenerateRandomString(8);
            }
            GrantDatabasePrivilege grantDatabasePrivilege = CreateGrantDatabasePrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnDatabasesTableName);

            grantDatabasePrivilege.SetData(SystemeConstants.CreatePrivilegeName, randomProfileName, SystemeConstants.DefaultDatabaseName);
            Assert.IsFalse(grantDatabasePrivilege.ValidateParameters());
        }
Example #8
0
        private void extractToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GDFFile x      = (GDFFile)listView1.SelectedItems[0].Tag;
            string  result = VariousFunctions.GetUserFileLocale("Save to Where?", "", false);

            if (result == null)
            {
                return;
            }
            menuStrip1.Enabled = listView1.Enabled = advTree1.Enabled = false;
            textBoxX1.Text     = "Status: Extracting file...";
            x.Extract(result);
            textBoxX1.Text     = "Status: Idle...";
            menuStrip1.Enabled = listView1.Enabled = advTree1.Enabled = true;
        }
Example #9
0
        public void DropSecurityProfile_TheProfileDoesntExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            Column             column            = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.ProfilesTableName).GetColumn(SystemeConstants.ProfileNameColumn);
            string             profileName       = VariousFunctions.GenerateRandomString(8);

            while (column.ExistCells(profileName))
            {
                profileName = VariousFunctions.GenerateRandomString(8);
            }
            DropSecurityProfile dropSecurityProfile = CreateDropSecurityProfile(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.ProfilesTableName);

            dropSecurityProfile.SetTargetSecurityProfile(profileName);
            Assert.IsFalse(dropSecurityProfile.ValidateParameters());
        }
        public void CreateDatabase_DatabaseDoenstExist_CreateDatabase()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            string             databaseName      = VariousFunctions.GenerateRandomString(8);

            while (databaseContainer.ExistDatabase(databaseName))
            {
                databaseName = VariousFunctions.GenerateRandomString(8);
            }
            CreateDatabase createDatabase = CreateCreateDatabase(databaseContainer, databaseName);

            Assert.IsTrue(createDatabase.ValidateParameters());
            createDatabase.Execute();
            Assert.IsTrue(databaseContainer.ExistDatabase(databaseName));
        }
Example #11
0
        public void RevoqueDatabasePrivilege_PrivilegeDoenstExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer        = ObjectConstructor.CreateDatabaseContainer();
            Column             databasePrivilegesColumn = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.DatabasesPrivilegesTableName).GetColumn(SystemeConstants.DatabasesPrivilegesPrivilegeNameColumnName);
            string             databasePrivilegeName    = VariousFunctions.GenerateRandomString(8);

            while (databasePrivilegesColumn.ExistCells(databasePrivilegeName))
            {
                databasePrivilegeName = VariousFunctions.GenerateRandomString(8);
            }
            RevokeDatabasePrivilege revoqueDatabasePrivilege = CreateRevoqueDatabasePrivilege(databaseContainer, SystemeConstants.SystemDatabaseName, SystemeConstants.PrivilegesOfProfilesOnDatabasesTableName);

            revoqueDatabasePrivilege.SetData(SystemeConstants.DefaultProfile, SystemeConstants.DefaultDatabaseName, databasePrivilegeName);
            Assert.IsFalse(revoqueDatabasePrivilege.ValidateParameters());
        }
Example #12
0
        public void AddCell_NoExistsCellsWithSameData_StrType()
        {
            List <string> dataToWork = TestColumn.CreateStringCellData();
            Column        column     = ObjectConstructor.CreateColumn(dataToWork, TypesKeyConstants.StringTypeKey, "aaaa");
            string        randomStr  = "uwu";

            while (dataToWork.Contains(randomStr))
            {
                randomStr = VariousFunctions.GenerateRandomString(8);
            }
            Assert.IsFalse(dataToWork.Contains(randomStr));
            Assert.IsFalse(column.ExistCells(randomStr));
            column.AddCell(ObjectConstructor.CreateCell(column, randomStr, null));
            Assert.IsTrue(column.ExistCells(randomStr));
        }
Example #13
0
        long GetRealSectorOffset(long off)
        {
            // Get the size up to the nearest cluster
            // Divide by cluster size
            // That is the block index.
            long SizeInCluster = VariousFunctions.DownToNearest200(off - VariousFunctions.DownToNearestCluster(off, xFile.PartitionInfo.ClusterSize));//VariousFunctions.GetBlockOffset(xFile.StartingCluster) + 0x4000;            long SizeInCluster = VariousFunctions.DownToNearestCluster(off, xFile.PartitionInfo.ClusterSize) / xFile.PartitionInfo.ClusterSize)
            uint Cluster       = (uint)(VariousFunctions.DownToNearestCluster(off, xFile.PartitionInfo.ClusterSize) / xFile.PartitionInfo.ClusterSize);

            //Cluster = (Cluster == 0) ? 0 : Cluster - 1;
            try
            {
                long Underlying = VariousFunctions.GetBlockOffset(xFile.BlocksOccupied[Cluster], xFile);
                return(Underlying + SizeInCluster);
            }
            catch { return(VariousFunctions.GetBlockOffset(xFile.BlocksOccupied[Cluster - 1], xFile)); }
        }
        public void CreateDatabase_DatabaseExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            string             databaseName      = VariousFunctions.GenerateRandomString(8);

            while (databaseContainer.ExistDatabase(databaseName))
            {
                databaseName = VariousFunctions.GenerateRandomString(8);
            }
            IDatabase database = new Database(databaseName);

            databaseContainer.AddDatabase(database);
            CreateDatabase createDatabase = CreateCreateDatabase(databaseContainer, database.databaseName);

            Assert.IsFalse(createDatabase.ValidateParameters());
        }
Example #15
0
        public void DeleteUser_TheUserDoenstExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            ITable             table             = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.UsersTableName);
            Column             column            = table.GetColumn(SystemeConstants.UsersNameColumnName);
            string             username          = VariousFunctions.GenerateRandomString(8);

            while (column.ExistCells(username))
            {
                username = VariousFunctions.GenerateRandomString(8);
            }
            DeleteUser deleteUser = CreateDeleteUser(databaseContainer);

            deleteUser.SetTargetUserName(username);
            Assert.IsFalse(deleteUser.ValidateParameters());
        }
Example #16
0
        public void Insert_BadArguments_ConcretelyDatabaseDoesntExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer        = ObjectConstructor.CreateDatabaseContainer();
            string             doenstExistDatabaseNames = VariousFunctions.GenerateRandomString(6);

            while (databaseContainer.ExistDatabase(doenstExistDatabaseNames))
            {
                doenstExistDatabaseNames = VariousFunctions.GenerateRandomString(6);
            }
            Assert.IsFalse(databaseContainer.ExistDatabase(doenstExistDatabaseNames));
            Insert insert = CreateInsert(databaseContainer, doenstExistDatabaseNames, "aa");

            insert.AddValue("zz");
            Assert.IsFalse(insert.ValidateParameters());
            insert.Execute();
        }
Example #17
0
        public void DeleteCell_CellNoExist_DoNothing()
        {
            List <string> dataToWork       = TestColumn.CreateStringCellData();
            Column        column           = ObjectConstructor.CreateColumn(dataToWork, TypesKeyConstants.StringTypeKey, "aaaa");
            string        noRegisteredData = VariousFunctions.GenerateRandomString(19);

            while (column.ExistCells(noRegisteredData))
            {
                noRegisteredData = VariousFunctions.GenerateRandomString(19);
            }
            Row  row = new Row();
            Cell noRegisteredCell = new Cell(column, noRegisteredData, row);

            row.AddCell(noRegisteredCell);
            Assert.IsFalse(column.DestroyCell(noRegisteredCell));
        }
Example #18
0
        private void btnInputFolder_Click(object sender, RoutedEventArgs e)
        {
            var fbd = new FolderBrowserDialog
            {
                SelectedPath =
                    Directory.Exists(txtInputFolder.Text)
                                                ? txtInputFolder.Text
                                                : VariousFunctions.GetApplicationLocation()
            };

            if (fbd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            txtInputFolder.Text = fbd.SelectedPath;
        }
Example #19
0
        public void GetColumnCount_ReturnCoherentValue()
        {
            Table  table       = new Table("testRowCount");
            int    columnCount = table.GetColumnCount();
            string columnName  = VariousFunctions.GenerateRandomString(7);

            for (int i = 0; i < 100; i++)
            {
                while (table.ExistColumn(columnName))
                {
                    columnName = VariousFunctions.GenerateRandomString(7);
                }
                Assert.IsFalse(table.ExistColumn(columnName));
                table.AddColumn(new Column(columnName, DataTypesFactory.GetDataTypesFactory().GetDataType(TypesKeyConstants.StringTypeKey)));
                Assert.AreEqual(columnCount + i + 1, table.GetColumnCount());
            }
        }
Example #20
0
        private void btnOutputFolder_Click(object sender, RoutedEventArgs e)
        {
            var fbd = new FolderBrowserDialog();

            if (Directory.Exists(txtOutputFolder.Text))
            {
                fbd.SelectedPath = txtOutputFolder.Text;
            }
            else
            {
                fbd.SelectedPath = VariousFunctions.GetApplicationLocation() + "\\plugins\\";
            }
            if (fbd.ShowDialog() == DialogResult.OK)
            {
                txtOutputFolder.Text = fbd.SelectedPath;
            }
        }
        public void CreateSecurityProfile_ProfileDoenstExits_CreateProfile()
        {
            IDatabaseContainer    databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            CreateSecurityProfile query             = CreateCreateSecurityProfile(databaseContainer);
            ITable table       = databaseContainer.GetDatabase(SystemeConstants.SystemDatabaseName).GetTable(SystemeConstants.ProfilesTableName);
            Column column      = table.GetColumn(SystemeConstants.ProfileNameColumn);
            string profileName = VariousFunctions.GenerateRandomString(8);

            while (column.ExistCells(profileName))
            {
                profileName = VariousFunctions.GenerateRandomString(8);
            }
            query.SetProfileName(profileName);
            Assert.IsTrue(query.ValidateParameters());
            query.Execute();
            Assert.IsTrue(column.ExistCells(profileName));
        }
Example #22
0
        private void SelectFilesToConvert(string folder = "")
        {
            FilesToConvert.Clear();
            var path = folder;

            if (string.IsNullOrWhiteSpace(folder))
            {
                var folderUser = new FolderBrowserDialog
                {
                    SelectedPath        = Tools.CurrentFolder,
                    Description         = "Select folder containing files",
                    ShowNewFolderButton = false
                };

                if (folderUser.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                path = folderUser.SelectedPath;
            }
            Tools.CurrentFolder = path;
            var files = Directory.GetFiles(path);

            if (!files.Any())
            {
                Log("No files found in that folder, try another");
                return;
            }
            foreach (var file in files.Where(file => VariousFunctions.ReadFileType(file) == XboxFileType.STFS))
            {
                FilesToConvert.Add(file);
            }
            if (!FilesToConvert.Any())
            {
                Log("No STFS files found in that folder, try another");
                return;
            }
            Log("Received " + (doLIVE ? "CON" : "LIVE") + " file, searching for STFS files to convert to " + (doLIVE ? "LIVE" : "CON"));
            Log("Found " + FilesToConvert.Count + " STFS " + (FilesToConvert.Count == 1 ? "file" : "files, converting to " + (doLIVE ? "LIVE" : "CON...")));
            EnableDisable(false);
            btnBegin.Enabled = true;
            btnBegin.Visible = true;
            btnBegin.Text    = "Cancel";
            toolTip1.SetToolTip(btnBegin, "Click to cancel conversion process");
            backgroundWorker2.RunWorkerAsync();
        }
Example #23
0
        public async Task TestDeleteImage()
        {
            var filePath    = VariousFunctions.GetTestsAssetDirectory() + @"\upload-image-example.jpg";
            var imageBinary = File.ReadAllBytes(filePath);

            var imgurClient   = AuthenticationHelpers.CreateClientAuthenticatedImgurClient();
            var imageEndpoint = new ImageEndpoint(imgurClient);
            var uploadedImage = await imageEndpoint.UploadImageFromBinaryAsync(imageBinary);

            var response = await imageEndpoint.DeleteImageAsync(uploadedImage.Data.DeleteHash);

            // Assert the Reponse
            Assert.IsNotNull(response.Data);
            Assert.AreEqual(response.Success, true);
            Assert.AreEqual(response.Status, HttpStatusCode.OK);
            Assert.IsTrue(response.Data);
        }
Example #24
0
        void plugclick(object sender, EventArgs e)
        {
            string locale = VariousFunctions.GetUserFileLocale("Open a File", "", true);

            if (locale == null)
            {
                return;
            }
            // Integrate log choice
            STFSPackage x = new STFSPackage(locale, null);

            if (!x.ParseSuccess)
            {
                return;
            }
            try { ((LFPlugIn)((ToolStripItem)sender).Tag).xConst.Invoke(new object[] { x, (Form)this }); }
            catch (Exception z) { x.CloseIO(); MessageBox.Show(z.Message); }
        }
Example #25
0
        public async Task TestCodeAuth()
        {
            var settings = VariousFunctions.LoadTestSettings();

            // Create a new OAuth2 Authentication
            var oAuth2Authentication = new OAuth2Authentication(settings.ClientId, settings.ClientSecret, false);
            var authorizationUrl     = oAuth2Authentication.CreateAuthorizationUrl(OAuth2Type.Code, "dicks");
            var code = "1234";

            try
            {
                await oAuth2Authentication.AuthorizeWithCode(code);
            }
            catch (ImgurResponseFailedException exception)
            {
                Assert.AreEqual(exception.ImgurResponse.Data.ErrorDescription, "Refresh token doesn't exist or is invalid for the client");
            }
        }
Example #26
0
        public void Insert_BadArguments_ConcretelyTableDoesntExist_NoticeInValidate()
        {
            IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer();
            Database           database          = new Database("TestInsert1");

            databaseContainer.AddDatabase(database);
            string doenstExistTableNames = VariousFunctions.GenerateRandomString(6);

            while (database.ExistTable(doenstExistTableNames))
            {
                doenstExistTableNames = VariousFunctions.GenerateRandomString(6);
            }
            Assert.IsFalse(database.ExistTable(doenstExistTableNames));
            Insert insert = CreateInsert(databaseContainer, database.databaseName, doenstExistTableNames);

            Assert.IsFalse(insert.ValidateParameters());
            insert.Execute();
        }
Example #27
0
        uint DetermineBlockIndex(long Off)
        {
            // Pre-planning... I need to figure ref the rounded offset in order
            // to determine the cluster that this bitch is in
            // So now that we have the rounded number, we can
            long rounded = VariousFunctions.DownToNearestCluster(Off, xFile.PartitionInfo.ClusterSize);

            // Loop for each cluster, determining if the sizes match
            for (uint i = 0; i < xFile.BlocksOccupied.Length; i++)
            {
                long off = VariousFunctions.GetBlockOffset(xFile.BlocksOccupied[i], xFile);
                if (off == rounded)
                {
                    return(i);
                }
            }
            throw new Exception("Block not allocated to this file!");
        }
Example #28
0
        private void HandleDragDrop(object sender, DragEventArgs e)
        {
            if (picWorking.Visible)
            {
                return;
            }
            var files = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (Path.GetExtension(files[0]).ToLowerInvariant() != ".dat" && VariousFunctions.ReadFileType(files[0]) != XboxFileType.STFS)
            {
                return;
            }
            if (!CanClose())
            {
                return;
            }
            ExtractFromSaveFile(files[0]);
        }
Example #29
0
        private void ProcessInputFile(string file)
        {
            Parser.Songs = null;
            if (VariousFunctions.ReadFileType(file) == XboxFileType.STFS)
            {
                var Splitter = new MoggSplitter();
                if (Splitter.ExtractDecryptMogg(file, true, Tools, Parser))
                {
                    InputFile = file;
                    DrawWaveForm();
                }
                else
                {
                    var msg = Splitter.ErrorLog.Aggregate("Couldn't process the audio in CON file '" + file + "'\nSee the error log below:", (current, log) => current + "\n" + log);
                    MessageBox.Show(msg, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else if (Path.GetExtension(file).ToLowerInvariant() == ".mogg")
            {
                if (Tools.DecM(File.ReadAllBytes(file), true, false, DecryptMode.ToMemory))
                {
                    InputFile = file;
                    DrawWaveForm();
                    return;
                }
                MessageBox.Show("Mogg file '" + file + "' is encrypted and I couldn't process it", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                switch (Path.GetExtension(file).ToLowerInvariant())
                {
                case ".ogg":
                case ".wav":
                    InputFile = file;
                    Tools.PlayingSongOggData = File.ReadAllBytes(file);
                    DrawWaveForm();
                    break;

                default:
                    MessageBox.Show("File '" + file + "' is not a valid input file", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    break;
                }
            }
        }
Example #30
0
        //[STAThread]
        //public static void Main()
        //{

        //}

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Load Supported Builds
            Manager.SupportedGame = new Manager.SupportedGames();

            // Load Settings
            Settings.LoadSettings(true);

            // Update Liberty Protocol
            LibertyProtocol.UpdateProtocol();

            // Create Temporary Directories
            VariousFunctions.CreateTemporaryDirectories();

            // Clean-up Old Temporary Files
            VariousFunctions.CleanUpTemporaryFiles();

            // Create Closing Method
            Application.Current.Exit += (o, args) =>
            {
                // Update Settings with Window Width/Height
                Settings.applicationSizeMaximize = (Settings.HomeWindow.WindowState == WindowState.Maximized);
                if (!Settings.applicationSizeMaximize)
                {
                    Settings.applicationSizeWidth  = Settings.HomeWindow.Width;
                    Settings.applicationSizeHeight = Settings.HomeWindow.Height;
                }

                // Save Settings
                Settings.UpdateSettings();
            };

            // Global Exception Catching
#if !DEBUG
            Application.Current.DispatcherUnhandledException += (o, args) =>
            {
                MetroException.Show((Exception)args.Exception);

                args.Handled = true;
            };
#endif
        }