示例#1
0
 public CBaseElement(CKey parent, SPosition pos)
 {
     _parent = parent;
     if (_parent != null)
     {
         _parent.AddChild(this);
     }
     _pos = pos;
 }
示例#2
0
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Need the input file.");
                Console.Read();
                return;
            }

            var inFile   = args[0];
            var outFile  = inFile + ".json";
            var outFile2 = inFile + ".txt";

            if (!File.Exists(inFile))
            {
                Console.WriteLine("File not found.");
                Console.Read();
                return;
            }

            var isDone = false;

            try
            {
                // OBS:
                // It's better to convert using same class model
                // as the one used in AikaEmu.GameServer.

                var fileName = Path.GetFileNameWithoutExtension(inFile);
                if (fileName == null)
                {
                    return;
                }

                BaseConvert convert = null;
                switch (fileName)
                {
                case "ItemList":
                    convert = new ItemList();
                    break;

                case "npcpos":
                    convert = new NpcPos();
                    break;

                case "MobPos":
                    convert = new MobPos();
                    break;

                case "ExpList":
                    convert = new ExpList();
                    break;

                case "PranExpList":
                    convert = new PranExpList();
                    break;

                case "MN":
                    convert = new Mn();
                    break;

                case "GearCore":
                    convert = new GearCore();
                    break;

                case "ConvertCore":
                    convert = new ConvertCore();
                    break;

                case "Title":
                    convert = new Title();
                    break;

                case "Recipe":
                    convert = new Recipe();
                    break;

                case "RecipeRate":
                    convert = new RecipeRate();
                    break;

                case "ItemEffect":
                    convert = new ItemEffect();
                    break;

                case "ReinforceA":
                case "ReinforceW":
                    convert = new ReinforceA();
                    ((ReinforceA)convert).IsReinforceW = fileName == "ReinforceW";
                    break;

                case "Reinforce2":
                case "Reinforce3":
                    convert = new Reinforce2();
                    break;

                case "MakeItems":
                    convert = new MakeItems();
                    break;

                case "SetItem":
                    convert = new SetItem();
                    break;

                case "SkillData":
                    convert = new SkillData();
                    break;

                case "Quest":
                    convert = new Quest();
                    break;

                case "Map":
                    convert = new Map();
                    break;

                case "ObjPos":
                    convert = new ObjPos();
                    break;

                case "SPosition":
                    convert = new SPosition();
                    break;

                case "Dialog":
                    convert = new Dialog();
                    break;

                case "StatusPoint":
                    convert = new StatusPoint();
                    break;
                }

                if (convert != null)
                {
                    convert.SetupFile(inFile, outFile, outFile2);
                    convert.Convert();
                    convert.Save();
                    isDone = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Console.Read();
                throw;
            }
            finally
            {
                if (isDone)
                {
                    Console.WriteLine("Input: " + Path.GetFileName(inFile));
                    Console.WriteLine("Output: " + Path.GetFileName(outFile));
                    Console.WriteLine("OutputSql: " + Path.GetFileName(outFile2));
                    Console.WriteLine("Converted with success.");
                }
                else
                {
                    Console.WriteLine("Error in conversion.");
                }
            }

            Console.Read();
        }
示例#3
0
        static void Main(string[] args)
        {
            string[,] array =
            {
                { "A1", "B1", "C1", "D1", "E1", "F1", "G1", "H1" },
                { "A2", "B2", "C2", "D2", "E2", "F2", "G2", "H2" },
                { "A3", "B3", "C3", "D3", "E3", "F3", "G3", "H3" },
                { "A4", "B4", "C4", "D4", "E4", "F4", "G4", "H4" },
                { "A5", "B5", "C5", "D5", "E5", "F5", "G5", "H5" },
                { "A6", "B6", "C6", "D6", "E6", "F6", "G6", "H6" },
                { "A7", "B7", "C7", "D7", "E7", "F7", "G7", "H7" },
                { "A8", "B8", "C8", "D8", "E8", "F8", "G8", "H8" },
            };

            string SPosition, EPosition, buchstabe, buchstabe1;
            int    zahl, zahl1;

            Console.Write("Начальное ");
            SPosition = Check();
            //деление на число и букву
            zahl      = int.Parse(SPosition.Substring(1));
            buchstabe = SPosition.Substring(0, 1).ToUpper();

            // проверка правильности буквы и числа
            while (CheckN(zahl) || CheckB(buchstabe))
            {
                SPosition = Check();
                zahl      = int.Parse(SPosition.Substring(1));
                buchstabe = SPosition.Substring(0, 1).ToUpper();
            }

            // конвертирование
            SPosition = buchstabe + zahl;
            int[] StartPosition = Coordination(array, SPosition);

            // Конечная позиция
            Console.Write("Конечное ");
            EPosition  = Check();
            zahl1      = int.Parse(EPosition.Substring(1));
            buchstabe1 = EPosition.Substring(0, 1).ToUpper();

            while (CheckN(zahl1) || CheckB(buchstabe1))
            {
                EPosition  = Check();
                zahl1      = int.Parse(EPosition.Substring(1));
                buchstabe1 = EPosition.Substring(0, 1).ToUpper();
            }

            // конвертирование
            EPosition = buchstabe1 + zahl1;
            int[] EndPosition = Coordination(array, EPosition);

            // ввод фигуры и ее проверка
            Console.Write("Напишите стандартное обозначение фигуры, которую собируетесь проверить");
            string piece = Console.ReadLine();

            if (piece == "К" || piece == "N")
            {
                Horse(StartPosition[0], StartPosition[1], EndPosition[0], EndPosition[1]);
            }
            else if (piece == "Кр" || piece == "K")
            {
                King(StartPosition[0], StartPosition[1], EndPosition[0], EndPosition[1]);
            }
            else if (piece == "Л" || piece == "R")
            {
                Rook(StartPosition[0], StartPosition[1], EndPosition[0], EndPosition[1]);
            }
            else if (piece == "С" || piece == "B")
            {
                Bishop(StartPosition[0], StartPosition[1], EndPosition[0], EndPosition[1]);
            }
            else if (piece == "Ф" || piece == "Q")
            {
                Queen(StartPosition[0], StartPosition[1], EndPosition[0], EndPosition[1]);
            }
            else if (piece == "п" || piece == "p" || piece == " ")
            {
                Pawn(StartPosition[0], StartPosition[1], EndPosition[0], EndPosition[1]);
            }
            else
            {
                Console.WriteLine("Вы ввели неправильное значеине");
            }
            Console.ReadKey();
        }
示例#4
0
 public CBaseElement(CBaseElement other)
 {
     _pos      = other._pos;
     _comments = other._comments;
 }