You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To make g-zip as useful as possible more algorithm to decode and encode files are always wanted. Therefore, g-zip is build to make it as easy as possible to add new algorithms.
This issue describes how to add a new algorithm to decode and encode files in g-zip.
First of all, you need to fork g-zip
convert_utils/encode.rs :
Create a function with the following signature:
pub fn your_encode(bytes: &[u8]) -> Result(String, String) {}
This function will take an arbitrary amount of bytes and will be called an arbitrary amount of times.
The function returns the sequence as a String and if any Error occur return an error describing the problem. This will be shown to the user in an error window.
implement the encode logic of your algorithm
convert_utils/decode.rs :
Create a function with the following signature:
pub fn your_decode(string: &str) -> Result<Vec, String> {}
This function will take an arbitrary amount of characters from the sequence and will be called an arbitrary amount of times.
The function returns the sequence as a Vec containing the bytes encoded in the given part of the sequence.
If any Errors occur return a String describing the problem. This will be shown to the user in an error window.
implement the decode logic of your algorithm
convert_utils/mod.rs :
Add: pub use encoder::your_encode;
Add: pub use decoder::your_decode;
gui_builder/decode_encode.rs :
Add new Type to Encode and Decode enum representing your new algorithm
Add the new Type to the Display implementation of Encode and Decode
In encode_builder:
add the new algorithm to options.
-> has to be tuple (&str, Option) the string will be shown on the UI next to the radio button to select
In decode_builder:
same as encoe_builder
gui_builder/start_button.rs :
Add: use crate::convert_utils::{your_decode, your_encode}
In encode_file:
Add the new Type to match expression that gives you an compiler error
-> new Type should match to function doing the new encoding algorithm
In decode_file:
Same as encode_file but the function should do de decoding of your new algorithm
Open a push request to add your algorithm to g-zip
The text was updated successfully, but these errors were encountered:
To make g-zip as useful as possible more algorithm to decode and encode files are always wanted. Therefore, g-zip is build to make it as easy as possible to add new algorithms.
This issue describes how to add a new algorithm to decode and encode files in g-zip.
First of all, you need to fork g-zip
convert_utils/encode.rs :
pub fn your_encode(bytes: &[u8]) -> Result(String, String) {}
convert_utils/decode.rs :
pub fn your_decode(string: &str) -> Result<Vec, String> {}
convert_utils/mod.rs :
gui_builder/decode_encode.rs :
add the new algorithm to options.
-> has to be tuple (&str, Option) the string will be shown on the UI next to the radio button to select
same as encoe_builder
gui_builder/start_button.rs :
Add: use crate::convert_utils::{your_decode, your_encode}
In encode_file:
Add the new Type to match expression that gives you an compiler error
-> new Type should match to function doing the new encoding algorithm
In decode_file:
Same as encode_file but the function should do de decoding of your new algorithm
Open a push request to add your algorithm to g-zip
The text was updated successfully, but these errors were encountered: