コード例 #1
0
        } // end of CQConnection Ctor

        /// <summary>
        /// Creates User session, Admin session and executes the query
        /// </summary>
        public void Initialize()
        {
            m_pwd = System.Environment.GetEnvironmentVariable("CQUserPwd");
            if (m_pwd != null)
            {
                m_pwd = m_pwd.Trim();
            }
            if (m_pwd == null)
            {
                Console.Write(UtilityMethods.Format(CQResource.CQ_ENTER_PWD, m_user));
                m_pwd = Microsoft.TeamFoundation.Converters.Utility.LocalizedPasswordReader.ReadLine();
                Display.NewLine();
            }

            CreateUserSession();
            CreateAdminSession();

            try
            {
                m_queryDef = CQWrapper.GetQueryDef(CQWrapper.GetWorkSpace(cqUserSession), m_query);
            }
            catch (ConverterException conEx)
            {
                string errMsg = UtilityMethods.Format(CQResource.CQ_INVALID_QUERY,
                                                      CurConResource.Analysis,
                                                      m_query, m_configFile);
                Logger.Write(LogSource.CQ, TraceLevel.Error, errMsg);
                ConverterMain.MigrationReport.WriteIssue(String.Empty, errMsg, string.Empty /* no item */,
                                                         null, "Config", ReportIssueType.Critical);

                throw new ConverterException(errMsg, conEx);
            }
        }