Перепиши этот код на C#
public final class Rustpotter {

    private Rustpotter() {}
    /**
     * Process i32 audio chunks.
     * 
     * Assumes that the audio chunk length matches the return
     * of the getSamplesPerFrame method.
     * 
     * Assumes sample rate match the configured for the detector.
     * 
     * Assumes that detector bits_per_sample is one of: 8, 16, 24, 32.
     * 
     * Assumes that detector sample_format is 'int'.
     */
    public final java.util.Optional<RustpotterDetection> processInt(int [] samples) {
        long ret = do_processInt(mNativeObj, samples);
        java.util.Optional<RustpotterDetection> convRet;
        if (ret != 0) {
            convRet = java.util.Optional.of(new RustpotterDetection(InternalPointerMarker.RAW_PTR, ret));
        } else {
            convRet = java.util.Optional.empty();
        }

        return convRet;
    }
    private static native long do_processInt(long self, int [] samples);
    /**
     * Process i16 audio chunks.
     * 
     * Assumes that the audio chunk length matches the return
     * of the getSamplesPerFrame method.
     * 
     * Assumes sample rate match the configured for the detector.
     * 
     * Assumes that detector bits_per_sample is one of: 8, 16.
     * 
     * Assumes that detector sample_format is 'int'.
     */
    public final java.util.Optional<RustpotterDetection> processSort(short [] samples) {
        long ret = do_processSort(mNativeObj, samples);
        java.util.Optional<RustpotterDetection> convRet;
        if (ret != 0) {
            convRet = java.util.Optional.of(new RustpotterDetection(InternalPointerMarker.RAW_PTR, ret));
        } else {
            convRet = java.util.Optional.empty();
        }

        return convRet;
    }
    private static native long do_processSort(long self, short [] samples);
    /**
     * Process f32 audio chunks.
     * 
     * Assumes that the audio chunk length matches the return
     * of the getSamplesPerFrame method.
     * 
     * Assumes sample rate match the configured for the detector.
     * 
     * Assumes that detector bits_per_sample is 32.
     * 
     * Assumes that detector sample_format is 'float'.
     */
    public final java.util.Optional<RustpotterDetection> processFloat(float [] samples) {
        long ret = do_processFloat(mNativeObj, samples);
        java.util.Optional<RustpotterDetection> convRet;
        if (ret != 0) {
            convRet = java.util.Optional.of(new RustpotterDetection(InternalPointerMarker.RAW_PTR, ret));
        } else {
            convRet = java.util.Optional.empty();
        }

        return convRet;
    }
    private static native long do_processFloat(long self, float [] samples);
    /**
     * Process audio chunks in bytes.
     * 
     * Assumes that the audio chunk lengthd matches the return
     * of the getBytesPerFrame method.
     * 
     * Assumes sample rate match the configured for the detector.
     * 
     * Assumes buffer endianness matches the configured for the detector.
     */
    public final java.util.Optional<RustpotterDetection> processBytes(byte [] bytes) {
        long ret = do_processBytes(mNativeObj, bytes);
        java.util.Optional<RustpotterDetection> convRet;
        if (ret != 0) {
            convRet = java.util.Optional.of(new RustpotterDetection(InternalPointerMarker.RAW_PTR, ret));
        } else {
            convRet = java.util.Optional.empty();
        }

        return convRet;
    }
    private static native long do_processBytes(long self, byte [] bytes);
    /**
     * Loads a wakeword from its model path.
     */
    public final void addWakewordModelFile(String path) throws Exception {
        do_addWakewordModelFile(mNativeObj, path);
    }
    private static native void do_addWakewordModelFile(long self, String path) throws Exception;
    /**
     * Loads a wakeword from its model bytes.
     */
    public final void addWakewordModelBytes(byte [] bytes) throws Exception {
        do_addWakewordModelBytes(mNativeObj, bytes);
    }
    private static native void do_addWakewordModelBytes(long self, byte [] bytes) throws Exception;
    /**
     * Returns the desired chunk size.
     */
    public final long getSamplesPerFrame() {
        long ret = do_getSamplesPerFrame(mNativeObj);

        return ret;
    }
    private static native long do_getSamplesPerFrame(long self);
    /**
     * Returns size in bytes for the desired chunk.
     */
    public final long getBytesPerFrame() {
        long ret = do_getBytesPerFrame(mNativeObj);

        return ret;
    }
    private static native long do_getBytesPerFrame(long self);
    /**
     * Removes a wakeword by name.
     */
    public final void removeWakeword(String name) {
        do_removeWakeword(mNativeObj, name);
    }
    private static native void do_removeWakeword(long self, String name);

    public synchronized void delete() {
        if (mNativeObj != 0) {
            do_delete(mNativeObj);
            mNativeObj = 0;
       }
    }
    @Override
    protected void finalize() throws Throwable {
        try {
            delete();
        }
        finally {
             super.finalize();
        }
    }
    private static native void do_delete(long me);
    /*package*/ Rustpotter(InternalPointerMarker marker, long ptr) {
        assert marker == InternalPointerMarker.RAW_PTR;
        this.mNativeObj = ptr;
    }
    /*package*/ long mNativeObj;

        public static void loadLibrary() throws java.io.IOException {
            String bundleLibraryPath = null;
            String osName = System.getProperty("os.name").toLowerCase();
            String osArch = System.getProperty("os.arch").toLowerCase();
            if (osName.contains("win")) {
                if(osArch.contains("amd64") || osArch.contains("x86_64")) {
                    bundleLibraryPath = "/librustpotter_java_win_x86_64.dll";
                }
            } else if (osName.contains("nix") || osName.contains("nux")
                    || osName.contains("aix")) {
                if(osArch.contains("amd64") || osArch.contains("x86_64")) {
                    bundleLibraryPath = "/librustpotter_java_debian_x86_64.so";
                } else if(osArch.contains("aarch64") || osArch.contains("arm64")) {
                    bundleLibraryPath = "/librustpotter_java_debian_aarch64.so";
                } else if(osArch.contains("armv7") || osArch.contains("arm")) {
                    bundleLibraryPath = "/librustpotter_java_debian_armv7l.so";
                }
            } else if (osName.contains("mac") || osName.contains("darwin")) {
                if(osArch.contains("amd64") || osArch.contains("x86_64")) {
                    bundleLibraryPath = "/librustpotter_java_macos_x86_64.dylib";
                } else if(osArch.contains("aarch64") || osArch.contains("arm64")) {
                    bundleLibraryPath = "/librustpotter_java_macos_aarch64.dylib";
                }
            }
            if (bundleLibraryPath == null) {
                throw new java.io.IOException("Rustpotter: Unsupported platform.");
            }
            NativeUtils.loadLibraryFromJar(bundleLibraryPath);
        }
    }