コード例 #1
0
 private void WriteHostInfo(WindowUrl host, Database db)
 {
     Debug.Assert(host != null);
     if (!host.IsFile && !string.IsNullOrEmpty(host.HostName))
     {
         if (!db.IsExist("HostInfo", new { HostUrl = host.HostName }))
         {
             db.Insert("HostInfo", new { HostUrl = host.HostName, HostName = host.HostSimpleName });
         }
     }
 }
コード例 #2
0
        public void WriteSnapshot(Snapshot sshot)
        {
            try
            {
                using (Database db = new Database())
                {
                    WriteSnapshotData(sshot, db);

                    if (!db.IsExist("Snapshots", new { SnapshotId = sshot.SnapshotId }))
                    {
                        WindowUrl host = WindowUrl.Create(sshot.WindowUrl);
                        var       snap = new
                        {
                            SessionId    = sshot.SessionId,
                            SnapshotId   = sshot.SnapshotId,
                            BackgroundId = sshot.BackgroundId,
                            SnapTime     = sshot.SnapTime,
                            ProcessId    = sshot.ProcessId,
                            ProcessName  = sshot.ProcessName,
                            WindowTitle  = sshot.WindowTitle,
                            WindowUrl    = host == null ? sshot.WindowUrl : host.AbsoluteUri,
                            UrlHost      = host == null ? null : host.HostName,
                            ControlText  = sshot.ControlText,
                            InputText    = sshot.InputText,
                        };
                        db.Insert("Snapshots", snap);

                        WriteApplicationInfo(sshot, db);
                        if (host != null)
                        {
                            WriteHostInfo(host, db);
                        }
                    }
                }
            }
            catch (Exception ex) { TraceLogger.Instance.WriteException(ex); throw; }
        }