public MainPage() { AppacheLogMaster appacheLogMaster = AppacheLogMaster.Instance; StackLayout main_stack = new StackLayout(); // InitializeComponent(); Button b_startinifinity = new Button { Text = "Start/Stop Infinity logging" }; b_startinifinity.Clicked += AddInfinityMesWhile; main_stack.Children.Add(b_startinifinity); Button b_upd_simple_message = new Button { Text = "Send Udp simple packet" }; b_upd_simple_message.Clicked += AddLogMes; main_stack.Children.Add(b_upd_simple_message); Button b_udp_chainsaw = new Button { Text = "Turn on UDP Logging to port 4445" }; b_udp_chainsaw.Clicked += (s, ev) => AppacheLogMaster.Instance.AddDefaultUdpLayout(); main_stack.Children.Add(b_udp_chainsaw); Button b_upd_simple_message_on = new Button { Text = "Turn off UDP Logging" }; b_upd_simple_message_on.Clicked += (e, ev) => { AppacheLogMaster.Instance.TurnOffUdpLayout(); }; main_stack.Children.Add(b_upd_simple_message_on); /* Button b_upd_simple_message_off = new Button * { * Text = "Turn on UDP Logging" * }; * b_upd_simple_message_off.Clicked += (e, ev) => { AppacheLogMaster.Instance.AddDefaultUdpLayout(); }; * main_stack.Children.Add(b_upd_simple_message_off);*/ Button ShowAllBasePahFiles = new Button { Text = "Get all logs files" }; ShowAllBasePahFiles.Clicked += (e, ev) => { GetAllLogFiles(); }; main_stack.Children.Add(ShowAllBasePahFiles); this.Content = main_stack; }
public void GetAllLogFiles() { try { var dir = AppacheLogMaster.GetAndroidCommonPath(); var fs = Directory.GetFiles(dir); var log = AppacheLogMaster.Instance.GetLogger("Result_func"); foreach (var f in fs) { AppacheLogMaster.Instance.GetLogger("f_result").Info(Path.GetFileName(f)); var resn = LoadFile(Path.Combine(dir, Path.GetFileName(f))); string converted = Encoding.UTF8.GetString(resn, 0, resn.Length); log.Info($"{Path.GetFileName(f)}: {converted}"); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } }