Move application constants to module

This commit is contained in:
Tim Visée
2017-12-30 21:25:17 +01:00
parent a7244ca64f
commit 08b42805ff
2 changed files with 25 additions and 21 deletions

18
src/app.rs Normal file
View 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;

View File

@@ -2,6 +2,8 @@ extern crate bufstream;
extern crate clap;
extern crate image;
mod app;
use std::io::Error;
use std::io::prelude::*;
use std::net::TcpStream;
@@ -16,23 +18,7 @@ use bufstream::BufStream;
use clap::{Arg, ArgMatches, App};
use image::{DynamicImage, FilterType, Pixel};
// 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;
use app::*;
@@ -104,10 +90,10 @@ fn main() {
/// Parse CLI arguments, return the matches.
fn parse_args<'a>() -> ArgMatches<'a> {
// Handle/parse arguments
App::new("pixelpwnr")
.version("0.1")
.author("Tim Visee <timvisee@gmail.com>")
.about("Pwns pixelflut")
App::new(APP_NAME)
.version(APP_VERSION)
.author(APP_AUTHOR)
.about(APP_ABOUT)
.arg(Arg::with_name("HOST")
.help("The host to pwn \"host:port\"")
.required(true)