Beispiel #1
0
        public static string GetDescription(Enum value, MultilingualDictionaryType dictType)
        {
            if (value == null)
            {
                return(string.Empty);
            }

            if (dictType == MultilingualDictionaryType.Japanese)
            {
                string description = value.ToString();
                var    fieldInfo   = value.GetType().GetField(description);
                var    attributes  =
                    (EnumDescriptionAttribute[])fieldInfo.GetCustomAttributes(typeof(EnumDescriptionAttribute), false);
                if (attributes != null && attributes.Length > 0)
                {
                    description = attributes[0].Description;
                }
                return(description);
            }
            else
            {
                string dictTypeHeader = dictType.ToString();
                string dictTypeKey    = string.Format("{0}_{1}.{2}", dictTypeHeader, value.GetType().ToString(), value.ToString());
                return(DictionaryInfo.GetDictValueForDictKeyForEnum(dictTypeKey));
            }
        }
Beispiel #2
0
        /// <summary>
        /// ini設定ファイルを読込
        /// </summary>
        public static void GetStationFromFile(string file)
        {
            //iniフォルダ
            iniFileDir = Path.GetDirectoryName(file);

            //CanOutputLog
            canOutputLog = Utility.ToInt(GetIniFileString("MAINTE", "CanOutputLog", file)) == 0 ? false : true;

            //ShowExample
            showExample = Utility.ToInt(GetIniFileString("MAINTE", "ShowExample", file)) == 0 ? false : true;

            //moveMessage
            moveMessage = Utility.ToInt(GetIniFileString("MAINTE", "MoveMessage", file)) == 0 ? false : true;


            //mediaDevice
            string mediaDeviceValue = GetIniFileString("MAINTE", "MediaDevice", file);

            foreach (MediaDeivceType type in Enum.GetValues(typeof(MediaDeivceType)))
            {
                if (mediaDeviceValue == type.ToString() || mediaDeviceValue == EnumHelper.GetDescription(type))
                {
                    mediaDevice = type;
                    break;
                }
            }

            //MediaReadaheadTime
            mediaReadaheadTime = Utility.ToInt(GetIniFileString("MAINTE", "MediaReadaheadTime", file));
            if (mediaReadaheadTime <= 10)
            {
                mediaReadaheadTime = 10;
            }

            //MultilingualDictionaryType
            string multiDictTypeValue = GetIniFileString("MAINTE", "MultilingualDictionaryType", file);

            foreach (MultilingualDictionaryType type in Enum.GetValues(typeof(MultilingualDictionaryType)))
            {
                if (multiDictTypeValue == EnumHelper.GetDescription(type))
                {
                    multiDictType = type;
                    break;
                }
            }

            DictionaryInfo.InitMultilingualDictionaryForMessage();


            //WebApiAddress
            webApiAddress = GetIniFileString("MAINTE", "WebApiAddress", file);

            playerID = GetIniFileString("MAINTE", "PlayerID", file);
        }
Beispiel #3
0
        /// <summary>
        /// INIファイルが書き換え可能かを確認します。
        /// </summary>
        public static void CheckIniFileWritable(string file)
        {
            FileStream fs = null;

            try
            {
                fs = File.Open(file, FileMode.Open, FileAccess.ReadWrite);
                fs.Close();
            }
            catch
            {
                throw new Exception(DictionaryInfo.GetMesssage("Message.E010"));
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            try
            {
                // 多重起動防止処理
                Mutex mutex = new Mutex(false, Application.ProductName);
                if (args.Length == 0)
                {
                    if (!mutex.WaitOne(0, false))
                    {
                        GC.KeepAlive(mutex);
                        mutex.Close();
                        return;
                    }
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                //共通変数が初期化
                VariableInfo.InitVariableInfo();

                // 設定ファイルのオープン
                if (File.Exists(VariableInfo.IniFile) == false)
                {
                    IniFileInfo.CreateDefaultIniFile(VariableInfo.IniFile);
                }

                // 設定読み込み
                IniFileInfo.GetIniInfo(VariableInfo.IniFile);
                DictionaryInfo.InitMultilingualDictionaryForClient();

                //LoginForm loginFormInstance = new LoginForm();
                //Application.Run(loginFormInstance);
                //return;

                // メイン画面起動
                MainForm mainFormInstance = new MainForm();

                Application.Run(mainFormInstance);

                mutex.ReleaseMutex();
            }
            catch (Exception ex)
            {
                LogApp.OutputErrorLog("Program", "Main", ex);
            }
        }