Remove unnecessary code from timeline_event_info and rename files for… (#470)
* Remove unnecessary code from timeline_event_info and rename files for issue462 * Remove unnecessary code #462
This commit is contained in:
@@ -39,7 +39,7 @@ impl ConfigReader {
|
||||
pub fn new() -> Self {
|
||||
ConfigReader {
|
||||
args: build_app(),
|
||||
event_timeline_config: load_eventcode_info("config/timeline_event_info.txt"),
|
||||
event_timeline_config: load_eventcode_info("config/statistics_event_info.txt"),
|
||||
target_eventids: load_target_ids("config/target_eventids.txt"),
|
||||
}
|
||||
}
|
||||
@@ -298,8 +298,6 @@ fn load_eventkey_alias(path: &str) -> EventKeyAliasConfig {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EventInfo {
|
||||
pub evttitle: String,
|
||||
pub detectflg: String,
|
||||
pub comment: String,
|
||||
}
|
||||
|
||||
impl Default for EventInfo {
|
||||
@@ -311,13 +309,7 @@ impl Default for EventInfo {
|
||||
impl EventInfo {
|
||||
pub fn new() -> EventInfo {
|
||||
let evttitle = "Unknown".to_string();
|
||||
let detectflg = "".to_string();
|
||||
let comment = "".to_string();
|
||||
EventInfo {
|
||||
evttitle,
|
||||
detectflg,
|
||||
comment,
|
||||
}
|
||||
EventInfo { evttitle }
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -355,21 +347,17 @@ fn load_eventcode_info(path: &str) -> EventInfoConfig {
|
||||
return config;
|
||||
}
|
||||
|
||||
// timeline_event_infoが読み込めなかったらエラーで終了とする。
|
||||
// statistics_event_infoが読み込めなかったらエラーで終了とする。
|
||||
read_result.unwrap().into_iter().for_each(|line| {
|
||||
if line.len() != 4 {
|
||||
if line.len() != 2 {
|
||||
return;
|
||||
}
|
||||
|
||||
let empty = &"".to_string();
|
||||
let eventcode = line.get(0).unwrap_or(empty);
|
||||
let event_title = line.get(1).unwrap_or(empty);
|
||||
let detect_flg = line.get(2).unwrap_or(empty);
|
||||
let comment = line.get(3).unwrap_or(empty);
|
||||
infodata = EventInfo {
|
||||
evttitle: event_title.to_string(),
|
||||
detectflg: detect_flg.to_string(),
|
||||
comment: comment.to_string(),
|
||||
};
|
||||
config
|
||||
.eventinfo
|
||||
|
||||
@@ -47,8 +47,8 @@ impl Timeline {
|
||||
sammsges.push(format!("Total Event Records: {}\n", self.stats.total));
|
||||
sammsges.push(format!("First Timestamp: {}", self.stats.start_time));
|
||||
sammsges.push(format!("Last Timestamp: {}\n", self.stats.end_time));
|
||||
sammsges.push("Count (Percent)\tID\tEvent\t\tTimeline".to_string());
|
||||
sammsges.push("--------------- ------- --------------- -------".to_string());
|
||||
sammsges.push("Count (Percent)\tID\tEvent\t".to_string());
|
||||
sammsges.push("--------------- ------- ---------------".to_string());
|
||||
|
||||
// 集計件数でソート
|
||||
let mut mapsorted: Vec<_> = self.stats.stats_list.iter().collect();
|
||||
@@ -74,28 +74,26 @@ impl Timeline {
|
||||
|
||||
// イベント情報取得(eventtitleなど)
|
||||
let conf = configs::CONFIG.read().unwrap();
|
||||
// timeline_event_info.txtに登録あるものは情報設定
|
||||
// statistics_event_info.txtに登録あるものは情報設定
|
||||
match conf.event_timeline_config.get_event_id(*event_id) {
|
||||
Some(e) => {
|
||||
// 出力メッセージ1行作成
|
||||
msges.push(format!(
|
||||
"{0} ({1:.1}%)\t{2}\t{3}\t{4}",
|
||||
"{0} ({1:.1}%)\t{2}\t{3}",
|
||||
event_cnt,
|
||||
(rate * 1000.0).round() / 10.0,
|
||||
event_id,
|
||||
e.evttitle,
|
||||
e.detectflg
|
||||
));
|
||||
}
|
||||
None => {
|
||||
// 出力メッセージ1行作成
|
||||
msges.push(format!(
|
||||
"{0} ({1:.1}%)\t{2}\t{3}\t{4}",
|
||||
"{0} ({1:.1}%)\t{2}\t{3}",
|
||||
event_cnt,
|
||||
(rate * 1000.0).round() / 10.0,
|
||||
event_id,
|
||||
"Unknown",
|
||||
""
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user