Exemple #1
0
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            if (args == null || args.Length < 2)
            {
                Console.Write("No proper arguments were specified or input file not found.\nUSAGE:\nUAsset2Json <action1> [action2] [...] [path or file]\n\nEXAMPLE:\nUAsset2Json -tojson -dumpnames d:\\assets\\my.uasset\nACTIONS:\n -tojson     \tdeserialize uasset(s) into JSON\n -tobin      \tupdates .uasset(s) with changes from JSON\n -dumpnames  \tdumps all names from uasset into .names file\n -dumpmeta   \tdumps some meta from uasset into .meta file\n -instnums   \tadds instance numbers > 0 to FName values in JSON\n -fullinst   \tadds instance numbers > 0 to every FName\n -newentries \tallow new entries (experimental, unstable)\n -verbose    \tprint warnings for some actions\n -force      \tforces updating of complex arrays from JSON\n\nCurrent version: v0.2.a (17 Aug 2019) KZ\nSupported game version: v1.05 (PC)");
                return;
            }
            string[] actions = (from x in RuntimeHelpers.GetSubArray(args, new Range(0, new Index(1, fromEnd: true)))
                                select x.ToLower()).Distinct().ToArray();
            string text = args[new Index(1, fromEnd: true).GetOffset(args.Length)].Trim('"');

            if (File.Exists(text))
            {
                ExportDir(actions, new string[1]
                {
                    text
                });
            }
            else if (Directory.Exists(text))
            {
                ExportDir(actions, Directory.GetFiles(text, "*.uasset", SearchOption.AllDirectories));
            }
            Console.Write("Done");
        }
Exemple #2
0
        public override HashSet <RegisterStorage> CreateTrashedRegisters()
        {
            var arch = (PowerPcArchitecture)Architecture;

            var trashed = new HashSet <RegisterStorage>
            {
                arch.Registers[0],
                arch.Registers[1],
                arch.FpRegisters[0],
                arch.lr,
                arch.ctr,
                arch.xer,
                arch.CrRegisters[0],
                arch.CrRegisters[1],
                arch.CrRegisters[5],
                arch.CrRegisters[7]
            };

            //GPR2 - GPR12
            foreach (var reg in RuntimeHelpers.GetSubArray(arch.Registers.ToArray(), new Range(2, 13)))
            {
                trashed.Add(reg);
            }

            //FPR0 - FPR13
            foreach (var reg in RuntimeHelpers.GetSubArray(arch.FpRegisters.ToArray(), new Range(1, 14)))
            {
                trashed.Add(reg);
            }

            return(trashed);
        }
Exemple #3
0
        public static void ArrayRangeHelperTest()
        {
            int[] a     = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            Range range = Range.All;

            Assert.Equal(a, RuntimeHelpers.GetSubArray(a, range));

            range = new Range(Index.FromStart(1), Index.FromEnd(5));
            Assert.Equal(new int [] { 2, 3, 4, 5 }, RuntimeHelpers.GetSubArray(a, range));

            range = new Range(Index.FromStart(0), Index.FromStart(a.Length + 1));
            Assert.Throws <ArgumentOutOfRangeException>(() => { int [] array = RuntimeHelpers.GetSubArray(a, range); });
        }