Esempio n. 1
0
        public void LogLocalEvent(McBaseLogItem aEvent)
        {
            McSerializedItem mcSerializedItem = new McSerializedItem();

            mcSerializedItem.SetItem(aEvent);
            HelperFunctions.DebugLine(aEvent.ToString());
            if (ObjectHolder.CyberGhostCom != null)
            {
                ObjectHolder.CyberGhostCom.AddToDebugLog(mcSerializedItem.GetJsonRepresentation());
            }
        }
 private void ResolveSession(McSessionLogItems item)
 {
     foreach (McSessionLogItem arg_21_0 in item.get_Sessions())
     {
         this.CreateNewSession(0);
         foreach (KeyValuePair <string, List <McSerializedItem> > current in arg_21_0.get_EventTypes())
         {
             using (List <McSerializedItem> .Enumerator enumerator3 = current.Value.GetEnumerator())
             {
                 while (enumerator3.MoveNext())
                 {
                     McBaseLogItem mcBaseLogItem = (McBaseLogItem)enumerator3.Current.GetItem();
                     DebugTreeItem debugTreeItem = new DebugTreeItem
                     {
                         Name        = mcBaseLogItem.get_Name(),
                         Value       = mcBaseLogItem.ToString(),
                         DateTime    = mcBaseLogItem.get_DateTime().ToString(CultureInfo.InvariantCulture),
                         LogCategory = mcBaseLogItem.get_DebugLevel().ToString(),
                         Item        = mcBaseLogItem
                     };
                     if (mcBaseLogItem.get_Name().StartsWith("OpenVPNLog"))
                     {
                         debugTreeItem.NodeName = "OpenVPNLog";
                         string debugData = ((McOpenVpnLogItem)mcBaseLogItem).get_DebugData();
                         debugTreeItem.Highlight = this.ContainsImportantVerb(debugData);
                         this.CreateChildNode(this._mOpenVpnNode, debugTreeItem, mcBaseLogItem);
                     }
                     if (mcBaseLogItem.get_Name().StartsWith("Service"))
                     {
                         debugTreeItem.NodeName = "Service";
                         this.CreateChildNode(this._mServiceNode, debugTreeItem, mcBaseLogItem);
                     }
                     if (mcBaseLogItem.get_Name().StartsWith("Gui"))
                     {
                         debugTreeItem.NodeName = "Gui";
                         this.CreateChildNode(this._mGuiNode, debugTreeItem, mcBaseLogItem);
                     }
                 }
             }
         }
     }
 }
        public void DeserializeDebugData(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return;
            }
            McBaseLogItem mcBaseLogItem = (McBaseLogItem)JsonConvert.DeserializeObject <McSerializedItem>(data).GetItem();

            if (mcBaseLogItem.get_Name() == "Init")
            {
                return;
            }
            DebugTreeItem debugTreeItem = new DebugTreeItem
            {
                Name        = mcBaseLogItem.get_Name(),
                Value       = mcBaseLogItem.ToString(),
                DateTime    = mcBaseLogItem.get_DateTime().ToString(CultureInfo.InvariantCulture),
                LogCategory = mcBaseLogItem.get_DebugLevel().ToString(),
                Item        = mcBaseLogItem
            };

            if (mcBaseLogItem.get_Name().StartsWith("Sessions"))
            {
                this.ResolveSession((McSessionLogItems)mcBaseLogItem);
                return;
            }
            if (mcBaseLogItem.get_Name() == "Exception")
            {
                debugTreeItem.NodeName = "Exception";
                this.CreateChildNode(this._exeptionNode, debugTreeItem, mcBaseLogItem);
                return;
            }
            if (mcBaseLogItem.get_Name().StartsWith("System"))
            {
                debugTreeItem.NodeName = "System";
                this.CreateChildNode(this._systemInfoNode, debugTreeItem, mcBaseLogItem);
                return;
            }
            if (mcBaseLogItem.get_Name().StartsWith("OpenVPNLog"))
            {
                debugTreeItem.NodeName = "OpenVPNLog";
                string debugData = ((McOpenVpnLogItem)mcBaseLogItem).get_DebugData();
                debugTreeItem.Highlight = this.ContainsImportantVerb(debugData);
                if (this._currentSession == null)
                {
                    this._currentSession = this.CreateNewSession(0);
                }
                this.CreateChildNode(this._mOpenVpnNode, debugTreeItem, mcBaseLogItem);
                return;
            }
            if (mcBaseLogItem.get_Name().StartsWith("Service"))
            {
                debugTreeItem.NodeName = "Service";
                if (this._currentSession == null)
                {
                    this._currentSession = this.CreateNewSession(0);
                }
                this.CreateChildNode(this._mServiceNode, debugTreeItem, mcBaseLogItem);
                return;
            }
            if (mcBaseLogItem.get_Name().StartsWith("Gui"))
            {
                debugTreeItem.NodeName = "Gui";
                if (this._currentSession == null)
                {
                    this._currentSession = this.CreateNewSession(0);
                }
                this.CreateChildNode(this._mGuiNode, debugTreeItem, mcBaseLogItem);
            }
        }