示例#1
0
        static byte[] RLECompression(byte[] indata, string type)
        {
            switch (type.ToUpper())
            {
            case "BM5":
                return(BM5RLE.Compress(indata));

            case "SFCW":
                return(SFCWRLE.Compress(indata));

            default:
                return(BM5RLE.Compress(indata));
            }
        }
示例#2
0
        static void OutputCompressedFile(string input, string output, string type)
        {
            if (File.Exists(input))
            {
                if (!(output == ""))
                {
                    int lztype = -1;
                    try
                    {//if there is no error, then its an LZ type (Lunar)
                        lztype = int.Parse(type);
                        byte[] file    = File.ReadAllBytes(input);
                        byte[] outbyte = null;
                        LCompress.Compress(file, out outbyte, LCompress.GetLZType(type));
                        File.WriteAllBytes(output, outbyte);
                    }
                    catch
                    {
                        switch (type.ToLower())
                        {
                        case "sbm5":
                            Console.WriteLine("Commencing Compression with Super Bomberman 5 RLE Type...");
                            BM5RLE.Compress(input, output);
                            break;

                        case "sfcw":
                            Console.WriteLine("Commencing Compression with Super Famicom Wars LZ/RLE Type...");
                            byte[] data = SFCWRLE.Compress(File.ReadAllBytes(input));
                            File.WriteAllBytes(output, data);
                            break;

                        default:
                            Console.WriteLine("Type argument was invalid. Failed.");
                            break;
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Missing output file argument. Failed.");
                    //message - output file required
                }
            }
            else
            {
                Console.WriteLine("Invalid input file argument. Failed.");
                //message- input file required
            }
        }