Exemple #1
0
        void StartMonitorFps()
        {
            try
            {
                vTraceEventSession = new TraceEventSession("FpsOverlayer");
                vTraceEventSession.EnableProvider(vProvider_DxgKrnl.ToString());
                vTraceEventSession.Source.AllEvents += ProcessEvents;

                AVActions.TaskStart(TaskTraceEventSource);
                AVActions.TaskStartLoop(LoopTraceEventOutput, vTask_TraceEventOutput);

                Debug.WriteLine("Started monitoring fps.");
            }
            catch { }
        }
Exemple #2
0
 //Install the required drivers
 async void button_Driver_Install_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         async void TaskAction()
         {
             try
             {
                 await InstallRequiredDrivers();
             }
             catch { }
         }
         await AVActions.TaskStart(TaskAction);
     }
     catch { }
 }
Exemple #3
0
 //Handle received socket data
 public static async Task ReceivedSocketHandler(TcpClient tcpClient, UdpEndPointDetails endPoint, byte[] receivedBytes)
 {
     try
     {
         async void TaskAction()
         {
             try
             {
                 await ReceivedSocketHandlerThread(tcpClient, receivedBytes);
             }
             catch { }
         }
         await AVActions.TaskStart(TaskAction);
     }
     catch { }
 }
Exemple #4
0
 //Stop the desired controller in task
 void StopControllerTask(ControllerStatus Controller, string disconnectTag)
 {
     try
     {
         //Start the controller stop task
         async void TaskAction()
         {
             try
             {
                 await StopControllerAsync(Controller, disconnectTag);
             }
             catch { }
         }
         AVActions.TaskStart(TaskAction);
     }
     catch { }
 }
Exemple #5
0
        //Empty the Windows Recycle Bin
        async Task RecycleBin_Empty()
        {
            try
            {
                List <DataBindString> messageAnswers = new List <DataBindString>();
                DataBindString        answerEmpty    = new DataBindString();
                answerEmpty.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                answerEmpty.Name        = "Empty the recycle bin";
                messageAnswers.Add(answerEmpty);

                DataBindString messageResult = await Popup_Show_MessageBox("Empty the recycle bin?", "", "This will permanently remove all the files and folders from your recycle bin.", messageAnswers);

                if (messageResult != null && messageResult == answerEmpty)
                {
                    await Notification_Send_Status("Remove", "Emptying recycle bin");

                    Debug.WriteLine("Emptying the Windows recycle bin.");

                    //Play recycle bin empty sound
                    PlayInterfaceSound(vConfigurationCtrlUI, "RecycleBinEmpty", false);

                    //Prepare the recycle bin task
                    void TaskAction()
                    {
                        try
                        {
                            SHEmptyRecycleBin(IntPtr.Zero, null, RecycleBin_FLAGS.SHRB_NOCONFIRMATION | RecycleBin_FLAGS.SHRB_NOSOUND);
                        }
                        catch { }
                    }

                    //Empty the windows recycle bin
                    await AVActions.TaskStart(TaskAction);
                }
            }
            catch { }
        }
