Example #1
0
    //Deserializer deserializer = new Deserializer();
    public void ReceviceDebugMsg(DebugMsg msg, params object[] objs)
    {
        isDebug = true;

        debugList.Add(msg);
        return;
    }
Example #2
0
        public void sendEmailToO2Support(string subject, string text, bool sendSync)
        {
            sendMessageToolStripMenuItem1.Text = "Sending email....";
            try
            {
                var screenShotToSend = new PictureBox
                {
                    BackgroundImage =
                        Screenshots.getScreenshotOfFormObjectAndItsControls(this)
                };
                DI.log.debug("Sending email to O2 Support with: " + text);
                Mail.sendMail(PublicDI.sEmailHost, "*****@*****.**",
                              PublicDI.sEmailToSendBugReportsTo, "",
                              "Email from O2 User - " + subject,
                              Mail.getUserDetailsAsEmailFormat() + Environment.NewLine + text,
                              DebugMsg.createAttachmentsForRemoteSupport(DebugMsg.getFirstRtbObject(), screenShotToSend),
                              sendSync, emailMessageSent);

                //
            }
            catch (Exception ex)
            {
                DI.log.ex(ex, "in sendEmailToO2Support");
                DI.log.error(
                    "Could not send support email, please ensure that this o2 module is connected to the Internet");
            }
        }
