Dim folderpath As String = IO.Path.GetDirectoryName(fpath) & "\" Dim sf As String = IO.Path.GetFileNameWithoutExtension(fpath) Dim fstream As New FileStream(fpath, FileMode.Open) Dim fl As New IO.FileInfo(fpath) Dim fcount As Integer = fl.Length Dim f1 As Integer = (fcount / 3) Dim bw As BinaryWriter Dim br As BinaryReader br = New BinaryReader(fstream)
Using fs As New FileStream(folderpath & sf & "_0", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), 0, f1) End Using Using fs As New FileStream(folderpath & sf & "_1", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), f1, f1) End Using Using fs As New FileStream(folderpath & sf & "_2", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), f1 + f1, f1) End Using
05-08-22, 01:34 AM (آخر تعديل لهذه المشاركة : 05-08-22, 01:41 AM {2} بواسطة asmarsou.)
(04-08-22, 11:58 PM)سعود كتب :
اخواني الكرام
هل فيجوال بيسك يمكنها تقسم ملف؟
احاول صيغة اجراء تقسيم ملف فما هو الخطا هنا:
PHP كود :
Dim folderpath As String = IO.Path.GetDirectoryName(fpath) & "\" Dim sf As String = IO.Path.GetFileNameWithoutExtension(fpath) Dim fstream As New FileStream(fpath, FileMode.Open) Dim fl As New IO.FileInfo(fpath) Dim fcount As Integer = fl.Length Dim f1 As Integer = (fcount / 3) Dim bw As BinaryWriter Dim br As BinaryReader br = New BinaryReader(fstream)
Using fs As New FileStream(folderpath & sf & "_0", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), 0, f1) End Using Using fs As New FileStream(folderpath & sf & "_1", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), f1, f1) End Using Using fs As New FileStream(folderpath & sf & "_2", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), f1 + f1, f1) End Using
اخي الفاضل
بالنسبة للسؤال هل فيجوال بيسك يمكنها تقسم ملف؟, بحثت وو جدت مثال لذلك مرفق
(05-08-22, 01:34 AM)asmarsou كتب :
(04-08-22, 11:58 PM)سعود كتب :
اخواني الكرام
هل فيجوال بيسك يمكنها تقسم ملف؟
احاول صيغة اجراء تقسيم ملف فما هو الخطا هنا:
PHP كود :
Dim folderpath As String = IO.Path.GetDirectoryName(fpath) & "\" Dim sf As String = IO.Path.GetFileNameWithoutExtension(fpath) Dim fstream As New FileStream(fpath, FileMode.Open) Dim fl As New IO.FileInfo(fpath) Dim fcount As Integer = fl.Length Dim f1 As Integer = (fcount / 3) Dim bw As BinaryWriter Dim br As BinaryReader br = New BinaryReader(fstream)
Using fs As New FileStream(folderpath & sf & "_0", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), 0, f1) End Using Using fs As New FileStream(folderpath & sf & "_1", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), f1, f1) End Using Using fs As New FileStream(folderpath & sf & "_2", FileMode.Append) bw = New BinaryWriter(fs) bw.Write(br.ReadBytes(fcount - 1), f1 + f1, f1) End Using
اخي الفاضل
بالنسبة للسؤال هل فيجوال بيسك يمكنها تقسم ملف؟, بحثت وو جدت مثال لذلك مرفق
جربت الفكرة على مجلد مضغوط ونجح كل من التقسيم و الدمج
بقيت نقطة وهي الاجراء التالي وهو التقسيم لماذا لا يفعل الزر بعد الانتهاء؟
PHP كود :
Private Sub split(fl As String) btnsplit.Invoke(Sub() btnsplit.Enabled = False) Dim fn As String = IO.Path.GetFileName(fl) Dim fsr As New FileStream(fl, FileMode.Open) Dim fcount As Integer = fsr.Length Dim br As New BinaryReader(fsr) nxt: Dim newfile As String = folder & fn & "_File_" & n Dim fsw As New FileStream(newfile, FileMode.Append) Dim bw As New BinaryWriter(fsw) Dim i As Integer For i = lastindex To fcount - 1 lastindex = i If th.ThreadState = Threading.ThreadState.AbortRequested Then Exit Sub prog1.Invoke(Sub() prog1.Value = ((i / fcount) * 100)) bw.Write(br.ReadBytes(i)) If filelength(newfile) >= splitsize Then n += 1 lastindex += 1 GoTo nxt End If Next newfile = Nothing fsr.Close() fsw.Close() br.Close() bw.Close() btnsplit.Invoke(Sub() btnsplit.Enabled = True) End Sub
مع ان التقسيم انتهى!!!
ما المشكلة؟
بالنسبة للمشروع اللذي رفعه الاخ بارك الله فيه لم اتمكن من استيعابه لانه متقدم جدا و لم اجربه. لكني اطلعت عليه اكثر من مرة ولانه غير انجليزي لم اتمكن من فهم المسميات.
07-08-22, 12:15 AM (آخر تعديل لهذه المشاركة : 07-08-22, 01:13 AM {2} بواسطة سعود.)
و لله الحمد اتممت فكرة التقسيم واعادة التجميع وذلك بوضع حد اقصى لكل الملفات المستخرجة. يفضل استخدام ملفات بحجم كبير و تجعل التقسيم او الحجم بالميجا وليس اقل ولا يحتوي كسر.
باذن الله اذا اكملت المثال ارفعه.
هذا سؤال بالاساسيات:
اللي اعرفه ان جملة on error تتخطى الخطأ فماذا حصل؟