Пример #1
0
        /// <summary>
        /// Check client version & start MobiusClientStart to do an update if current version is out of date
        /// </summary>

        public static void UpdateClientVersionIfNecessary()
        {
            if (MobiusClientUtil.UseMobiusClientUserIniFileAsMainIniFile)
            {
                return;                                                                       // skip if not using Mobius services
            }
            if (!MobiusClientUtil.ClientVersionIsUpToDate())
            {
                try
                {
                    string localMobiusClientStartPath = MobiusClientUtil.GetMobiusBaseDirectoryFilePath("MobiusClientStart.exe");
                    if (!System.IO.File.Exists(localMobiusClientStartPath))
                    {
                        return;
                    }

                    Process.Start(localMobiusClientStartPath);
                    Thread.Sleep(1 * 1000);
                    Environment.Exit(-1);                     // exit process immediately
                }
                catch (Exception ex)
                {
                    string msg = DebugLog.FormatExceptionMessage(ex, "Error checking client version");
                    DebugLog.Message(msg);
                    return;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Initialize client log
        /// </summary>
        /// <param name="qualifier">Optional log file qualifier (e.g. Username)</param>

        public static void Initialize(
            string qualifier)
        {
            string logDir;

            //DebugLog.Message("ClientLog.Initialize for user: "******"MobiusClient";

            if (Lex.IsDefined(qualifier))             // qualify log file name, usually by username
            {
                LogFileName += "." + qualifier;       // add qualifier

                logDir = Application.StartupPath + @"\Log";
                if (!Directory.Exists(logDir))
                {
                    try { Directory.CreateDirectory(logDir); }
                    catch (Exception ex) { logDir = Application.StartupPath; }
                }
            }

            else
            {
                string iniFilePath = MobiusClientUtil.GetMobiusBaseDirectoryFilePath("MobiusClient.ini");
                if (Lex.IsDefined(iniFilePath))
                {
                    logDir = Path.GetDirectoryName(iniFilePath);
                }
                else
                {
                    logDir = Application.StartupPath;
                }
            }

            LogFileName = logDir + @"\" + LogFileName + ".log";             // full name

            //DebugLog.Message("ClientLog.LogFileName = " + LogFileName);

            DebugLog.LogFileName = LogFileName;
            DebugLog.ResetFile();
            DebugLog.IDebugLog = new DebugLogMediator();                                   // link DebugLog to us

            Mobius.NativeSessionClient.NativeSessionClient.IDebugLog = DebugLog.IDebugLog; // also for the client to the native sessions

            FatalErrorLogFileName = logDir + @"\MobiusClientFatalError.log";

            return;
        }