Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of more Decode and Encoding Algorithms #23

Open
EcoFreshKase opened this issue Aug 5, 2023 · 0 comments
Open

Addition of more Decode and Encoding Algorithms #23

EcoFreshKase opened this issue Aug 5, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@EcoFreshKase
Copy link
Owner

EcoFreshKase commented Aug 5, 2023

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.

  1. First of all, you need to fork g-zip

  2. 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
  3. 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
  4. convert_utils/mod.rs :

    • Add: pub use encoder::your_encode;
    • Add: pub use decoder::your_decode;
  5. 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
  6. 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

  7. Open a push request to add your algorithm to g-zip

@EcoFreshKase EcoFreshKase added enhancement New feature or request good first issue Good for newcomers labels Aug 5, 2023
@EcoFreshKase EcoFreshKase mentioned this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant