Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static List <KnightSection> GetBeforeNo1Section(int m)
        {
            MillionConfig        config    = LoadMillionConfig();
            Strongest            strongest = GetBeforeNo1(config, m);
            List <KnightSection> result    = new List <KnightSection>();

            foreach (string val in strongest.Knights)
            {
                result.Add(new KnightSection(val));
            }
            return(result);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static MillionConfig LoadMillionConfig()
        {
            MillionConfig config = new MillionConfig();

            if (System.IO.File.Exists("MillionConfig.xml"))
            {
                System.Xml.Serialization.XmlSerializer objXmlSerializer =
                    new System.Xml.Serialization.XmlSerializer(typeof(MillionConfig));
                System.IO.StreamReader sr = new System.IO.StreamReader(
                    "MillionConfig.xml", new System.Text.UTF8Encoding(false));
                config = (MillionConfig)objXmlSerializer.Deserialize(sr);
                //設定ファイルクローズ
                sr.Close();
            }

            return(config);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <param name="sections"></param>
        /// <param name="m"></param>
        /// <returns></returns>
        private static MillionConfig GetMillionConfig(IntegrationDto data, List <KnightSection> sections, int m)
        {
            MillionConfig config    = LoadMillionConfig();
            Strongest     strongest = GetBeforeNo1(config, m);

            strongest.Attack   = data.Atack;
            strongest.Hitpoint = data.HitPoint;
            strongest.Cost     = data.Cost;
            strongest.Knights  = new string[sections.Count()];
            for (int i = 0; i < sections.Count(); i++)
            {
                strongest.Knights[i] = sections[i].KnightName;
            }
            strongest.ComboList = new string[data.Combo.Count()];
            for (int i = 0; i < data.Combo.Count(); i++)
            {
                strongest.ComboList[i] = data.Combo[i].Name;
            }
            return(config);
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="config"></param>
        public static void SaveXmlConfig(IntegrationDto data, List <KnightSection> sections, int m)
        {
            try
            {
                MillionConfig config = GetMillionConfig(data, sections, m);
                XmlSerializer objXmlSerializer;
                using (FileStream objfs = new FileStream("MillionConfig.xml", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
                {
                    //シリアル化し、XMLファイルに保存する
                    objXmlSerializer = new XmlSerializer(typeof(MillionConfig));
                    objXmlSerializer.Serialize(objfs, config);

                    //設定ファイルクローズ
                    objfs.Close();
                }
            }
            catch
            {
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public static IntegrationDto GetBeforeNo1(int m)
        {
            MillionConfig  config    = LoadMillionConfig();
            Strongest      strongest = GetBeforeNo1(config, m);
            IntegrationDto dto       = new IntegrationDto();

            dto.Atack = strongest.Attack;
            dto.Cost  = strongest.Cost;
            if (dto.Cost == 0)
            {
                dto.Cost = 999;
            }
            dto.HitPoint = strongest.Hitpoint;
            dto.Combo    = new List <ComboDto>();
            foreach (string val in strongest.ComboList)
            {
                ComboDto data = new ComboDto();
                data.Name = val;
                dto.Combo.Add(data);
            }
            return(dto);
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        private static Strongest GetBeforeNo1(MillionConfig config, int m)
        {
            Strongest strongest = new Strongest();;

            if (m == 3)
            {
                strongest = config.Strongest3;
            }
            if (m == 6)
            {
                strongest = config.Strongest6;
            }
            if (m == 9)
            {
                strongest = config.Strongest9;
            }
            if (m == 12)
            {
                strongest = config.Strongest12;
            }
            return(strongest);
        }