Ejemplo n.º 1
0
        private void SendMessage()
        {
            if (_selectedChannel != null)
            {
                try
                {
                    PleaseWait(() =>
                    {
                        var embed = CheckWhatToSend_ThreadSafe();

                        if (embed.Thumbnail == null)
                        {
                            _selectedChannel.SendMessageAsync(null, false, embed);
                        }
                        else
                        {
                            _selectedChannel.SendFileAsync(_selectedImagePath, string.Empty, false, embed,
                                                           RequestOptions.Default);
                        }
                    });
                    ShowMessage(this, "Message sent to Discord.");
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                    DumpFile.Create(e);
                    throw;
                }
            }
            else
            {
                ShowMessage(this, "Please select a channel to continue.", "Select Channel", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Ejemplo n.º 2
0
 private static void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
 {
     //update Logs
     Log.Exception(e.Exception.Message);
     // Process unhandled exception
     DumpFile.Create(e.Exception);
     // Prevent default unhandled exception processing
     e.Handled = true;
 }
Ejemplo n.º 3
0
        private static void MyHandler(object sender, UnhandledExceptionEventArgs args)
        {
            var e = (Exception)args.ExceptionObject;

            // update Logs
            Log.Exception(e.Message);
            // Process unhandled exception
            DumpFile.Create(e);
        }
Ejemplo n.º 4
0
        private void btnIidsFromClipboard_Click(object sender, EventArgs e)
        {
            var lookup = DumpFile.GetSymbolsFromClipboard();

            if (lookup == null || lookup.Symbols.Count == 0)
            {
                MessageBox.Show("No valid clipboard data available.", "Instrument Ids from Clipboard");
            }
            else
            {
                updateInstrumentSymbolList(lookup);
                lookup.Save();
            }
        }
Ejemplo n.º 5
0
        private void btnOpenDumpFile_Click(object sender, EventArgs e)
        {
            DialogResult dlgResult = openFileDlg.ShowDialog();

            if (dlgResult == DialogResult.OK)
            {
                txtDump.Text = "";

                DumpFile dump = new DumpFile(openFileDlg.FileName);
                dump.Lookup = _lookup;

                string outputFilename = @"C:\Users\mhatmaker\Desktop\Dump 101\dumpfile." + DumpFile.DateTimeNumber + ".txt";

                DumpReports.DepthBidAskSpread(dump, outputFilename, 6);
            }
        }
Ejemplo n.º 6
0
        List <DumpFile> CreateDumpFileList(IReadOnlyList <StorageFile> files)
        {
            var dumpFiles = new List <DumpFile>();

            foreach (var file in files)
            {
                DumpFile dumpFile = new DumpFile();
                dumpFile.File = file;
                dumpFile.Name = file.Name;

                var values = dumpFile.Name.Split('.');

                dumpFile.Ticks      = Convert.ToInt64(values[0]);
                dumpFile.EntryCount = Convert.ToInt32(values[2]);
                dumpFiles.Add(dumpFile);
            }
            return(dumpFiles.OrderBy(d => d.Ticks).ToList());
        }
Ejemplo n.º 7
0
        private void btnImportIidFile_Click(object sender, EventArgs e)
        {
            DialogResult dlgResult = openFileDlg.ShowDialog();

            if (dlgResult == DialogResult.OK)
            {
                var lookup = DumpFile.GetSymbolsFromTextFile(openFileDlg.FileName);

                if (lookup == null || lookup.Symbols.Count == 0)
                {
                    MessageBox.Show("No valid InstrumentId/Symbol data available in selected file.", "Instrument Ids from Text File");
                }
                else
                {
                    updateInstrumentSymbolList(lookup);
                    lookup.Save();
                }
            }
        }
Ejemplo n.º 8
0
 public static int Dump(DumpFile file)
 {
     if (file == DumpFile.LV1)
     {
         return(cl.DownloadString("http://" + IP + "/dump.ps3?lv1").Contains("Dumped: dump_lv1.bin") ? 0 : -1);
     }
     else if (file == DumpFile.LV2)
     {
         return(cl.DownloadString("http://" + IP + "/dump.ps3?lv2").Contains("Dumped: dump_lv2.bin") ? 0 : -1);
     }
     else if (file == DumpFile.RSX)
     {
         return(cl.DownloadString("http://" + IP + "/dump.ps3?rsx").Contains("Dumped: dump_rsx.bin") ? 0 : -1);
     }
     else if (file == DumpFile.FullMemory)
     {
         return(cl.DownloadString("http://" + IP + "/dump.ps3?full").Contains("Dumped: dump_full.bin") ? 0 : -1);
     }
     return(-1);
 }
Ejemplo n.º 9
0
        private void PopulateChannelDropdown()
        {
            try
            {
                Dispatcher.Invoke(() =>
                {
                    var channelItems = _channels
                                       .Select(s => new ComboBoxItem
                    {
                        Content = (s.Category == null ? $"{s.Name} " : $"({s.Category?.Name}) {s.Name} "), Tag = s.Id
                    })
                                       .OrderBy(o => o.Content).ToList();

                    channelItems.ForEach(item => cmbChannelPicker.Items.Add(item));
                }, DispatcherPriority.ContextIdle);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                DumpFile.Create(e);
                throw;
            }
        }
Ejemplo n.º 10
0
        private void GetSettings()
        {
            try
            {
                var settingsFile = myFiles.Json.Settings;
                if (!File.Exists(settingsFile))
                {
                    JsonFile.Create <Settings>(settingsFile, new JsonObjects.Empty().Settings());
                }

                if (File.Exists(settingsFile))
                {
                    var settings = JsonFile.Load <Settings>(settingsFile);
                    _serverName = settings.ServerName;
                    _botToken   = settings.BotToken;
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                DumpFile.Create(e);
                throw;
            }
        }
Ejemplo n.º 11
0
        // I think this should be for kernel-mode only.
        // [Parameter( Mandatory = false )]
        // public SwitchParameter IgnoreInaccessibleMemory { get; set; }



        protected override void ProcessRecord()
        {
            // Support relative paths in PS.
            string dumpFileResolved = SessionState.Path.GetUnresolvedProviderPathFromPSPath(DumpFile);

            DEBUG_FORMAT flags = DEBUG_FORMAT.DEFAULT;

            flags |= DEBUG_FORMAT.USER_SMALL_FULL_MEMORY |
                     DEBUG_FORMAT.USER_SMALL_HANDLE_DATA |
                     DEBUG_FORMAT.USER_SMALL_UNLOADED_MODULES |
                     DEBUG_FORMAT.USER_SMALL_INDIRECT_MEMORY |
                     DEBUG_FORMAT.USER_SMALL_DATA_SEGMENTS |
                     DEBUG_FORMAT.USER_SMALL_PROCESS_THREAD_DATA |
                     DEBUG_FORMAT.USER_SMALL_PRIVATE_READ_WRITE_MEMORY |
                     DEBUG_FORMAT.USER_SMALL_FULL_MEMORY_INFO |
                     DEBUG_FORMAT.USER_SMALL_THREAD_INFO |
                     DEBUG_FORMAT.USER_SMALL_CODE_SEGMENTS |
                     DEBUG_FORMAT.USER_SMALL_FULL_AUXILIARY_STATE;  // TODO: Need to learn what this means


            // I think this should be for kernel-mode only.
            // if( IgnoreInaccessibleMemory )
            // {
            //     flags |= DEBUG_FORMAT.USER_SMALL_IGNORE_INACCESSIBLE_MEM;
            // }

            // TODO: Figure out these things, and see if there are new ones I don't know about:
            //       DEBUG_FORMAT.USER_SMALL_FILTER_MEMORY |
            //       DEBUG_FORMAT.USER_SMALL_FILTER_PATHS |

            //       DEBUG_FORMAT.USER_SMALL_NO_OPTIONAL_DATA |

            //       DEBUG_FORMAT.USER_SMALL_NO_AUXILIARY_STATE |


            if (!AllowClobber)
            {
                flags |= DEBUG_FORMAT.NO_OVERWRITE;
            }

            if (Compress)
            {
                flags |= DEBUG_FORMAT.WRITE_CAB;
            }

            if (CompressWithSymbols)
            {
                flags |= DEBUG_FORMAT.WRITE_CAB;
                flags |= DEBUG_FORMAT.CAB_SECONDARY_FILES;
                // TODO: What is CAB_SECONDARY_ALL_IMAGES for? DbgEng.h says
                //
                //    "When creating a CAB with secondary images do searches
                //    for all image files, regardless of whether they're
                //    needed for the current session or not."
                //
                // but I don't know what it means for an image file to be "needed" for the
                // current session versus not.
            }

            if ((Compress || CompressWithSymbols) &&
                !DumpFile.EndsWith(".cab", StringComparison.OrdinalIgnoreCase))
            {
                WriteWarning("Output will be compressed, but output file name does not end in '.cab'.");
                WriteWarning("You will need to rename the resulting file to end with '.cab' if you want to be able to mount the dump file with Mount-DbgDumpFile.");
            }

            // TODO: Just let the API fail instead of doing this pre-check?
            if (File.Exists(dumpFileResolved))
            {
                if (!AllowClobber)
                {
                    // is there a better "already exists" exception?
                    WriteError(new InvalidOperationException(Util.Sprintf("The file '{0}' already exists. Use -AllowClobber to overwrite it.",
                                                                          DumpFile)),
                               "DumpFileAlreadyExists",
                               ErrorCategory.ResourceExists,
                               DumpFile);
                    return;
                }
            }

            using (var disposer = new ExceptionGuard())
            {
                disposer.Protect(Debugger.HandleDbgEngOutput((x) => SafeWriteVerbose(x.TrimEnd())));
                disposer.Protect(new CtrlCInterceptor(_CtrlCHandler));

                try
                {
                    MsgLoop.Prepare();

                    var task = Debugger.WriteDumpAsync(DumpFile,
                                                       flags,
                                                       Comment,
                                                       CancelTS.Token);
                    task.ContinueWith((_t) => { disposer.Dispose(); SignalDone(); });

                    MsgLoop.Run();

                    Util.Await(task);   // in case it threw
                }
                catch (DbgProviderException dpe)
                {
                    if ((dpe.HResult == DebuggerObject.E_UNEXPECTED) &&
                        CancelTS.IsCancellationRequested)
                    {
                        WriteWarning("Dump file creation canceled.");
                    }
                    else
                    {
                        WriteError(dpe);
                    }
                }
            } // end using( dbgeng output, CTRL-C )
        }     // end ProcessRecord()