Exemple #1
0
        static string CompressLow(string a7z, string target, uint checksize)
        {
            string command = "a -hide " + "\"" + a7z + "\"" + " " + "\"" + target + "\"";

            StringBuilder sb = new StringBuilder(1024);
//            int r = SevenZip(IntPtr.Zero, command, sb, 1024);
            int r;

            using (SevenZipDLLInResource dll = new SevenZipDLLInResource())
            {
                r = dll.SevenZip(IntPtr.Zero, command, sb, 1024);
            }

            if (r != 0)
            {//エラー発生
                return(sb.ToString());
            }

            if (!File.Exists(a7z))
            {
                return("file not found");
            }
            else if (U.GetFileSize(a7z) < checksize)
            {
                File.Delete(a7z);
                return("file size too short");
            }

            return("");
        }
Exemple #2
0
        static string ExtractLow(string a7z, string dir)
        {
            string command = "x -y -hide -o" + "\"" + dir + "\"" + " " + "\"" + a7z + "\"";


            StringBuilder sb = new StringBuilder(1024);
//            int r = SevenZip(IntPtr.Zero, command, sb, 1024);
            int r;

            using (SevenZipDLLInResource dll = new SevenZipDLLInResource())
            {
                r = dll.SevenZip(IntPtr.Zero, command, sb, 1024);
            }

            if (r != 0)
            {
                return(sb.ToString());
            }
            return("");
        }