Exemple #1
0
 private void GenFileLog(string str, eI2LogLevel thisLevel)
 {
     if (logLevel <= thisLevel)
     {
         KnownFiles.ioAppend(KnownFiles.eKnownFiles.Log, _2InfoDisplay_DebugOut.PreForLevel(thisLevel) + FileLog_GetPreText() + str);
     }
 }
Exemple #2
0
 private void addBodyFile(KnownFiles.eKnownFiles which)
 {
     try
     {
         MSAppendLine("<pre>");
         MSAppendLine(KnownFiles.ioReadAllText(which));
         MSAppendLine("</pre>");
     }
     catch (IOException)
     { }
 }
Exemple #3
0
        private void fileLog(bool isWrite, string msg)
        {
            if (ClearLogFirst && !ClearLogFirst_Done)
            {
                ClearLogFirst_Done = true;
                KnownFiles.ioDelete(KnownFiles.eKnownFiles.AndroidCom);
                KnownFiles.ioAppend(KnownFiles.eKnownFiles.AndroidCom, Endpoint);
            }
            var line = $"{DateTime.UtcNow.ToSwissTime(false)}: {(isWrite ? "pc --> a" : "pc <-- a")}: {msg}";

            KnownFiles.ioAppend(KnownFiles.eKnownFiles.AndroidCom, line);
        }
Exemple #4
0
        TimeSpan CheckInterval = new TimeSpan(0, 10, 0); //once every 10 minutes
        public override eI6Error Process(string destMobile, string msg, Ix iAll)
        {
            using (var x = new LogPreText("DelLog", iAll))
            {
                if (DateTime.UtcNow > (LastCheck + CheckInterval))
                {
                    LastCheck = DateTime.UtcNow;

                    long maxSize;
                    if (long.TryParse("_6WhatsAppProcess_Pre_DeleteLogFile.MaxSize".GetConfig(), out maxSize))
                    {
                        long currentSize = KnownFiles.ioSize(KnownFiles.eKnownFiles.Log);
                        if (currentSize > maxSize)
                        {
                            KnownFiles.ioDelete(KnownFiles.eKnownFiles.Log);
                        }
                    }
                }

                return(Child.Process(destMobile, msg, iAll));
            }
        }
Exemple #5
0
        //public string GetTest()
        //{
        //    MS = new MemoryStream();
        //    addHeader("Test");
        //    addBodyTest();
        //    addFooter();
        //    return SB.ToString();
        //}

        public void GetData(string request, out MemoryStream msOut, out string ContentType)
        {
            MS = new MemoryStream();
            KnownFiles.eKnownFiles which;
            if (KnownFiles.IsKnown(request, out which))
            {
                addHeader(KnownFiles.Get(which));
                addBodyLinks(KnownFiles.GetAll());
                addBodyFile(which);
                addFooter();
            }
            else if (request == "Screen")
            {
                Bitmap bAll = ImageCapture.GetAll();
                bAll.Save(MS, System.Drawing.Imaging.ImageFormat.Png);
                this.ContentType = "image/png";
            }
            else if (request == "FullInfo")
            {
                this.ContentType = "text/plain";
                TrayStatus full = Mem.GetValues();
                if (DisplayTextController._globInstance != null)
                {
                    full.AddRange(DisplayTextController._globInstance.GetStatus());
                }
                MSAppendLine(full.ToString());
            }
            else if (request == "FullInfoIM")
            {
                this.ContentType = "text/plain";
                StringBuilder sb   = new StringBuilder();
                TrayStatus    full = Mem.GetValues();
                if (DisplayTextController._globInstance != null)
                {
                    full.AddRange(DisplayTextController._globInstance.GetStatus());
                }
                full.TheList.ForEach(i => i.ToIntermapperInfo(sb));
                MSAppendLine(sb.ToString());
            }
            else if (request == "Memory")
            {
                addHeader(request);
                addBodyLinks(KnownFiles.GetAll());
                MSAppendLine("<pre>");
                MSAppendLine(Mem.GetValues().ToString());
                MSAppendLine("</pre>");
                addFooter();
            }
            else if (request == "DelPic")
            {
                addHeader(request);
                addBodyLinks(KnownFiles.GetAll());
                foreach (BmpFileHandler.PathAndDate f1 in new BmpFileHandler(".").GetSortedList())
                {
                    if (f1.Path.Contains("zapi"))
                    {
                        File.Delete(f1.Path);
                        MSAppendLine(f1.Path + "<br />");
                    }
                }
                addFooter();
            }
            else if (request == "ListPic")
            {
                addHeader(request);
                addBodyLinks(KnownFiles.GetAll());
                MSAppendLine("<pre>");
                foreach (BmpFileHandler.PathAndDate f1 in new BmpFileHandler(".").GetSortedList())
                {
                    MSAppendLine(f1.LastWrite.ToString() + " " + f1.Path + "<br />");
                }
                MSAppendLine("</pre>");
                addFooter();
            }
            else if (request.StartsWith("ShowPic_"))
            {
                try
                {
                    int id = int.Parse(request.Substring("ShowPic_".Length));
                    addHeader(request);
                    addBodyLinks(KnownFiles.GetAll());
                    MSAppendLine("<br>");
                    MSAppendLine("<br>");
                    foreach (BmpFileHandler.PathAndDate f1 in new BmpFileHandler(".").GetSortedList())
                    {
                        MSAppendLine(f1.Path);
                        MSAppendLine("<br>");
                        MSAppendLine(string.Format("<img src=\"Pic_{0}\" width=\"600\" height=\"500\" > ", f1.Path));
                        MSAppendLine("<hr>");
                    }
                    addFooter();
                }
                catch (Exception _)
                {
                }
            }
            else if (request.StartsWith("Pic_"))
            {
                string path = null;
                try
                {
                    path = request.Substring("Pic_".Length).Replace("%20", " ");
                    Bitmap bAll = new System.Drawing.Bitmap(path);
                    bAll.Save(MS, System.Drawing.Imaging.ImageFormat.Png);
                    this.ContentType = "image/png";
                }
                catch (Exception _)
                {
                }
            }
            else if (request == "DelLog")
            {
                addHeader(request);
                addBodyLinks(KnownFiles.GetAll());
                KnownFiles.ioDelete(KnownFiles.eKnownFiles.Log);
                addFooter();
            }
            else if (request == "Step")
            {
                addHeader(request);
                addBodyLinks(KnownFiles.GetAll());
                MSAppendLine("<pre>");
                MSAppendLine("_6WhatsAppProcess_Real performs steps to send a whatsapp message:<br>");
                MSAppendLine("Step 1: findSearchWindow and enter tel<br>");
                MSAppendLine("Step 2: findAccount and Click it<br>");
                MSAppendLine("Step 3: verify account string top rigth position<br>");
                MSAppendLine("Step 4: find type-msg-here, and enter text<br>");
                MSAppendLine("</pre>");
                addFooter();
            }
            else
            {
                addHeader("No selection");
                addBodyLinks(KnownFiles.GetAll());
                addFooter();
            }

            msOut       = this.MS;
            ContentType = this.ContentType;
        }
Exemple #6
0
 public void FileLog_TelStatus(List <string> val)
 {
     KnownFiles.ioWriteAllLines(KnownFiles.eKnownFiles.TelStatus, val.ToArray());
 }
Exemple #7
0
 public long FileSize()
 {
     return(KnownFiles.ioSize(KnownFiles.eKnownFiles.Log));
 }