Beispiel #1
0
        public static void rangerr(string[] args)
        {
            Stream stream = null;

            switch (args[1])
            {
            case "-zip":
                zipopr zip = new zipopr(args[3]);
                stream = zip.ZipToFile("ranger.grp");
                if (stream == null)
                {
                    stream = zip.ZipToFile("r.grp");
                }
                if (stream == null)
                {
                    for (int i = 1; i < 11; i++)
                    {
                        stream = zip.ZipToFile(string.Format("r{0}.grp", i));
                        if (stream != null)
                        {
                            break;
                        }
                    }
                }
                break;

            case "-auto":
                stream = new FileStream(args[3], FileMode.Open);
                break;

            default:
                return;
            }
            Rcore.SaveRToXls(stream, args[4], args[2].Substring(1), args[5]);
        }
Beispiel #2
0
        public static void rangerw(string[] args)
        {
            object[][][] tmpdata = Rcore.FromXls(args[3]);
            if (tmpdata != null)
            {
                Rcore.stringCodeType stringcode = Rcore.stringCodeType.BIG5;
                if (args[2].ToLower() == "-gbk")
                {
                    stringcode = Rcore.stringCodeType.GBK;
                }
                Rcore.RsaveType rsavetype = Rcore.saveRanger(tmpdata, stringcode);
                MemoryStream    stream    = (MemoryStream)(rsavetype.RsaveStream);
                if (args.Length > 5)
                {
                    int tmplength = 0;
                    using (FileStream fsIndex = new FileStream(args[5], FileMode.Create))
                    {
                        using (BinaryWriter bw = new BinaryWriter(fsIndex))
                        {
                            foreach (int index in rsavetype.Rindex)
                            {
                                tmplength += index;
                                bw.Write(tmplength);
                            }
                        }
                    }
                }
                switch (args[1])
                {
                case "-zip":
                    zipopr            zip     = new zipopr(args[4]);
                    zipopr.ZipFileOpr zipfile = zip.ZiptoFiles();
                    zipfile = zip.ReplaceFiles(zipfile, "Ranger.grp", rsavetype.RsaveStream);
                    zipfile = zip.ReplaceFiles(zipfile, "r1.grp", rsavetype.RsaveStream);
                    zipfile = zip.ReplaceFiles(zipfile, "r.grp", rsavetype.RsaveStream);
                    MemoryStream zipstream = (MemoryStream)zip.FilesToZip(zipfile);
                    File.WriteAllBytes(args[4], zipstream.ToArray());
                    break;

                case "-auto":
                    FileStream fs = new FileStream(args[4], FileMode.Create);
                    fs.Write(stream.ToArray(), 0, (int)stream.Length);
                    fs.Close();
                    break;
                }
            }
            //imzopr.imzopr imz = new imzopr.imzopr(args[1]);
            //imz.package(args[2]);
        }