+++ /dev/null
-Option Explicit \r
- \r
-'********************************************************************************\r
-' <<< [Syncs] >>> \r
-'********************************************************************************\r
-Class Syncs\r
- Public Files ' ArrayClass of ArrayClass of string. Last is in synced folder\r
- Private m_SyncedFolderPath ' as string\r
-\r
- Private Sub Class_Initialize()\r
- m_SyncedFolderPath = "Syncs.files"\r
- Set Files = new ArrayClass\r
- End Sub\r
-\r
-\r
-\r
- \r
-'********************************************************************************\r
-' <<< [Syncs::DoSync] >>> \r
-'********************************************************************************\r
-Public Sub DoSync()\r
- Dim file, t0, t1, i_mods, sync_path, cmd\r
-\r
-\r
- '//=== Add synced folder\r
- For Each file In Me.Files.m_Array\r
- sync_path = m_SyncedFolderPath + "\" + g_fs.GetFileName( file(0) )\r
-\r
-\r
- '//=== Compare time stamp\r
- If exist( sync_path ) Then\r
- t0 = g_fs.GetFile( sync_path ).DateLastModified\r
- Else\r
- t0 = g_fs.GetFile( file( 0 ) ).DateLastModified\r
- End If\r
- Set i_mods = new ArrayClass\r
- For i=0 To file.Count-1\r
- t1 = g_fs.GetFile( file( i ) ).DateLastModified\r
- If t1 <> t0 Then i_mods.Add i\r
- Next\r
-\r
- echo g_fs.GetFileName( sync_path )\r
-\r
- If i_mods.Count = 0 Then\r
- echo "\93¯\82¶\82Å\82·"\r
- If not exist( sync_path ) Then _\r
- copy file(0), sync_path\r
-\r
-\r
- '//=== Copy\r
- ElseIf i_mods.Count = 1 and exist( sync_path ) Then\r
- For i=0 To file.Count-1\r
- If i <> i_mods(0) Then copy file( i_mods(0) ), file( i )\r
- Next\r
- copy file( i_mods(0) ), sync_path\r
-\r
-\r
- '//=== Diff\r
- Else\r
- cmd = Empty\r
- If not exist( sync_path ) Then\r
- If i_mods.Count = 1 Then\r
- cmd = Setting_getDiffCmdLine(2)\r
- cmd = Replace( cmd, "%1", file(0) )\r
- cmd = Replace( cmd, "%2", file(1) )\r
- RunProg cmd, ""\r
-\r
- echo "1) " & file(0)\r
- echo "2) " & file(1)\r
- i = input( "\82Ç\82¿\82ç\82Ì\83t\83@\83C\83\8b\82ð\8dÌ\97p\82µ\82Ü\82·\82©\81H>" )\r
- If i = 1 Then\r
- copy file(0), file(1)\r
- copy file(0), sync_path\r
- ElseIf i = 2 Then\r
- copy file(1), file(0)\r
- copy file(1), sync_path\r
- End If\r
- End If\r
- Else\r
- If i_mods.Count = 2 Then\r
- cmd = Setting_getDiffCmdLine(3)\r
- cmd = Replace( cmd, "%1", file(0) )\r
- cmd = Replace( cmd, "%2", sync_path )\r
- cmd = Replace( cmd, "%3", file(1) )\r
- RunProg cmd, ""\r
-\r
- echo "1) " & file(0)\r
- echo "2) " & file(1)\r
- echo "0) " & sync_path\r
- i = input( "\82Ç\82Ì\83t\83@\83C\83\8b\82ð\8dÌ\97p\82µ\82Ü\82·\82©\81H>" )\r
- If i = 1 Then\r
- copy file(0), file(1)\r
- copy file(0), sync_path\r
- ElseIf i = 2 Then\r
- copy file(1), file(0)\r
- copy file(1), sync_path\r
- ElseIf i = 0 Then\r
- copy sync_path, file(0)\r
- copy sync_path, file(1)\r
- End If\r
- End If\r
- End If\r
-\r
- If IsEmpty( cmd ) Then\r
- echo "\88á\82¢\82ª\91½\82·\82¬\82Ü\82· : " + g_fs.GetFileName( sync_path )\r
- End If\r
- End If\r
- Next\r
-End Sub\r
- \r
-End Class \r
- \r