Overclock.net banner
41 - 60 of 258 Posts

· Premium Member
Joined
·
2,645 Posts
The threads are basically restricted to the 7za.exe file. 7-Zip is managing threads, my app just starts 1x 7zip process for all the .GCF files, then each folder under common has its own process, but the process for common folders is done one at a time. (May fix that in next release)
 

· Registered
Joined
·
1,443 Posts
Discussion Starter · #43 ·
well here is my idea of a way to multitasking. I know its hard to share arrays between thread when using VB so presuming its the same for C# but i have used a similar technique in VB

1. get all of the Directories that need to be backed up and add them to a Public Shared Array.
2. Start x number of threads (x = a user selected number)
3. each thread reads the last item in the array, deletes it then starts backing it up (it might be best to have a ~1ms delay between starting each thread just in case it tries to read the same array index)
4. keep doing this until the array is empty.
 

· Premium Member
Joined
·
2,645 Posts
well, theres nothing i can do about the steamapps folder as its only 1 archive. but i can get all the common folders on different threads running concurrently
 

· Registered
Joined
·
1,443 Posts
Discussion Starter · #45 ·
Quote:
Originally Posted by FiX;12867556
well, theres nothing i can do about the steamapps folder as its only 1 archive. but i can get all the common folders on different threads running concurrently
I might make some pseudo code to explain my idea. give me about 10 minutes.
smile.gif
 

· Registered
Joined
·
1,443 Posts
Discussion Starter · #47 ·
this is in rough VB. it took longer than 10 minutes but meh ;p

Code:

Code:
Public Class Form1

    Public Shared backupDir() As String
    Public Shared i As Integer = 0

    Public Sub btnBackup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBackup.Click
        Dim sDir As Integer = tbxSteamDir.text
        Dim bDir As Integer = tbxBackupDir.text
        Dim numThreads As Integer = tbxNumThreads.text

        ' add steam apps to array
        backupDir(i) = Application.StartupPath & ".7za.exe a -t7z " & bDir & "\steamapps.7z " & sDir & "\steamapps\* -mx9 -xr!common"
        i++

        ' add individual common folders to array
        For Each cmnFolder As String In IO.Directory.GetDirectories(sDir & "\steamapps\common")
            ' Get folder name
            Dim folder As String = ""
            For c = Len(cmnFolder) To 1 Step -1
                If Mid(cmnFolder, c, 1) = "\" Then
                    Exit For
                Else
                    folder = Mid(cmnFolder, c, 1) & folder
                End If
            Next c
            ' Add to array
            backupDir(i) = Application.StartupPath & ".7za.exe a -t7z " & cmnFolder & "\common\" & folder & ".7z " & cmnFolder & " -mx9"
            i++
        Next

        'Start Threads
        Dim l As Integer
        While l <= numThreads
            ' start threads in here
        End While

    End Sub

    Public Class runThread
        ' do what you normally do in each thread but use the last index of backupDir(i) as the command deleting it as it gets used.
    End Class

End Class
 

· Premium Member
Joined
·
2,645 Posts
Quote:


Originally Posted by Du-z
View Post

Yup thats out in a nutshell. Don't run all the threads at once though.each instance of 7zip uses ~0.5GB of ram

Wow, really? I never noticed.... Might as well leave it where it is then (1 steamapps thread, and 1 common thread for each folder, although theres only 1 common thread running at a time.)
 

· Registered
Joined
·
1,443 Posts
Discussion Starter · #56 ·
well i have finished 50% of the code. the backup can now use up to 4 threads until the whole thing it backed so in theory its about 380% faster than the previous version ^.^

I can't figure out the best way to do the same for restoring though. ill need to wait for FiX to come back online to do that
smile.gif
.

RESTORE FUNCTION NOT WORKING AT THE MOMENT!
Executable
Source Code
 

· Registered
Joined
·
1,443 Posts
Discussion Starter · #59 ·
Hey Guys i have updated the prog to v1.1.3

it now can run multiple instances at a time with both the backup and restore function! I have also improved many other parts of it.

Download Here:
Steam Backup Tool v1.1.3
Source
 

· Premium Member
Joined
·
2,645 Posts
Dont worry guys, were still working on it
Next version should have a statistics report (its opt-in) which should show the averages on graphs on my site. Just getting the PHP done atm
 
41 - 60 of 258 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top