Ejemplo n.º 1
0
        protected override Yield Start(XDoc config, Result result)
        {
            yield return(Coroutine.Invoke(base.Start, config, new Result()));

            // read configuration settings
            _username = config["username"].AsText;
            if (string.IsNullOrEmpty(_username))
            {
                throw new ArgumentException(MISSING_FIELD_ERROR, "username");
            }
            _password = config["password"].AsText;
            if (string.IsNullOrEmpty(_password))
            {
                throw new ArgumentException(MISSING_FIELD_ERROR, "password");
            }
            _uri = config["mantis-uri"].AsUri;
            if (_uri == null)
            {
                throw new ArgumentException(MISSING_FIELD_ERROR, "mantis-uri");
            }

            // initialize web-service
            _service     = new MantisWebServices.MantisConnect();
            _service.Url = _uri.At("api", "soap", "mantisconnect.php").ToString();
            result.Return();
        }
Ejemplo n.º 2
0
        protected override Yield Stop(Result result)
        {
            // clear settings
            _uri      = null;
            _password = null;
            _username = null;
            _service  = null;
            yield return(Coroutine.Invoke(base.Stop, new Result()));

            result.Return();
        }
Ejemplo n.º 3
0
        protected override Yield Stop(Result result) {

            // clear settings
            _uri = null;
            _password = null;
            _username = null;
            _service = null;
            yield return Coroutine.Invoke(base.Stop, new Result());
            result.Return();
        }
Ejemplo n.º 4
0
        protected override Yield Start(XDoc config, Result result) {
            yield return Coroutine.Invoke(base.Start, config, new Result());

            // read configuration settings
            _username = config["username"].AsText;
            if(string.IsNullOrEmpty(_username)) {
                throw new ArgumentException(MISSING_FIELD_ERROR, "username");
            }
            _password = config["password"].AsText;
            if(string.IsNullOrEmpty(_password)) {
                throw new ArgumentException(MISSING_FIELD_ERROR, "password");
            }
            _uri = config["mantis-uri"].AsUri;
            if(_uri == null) {
                throw new ArgumentException(MISSING_FIELD_ERROR, "mantis-uri");
            }

            // initialize web-service
            _service = new MantisWebServices.MantisConnect();
            _service.Url = _uri.At("api", "soap", "mantisconnect.php").ToString();
            result.Return();
        }
Ejemplo n.º 5
0
        private static void ReportIssue(string errType, string errMessage, string errTrace)
        {
            try
            {
                using (var c = new MantisConnect())
                {
                    string
                        username = "******",
                        password = "******",
                        version  = App.AssemblyVersion.Substring(2, 3);

                    var os = Environment.OSVersion;

                    //var projects = c.mc_projects_get_user_accessible(username, password);
                    //var vislabProject = (from p in projects where p.name == "VisLab" select p).FirstOrDefault();
                    //var severity = (from s in c.mc_enum_severities(username, password) where s.name == "crash" select s).FirstOrDefault();
                    //var priority = (from p in c.mc_enum_priorities(username, password) where p.name == "high" select p).FirstOrDefault();
                    //var viewState = (from v in c.mc_enum_view_states(username, password) where v.name == "private" select v).FirstOrDefault();

                    string biggestIssueId = c.mc_issue_get_biggest_id(username, password, "1"); //vislabProject.id);

                    c.mc_issue_add(username, password, new IssueData()
                    {
                        view_state = new ObjectRef()
                        {
                            id   = "50",      //viewState.id,
                            name = "private", //viewState.name,
                        },
                        category               = "Bug",
                        summary                = errType.Length > 128 ? errType.Substring(0, 128) : errType,
                        description            = errMessage,
                        additional_information = errTrace,
                        version                = version,
                        severity               = new ObjectRef()
                        {
                            id   = "70",    //severity.id,
                            name = "crash", //severity.name,
                        },
                        priority = new ObjectRef()
                        {
                            id   = "40",   //priority.id,
                            name = "high", //priority.name,
                        },
                        id      = biggestIssueId + 1,
                        project = new ObjectRef()
                        {
                            id   = "1",      //vislabProject.id,
                            name = "VisLab", //vislabProject.name
                        },
                        platform = Environment.Version.ToString(),
                        os       = os.Platform.ToString(),
                        os_build = os.Version.ToString(),
                        notes    = new IssueNoteData[]
                        {
                            new IssueNoteData()
                            {
                                text = string.Format("Is64BitOperatingSystem={0}\nIs64BitProcess={1}\nMachineName={2}\nProcessorCount={3}\nUserDomainName={4}\nUserName={5}\nPhysMemory={6}\nAssemblyVersion={7}\nVissimVersion={8}"
                                                     , Environment.Is64BitOperatingSystem
                                                     , Environment.Is64BitProcess
                                                     , Environment.MachineName
                                                     , Environment.ProcessorCount
                                                     , Environment.UserDomainName
                                                     , Environment.UserName
                                                     , Environment.WorkingSet
                                                     , App.AssemblyVersion
                                                     , vissim.IsInstanciated ? vissim.Instance.Wrap().Version : "UNKNOWN"),
                                view_state = new ObjectRef()
                                {
                                    id   = "50",           //viewState.id,
                                    name = "private",      //viewState.name,
                                },
                            },
                        },
                    });
                }
            }
            catch { }
        }