Exemplo n.º 1
0
 public PackBrowser(string filename)
 {
     // Set PrgressDialog
     this.pd = new ProgressDialog(this.Handle);
     this.pd.Title = this.Name;
     this.pd.Caption = Properties.Resources.Str_Initialize;
     this.pd.Animation = 151;
     this.pd.ShowDialog();
     InitializeComponent();
     this.PackFile = filename;
     this.w = new Worker(false);
     this.d = new Dialogs();
     this.isVista = (Environment.OSVersion.Version.Major >= 6) ? true : false;
 }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            OperatingSystem osInfo = Environment.OSVersion;
            this.isVista = (osInfo.Version.Major >= 6) ? true : false;
            this.env = new MabiEnvironment(Properties.Resources.Uri_PatchTxt);
            this.d = new Dialogs();
            this.w = new Worker();
            this.PackageDir = this.env.MabinogiDir + "\\Package";
            this.MabiVer = (int)this.env.LocalVersion;
            this.Text = AssemblyProduct + String.Format(" v.{0}", AssemblyVersion);
            this.filter = Properties.Resources.PackFileDesc + "(*.pack)|";
            String PackageDir = (Properties.Settings.Default.LastPackFile != "") ?
                Properties.Settings.Default.LastPackFile :
                this.PackageDir;
            if (isVista){
                GlassExtensions.HookGlassRender(InputDir);
                GlassExtensions.HookGlassRender(SaveAs);
                GlassExtensions.HookGlassRender(Level);
                //new GlassRenderer(Level, 0, 0);
                GlassExtensions.HookGlassRender(PackageVersion);
                GlassExtensions.HookGlassRender(OpenPack);
                GlassExtensions.HookGlassRender(ExtractTo);
            }
            #region Init Pack Tab
            PackageVersion.Minimum = this.MabiVer;
            PackageVersion.Value = Int32.Parse(DateTime.Today.ToString("yyMMdd"));
            uCurrentVer.Text = String.Format("(Current:{0} / Server:{1})", env.LocalVersion, env.Version);
            SaveAs.Text = env.MabinogiDir+"\\Package\\custom-" + PackageVersion.Value.ToString() + ".pack";
            Level.SelectedIndex = 0;
            #endregion
            #region Init Unpack Tab

            string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
            ExtractTo.Text = path;
            #endregion
            #region Init About Tab
            labelProductName.Text = AssemblyProduct;
            labelVersion.Text = String.Format("v.{0}", AssemblyVersion);
            labelCopyright.Text = AssemblyCopyright;
            labelDescription.Text = AssemblyDescription;
            #endregion
        }
Exemplo n.º 3
0
 static void Main(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(true);
     // Standard Mode
     if (args.Length == 0)
     {
         Application.Run(new MainWindow());
     }
     else
     {
         if (Win32.AttachConsole(System.UInt32.MaxValue))
         {
             Worker w = new Worker(true);
             Console.Title = "MabiPacker";
             // Console Mode
             StreamWriter stdout = new StreamWriter(Console.OpenStandardOutput());
             stdout.AutoFlush = true;
             Console.SetOut(stdout);
             Console.ForegroundColor = ConsoleColor.Cyan;
             Console.WriteLine("\r\n*** MabiPacker Console Mode ***");
             // Parse query strings
             var options = new HashSet<string> {
                 "/input",	// input path
                 "/output",	// output path
                 "/version",	// version
                 "/level"	// Compress level (optional, default=-1)
             };
             string key = null;
             var result = args
                 .GroupBy(s => options.Contains(s) ? key = s : key)
                 .ToDictionary(g => g.Key, g => g.Skip(1).FirstOrDefault());
             if (result.ContainsKey("/input") == false)
             {
                 Console.ForegroundColor = ConsoleColor.Red;
                 Console.WriteLine("Error: /input value is always required!");
                 Console.ResetColor();
                 Application.Exit();
             }
             if (File.Exists(result["/input"]))
             {
                 // Unpack mode
                 if (result.ContainsKey("/output") == false)
                 {
                     MabiEnvironment u = new MabiEnvironment();
                     result["/output"] = u.MabinogiDir;
                 }
                 Console.ForegroundColor = ConsoleColor.Yellow;
                 // Pack mode
                 w.Unpack(result["/input"], result["/output"]);
             }
             else if (Directory.Exists(result["/input"]))
             {
                 if (result.ContainsKey("/version") == false || result.ContainsKey("/output") == false)
                 {
                     Console.ForegroundColor = ConsoleColor.Red;
                     Console.WriteLine("Error : If /input value is directory, /version and /output value is required.");
                     Console.ResetColor();
                     Application.Exit();
                 }
                 if (result.ContainsKey("/level") == false)
                     result["/level"] = "-1";
                 Console.ForegroundColor = ConsoleColor.Green;
                 // Pack mode
                 w.Pack(result["/input"], result["/output"], uint.Parse(result["/version"]), int.Parse(result["/level"]));
             }
             Console.ForegroundColor = ConsoleColor.Cyan;
             Console.WriteLine("Finish.");
             Console.ResetColor();
             Win32.FreeConsole();
         }else{
             string Query = String.Join(" ", args);
             if (File.Exists(Query) && System.IO.Path.GetExtension(@Query) == ".pack")
             {
                 Application.Run(new PackBrowser(Query));
             }
         }
     }
 }
Exemplo n.º 4
0
 public Dialogs(string MabiDir = "C:\\Nexon\\Mabinogi")
 {
     this.MabiDir = MabiDir;
     this.w = new Worker(false);
     this.isVista = (Environment.OSVersion.Version.Major >= 6) ? true : false;
 }