Move application constants to module
This commit is contained in:
18
src/app.rs
Normal file
18
src/app.rs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// Application properties
|
||||||
|
pub const APP_NAME: &'static str = "pixelpwnr";
|
||||||
|
pub const APP_VERSION: &'static str = "0.1";
|
||||||
|
pub const APP_AUTHOR: &'static str = "Tim Visee <timvisee@gmail.com>";
|
||||||
|
pub const APP_ABOUT: &'static str = "A quick pixelflut client, that pwns pixelflut panels.";
|
||||||
|
|
||||||
|
// The default thread count
|
||||||
|
pub const DEFAULT_THREAD_COUNT: usize = 4;
|
||||||
|
|
||||||
|
// The default image width and height
|
||||||
|
pub const DEFAULT_IMAGE_WIDTH: u32 = 1920;
|
||||||
|
pub const DEFAULT_IMAGE_HEIGHT: u32 = 1080;
|
||||||
|
|
||||||
|
// The default frames per second rate
|
||||||
|
pub const DEFAULT_IMAGE_FPS: u32 = 1;
|
||||||
|
|
||||||
|
// The amount of milliseconds to wait for an image, when a painter has no image.
|
||||||
|
pub const PAINTER_IMAGE_WAIT_DELAY_MILLIS: u64 = 100;
|
||||||
28
src/main.rs
28
src/main.rs
@@ -2,6 +2,8 @@ extern crate bufstream;
|
|||||||
extern crate clap;
|
extern crate clap;
|
||||||
extern crate image;
|
extern crate image;
|
||||||
|
|
||||||
|
mod app;
|
||||||
|
|
||||||
use std::io::Error;
|
use std::io::Error;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
@@ -16,23 +18,7 @@ use bufstream::BufStream;
|
|||||||
use clap::{Arg, ArgMatches, App};
|
use clap::{Arg, ArgMatches, App};
|
||||||
use image::{DynamicImage, FilterType, Pixel};
|
use image::{DynamicImage, FilterType, Pixel};
|
||||||
|
|
||||||
|
use app::*;
|
||||||
|
|
||||||
// The default thread count
|
|
||||||
const DEFAULT_THREAD_COUNT: usize = 4;
|
|
||||||
|
|
||||||
// The default image width and height
|
|
||||||
const DEFAULT_IMAGE_WIDTH: u32 = 1920;
|
|
||||||
const DEFAULT_IMAGE_HEIGHT: u32 = 1080;
|
|
||||||
|
|
||||||
// The default frames per second rate
|
|
||||||
const DEFAULT_IMAGE_FPS: u32 = 1;
|
|
||||||
|
|
||||||
// The amount of milliseconds to wait for an image, when a painter has no image.
|
|
||||||
const PAINTER_IMAGE_WAIT_DELAY_MILLIS: u64 = 100;
|
|
||||||
|
|
||||||
// The default size of the command output read buffer
|
|
||||||
// const CMD_READ_BUFFER_SIZE: usize = 16;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -104,10 +90,10 @@ fn main() {
|
|||||||
/// Parse CLI arguments, return the matches.
|
/// Parse CLI arguments, return the matches.
|
||||||
fn parse_args<'a>() -> ArgMatches<'a> {
|
fn parse_args<'a>() -> ArgMatches<'a> {
|
||||||
// Handle/parse arguments
|
// Handle/parse arguments
|
||||||
App::new("pixelpwnr")
|
App::new(APP_NAME)
|
||||||
.version("0.1")
|
.version(APP_VERSION)
|
||||||
.author("Tim Visee <timvisee@gmail.com>")
|
.author(APP_AUTHOR)
|
||||||
.about("Pwns pixelflut")
|
.about(APP_ABOUT)
|
||||||
.arg(Arg::with_name("HOST")
|
.arg(Arg::with_name("HOST")
|
||||||
.help("The host to pwn \"host:port\"")
|
.help("The host to pwn \"host:port\"")
|
||||||
.required(true)
|
.required(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user