Beispiel #1
0
    public CrashReporter MakeInitial(string projectname = "", eCrashWriteType type = eCrashWriteType.EWRITEMAIL, string clientVersion = "", string gmailID = "", string gmailPWD = "", string mailingList = "", eExceptionType level = eExceptionType.Exception)
    {
        m_eWriteMode          = type;
        m_tCrashReporterLevel = level;

                #if UNITY_EDITOR
        m_eWriteMode = eCrashWriteType.EWRITEFILE;
                #endif
        if (m_eWriteMode == eCrashWriteType.EWRITEOFF)
        {
            return(null);
        }

        m_bCrashCatched = false;
        UnityEngine.Debug.Log("CrashReporter Start!!! Mode:" + m_eWriteMode.ToString());
                #if !UNITY_5_4_OR_NEWER
        Application.RegisterLogCallback(HandleException);
        Application.RegisterLogCallbackThreaded(HandleExceptionThread);
                #else
        Application.logMessageReceived         += HandleException;
        Application.logMessageReceivedThreaded += HandleExceptionThread;
                #endif

        if (projectname.Length > 0)
        {
            m_strProjectName = projectname;
        }

        if (clientVersion.Length > 0)
        {
            m_strBuild_version = clientVersion;
        }

        if (gmailID.Length > 0)
        {
            m_stServerInfo.AddSmtp(new SmtpMailInfo(gmailID, gmailPWD, "smtp.gmail.com", true));
        }

        m_strMailingList = "";
        if (mailingList.Length > 0)
        {
            m_strMailingList = mailingList;
        }

        m_stUserInfo.userID   = "";
        m_stUserInfo.userUID  = "";
        m_stUserInfo.nickname = "";
        m_stUserInfo.teamname = "";


        Routine(UpdateCrashRepoter());

        return(this);
    }
Beispiel #2
0
    public void TestRun()
    {
        m_eWriteMode            = eCrashWriteType.EWRITESERVER;
        m_bUpdateWaitServerInfo = true;

        m_stServerInfo.ClearSmtpList();
        m_stServerInfo.ResetSmtpIndex();

        m_stServerInfo.SetServerHost("http://mobile-crashreport.pmang.com:38320/sendmail/1");

        m_stServerInfo.AddSmtp(new SmtpMailInfo("", "", "mailneo.ds.neowiz.com", false));               // 기존.
        m_stServerInfo.AddSmtp(new SmtpMailInfo("", "", "jderms1.pmang.com", false));
        m_bUpdateWaitServerInfo = false;

        throw new System.Exception();
    }
Beispiel #3
0
    public void SetCrashReporterOnlineInfo(string strConfigFileHost)
    {
#if !UNITY_EDITOR
        m_bUpdateWaitServerInfo = true;
        Routine(WebRequest(strConfigFileHost + "?" + Time.time, null, (msg) => {
            string json     = msg;
            Hashtable table = SG.MiniJsonExtensions.hashtableFromJson(json);

            try {
                m_eWriteMode     = (eCrashWriteType)System.Enum.Parse(typeof(eCrashWriteType), table["mode"].ToString());
                m_strMailingList = table["MailingList"].ToString();

                try {
                    m_tCrashReporterLevel = eExceptionType.None;
                    ArrayList arr         = (ArrayList)table["CrashReporterLevel"];
                    foreach (string item in arr)
                    {
                        m_tCrashReporterLevel |= (eExceptionType)Enum.Parse(typeof(eExceptionType), item);
                    }
                } catch {
                    m_tCrashReporterLevel = eExceptionType.Exception;
                }

                if (m_eWriteMode == eCrashWriteType.EWRITEMAIL)
                {
                    ArrayList list = (ArrayList)table["GmailList"];
                    foreach (Hashtable item in list)
                    {
                        m_stServerInfo.SetServerHost("");
                        m_stServerInfo.AddSmtp(new SmtpMailInfo(item["id"].ToString(), item["pwd"].ToString(), "smtp.gmail.com", true));
                    }
                }
                else if (m_eWriteMode == eCrashWriteType.EWRITESERVER)
                {
                    //					m_stServerInfo.GetCurrentSmtp().userID

                    m_stServerInfo.ClearSmtpList();
                    m_stServerInfo.ResetSmtpIndex();

                    Hashtable hash = (Hashtable)table["ServerInfo"];
                    m_stServerInfo.SetServerHost(hash["host"].ToString());

                    ArrayList list = (ArrayList)hash["SmtpList"];
                    foreach (Hashtable item in list)
                    {
                        m_stServerInfo.AddSmtp(new SmtpMailInfo(item["id"].ToString(), item["pwd"].ToString(), item["smtp"].ToString(), (bool)item["ssl"]));
                    }
                }
            } catch (Exception ex) {
                Debug.LogError(ex.Message);
                m_eWriteMode = eCrashWriteType.EWRITEGAv3;
            }

            m_bUpdateWaitServerInfo = false;
            UnityEngine.Debug.Log("CrashReporter Change Mode:" + m_eWriteMode.ToString());
        }, () => {
            m_eWriteMode            = eCrashWriteType.EWRITEGAv3;
            m_bUpdateWaitServerInfo = false;
        }));
#endif
    }
Beispiel #4
0
    public static CrashReporter StartCrashReporter(GameObject go, string projectname = "", eCrashWriteType type = eCrashWriteType.EWRITEMAIL, string clientVersion = "", string gmailID = "", string gmailPWD = "", string mailingList = "", eExceptionType level = eExceptionType.Exception)
    {
        if (go.GetComponent <MonoBehaviour> () == null)
        {
            throw new Exception("monobehaviour object not set : for use coroutine works");
        }

        if (go.GetComponent <CrashReporter>() != null)
        {
            Destroy(go.GetComponent <CrashReporter>());
        }

        return(go.AddComponent <CrashReporter>().MakeInitial(projectname, type, clientVersion, gmailID, gmailPWD, mailingList, level));
    }