Exemple #6
0
        //File and folder actions
        private async Task FilePicker_Actions()
        {
            try
            {
                //Get the selected list item
                DataBindFile selectedItem = (DataBindFile)lb_FilePicker.SelectedItem;

                //Check if actions are available
                if (vFilePickerCurrentPath == "PC" && selectedItem.FileType != FileType.FolderDisc)
                {
                    Debug.WriteLine("File and folders action cancelled, no actions available.");
                    await Notification_Send_Status("Close", "No actions available");

                    return;
                }

                //Check the selected file type
                if (selectedItem.FileType == FileType.UwpApp)
                {
                    //Add answers for messagebox
                    List <DataBindString> Answers = new List <DataBindString>();

                    DataBindString answerUpdate = new DataBindString();
                    answerUpdate.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Refresh.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    answerUpdate.Name        = "Check application update";
                    Answers.Add(answerUpdate);

                    DataBindString answerRemove = new DataBindString();
                    answerRemove.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/RemoveCross.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    answerRemove.Name        = "Remove the application";
                    Answers.Add(answerRemove);

                    //Show the messagebox prompt
                    DataBindString messageResult = await Popup_Show_MessageBox("Application actions", "", "Please select an action that you want to use on: " + selectedItem.Name, Answers);

                    if (messageResult != null)
                    {
                        //Update application
                        if (messageResult == answerUpdate)
                        {
                            await UwpListUpdateApplication(selectedItem);
                        }
                        //Remove application
                        else if (messageResult == answerRemove)
                        {
                            await UwpListRemoveApplication(selectedItem);
                        }
                    }
                }
                else if (selectedItem.FileType == FileType.FolderDisc)
                {
                    //Add answers for messagebox
                    List <DataBindString> Answers = new List <DataBindString>();

                    DataBindString answerEjectDisc = new DataBindString();
                    answerEjectDisc.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Eject.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    answerEjectDisc.Name        = "Eject disc or unmount the image";
                    Answers.Add(answerEjectDisc);

                    //Show the messagebox prompt
                    DataBindString messageResult = await Popup_Show_MessageBox("Application actions", "", "Please select an action that you want to use on: " + selectedItem.Name, Answers);

                    if (messageResult != null && messageResult == answerEjectDisc)
                    {
                        await FilePicker_EjectDrive(selectedItem, selectedItem.PathFile);
                    }
                }
                else
                {
                    //Add answers for messagebox
                    List <DataBindString> Answers = new List <DataBindString>();

                    //Check the file type
                    bool preFile = selectedItem.FileType == FileType.FolderPre || selectedItem.FileType == FileType.FilePre || selectedItem.FileType == FileType.GoUpPre;

                    //Count checked items
                    int checkedItems = List_FilePicker.Count(x => x.Checked == Visibility.Visible);

                    //Check the sorting type
                    string sortType = string.Empty;
                    if (vFilePickerSortType == SortingType.Name)
                    {
                        sortType = "Sort files and folders by date";
                    }
                    else
                    {
                        sortType = "Sort files and folders by name";
                    }

                    DataBindString answerSort = new DataBindString();
                    answerSort.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Sorting.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    answerSort.Name        = sortType;
                    Answers.Add(answerSort);

                    DataBindString answerCopySingle = new DataBindString();
                    if (!preFile)
                    {
                        answerCopySingle.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Copy.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerCopySingle.Name        = "Copy the file or folder";
                        Answers.Add(answerCopySingle);
                    }
                    DataBindString answerCopyChecked = new DataBindString();
                    if (checkedItems > 0)
                    {
                        answerCopyChecked.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Copy.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerCopyChecked.Name        = "Copy selected files and folders";
                        Answers.Add(answerCopyChecked);
                    }

                    DataBindString answerCutSingle = new DataBindString();
                    if (!preFile)
                    {
                        answerCutSingle.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Cut.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerCutSingle.Name        = "Cut the file or folder";
                        Answers.Add(answerCutSingle);
                    }
                    DataBindString answerCutChecked = new DataBindString();
                    if (checkedItems > 0)
                    {
                        answerCutChecked.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Cut.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerCutChecked.Name        = "Cut selected files and folders";
                        Answers.Add(answerCutChecked);
                    }

                    DataBindString answerPaste = new DataBindString();
                    if (vClipboardFiles.Count == 1)
                    {
                        DataBindFile clipboardFile = vClipboardFiles.FirstOrDefault();
                        answerPaste.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Paste.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerPaste.Name        = "Paste (" + clipboardFile.FileType.ToString() + " " + clipboardFile.ClipboardType.ToString() + ") " + clipboardFile.Name;
                        Answers.Add(answerPaste);
                    }
                    else if (vClipboardFiles.Count > 1)
                    {
                        int    copyCount   = vClipboardFiles.Count(x => x.ClipboardType == ClipboardType.Copy);
                        int    cutCount    = vClipboardFiles.Count(x => x.ClipboardType == ClipboardType.Cut);
                        string statusCount = string.Empty;
                        if (copyCount > cutCount)
                        {
                            statusCount = "(" + copyCount + "x copy)";
                        }
                        else
                        {
                            statusCount = "(" + cutCount + "x cut)";
                        }

                        answerPaste.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Paste.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerPaste.Name        = "Paste " + statusCount + " files or folders";
                        Answers.Add(answerPaste);
                    }

                    DataBindString answerRename = new DataBindString();
                    if (!preFile)
                    {
                        answerRename.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Rename.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerRename.Name        = "Rename the file or folder";
                        Answers.Add(answerRename);
                    }

                    DataBindString answerRemoveSingle = new DataBindString();
                    if (!preFile)
                    {
                        answerRemoveSingle.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerRemoveSingle.Name        = "Remove the file or folder";
                        Answers.Add(answerRemoveSingle);
                    }
                    DataBindString answerRemoveChecked = new DataBindString();
                    if (checkedItems > 0)
                    {
                        answerRemoveChecked.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerRemoveChecked.Name        = "Remove selected files and folders";
                        Answers.Add(answerRemoveChecked);
                    }

                    DataBindString answerDownloadRomInfo = new DataBindString();
                    if (!preFile && vFilePickerShowRoms)
                    {
                        answerDownloadRomInfo.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Download.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerDownloadRomInfo.Name        = "Download game information";
                        Answers.Add(answerDownloadRomInfo);
                    }

                    DataBindString answerDownloadConsoleInfo = new DataBindString();
                    if (!preFile && vFilePickerShowRoms)
                    {
                        answerDownloadConsoleInfo.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Download.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        answerDownloadConsoleInfo.Name        = "Download console information";
                        Answers.Add(answerDownloadConsoleInfo);
                    }

                    DataBindString answerCreateFolder = new DataBindString();
                    answerCreateFolder.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/FolderAdd.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    answerCreateFolder.Name        = "Create a new folder here";
                    Answers.Add(answerCreateFolder);

                    DataBindString answerCreateTextFile = new DataBindString();
                    answerCreateTextFile.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Extensions/Txt.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    answerCreateTextFile.Name        = "Create a new text file here";
                    Answers.Add(answerCreateTextFile);

                    //Show the messagebox prompt
                    DataBindString messageResult = await Popup_Show_MessageBox("File and folder actions", "", "Please select an action that you want to use on: " + selectedItem.Name, Answers);

                    if (messageResult != null)
                    {
                        //Sort files and folders
                        if (messageResult == answerSort)
                        {
                            await FilePicker_SortFilesFoldersSwitch(false);
                        }
                        //Copy file or folder
                        else if (messageResult == answerCopySingle)
                        {
                            await FilePicker_FileCopy_Single(selectedItem);
                        }
                        else if (messageResult == answerCopyChecked)
                        {
                            await FilePicker_FileCopy_Checked();
                        }
                        //Cut file or folder
                        else if (messageResult == answerCutSingle)
                        {
                            await FilePicker_FileCut_Single(selectedItem);
                        }
                        else if (messageResult == answerCutChecked)
                        {
                            await FilePicker_FileCut_Checked();
                        }
                        //Paste file or folder
                        else if (messageResult == answerPaste)
                        {
                            async void TaskAction()
                            {
                                try
                                {
                                    await FilePicker_FilePaste();
                                }
                                catch { }
                            }
                            await AVActions.TaskStart(TaskAction);
                        }
                        //Rename file or folder
                        else if (messageResult == answerRename)
                        {
                            await FilePicker_FileRename(selectedItem);
                        }
                        //Create a new folder
                        else if (messageResult == answerCreateFolder)
                        {
                            await FilePicker_CreateFolder();
                        }
                        //Create a new text file
                        else if (messageResult == answerCreateTextFile)
                        {
                            await FilePicker_CreateTextFile();
                        }
                        //Remove file or folder
                        else if (messageResult == answerRemoveSingle)
                        {
                            await FilePicker_FileRemove_Single(selectedItem);
                        }
                        else if (messageResult == answerRemoveChecked)
                        {
                            await FilePicker_FileRemove_Checked();
                        }
                        //Download game information
                        else if (messageResult == answerDownloadRomInfo)
                        {
                            DownloadInfoGame informationDownloaded = await DownloadInfoGame(selectedItem.Name, 210, false);

                            if (informationDownloaded != null)
                            {
                                selectedItem.Description = ApiIGDB_GameSummaryString(informationDownloaded.Details);
                                if (informationDownloaded.ImageBitmap != null)
                                {
                                    selectedItem.ImageBitmap = informationDownloaded.ImageBitmap;
                                }
                            }
                        }
                        //Download console information
                        else if (messageResult == answerDownloadConsoleInfo)
                        {
                            DownloadInfoConsole informationDownloaded = await DownloadInfoConsole(selectedItem.Name, 210);

                            if (informationDownloaded != null)
                            {
                                selectedItem.Description = ApiIGDB_ConsoleSummaryString(informationDownloaded.Details);
                                if (informationDownloaded.ImageBitmap != null)
                                {
                                    selectedItem.ImageBitmap = informationDownloaded.ImageBitmap;
                                }
                            }
                        }
                    }
                }
            }
            catch { }
        }