Example #3
0
        public static bool launch(string parentFormTitle)
        {
            try
            {
                if (isGuiLoaded())
                {
                    PublicDI.log.error("There is already a GUI loaded and only one can be loaded");
                    return(false);
                }
                //parentFormTitle = ClickOnceDeployment.getFormTitle_forClickOnce(parentFormTitle);
                //new O2DockPanel();

                O2Thread.staThread(() => new O2DockPanel());

                var maxTimeToWaitForGuiCreation = 20000;
                if (O2DockPanel.guiLoaded.WaitOne(maxTimeToWaitForGuiCreation))
                {
                    O2AscxGUI.o2GuiWithDockPanel.invokeOnThread(() => O2AscxGUI.o2GuiWithDockPanel.Text = parentFormTitle);
                    return(true);
                }
                if (false == DebugMsg.IsDebuggerAttached())
                {
                    //PublicDI.log.reportCriticalErrorToO2Developers(null, null, "from O2AscxGUI: GUI was not available after 20 seconds");
                    PublicDI.log.error("from O2AscxGUI: GUI was not available after 20 seconds");
                }
                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #4
0
 public void Init(Camera mainCamera, Camera landmarkCamera)
 {
     _main       = mainCamera;
     _landmark   = landmarkCamera;
     _saturation = _main.gameObject.GetComponent <UnsaturatePostEffect>();
     if (!_saturation)
     {
         DebugMsg.ComponentNotFound(Debug.LogWarning, typeof(UnsaturatePostEffect));
     }
     _outliner = _landmark.gameObject.GetComponent <OutlinerPostEffect>();
     if (!_outliner)
     {
         DebugMsg.ComponentNotFound(Debug.LogWarning, typeof(OutlinerPostEffect));
     }
     _depthOfField = _landmark.gameObject.GetComponent <DepthOfField>();
     if (!_depthOfField)
     {
         DebugMsg.ComponentNotFound(Debug.LogWarning, typeof(DepthOfField));
     }
     else
     {
         _depthOfField.enabled = false;
     }
     _shake = _main.GetComponent <CameraShake>();
     if (!_shake)
     {
         DebugMsg.ComponentNotFound(Debug.LogWarning, typeof(CameraShake));
     }
 }
    void CheckHistotryFrame(DebugMsg msg)
    {
        //Debug.Log("CheckHistotryFrame");
        for (int i = 0; i < msg.infos.Count; i++)
        {
            if (m_world.GetEntityIsExist(msg.infos[i].id))
            {
                for (int j = 0; j < msg.infos[i].infos.Count; j++)
                {
                    if (msg.infos[i].infos[j].m_compName == "CommandComponent")
                    {
                        CheckCommandLogic(msg, msg.infos[i], msg.infos[i].infos[j]);
                    }
                    else
                    {
                        CheckComponentLogic(msg, msg.infos[i], msg.infos[i].infos[j]);
                    }
                }
            }
            else
            {
                //string log = "error not find entity frame " + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + msg.infos[i].id + "\n";
                //Debug.LogWarning(log);
            }
        }

        for (int i = 0; i < msg.singleCompInfo.Count; i++)
        {
            CheckSingleComponentLogic(msg, msg.singleCompInfo[i]);
        }
    }
Example #6
0
 public override void Enter()
 {
     base.Enter();
     DebugMsg.Log("进入战斗待机状态");
     _time = 0;
     SetAgentState(KeyNameEnum.NEAR_ENEMY, false);
 }
Example #7
0
        public static O2DockContent addAscxControlToO2GuiWithDockPanelWithDockState(Type ascxControlToLoad,
                                                                                    DockState dockState,
                                                                                    String name, bool showControl)
        {
            if (O2AscxGUI.o2GuiWithDockPanel == null)
            {
                PublicDI.log.error(" in addAscxControlToO2GuiWithDockPanelWithDockState o2GuiWithDockPanel was null, so aborting load of {0}", ascxControlToLoad.FullName);
                return(null);
            }
            var o2DocContent = new O2DockContent(ascxControlToLoad, dockState, name);

            // add it as soon as possible to this list (in case there is a request for it from another thread)
            O2DockUtils.addO2DockContentToDIGlobalVar(o2DocContent);

            if (showControl)
            {
                //add content to DockPanel (in a thread safe way)
                showO2DockContentInDockPanel(o2DocContent);


                // wait for control to be loaded
                if (false == DebugMsg.IsDebuggerAttached())
                {
                    o2DocContent.controlLoadedIntoGui.WaitOne();
                }
                else if (false == o2DocContent.controlLoadedIntoGui.WaitOne(10000))
                {
                    PublicDI.log.error("Failed to load control {0} in 10 sec", o2DocContent.name);
                }
            }
            return(o2DocContent);
        }
        public static bool createCirDump(String sApplicationToScan, String sScanResultsFolder,
                                         Callbacks.dMethod_Object dProcessCompletionCallback, Callbacks.dMethod_String _logCallback,
                                         bool bDeleteAllRulesFromDbBeforeScan,
                                         bool bStoreControlFlowBlockRawDataInsideCirDataFile)
        {
            var srScanResults = new O2scanresults
            {
                bDeleteAllRulesForCirCreation = bDeleteAllRulesFromDbBeforeScan,
                dProcessCompletionCallback    = dProcessCompletionCallback,
                logCallback        = _logCallback,
                bCreateCirDataFile = true,
                bStoreControlFlowBlockRawDataInsideCirDataFile =
                    bStoreControlFlowBlockRawDataInsideCirDataFile,
                bDeleteCreatedAssessmentFile = true
            };
            // srScanResults.sPathToCirDumpFiles = sScanResultsFolder; // o2.rules.scan.CalculateCirDataFileNameInResultsFolder(sApplicationToScan, sScanResultsFolder);

            bool bScanResult = srScanResults.scanApplication(sApplicationToScan);


            //o2.rules.scan.SaveCirDataFile(srScanResults, sScanResultsFolder);
            DebugMsg.saveLogIntoFile(Path.Combine(sScanResultsFolder,
                                                  Path.GetFileNameWithoutExtension(sApplicationToScan) +
                                                  " - CreateConsolidatedCirDump.txt"));

            return(bScanResult);
        }
    void CheckSingleComponentLogic(DebugMsg msg, ComponentInfo info)
    {
        RecordSystemBase   rsb = m_world.GetRecordSystemBase(info.m_compName);
        SingletonComponent sc  = rsb.GetSingletonRecord(msg.frame);

        if (sc == null)
        {
            //Debug.LogWarning("");
            return;
        }

        string content = Serializer.Serialize(sc);

        if (!content.Equals(info.content))
        {
            string log = "error: frame" + msg.frame + " currentFrame:" + m_world.FrameCount + " HashCode " + sc.GetHashCode() + " singleComp:" + info.m_compName + "\n remote:" + info.content + "\n local:" + content + "\n";
            Debug.LogWarning(log);
            rsb.PrintRecord(0);

            Time.timeScale = 0;
            Record(log);
            OutPutDebugRecord();
        }
        else
        {
            //Debug.Log("singleComp correct ! frame " + msg.frame + " m_world:" + m_world.FrameCount + "\ncontent " + info.content);
        }
    }
Example #10
0
        public void Awake()
        {
            if (_instance == null)
            {
                _instance = this;
                _canvas   = transform.FindChild("Canvas");
                if (!_canvas)
                {
                    DebugMsg.GameObjectNotFound(Debug.LogError, "Canvas");
                }

                foreach (Transform child in _canvas.transform.GetComponentsInChildren <Transform>())
                {
                    if (child.name.Equals("Crosshair"))
                    {
                        _crosshair = child.gameObject;
                    }
                }
                GameObject black = new GameObject("_blackImage");
                black.transform.parent = _canvas.transform;
                black.transform.LocalReset();
                _blackImage       = black.AddComponent <Image>();
                _blackImage.color = new Color(0, 0, 0, 0);
                DontDestroyOnLoad(this);
            }
            else
            {
                Destroy(gameObject);
            }
        }
Example #11
0
        public override void Enter()
        {
            base.Enter();
            DebugMsg.Log("进入警戒状态");

            OnComplete();
        }
    public void DebugLogic(DebugMsg msg)
    {
        //Debug.Log("DebugLogic ");

        if (msg.frame == m_world.FrameCount)
        {
            CheckCurrentFrame(msg);
        }
        else if (msg.frame < m_world.FrameCount)
        {
            Debug.Log("检查了历史数据 msg " + msg.frame + " world" + m_world.FrameCount);
            //CheckHistotryFrame(msg);
        }
        else
        {
            string log = "服务器超前 msg:" + msg.frame + " m_world:" + m_world.FrameCount + "\n";
            Debug.LogWarning(log);
            //syncLog += log;
        }

        var dr = GetDebugMsg(msg.frame);

        if (dr != null && dr.msg != msg.msg)
        {
            //Time.timeScale = 0;
            //Debug.LogWarning("msg error! frame :" + msg.frame + "\nlocal :\n " + dr.msg + "\nremote :\n " + msg.msg);
        }
        else
        {
            //Debug.Log("msg " + msg.msg);
        }

        RecordDebugMsg(msg);
    }
Example #13
0
        public static void executeInAppDomain(string appDomainName, string scriptToExecute)
        {
            O2Thread.mtaThread(
                () => {
                var o2AppDomain = new O2.Kernel.Objects.O2AppDomainFactory(appDomainName);
                try
                {
                    o2AppDomain.load("O2_XRules_Database");
                    o2AppDomain.load("O2_Kernel");
                    o2AppDomain.load("O2_DotNetWrappers");

                    var o2Proxy = (O2Proxy)o2AppDomain.getProxyObject("O2Proxy");

                    o2Proxy.InvokeInStaThread = true;
                    o2Proxy.staticInvocation("O2_External_SharpDevelop", "FastCompiler_ExtensionMethods", "executeSourceCode", new object[] { scriptToExecute });
                }
                catch (Exception ex)
                {
                    ex.log("inside new AppDomain");
                }

                DebugMsg.showMessageBox("Click OK to close the '{0}' AppDomain (and close all open windows)".format(appDomainName));
                o2AppDomain.unLoadAppDomain();
            });
        }
Example #14
0
    //void CheckCurrentCommandLogic(DebugMsg msg, EntityBase entity, EntityInfo entityInfo, ComponentInfo compInfo)
    //{

    //}

    void CheckCurrentComponentLogic(DebugMsg msg, EntityBase entity, EntityInfo entityInfo, ComponentInfo compInfo)
    {
        //Debug.Log("CheckCurrentComponentLogic");

        if (!m_world.GetExistRecordSystem(compInfo.m_compName))
        {
            return;
        }

        ComponentBase compLocal = entity.GetComp(compInfo.m_compName);

        if (IsFilter(compInfo.m_compName))
        {
            string content = Serializer.Serialize(compLocal);

            if (!content.Equals(compInfo.content))
            {
                RecordSystemBase rsb = m_world.GetRecordSystemBase(compInfo.m_compName);

                string log = "error: frame" + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + entity.ID + " msg.id " + entityInfo.id + " comp:" + compInfo.m_compName + "\n remote:" + compInfo.content + "\n local:" + content + "\n";
                Debug.LogWarning(log);
                rsb.PrintRecord(entity.ID);

                //派发冲突
                GlobalEvent.DispatchEvent(c_isConflict, msg.frame);

                Time.timeScale = 0;
                OutPutDebugRecord();
            }
            else
            {
                //Debug.Log("ReceviceDebugMsg  correct! frame " + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + entity.ID + " msg.id " + entityInfo.id + " comp:" + compInfo.m_compName + " content :" + compInfo.content);
            }
        }
    }
Example #15
0
        public async override void Enter()
        {
            DebugMsg.Log("进入受伤状态");
            //模拟受伤状态的延时时间
            await Task.Delay(TimeSpan.FromSeconds(2));

            OnComplete();
        }
Example #16
0
 public override void Enter()
 {
     base.Enter();
     DebugMsg.Log("进入移动状态");
     _self       = (Transform)_agent.Maps.GetGameData(DataName.SELF_TRANS);
     _enemy      = (Transform)_agent.Maps.GetGameData(DataName.ENEMY_TRANS);
     _controller = _self.GetComponent <CharacterController>();
 }
Example #17
0
 //计划完成了当前动作
 private void PlanActionComplete(TAction actionLabel)
 {
     DebugMsg.Log("下一步");
     if (_planHandler.GetCurrentHandler().Label.ToString() == actionLabel.ToString())
     {
         _planHandler.NextAction();
     }
 }
 public static string sayHellotoMe(string myName, bool showInMessageBox)
 {
     string message = string.Format("Hello {0}", myName);
     log.info(message);
     if (showInMessageBox)
         DebugMsg.showMessageBox(message);
     return message;
 }
        public static ascx_LogViewer add_LogViewer <T>(this T control)
            where T : Control
        {
            var logControl = control.add_Control <ascx_LogViewer>();

            DebugMsg.startShowThread();                                 //ensure the show thread is started
            return(logControl);
        }
Example #20
0
 public void UpdateData()
 {
     if (WhetherToReplan())
     {
         DebugMsg.Log("制定新计划");
         BuildPlanAndStart();
     }
 }
Example #21
0
 public void RemoveInteraction(Interaction interaction)
 {
     try {
         AvailableInteractions.Remove(interaction);
     }
     catch (NoSuchItemException) {
         DebugMsg.NoExistantInteraction(Debug.LogWarning);
     }
 }
        public static void sayHelloO2World()
        {
            var response = "Hello there, do you want me to say hello to you?".askUserQuestion();

            if (response)
            {
                DebugMsg.showMessageBox("Thanks and Hello from the OWASP O2 Platform :)");
            }
        }
Example #23
0
    public override void NoRecalcLateFixedUpdate(int deltaTime)
    {
        if (!isDebug)
        {
            return;
        }

        DebugMsg msg = new DebugMsg();

        msg.frame = m_world.FrameCount;
        msg.infos = new List <EntityInfo>();

        for (int i = 0; i < m_world.m_entityList.Count; i++)
        {
            EntityBase eb    = m_world.m_entityList[i];
            EntityInfo einfo = new EntityInfo();
            einfo.id = eb.ID;

            einfo.infos = new List <ComponentInfo>();

            foreach (var item in eb.m_compDict)
            {
                if (item.Value.GetType().IsSubclassOf(typeof(PlayerCommandBase)))
                {
                    CommandComponent cc   = (CommandComponent)item.Value;
                    ComponentInfo    info = new ComponentInfo();
                    cc.time         = 0;
                    info.m_compName = item.Value.GetType().Name;
                    info.content    = Serializer.Serialize(item.Value);

                    einfo.infos.Add(info);
                }
                else if (IsFilter(item.Value.GetType().Name))
                {
                    ComponentInfo info = new ComponentInfo();
                    info.m_compName = item.Value.GetType().Name;
                    info.content    = Serializer.Serialize(item.Value);

                    einfo.infos.Add(info);
                }
            }

            if (einfo.infos.Count > 0)
            {
                msg.infos.Add(einfo);
            }
        }

        List <EntityBase> list = GetEntityList();

        for (int i = 0; i < list.Count; i++)
        {
            ConnectionComponent cc = list[i].GetComp <ConnectionComponent>();
            ProtocolAnalysisService.SendMsg(cc.m_session, msg);
        }
    }
 public void Start()
 {
     CurrentConfig = new LookConfig();
     _camera       = GetComponentInChildren <Camera>();
     if (FixedForward == null)
     {
         DebugMsg.ComponentNotFound(Debug.LogWarning, typeof(Transform), "Initialized with <b>this</b> object transform instead.");
         FixedForward = transform;
     }
 }
Example #25
0
 protected void AddModel(T label, IModel model)
 {
     if (!_modelsDic.ContainsKey(label))
     {
         _modelsDic.Add(label, model);
     }
     else
     {
         DebugMsg.LogError("缓存中未找到,未对该Model对象进行初始化,标签:" + label);
     }
 }
Example #26
0
 public void ExcuteState(T key)
 {
     if (_viewDic.ContainsKey(key))
     {
         _fsm.ExcuteNewState(key);
     }
     else
     {
         DebugMsg.LogWarning("动作" + key + "不在当前动作缓存内");
     }
 }
Example #27
0
        public void UpdateData()
        {
            if (_agent.IsAgentOver)
            {
                return;
            }

            if (WhetherToReplan())
            {
                DebugMsg.Log("制定新计划");
                BuildPlanAndStart();
            }
        }
Example #28
0
 public override void Execute()
 {
     base.Execute();
     if (_time < 2)
     {
         _time += Time.fixedDeltaTime;
     }
     else
     {
         DebugMsg.Log("战斗待机状态完成");
         OnComplete();
     }
 }
Example #29
0
        protected void AddView(IFsmState <T> state)
        {
            T key = state.Label;

            if (_viewDic.ContainsKey(key))
            {
                DebugMsg.LogError("已包含当前键值");
            }
            else
            {
                _viewDic.Add(key, state);
            }
        }
Example #30
0
        public static bool ScanWithNoRules(String sApplicationToScan, String sScanResultsFolder,
                                           Callbacks.dMethod_Object dProcessCompletionCallback)
        {
            var srScanResults = new O2scanresults();

            srScanResults.bScanWithNoRules = true;
            bool bScanResult = srScanResults.scanApplication(sApplicationToScan);

            DebugMsg.saveLogIntoFile(Path.Combine(sScanResultsFolder,
                                                  Path.GetFileNameWithoutExtension(sApplicationToScan) +
                                                  " - Scan_WithNoRules.txt"));
            return(bScanResult);
        }