Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //获取日志名称为ASPNET35BookDemo的日志
     LogList loglist = new LogList("ASPNET35BookDemo");
     //将GridView1的数据源设置为LogList对象
     GridView1.DataSource = loglist;
     //调用DataBind方法进行绑定
     GridView1.DataBind();
 }
Пример #2
0
        private async void ClearLogAsync()
        {
            StartActivityIndication(TextConstants.ActivityClearingLog);

            await Task.Run(async() =>
            {
                if (!await _bluetooth.TurnOnBluetoothAsync(1000, 25))
                {
                    ShowMessage(TextConstants.BluetoothTurnOnFail, TextConstants.ButtonClose);
                    return;
                }
                if (!await _bluetooth.CreateConnectionAsync(5000, 50))
                {
                    ShowMessage(TextConstants.BluetoothConnectionFail, TextConstants.ButtonClose);
                    return;
                }

                KeyVendorCommand clearLogCommand = new KeyVendorCommand
                {
                    UserUUID    = _user.UUID,
                    Time        = DateTime.Now,
                    CommandType = KeyVendorCommandType.ClearLog
                };
                KeyVendorTerminal terminal = new KeyVendorTerminal(_bluetooth);
                KeyVendorAnswer answer     = await terminal.ExecuteCommandAsync(clearLogCommand, 15000, 100);

                if (!answer.IsCorrect || answer.AnswerType != KeyVendorAnswerType.Success)
                {
                    ShowMessage(TextConstants.ErrorClearLogFail, TextConstants.ButtonClose);
                    return;
                }

                LogList.Clear();
                Indexer = 0;
                ShowMessage(TextConstants.SuccessLogCleared, TextConstants.ButtonClose);
            });

            UpdateCommands();
            StopActivityIndication();
        }
Пример #3
0
        /// <summary>
        /// Write logs and set event completed.
        /// </summary>
        /// <param name="list">list of log entries</param>
        /// <param name="mre">event</param>
        private void WriteLogs(LogList list)
        {
            int i = 0;

            foreach (LogEntry l in list)
            {
                Writer.WriteLine(l.Content);
                Writer.Flush();

                //while (_MEGA_LOCK) Thread.Sleep(1000);
                //lock (Stream)
                //{
                //    if (v_closed || Stream == null || !Stream.CanWrite)
                //    {
                //        ReCreateStream();
                //    }
                //    lock (Writer)
                //    {
                //        Writer.WriteLine(l.Content);
                //        Writer.Flush();
                //    }
                //}
                //list.Length -= l.Length;
                ////if (_MEGA_LOCK)
                ////{
                ////    lock (v_buffer)
                ////    {
                ////        LogEntry[] entries = new LogEntry[list.Count - (i + 1) + v_buffer.Count];
                ////        v_buffer.CopyTo(0, entries, 0, v_buffer.Count);
                ////        list.CopyTo(i, entries, v_buffer.Count, list.Count - (i + 1));
                ////        v_buffer = new List<LogEntry>(entries);
                ////    }
                ////    break;
                ////}
                //this.CurrentChunkSize = list.Length;
                //i++;
            }
        }
Пример #4
0
        private void loadFile()
        {
            var t = Task.Run(() =>
            {
                filePath = AppDomain.CurrentDomain.BaseDirectory + "log\\" + fileName + ".log";
                FileStream fs;
                if (File.Exists(filePath))
                {
                    using (StreamReader sr = new StreamReader(filePath))
                    {
                        // 从文件读取并显示行,直到文件的末尾
                        while (!sr.EndOfStream)
                        {
                            string line;
                            line = sr.ReadLine();
                            if (null != line && !"".Equals(line))
                            {
                                Action action = delegate
                                {
                                    LogList.Items.Add(line);
                                    LogList.ScrollIntoView(line);
                                };
                                LogList.Dispatcher.BeginInvoke(DispatcherPriority.Background, action);
                            }
                        }
                        LogHelper.ShowLog("文件读取完成");
                    }
                }
            });

            t.GetAwaiter().OnCompleted(() =>
            {
                LogHelper.ShowLog("开始监控写入");
                CommandWatcher watcher  = new CommandWatcher(filePath);
                watcher.CommandHandler += newLine;
                watcher.Start();
            });
        }
