From 8f4a9ed3dc55db7b41edc010384b987979e467a8 Mon Sep 17 00:00:00 2001 From: witte Date: Sat, 17 Jun 2023 13:21:27 +0200 Subject: [PATCH] =?UTF-8?q?Projektdateien=20hinzuf=C3=BCgen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.config | 6 + FileMover.sln | 25 +++++ FileMover.vbproj | 123 ++++++++++++++++++++ Form1.Designer.vb | 174 +++++++++++++++++++++++++++++ Form1.resx | 126 +++++++++++++++++++++ Form1.vb | 91 +++++++++++++++ My Project/Application.Designer.vb | 38 +++++++ My Project/Application.myapp | 11 ++ My Project/AssemblyInfo.vb | 35 ++++++ My Project/Resources.Designer.vb | 62 ++++++++++ My Project/Resources.resx | 117 +++++++++++++++++++ My Project/Settings.Designer.vb | 73 ++++++++++++ My Project/Settings.settings | 7 ++ 13 files changed, 888 insertions(+) create mode 100644 App.config create mode 100644 FileMover.sln create mode 100644 FileMover.vbproj create mode 100644 Form1.Designer.vb create mode 100644 Form1.resx create mode 100644 Form1.vb create mode 100644 My Project/Application.Designer.vb create mode 100644 My Project/Application.myapp create mode 100644 My Project/AssemblyInfo.vb create mode 100644 My Project/Resources.Designer.vb create mode 100644 My Project/Resources.resx create mode 100644 My Project/Settings.Designer.vb create mode 100644 My Project/Settings.settings diff --git a/App.config b/App.config new file mode 100644 index 0000000..ffaf540 --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/FileMover.sln b/FileMover.sln new file mode 100644 index 0000000..52bb59b --- /dev/null +++ b/FileMover.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32510.428 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "FileMover", "FileMover.vbproj", "{38C66963-2AC5-4216-AD1A-CAC322DD495F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {38C66963-2AC5-4216-AD1A-CAC322DD495F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38C66963-2AC5-4216-AD1A-CAC322DD495F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38C66963-2AC5-4216-AD1A-CAC322DD495F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38C66963-2AC5-4216-AD1A-CAC322DD495F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED222275-FE9A-4861-BE7C-66CAF9BAFBDC} + EndGlobalSection +EndGlobal diff --git a/FileMover.vbproj b/FileMover.vbproj new file mode 100644 index 0000000..bba51d0 --- /dev/null +++ b/FileMover.vbproj @@ -0,0 +1,123 @@ + + + + + Debug + AnyCPU + {38C66963-2AC5-4216-AD1A-CAC322DD495F} + WinExe + FileMover.My.MyApplication + FileMover + FileMover + 512 + WindowsForms + v4.7.2 + true + true + + + AnyCPU + true + full + true + true + bin\Debug\ + FileMover.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + FileMover.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Form + + + Form1.vb + Form + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + Form1.vb + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + \ No newline at end of file diff --git a/Form1.Designer.vb b/Form1.Designer.vb new file mode 100644 index 0000000..ca76609 --- /dev/null +++ b/Form1.Designer.vb @@ -0,0 +1,174 @@ + _ +Partial Class Form1 + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.TextBox2 = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.Button2 = New System.Windows.Forms.Button() + Me.Timer1 = New System.Windows.Forms.Timer(Me.components) + Me.ProgressBar1 = New System.Windows.Forms.ProgressBar() + Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker() + Me.Label3 = New System.Windows.Forms.Label() + Me.Panel3 = New System.Windows.Forms.Panel() + Me.Button3 = New System.Windows.Forms.Button() + Me.Panel3.SuspendLayout() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(3, 16) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(95, 20) + Me.TextBox1.TabIndex = 0 + Me.TextBox1.Text = "E:\yt" + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(3, 0) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(63, 13) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Base Folder" + ' + 'TextBox2 + ' + Me.TextBox2.Location = New System.Drawing.Point(141, 16) + Me.TextBox2.Name = "TextBox2" + Me.TextBox2.Size = New System.Drawing.Size(56, 20) + Me.TextBox2.TabIndex = 0 + Me.TextBox2.Text = "|" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(138, 0) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(53, 13) + Me.Label2.TabIndex = 1 + Me.Label2.Text = "Seperator" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(234, 66) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(114, 23) + Me.Button1.TabIndex = 2 + Me.Button1.Text = "Move Files (1 Time)" + Me.Button1.UseVisualStyleBackColor = True + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(234, 25) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(114, 23) + Me.Button2.TabIndex = 2 + Me.Button2.Text = "Move Files (Loop)" + Me.Button2.UseVisualStyleBackColor = True + ' + 'ProgressBar1 + ' + Me.ProgressBar1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ProgressBar1.Location = New System.Drawing.Point(12, 74) + Me.ProgressBar1.Maximum = 60 + Me.ProgressBar1.Name = "ProgressBar1" + Me.ProgressBar1.Size = New System.Drawing.Size(336, 20) + Me.ProgressBar1.TabIndex = 3 + Me.ProgressBar1.Value = 50 + Me.ProgressBar1.Visible = False + ' + 'BackgroundWorker1 + ' + Me.BackgroundWorker1.WorkerReportsProgress = True + Me.BackgroundWorker1.WorkerSupportsCancellation = True + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(15, 58) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(47, 13) + Me.Label3.TabIndex = 1 + Me.Label3.Text = "Stopped" + Me.Label3.Visible = False + ' + 'Panel3 + ' + Me.Panel3.Controls.Add(Me.Button3) + Me.Panel3.Controls.Add(Me.Label1) + Me.Panel3.Controls.Add(Me.TextBox1) + Me.Panel3.Controls.Add(Me.TextBox2) + Me.Panel3.Controls.Add(Me.Label2) + Me.Panel3.Location = New System.Drawing.Point(12, 12) + Me.Panel3.Name = "Panel3" + Me.Panel3.Size = New System.Drawing.Size(207, 43) + Me.Panel3.TabIndex = 6 + ' + 'Button3 + ' + Me.Button3.Location = New System.Drawing.Point(104, 14) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(31, 23) + Me.Button3.TabIndex = 2 + Me.Button3.Text = "..." + Me.Button3.UseVisualStyleBackColor = True + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(360, 101) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.ProgressBar1) + Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.Panel3) + Me.Controls.Add(Me.Button2) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "Form1" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "File Mover" + Me.Panel3.ResumeLayout(False) + Me.Panel3.PerformLayout() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents TextBox1 As TextBox + Friend WithEvents Label1 As Label + Friend WithEvents TextBox2 As TextBox + Friend WithEvents Label2 As Label + Friend WithEvents Button1 As Button + Friend WithEvents Button2 As Button + Friend WithEvents Timer1 As Timer + Friend WithEvents ProgressBar1 As ProgressBar + Friend WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker + Friend WithEvents Label3 As Label + Friend WithEvents Panel3 As Panel + Friend WithEvents Button3 As Button +End Class diff --git a/Form1.resx b/Form1.resx new file mode 100644 index 0000000..f6f80a2 --- /dev/null +++ b/Form1.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 106, 17 + + \ No newline at end of file diff --git a/Form1.vb b/Form1.vb new file mode 100644 index 0000000..2dd15d8 --- /dev/null +++ b/Form1.vb @@ -0,0 +1,91 @@ +Public Class Form1 + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + Dim base As String = TextBox1.Text + Dim seperator As String = TextBox2.Text + doWork(base:=base, seperator:=seperator) + End Sub + + Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click + If BackgroundWorker1.IsBusy Then + BackgroundWorker1.CancelAsync() + Button2.Text = "Move Files (Loop)" + Else + BackgroundWorker1.RunWorkerAsync() + Button2.Text = "Move Files (Stop)" + End If + Button1.Visible = Not Button1.Visible + Label3.Visible = Not Label3.Visible + ProgressBar1.Visible = Label3.Visible + End Sub + Private Sub doWork(base As String, seperator As String) + For Each file As String In My.Computer.FileSystem.GetFiles(base) + Dim myFile As New System.IO.FileInfo(file) + If myFile.Length = 0 OrElse myFile.LastWriteTime > Now.AddMinutes(-60) Then + Continue For + End If + If file.Contains(seperator) Then + Dim filename As String = file.ToLower + Label3.Invoke(Sub() Label3.Text = file) + filename = filename.Substring(filename.IndexOf(seperator) + 1) + Dim yourpath As String = base + "\" + filename + Dim targetfile As String = yourpath + file.Substring(file.LastIndexOf("\")) + If Not System.IO.Directory.Exists(yourpath) Then + System.IO.Directory.CreateDirectory(yourpath) + End If + Try + My.Computer.FileSystem.MoveFile(file, targetfile) + System.Threading.Thread.Sleep(file.Substring(file.LastIndexOf("\")).Length * 25) + Catch ex As Exception + MsgBox(ex.ToString) + End Try + End If + Next + End Sub + + Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork + Dim base As String = TextBox1.Text + Dim seperator As String = TextBox2.Text + Try + While Not BackgroundWorker1.CancellationPending() + doWork(base:=base, seperator:=seperator) + ProgressBar1.Invoke(Sub() ProgressBar1.Value = ProgressBar1.Maximum) + While ProgressBar1.Value <> ProgressBar1.Minimum + If Not BackgroundWorker1.CancellationPending Then + DecreaseProgressBar() + System.Threading.Thread.Sleep(1000) + Else + ProgressBar1.Invoke(Sub() ProgressBar1.Value = ProgressBar1.Minimum) + Label3.Invoke(Sub() Label3.Text = "Stopped") + Exit While + End If + End While + End While + Catch ex As Exception + MsgBox(ex.ToString) + End Try + End Sub + + Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If Debugger.IsAttached Then + TextBox1.Text = "\\GVM05\yt" + End If + End Sub + + Private Sub DecreaseProgressBar() + If ProgressBar1.Value <> ProgressBar1.Minimum Then + ProgressBar1.Invoke(Sub() ProgressBar1.Value -= 1) + Label3.Invoke(Sub() Label3.Text = "Waiting ... " & ProgressBar1.Value.ToString) + End If + End Sub + Private Sub ProgressBar1_Click(sender As Object, e As EventArgs) Handles ProgressBar1.Click + DecreaseProgressBar() + End Sub + + Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click + Using dialog As New FolderBrowserDialog() + If dialog.ShowDialog() = Windows.Forms.DialogResult.OK Then + TextBox1.Text = dialog.SelectedPath + End If + End Using + End Sub +End Class diff --git a/My Project/Application.Designer.vb b/My Project/Application.Designer.vb new file mode 100644 index 0000000..390cf6c --- /dev/null +++ b/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + 'NOTE: This file is auto-generated; do not modify it directly. To make changes, + ' or if you encounter build errors in this file, go to the Project Designer + ' (go to Project Properties or double-click the My Project node in + ' Solution Explorer), and make changes on the Application tab. + ' + Partial Friend Class MyApplication + + _ + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = false + Me.EnableVisualStyles = true + Me.SaveMySettingsOnExit = true + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + _ + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Global.FileMover.Form1 + End Sub + End Class +End Namespace diff --git a/My Project/Application.myapp b/My Project/Application.myapp new file mode 100644 index 0000000..1243847 --- /dev/null +++ b/My Project/Application.myapp @@ -0,0 +1,11 @@ + + + true + Form1 + false + 0 + true + 0 + 0 + true + diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..a646104 --- /dev/null +++ b/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' Allgemeine Informationen über eine Assembly werden über die folgenden +' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +' die einer Assembly zugeordnet sind. + +' Werte der Assemblyattribute überprüfen + + + + + + + + + + +'Die folgende GUID wird für die typelib-ID verwendet, wenn dieses Projekt für COM verfügbar gemacht wird. + + +' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +' +' Hauptversion +' Nebenversion +' Buildnummer +' Revision +' +' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +' indem Sie "*" wie unten gezeigt eingeben: +' + + + diff --git a/My Project/Resources.Designer.vb b/My Project/Resources.Designer.vb new file mode 100644 index 0000000..db05d2d --- /dev/null +++ b/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("FileMover.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/My Project/Resources.resx b/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/My Project/Settings.Designer.vb b/My Project/Settings.Designer.vb new file mode 100644 index 0000000..04d8182 --- /dev/null +++ b/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.FileMover.My.MySettings + Get + Return Global.FileMover.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/My Project/Settings.settings b/My Project/Settings.settings new file mode 100644 index 0000000..85b890b --- /dev/null +++ b/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +