@@ -28,6 +28,7 @@ use std::sync::mpsc::Sender;
2828use std:: sync:: Mutex ;
2929use std:: thread:: JoinHandle ;
3030use std:: time:: Duration ;
31+ use crate :: progress:: ProgressCallback ;
3132
3233static MAIN_THREAD_HANDLE : Mutex < Option < JoinHandle < ( ) > > > = Mutex :: new ( None ) ;
3334
@@ -283,6 +284,24 @@ impl Session {
283284 crate :: load ( file_path)
284285 }
285286
287+ /// Load the file with a progress callback, the callback will _only_ be called for BNDBs currently.
288+ ///
289+ /// ```no_run
290+ /// let headless_session = binaryninja::headless::Session::new().unwrap();
291+ ///
292+ /// let print_progress = |progress, total| {
293+ /// println!("{}/{}", progress, total);
294+ /// true
295+ /// };
296+ ///
297+ /// let bv = headless_session
298+ /// .load_with_progress("cat.bndb", print_progress)
299+ /// .expect("Couldn't open `cat.bndb`");
300+ /// ```
301+ pub fn load_with_progress ( & self , file_path : impl AsRef < Path > , progress : impl ProgressCallback ) -> Option < Ref < binary_view:: BinaryView > > {
302+ crate :: load_with_progress ( file_path, progress)
303+ }
304+
286305 /// ```no_run
287306 /// use binaryninja::{metadata::Metadata, rc::Ref};
288307 /// use std::collections::HashMap;
@@ -303,6 +322,35 @@ impl Session {
303322 ) -> Option < Ref < binary_view:: BinaryView > > {
304323 crate :: load_with_options ( file_path, update_analysis_and_wait, options)
305324 }
325+
326+ /// Load the file with options and a progress callback, the callback will _only_ be called for BNDBs currently.
327+ ///
328+ /// ```no_run
329+ /// use binaryninja::{metadata::Metadata, rc::Ref};
330+ /// use std::collections::HashMap;
331+ ///
332+ /// let print_progress = |progress, total| {
333+ /// println!("{}/{}", progress, total);
334+ /// true
335+ /// };
336+ ///
337+ /// let settings: Ref<Metadata> =
338+ /// HashMap::from([("analysis.linearSweep.autorun", false.into())]).into();
339+ /// let headless_session = binaryninja::headless::Session::new().unwrap();
340+ ///
341+ /// let bv = headless_session
342+ /// .load_with_options_and_progress("cat.bndb", true, Some(settings), print_progress)
343+ /// .expect("Couldn't open `cat.bndb`");
344+ /// ```
345+ pub fn load_with_options_and_progress < O : IntoJson > (
346+ & self ,
347+ file_path : impl AsRef < Path > ,
348+ update_analysis_and_wait : bool ,
349+ options : Option < O > ,
350+ progress : impl ProgressCallback ,
351+ ) -> Option < Ref < binary_view:: BinaryView > > {
352+ crate :: load_with_options_and_progress ( file_path, update_analysis_and_wait, options, progress)
353+ }
306354}
307355
308356impl Drop for Session {
0 commit comments