Exemplo n.º 1
0
        public static RepoPatch From_repo_patch_t(Repo repo, IntPtr ptr)
        {
            IntPtr patch_id_pointer = Marshal.ReadIntPtr(ptr);

            if (patch_id_pointer == IntPtr.Zero)
            {
                return(null);
            }

            ThcrapDll.repo_patch_t patch = Marshal.PtrToStructure <ThcrapDll.repo_patch_t>(ptr);
            RepoPatch outRepo            = new RepoPatch();

            outRepo.Repo  = repo;
            outRepo.Id    = patch.patch_id;
            outRepo.Title = patch.title;
            return(outRepo);
        }
Exemplo n.º 2
0
        private Repo(IntPtr repo_ptr)
        {
            ThcrapDll.repo_t repo = Marshal.PtrToStructure <ThcrapDll.repo_t>(repo_ptr);

            Id            = repo.id;
            Title         = repo.title;
            this.repo_ptr = repo_ptr;

            Patches = new List <RepoPatch>();
            IntPtr    current_patch_ptr = repo.patches;
            RepoPatch current_patch     = RepoPatch.From_repo_patch_t(this, current_patch_ptr);

            while (current_patch != null)
            {
                Patches.Add(current_patch);
                current_patch_ptr += Marshal.SizeOf <ThcrapDll.repo_patch_t>();
                current_patch      = RepoPatch.From_repo_patch_t(this, current_patch_ptr);
            }

            PatchesFiltered = Patches;
        }