Пример #5
0
        public LogControl()
        {
            var c = LogManager.Configuration ?? new LoggingConfiguration();

            _logs = new LogList();

            InitializeComponent();

            // Null check Dispatcher, otherwise test bringup for GUI tests will fail.
            if (Dispatcher != null)
            {
                _logTarget = new IntifaceNLogTarget(_logs);
                c.AddTarget("IntifaceLogger", _logTarget);
                _outgoingLoggingRule = new LoggingRule("*", LogLevel.Debug, _logTarget);
                c.LoggingRules.Add(_outgoingLoggingRule);
                LogManager.Configuration = c;
            }

            //LogLevelComboBox.SelectionChanged += LogLevelSelectionChangedHandler;
            LogListBox.ItemsSource = _logs;
            ButtplugFFILog.StartLogHandler(ButtplugLogLevel.Info, false);
            B******g.ButtplugFFILog.LogMessage += (obj, msg) => _logs.Add(msg.Trim());
        }
Пример #6
0
        public void GetLogListUsingPqlTest()
        {
            try
            {
                LogsRequester requester = new LogsRequester("AC907d7e328b3a5b402fa908857e047a243a8949b1", "2c78e8a8d1033b77902758e584ad5fc4a1c5ee02", "AC907d7e328b3a5b402fa908857e047a243a8949b1");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetLogListTest:3000");
                }

                WebRequest.RegisterPrefix("http://GetLogListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":1,\"start\":0,\"end\":0,\"page\":0,\"numPages\":1,\"pageSize\":2,\"nextPageUri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Applications&cursor=492dc883a811bd0204204ea9047122f93a2788a2\", \"logs\" : [{\"hostname\":\"spv07vcs10\",\"subsystem\":\"vcsserver\",\"timestamp\":1485450178603416,\"scope\":\"public\",\"level\":\"info\",\"accountId\":\"AC907d7e328b3a5b402fa908857e047a243a8949b1\",\"requestId\":null,\"callId\":\"CA5c8c6d7df5d19096eb71ce516a39ade6aa1b0d4f\",\"message\":\"Customer Response 200 : POST http://172.29.11.10/FreeClimbSurvey/FreeClimbSurvey/NextQuestion\",\"metadata\":[{\"GetSpeech\":{\"actionUrl\":\"http://172.29.11.10/FreeClimbSurvey/FreeClimbSurvey/HandleQuestionResponse\",\"grammarFile\":\"http://172.29.11.10/FreeClimbSurvey/Grammars/969d88d2-8edb-4ad9-8436-aa0c4d268f56.grxml\",\"grammarRule\":\"Choices\",\"grammarType\":\"URL\",\"noInputTimeoutMs\":4000,\"prompts\":[{\"Say\":{\"text\":\"what is your favorite color\"}}],\"recognitionTimeoutMs\":5000}}]}]}");
                LogSearchFilters filters = new LogSearchFilters();
                string           pql     = "level=\"info\"";
                filters.setPql(pql);
                LogList logList = requester.get(filters);

                Assert.IsNotNull(logList);

                Assert.AreEqual(logList.getLocalSize, 1);
                Assert.AreEqual((logList.export()).Count, 1);

                Log log = logList.get(0) as Log;

                Assert.IsNotNull(log);
                Assert.AreEqual(log.getLevel, ELogLevel.Info);
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
Пример #7
0
        public ActionResult FormUpdateLog(LogList lo)
        {
            LogList       t  = new LogList();
            StringBuilder sb = new StringBuilder();

            Debug.WriteLine("I am inside the function");
            foreach (var item in lo.ls)
            {
                Debug.WriteLine("Checked value" + item.IsChecked);
                if (item.IsChecked)
                {
                    Debug.WriteLine("Checked value" + item.IsChecked);
                    int ide   = int.Parse(Request.Form["LogID"]);
                    var query = from tb in _db.LogisticsIssues
                                where tb.LogisticsIssueID == ide
                                select tb;


                    foreach (LogisticsIssue ti in query)
                    {
                        ti.Status   = item.Text;
                        ti.Comments = lo.logdescription;
                    }
                    try
                    {
                        _db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        // Provide for exceptions.
                    }
                }
            }

            return(RedirectToAction("LogisticsFinalPage"));
        }
Пример #8
0
        //folderpath includes the slash already
        public static void ReadFromDisk(string folderPath)
        {
            try
            {
                DataContractSerializer format = new DataContractSerializer(logList.GetType());
                if (File.Exists(folderPath + logListXmlFilename))
                {
                    using (var w = XmlReader.Create(folderPath + logListXmlFilename))
                    {
                        logList = (LogList)format.ReadObject(w);
                    }
                }

                format = new DataContractSerializer(logList.VariablesDict.GetType());
                if (File.Exists(folderPath + variablesDictXmlFilename))
                {
                    using (var w = XmlReader.Create(folderPath + variablesDictXmlFilename))
                    {
                        logList.VariablesDict = (Dictionary <string, string>)format.ReadObject(w);
                    }
                }

                format = new DataContractSerializer(logList.FuncCallCountDict.GetType());
                if (File.Exists(folderPath + funcCallCountDictXmlFilename))
                {
                    using (var w = XmlReader.Create(folderPath + funcCallCountDictXmlFilename))
                    {
                        logList.FuncCallCountDict = (Dictionary <string, int>)format.ReadObject(w);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("ReadFromDisk failed: \n" + e.ToString());
            }
        }
Пример #9
0
        private void catchData()
        {
            this.data = new Dictionary <object, dynamic>();
            LogController controller = new LogController();
            LogList       control    = new LogList();

            this.data["startDate"] = startDateLog.Value;
            this.data["endDate"]   = endDateLog.Value;
            this.data["userId"]    = userIdLog.SelectedValue;

            controller.data = this.data;
            Dictionary <Object, dynamic> result = controller.getLogs();

            if (result["code"] == Result.Failed)
            {
                MessageBox.Show(result["msg"]);
            }

            if (result["code"] == Result.Processed)
            {
                control.loadDataGrid(result["content"]);
                Parent.Controls.Add(control);
            }
        }
 internal void loadLoglist(LogList log)
 {
     this.loglist = log;
     Console.WriteLine(this.loglist.slices.Count() + " slices in log");
 }
Пример #11
0
        public ActionResult FormProcLogSupport(LogList lci)
        {
            StringBuilder sb  = new StringBuilder();
            StringBuilder sb1 = new StringBuilder();

            foreach (var item in lci.logIs)
            {
                Debug.WriteLine("Checked value" + item.IsChecked);
                if (item.IsChecked)
                {
                    //append each checked records into StringBuilder
                    sb.Append(item.Text + ",");
                }
            }

            foreach (var item in lci.plIs)
            {
                Debug.WriteLine("Checked value" + item.IsChecked);
                if (item.IsChecked)
                {
                    //append each checked records into StringBuilder
                    sb1.Append(item.Text + ",");
                }
            }
            DateTime now    = DateTime.Now;
            var      time24 = DateTime.Now.ToString("HH:mm:ss");

            Debug.WriteLine("The string is " + sb.ToString() + " " + sb1.ToString());
            //  String s1 = sb.ToString() + " And Priority is "+ sb1.ToString() + " The description is " + lci.logdescription + " " + DateTime.Now.ToString("dd/MM/yyyy") + "The time is" + time24;
            LogisticsIssue tc = new LogisticsIssue();

            //  tc.LogisticsIssueID = 4;
            tc.BuildingNo  = 1;
            tc.LabNo       = "1";
            tc.PCNo        = 1;
            tc.ProblemType = sb.ToString();
            tc.Priority    = sb1.ToString();
            tc.Date_Log    = DateTime.Now.Date;
            tc.Time_Log    = now.TimeOfDay;
            tc.Status      = "Not Resolved";
            tc.Comments    = lci.logdescription;
            _db.LogisticsIssues.Add(tc);
            _db.SaveChanges();
            var li = (from tch in _db.LogisticsIssues
                      orderby tch.LogisticsIssueID descending
                      select tch.LogisticsIssueID).First();
            string s1 = li.ToString();

            Debug.WriteLine("hidden field value from Log" + Request.Form["SubmissionFrom"]);

            /*  if (Request.Form["SubmissionFrom"].ToString() == "ITUnitTeam")
             * {
             *    return RedirectToAction("ITFinalSubmissionPage", "ITUnitTeam", new { s = s1 });
             * }
             * else if (Request.Form["SubmissionFrom"].ToString() == "LogSupportTeam")
             * {
             *    return RedirectToAction("CreateNewLogIssue", "LogisticsSupportTeam", new { s = s1 });
             * }
             * else
             * {*/
            string s2 = Request.Form["SubmissionFrom"].ToString();

            return(RedirectToAction("ExamTeamFinalPage", new { s = s1, s4 = s2 }));
            //}
        }
Пример #12
0
 public virtual void LogListLog(VBALogLevelFlag level, string message)
 {
     if (m_loglevelstartard <= level)
     {
         LogList l = new LogList();
         l.errtime = DateTime.Now;
         l.errlevel = level;
         l.errmessage = message;
         m_loglist.Add(l);
     }
 }
Пример #13
0
        public LogList getLogList(DateTime date)
        {
            LogList log = new LogList();
            List<ScheduledSlice> scheduledslices =getScheduledSlices(date);

            for (int i = 0; i < scheduledslices.Count; i++)
            {
                ScheduledSlice scheduledslice = scheduledslices.ElementAt(i);
                LogListPrj.Slice slice = log.newSliceOnList(scheduledslice.scheduleddate);
                for (int j = 0; j < scheduledslice.slots.Count; j++)
                {
                    ScheduledSlot schslot = scheduledslice.slots.ElementAt(j);
                    DataItem item = null;
                    if (schslot.type == "AUDIO")
                    {
                        item = new DataSongItem(schslot.iddataitem, schslot.dataitem.artist, schslot.dataitem.title, System.Configuration.ConfigurationSettings.AppSettings["MusicPath"] + "" + schslot.dataitem.file, new TimeMarker(TimeSpan.Zero, schslot.dataitem.runtime));
                        item.setField("pic1", schslot.dataitem.radiovis1);
                        item.setField("pic2", schslot.dataitem.radiovis2);
                        item.setField("pic3", schslot.dataitem.radiovis3);
                        item.setField("pic4", schslot.dataitem.radiovis4);
                        item.setField("radiovistxt", schslot.dataitem.radiovistxt);
                        item.setField("currentdescr", schslot.dataitem.radiovistxt);

                    }
                    else if (schslot.type == "LOGNOTE")
                    {
                        item = new DataLogNoteItem(schslot.idhist, schslot.param, TimeSpan.Zero);

                    }
                    else if (schslot.type == "SYNC")
                    {
                        if(schslot.param == "HARD")
                            item = new DataSyncItem(schslot.idhist, DS.SyncType.HARD, schslot.scheduleddatetime);

                        else
                            item = new DataSyncItem(schslot.idhist, DS.SyncType.SOFT, schslot.scheduleddatetime);
                    }

                    if(item != null)
                        log.addDataToSlice(item, slice, schslot.idhist, date);
                }

            }

                log.refreshAirdatetime();
                log.loadPlaylist();
            return log;
        }
Пример #14
0
        public LogList loadLogList(DateTime start, DateTime end)
        {

            isConnected();
            String q = "SELECT * FROM scheduledslice ";

            LogList log = new LogList();


            //log.slices.AddLast();

            log.refreshAirdatetime();
            return log;
        }