<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_Tutorial%2FStream_File%2FFile_Utilities</id>
		<title>VB.Net Tutorial/Stream File/File Utilities - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_Tutorial%2FStream_File%2FFile_Utilities"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/Stream_File/File_Utilities&amp;action=history"/>
		<updated>2026-04-05T22:02:07Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_Tutorial/Stream_File/File_Utilities&amp;diff=3680&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/Stream_File/File_Utilities&amp;diff=3680&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_Tutorial/Stream_File/File_Utilities&amp;diff=3681&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/Stream_File/File_Utilities&amp;diff=3681&amp;oldid=prev"/>
				<updated>2010-05-26T12:56:19Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Copy a file==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.IO&lt;br /&gt;
Imports System.Text&lt;br /&gt;
        &lt;br /&gt;
Public Class Tester&lt;br /&gt;
    Public Shared Sub Main&lt;br /&gt;
    &lt;br /&gt;
        Dim mySourceFileStream As FileStream&lt;br /&gt;
        Dim myDestFileStream As FileStream&lt;br /&gt;
        Dim bteRead() As Byte&lt;br /&gt;
        Dim intByte As Integer&lt;br /&gt;
        Dim bteMessage(128) As Byte&lt;br /&gt;
        Dim strCopyMessage As String = &amp;quot;&amp;quot;&lt;br /&gt;
        Try&lt;br /&gt;
            myDestFileStream = New FileStream(&amp;quot;dest.txt&amp;quot;, FileMode.OpenOrCreate, FileAccess.Write)&lt;br /&gt;
            bteMessage = Encoding.ASCII.GetBytes(strCopyMessage)&lt;br /&gt;
            myDestFileStream.Write(bteMessage, 0, bteMessage.Length)&lt;br /&gt;
            mySourceFileStream = New FileStream(&amp;quot;source.txt&amp;quot;, FileMode.OpenOrCreate, FileAccess.Read)&lt;br /&gt;
            intByte = mySourceFileStream.Length&lt;br /&gt;
            ReDim bteRead(intByte)&lt;br /&gt;
            mySourceFileStream.Read(bteRead, 0, intByte)&lt;br /&gt;
            myDestFileStream.Write(bteRead, 0, intByte)&lt;br /&gt;
            myDestFileStream.Close()&lt;br /&gt;
            mySourceFileStream.Close()&lt;br /&gt;
        Catch ex As IOException&lt;br /&gt;
            Console.WriteLine(ex.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Delete a file==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.IO&lt;br /&gt;
Public Class Tester&lt;br /&gt;
    Public Shared Sub Main&lt;br /&gt;
        Dim f As File&lt;br /&gt;
        f.Delete(&amp;quot;test.txt&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Delete a file with kill==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Public Class Tester&lt;br /&gt;
    Public Shared Sub Main&lt;br /&gt;
        Kill(&amp;quot;Test.csv&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==File copy==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Windows.Forms&lt;br /&gt;
public class FileOpenDialogFilter&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
      System.IO.File.Copy(&amp;quot;c:\\test.txt&amp;quot;, &amp;quot;c:\\test1.txt&amp;quot;, True)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Move a File==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Public Class Tester&lt;br /&gt;
    Declare Auto Function MoveFile Lib &amp;quot;KERNEL32.dll&amp;quot; Alias &amp;quot;MoveFile&amp;quot; (ByVal src As String, ByVal&lt;br /&gt;
dst As String) As Boolean&lt;br /&gt;
    Public Shared Sub Main&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
            MoveFile(&amp;quot;d:\\test.txt&amp;quot;, &amp;quot;c:\\test.txt&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Move a file with File.Move==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.IO&lt;br /&gt;
Public Class Tester&lt;br /&gt;
    Public Shared Sub Main&lt;br /&gt;
        Dim f As File&lt;br /&gt;
        f.Move(&amp;quot;test.txt&amp;quot;, &amp;quot;text2.txt&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Unhandled Exception: System.IO.IOException: Cannot create a file when that file already exists.&lt;br /&gt;
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)&lt;br /&gt;
   at System.IO.__Error.WinIOError()&lt;br /&gt;
   at System.IO.File.Move(String sourceFileName, String destFileName)&lt;br /&gt;
   at Tester.Main()&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use FreeFile==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Option Strict On&lt;br /&gt;
Public Module Checking&lt;br /&gt;
   Private Const filename As String = &amp;quot;CheckFile.dat&amp;quot;&lt;br /&gt;
   Public Sub Main()&lt;br /&gt;
      Dim fn As Integer = FreeFile&lt;br /&gt;
      Dim fileOpened As Boolean&lt;br /&gt;
      Try&lt;br /&gt;
         FileOpen(fn, filename, OpenMode.Append)&lt;br /&gt;
         fileOpened = True&lt;br /&gt;
         WriteLine(fn, 1605, Date.Now, &amp;quot;Books&amp;quot;, 2.19)&lt;br /&gt;
      Catch e As Exception&lt;br /&gt;
         Console.WriteLine(e.GetType().Name &amp;amp; &amp;quot;: &amp;quot; &amp;amp; e.Message)&lt;br /&gt;
      Finally&lt;br /&gt;
         If fileOpened Then FileClose(fn)&lt;br /&gt;
      End Try&lt;br /&gt;
   End Sub&lt;br /&gt;
End Module&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use FreeFile to read a text file==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;public class Test&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Dim file_num As Integer = FreeFile()&lt;br /&gt;
        Dim file_name As String = &amp;quot;test.txt&amp;quot;&lt;br /&gt;
        FileOpen(file_num, file_name, OpenMode.Input, OpenAccess.Read, OpenShare.Shared)&lt;br /&gt;
        Do While Not EOF(file_num)&lt;br /&gt;
            Dim txt As String = LineInput(file_num)&lt;br /&gt;
            Console.WriteLine(txt)&lt;br /&gt;
        Loop&lt;br /&gt;
        FileClose(file_num)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use the HMACSHA1 hashing function to generate a checksum for a file.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Text&lt;br /&gt;
Imports System.Security.Cryptography&lt;br /&gt;
Public Class Tester&lt;br /&gt;
    Public Shared Sub Main&lt;br /&gt;
        Dim checksum1 As Byte()&lt;br /&gt;
        checksum1 = GenerateFileChecksum(&amp;quot;test.txt&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Shared Function GenerateFileChecksum(ByVal filePath As String) As Byte()&lt;br /&gt;
        Dim hashingFunction As HMACSHA1&lt;br /&gt;
        Dim hasingBase() As Byte&lt;br /&gt;
        Dim hashValue() As Byte&lt;br /&gt;
        Dim inStream As IO.Stream&lt;br /&gt;
        If (My.ruputer.FileSystem.FileExists(filePath)= False) Then&lt;br /&gt;
            Throw New IO.FileNotFoundException&lt;br /&gt;
            Return Nothing&lt;br /&gt;
        End If&lt;br /&gt;
        hasingBase = (New UnicodeEncoding).GetBytes(&amp;quot;Cookbook&amp;quot;)&lt;br /&gt;
        hashingFunction = New HMACSHA1(hasingBase, True)&lt;br /&gt;
        inStream = New IO.FileStream(filePath,IO.FileMode.Open, IO.FileAccess.Read)&lt;br /&gt;
        hashValue = hashingFunction.ruputeHash(inStream)&lt;br /&gt;
        inStream.Close()&lt;br /&gt;
        Return hashValue&lt;br /&gt;
    End Function&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>