mirror of
https://github.com/132nd-vWing/tacview-splitter.git
synced 2026-08-26 11:38:37 +02:00
introduced find_line_type
This commit is contained in:
+15
-8
@@ -75,14 +75,7 @@ fn process_line<'a>(continued: bool, ids: &mut lib::IDs<'a>, line: &'a String, l
|
|||||||
let line_type;
|
let line_type;
|
||||||
let will_continue: bool;
|
let will_continue: bool;
|
||||||
if !continued {
|
if !continued {
|
||||||
let first_char = line.chars().nth(0).expect("malformed line");
|
line_type = find_line_type(line);
|
||||||
if first_char == COMMENT {
|
|
||||||
line_type = TIMESTAMP;
|
|
||||||
} else if first_char == MINUS {
|
|
||||||
line_type = DESTRUCTION;
|
|
||||||
} else {
|
|
||||||
line_type = TELEMETRY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if line_type == TELEMETRY {
|
if line_type == TELEMETRY {
|
||||||
id = line
|
id = line
|
||||||
@@ -113,6 +106,20 @@ fn process_line<'a>(continued: bool, ids: &mut lib::IDs<'a>, line: &'a String, l
|
|||||||
(line_type, will_continue, id)
|
(line_type, will_continue, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn find_line_type(line: &String) -> u8 {
|
||||||
|
let line_type: u8;
|
||||||
|
|
||||||
|
let first_char = line.chars().nth(0).expect("malformed line");
|
||||||
|
if first_char == COMMENT {
|
||||||
|
line_type = TIMESTAMP;
|
||||||
|
} else if first_char == MINUS {
|
||||||
|
line_type = DESTRUCTION;
|
||||||
|
} else {
|
||||||
|
line_type = TELEMETRY;
|
||||||
|
}
|
||||||
|
return line_type
|
||||||
|
}
|
||||||
|
|
||||||
fn get_output_filenames(input_filename: &String) -> lib::OutputFilenames {
|
fn get_output_filenames(input_filename: &String) -> lib::OutputFilenames {
|
||||||
let blue = input_filename.replace(".zip", "_blue.zip");
|
let blue = input_filename.replace(".zip", "_blue.zip");
|
||||||
let red = input_filename.replace(".zip", "_red.zip");
|
let red = input_filename.replace(".zip", "_red.zip");
|
||||||
|
|||||||
Reference in New Issue
Block a user