Esempio n. 1
0
        //* -----------------------------------------------------------------------*
        /// <summary>起動前の各種検証をします。</summary>
        ///
        /// <returns>起動検証に成功した場合、<c>true</c></returns>
        public bool validate()
        {
            bool bResult = true;

            try
            {
                complete();
                string strErrorMessage = errorMessage;
                CMessageBox.titleBar = title;
                if (strErrorMessage.Length != 0)
                {
                    throw new ArgumentOutOfRangeException(
                              strErrorMessage, "初期設定データの一部に不正な値を検出しました。");
                }
                CLogger.outFile = fileIOConfigure.fileLog;
                CLogger.add(ToString());
                using (CValidateEnvironment envValidator = new CValidateEnvironment())
                {
                    CLogger.add(envValidator.ToString());
                    if (!envValidator.AVALIABLE)
                    {
                        throw new PlatformNotSupportedException(envValidator.ERROR_MESSAGE);
                    }
                }
                using (CValidateDirectX dxValidator = new CValidateDirectX())
                {
                    CLogger.add(dxValidator.ToString());
                    if (!dxValidator.isAvaliablePS11)
                    {
                        throw new PlatformNotSupportedException("ビデオチップがピクセルシェーダ1.1に対応していません。");
                    }
                }
#if WINDOWS
                mutex = new Mutex(false, codename);
                if (!mutex.WaitOne(0, false))
                {
                    throw new ApplicationException("多重起動されました。" + Environment.NewLine + "このアプリケーションは多重起動に対応しておりません。");
                }
#endif
            }
            catch (Exception e)
            {
                CMessageBox.show(
                    "起動時の環境検証に失敗しました。非対応のハードウェアまたはOSを使用しているか、" + Environment.NewLine +
                    "あるいはいくつかのランタイム ライブラリが不足している可能性があります。" +
                    Environment.NewLine + Environment.NewLine + e.ToString());
                bResult = false;
            }
            isAllAvaliable = bResult;
            return(bResult);
        }