Exemple #1
0
        /// <summary>
        /// 設定データを文字列化します。
        /// </summary>
        /// <param name="src">対象項目</param>
        /// <returns>設定データ文字列</returns>
        public static string ToPrint(this CheckInfo src)
        {
            switch (src.Mode)
            {
            case SetMode.Terms:
                var dts = Date.FromTerm(src.Data, 2017);
                return((dts == null) ? "" : string.Join(" to ", dts.Where(x => x != DateTime.MinValue && x != DateTime.MaxValue).Select(x => x.ToString("yyyy/MM/dd HH:mm"))));

            case SetMode.Frequency:
                var fqs = Frequency.Split(src.Data);
                return((fqs == null) ? "" : fqs.Join());

            case SetMode.PowerMode:
                var pms = PowerMode.ToArray(src.Data);
                return((pms == null) ? "" : string.Join(", ", pms.Select(x => x.ToString())));

            case SetMode.Sector:
                var data = src.Data.Replace("\r\n", "`");
                var scs  = Sectors.ToArray(data)?.ToArray();
                return((scs == null) ? "" : string.Join("\r\n", scs.Select(x => x.ToString())));

            default:
                return(src.Data.ToString());
            }
        }
Exemple #2
0
        /// <summary>
        /// 0から始まる対象の部門番号を取得
        /// </summary>
        /// <param name="Category">対象カテゴリ</param>
        /// <param name="General">コンテスト設定 (一般)リスト</param>
        /// <returns>部門番号</returns>
        public static int GetCategoryIndex(string Category, List <CheckInfo> General)
        {
            int ret = -1;

            var sec = Sectors.ToArray(General.GetByName("Sectors")).ToList();

            for (int i = 0; i < sec.Count; i++)
            {
                if (Category == "(" + sec[i].Code + ")" + sec[i].WrittenName)
                {
                    ret = i;
                    break;
                }
            }

            return(ret);
        }
Exemple #3
0
 /// <summary>
 /// 対象の部門データを取得
 /// </summary>
 /// <param name="Category">対象カテゴリ</param>
 /// <param name="General">コンテスト設定 (一般)リスト</param>
 /// <returns>部門データ</returns>
 public static Sectors GetSectorFromCategory(string Category, List <CheckInfo> General)
 {
     return(Sectors.ToArray(General.GetByName("Sectors"))?.FirstOrDefault(x => Category == "(" + x.Code + ")" + x.WrittenName));
 }