Esempio n. 1
0
        private void AddAsset(string path, string entryString)
        {
            if (listViewAssets.FindItemWithText(entryString) != null || !GNF.IsFileValid(path))
            {
                return;
            }

            var item = new ListViewItem
            {
                Text = entryString
            };

            item.SubItems.Add(path);
            listViewAssets.Items.Add(item);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            // If there are no arguments passed then it acts as if help command is ran
            if (args.Count() == 0)
            {
                Program.ShowHelpText();
                return;
            }

            switch (args[0].ToLower())
            {
            default:
            {
                if (args.Count() == 1 && Directory.Exists(args[0]))
                {
                    // If a single existing folder is inputted, the tool will autopack that
                    // The following codes sets up that process

                    string inputDir = args[0];
                    args    = new string[5];
                    args[0] = string.Empty;         // Can equal blank string value

                    args[1] = "-i";
                    args[2] = inputDir;

                    args[3] = "-o";
                    args[4] = Path.GetDirectoryName(inputDir) + "\\output.ba2";

                    goto case "-p";
                }

                Program.ShowHelpText(true);
                break;
            }

            case "-h":
            case "-help":
            {
                Program.ShowHelpText();
                break;
            }

            case "-p":
            case "-pack":
            {
                string inputDir        = string.Empty;
                string outputPath      = string.Empty;
                bool   isStrTableSaved = true;

                for (uint i = 1; i < args.Count(); i++)
                {
                    string option = args[i];

                    switch (option)
                    {
                    default:
                    {
                        Program.ShowHelpText(true);
                        return;
                    }

                    case "-nostrtbl":
                    {
                        isStrTableSaved = false;
                        break;
                    }

                    case "-i":
                    case "-indir":
                    {
                        i++;
                        inputDir = args[i];
                        break;
                    }

                    case "-o":
                    case "-out":
                    {
                        i++;
                        outputPath = args[i];
                        break;
                    }
                    }
                }

                if (string.IsNullOrEmpty(inputDir) || string.IsNullOrEmpty(outputPath))
                {
                    Program.ShowHelpText(true);
                    return;
                }

                Console.WriteLine("Reading and verifying files...");
                var gnfList = new List <GNF>();

                foreach (string file in Directory.GetFiles(inputDir, "*", SearchOption.AllDirectories))
                {
                    if (GNF.IsFileValid(file))
                    {
                        var gnfFile = new GNF
                        {
                            EntryStr = file.Substring(inputDir.Length + 1),
                            RealPath = file
                        };

                        gnfList.Add(gnfFile);
                    }
                }

                Console.WriteLine("Packing...");
                GNMF.Write(outputPath, gnfList, isStrTableSaved);

                Console.WriteLine("\nDone!\n");
                break;
            }
            }
        }