コード例 #1
0
ファイル: Program.cs プロジェクト: mesia032/necromancy-server
        public Program(string[] args)
        {
            _consoleLock = new object();
            LogProvider.GlobalLogWrite += LogProviderOnGlobalLogWrite;
            if (args.Length == 2)
            {
                FpmfArchiveIO archiveIO = new FpmfArchiveIO();
                FpmfArchive   archive   = archiveIO.Open(args[0]);
                archiveIO.Save(archive, args[1]);
                return;
            }

            if (args.Length == 1)
            {
                FpmfArchiveIO archiveIO = new FpmfArchiveIO();
                archiveIO.OpenWoItm(args[0]);
                return;
            }


            NecSetting setting = new NecSetting();

            LogProvider.Configure <NecLogger>(setting);

            NecServer server = new NecServer(setting);

            server.Start();
            Console.WriteLine("Press any key to exit..");
            Console.ReadKey();
            server.Stop();
        }
コード例 #2
0
        public override CommandResultType Handle(ConsoleParameter parameter)
        {
            FpmfArchiveIO archiveIO2 = new FpmfArchiveIO();

//            archiveIO2.OpenWoItm("C:\\Games\\Wizardry Online\\data_un\\settings\\item.csv");

//            return CommandResultType.Continue;
            if (parameter.Arguments.Count == 2)
            {
                FpmfArchiveIO  archiveIO = new FpmfArchiveIO();
                string[]       hedFiles;
                FileAttributes attr = File.GetAttributes(parameter.Arguments[0]);
                if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
                {
                    hedFiles = Directory.GetFiles(parameter.Arguments[0], "*.hed", SearchOption.AllDirectories);
                }
                else
                {
                    hedFiles    = new string[1];
                    hedFiles[0] = parameter.Arguments[0];
                }
                for (int i = 0; i < hedFiles.Length; i++)
                {
                    FpmfArchive archive = archiveIO.Open(hedFiles[i], parameter.Arguments[1]);
                    archiveIO.Save(archive, parameter.Arguments[1]);
                }
                return(CommandResultType.Completed);
            }
            else if (parameter.Arguments.Count == 1)
            {
                FpmfArchiveIO archiveIO = new FpmfArchiveIO();
                FpmfArchive   archive   = archiveIO.Open(parameter.Arguments[0]);
                archiveIO.OpenWoItm(parameter.Arguments[0]);
                return(CommandResultType.Completed);
            }
            else if (parameter.Arguments.Count == 3)
            {
                FpmfArchiveIO  archiveIO = new FpmfArchiveIO();
                string[]       hedFiles;
                FileAttributes attr = File.GetAttributes(parameter.Arguments[1]);
                if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
                {
                    hedFiles = Directory.GetFiles(parameter.Arguments[1], "*.hed", SearchOption.AllDirectories);
                }
                else
                {
                    hedFiles    = new string[1];
                    hedFiles[0] = parameter.Arguments[1];
                }
                for (int i = 0; i < hedFiles.Length; i++)
                {
                    if (parameter.Arguments[0] == "header")
                    {
                        archiveIO.Header(hedFiles[i], parameter.Arguments[2]);
                    }
                }
                return(CommandResultType.Completed);
            }

            return(CommandResultType.Continue);
        }