MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / create_file_with_progress

Method create_file_with_progress

rust/src/project.rs:516–546  ·  view source on GitHub ↗

Create a file in the project `contents` - Bytes of the file that will be created `folder` - Folder to place the created file in `name` - Name to assign to the created file `description` - Description to assign to the created file `progress` - [`ProgressCallback`] that will be called as the [`ProjectFile`] is being created

(
        &self,
        contents: &[u8],
        folder: Option<&ProjectFolder>,
        name: N,
        description: D,
        mut progress: P,
    )

Source from the content-addressed store, hash-verified

514 /// * `description` - Description to assign to the created file
515 /// * `progress` - [`ProgressCallback`] that will be called as the [`ProjectFile`] is being created
516 pub fn create_file_with_progress<N, D, P>(
517 &self,
518 contents: &[u8],
519 folder: Option<&ProjectFolder>,
520 name: N,
521 description: D,
522 mut progress: P,
523 ) -> Result<Ref<ProjectFile>, ()>
524 where
525 N: BnStrCompatible,
526 D: BnStrCompatible,
527 P: ProgressCallback,
528 {
529 let name_raw = name.into_bytes_with_nul();
530 let description_raw = description.into_bytes_with_nul();
531 let folder_ptr = folder.map(|p| p.handle.as_ptr()).unwrap_or(null_mut());
532
533 unsafe {
534 let result = BNProjectCreateFile(
535 self.handle.as_ptr(),
536 contents.as_ptr(),
537 contents.len(),
538 folder_ptr,
539 name_raw.as_ref().as_ptr() as *const c_char,
540 description_raw.as_ref().as_ptr() as *const c_char,
541 &mut progress as *mut P as *mut c_void,
542 Some(P::cb_progress_callback),
543 );
544 Ok(ProjectFile::ref_from_raw(NonNull::new(result).ok_or(())?))
545 }
546 }
547
548 /// Create a file in the project
549 ///

Callers 2

create_fileMethod · 0.45
modify_projectFunction · 0.45

Calls 4

into_bytes_with_nulMethod · 0.80
mapMethod · 0.80
lenMethod · 0.45
as_refMethod · 0.45

Tested by 1

modify_projectFunction · 0.36