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

Method create_file_unsafe_with_progress

rust/src/project.rs:591–627  ·  view source on GitHub ↗
(
        &self,
        contents: &[u8],
        folder: Option<&ProjectFolder>,
        name: N,
        description: D,
        id: I,
        creation_time: SystemTime,
        mut progress: P,
  

Source from the content-addressed store, hash-verified

589 /// * `progress` - [`ProgressCallback`] that will be called as the [`ProjectFile`] is being created
590 #[allow(clippy::too_many_arguments)]
591 pub unsafe fn create_file_unsafe_with_progress<N, D, I, P>(
592 &self,
593 contents: &[u8],
594 folder: Option<&ProjectFolder>,
595 name: N,
596 description: D,
597 id: I,
598 creation_time: SystemTime,
599 mut progress: P,
600 ) -> Result<Ref<ProjectFile>, ()>
601 where
602 N: BnStrCompatible,
603 D: BnStrCompatible,
604 I: BnStrCompatible,
605 P: ProgressCallback,
606 {
607 let name_raw = name.into_bytes_with_nul();
608 let description_raw = description.into_bytes_with_nul();
609 let id_raw = id.into_bytes_with_nul();
610 let folder_ptr = folder.map(|p| p.handle.as_ptr()).unwrap_or(null_mut());
611
612 unsafe {
613 let result = BNProjectCreateFileUnsafe(
614 self.handle.as_ptr(),
615 contents.as_ptr(),
616 contents.len(),
617 folder_ptr,
618 name_raw.as_ref().as_ptr() as *const c_char,
619 description_raw.as_ref().as_ptr() as *const c_char,
620 id_raw.as_ref().as_ptr() as *const c_char,
621 systime_to_bntime(creation_time).unwrap(),
622 &mut progress as *mut P as *mut c_void,
623 Some(P::cb_progress_callback),
624 );
625 Ok(ProjectFile::ref_from_raw(NonNull::new(result).ok_or(())?))
626 }
627 }
628
629 /// Get a list of files in the project
630 pub fn files(&self) -> Array<ProjectFile> {

Callers 2

create_file_unsafeMethod · 0.80
modify_projectFunction · 0.80

Calls 5

systime_to_bntimeFunction · 0.85
into_bytes_with_nulMethod · 0.80
mapMethod · 0.80
lenMethod · 0.45
as_refMethod · 0.45

Tested by 1

modify_projectFunction · 0.64