diff --git a/SVC_ORACLE/SVC_ORACLE/Form1.cs b/SVC_ORACLE/SVC_ORACLE/Form1.cs index b10fab6..6b4d0a8 100644 --- a/SVC_ORACLE/SVC_ORACLE/Form1.cs +++ b/SVC_ORACLE/SVC_ORACLE/Form1.cs @@ -15,7 +15,7 @@ namespace SVC_ORACLE { public partial class Form1 : Form { - Dictionary timers = new Dictionary(); + Dictionary timers = new Dictionary(); BackgroundWorker bw; string[] AllObjects = { "PROCEDURE", "FUNCTION", "PACKAGE", "PACKAGE BODY", "TRIGGER", "TYPE" }; string[] ExecutingObjects = { "PROCEDURE", "FUNCTION", "PACKAGE", "PACKAGE BODY", "TRIGGER", "TYPE" }; @@ -34,11 +34,9 @@ private void LoadProfiles() try { cbProfiles.DropDownStyle = ComboBoxStyle.DropDownList; - foreach (Timer item in timers.Values) + foreach (var item in timers.Values) { - item.Enabled = false; - item.Tick -= Tmr_Tick; - item.Dispose(); + item.Close(); } cbProfiles.Items.Clear(); timers.Clear(); @@ -51,8 +49,8 @@ private void LoadProfiles() int timerValue = Convert.ToInt32((new Config(item.Value + ".profile"))["AutoRefresh"]); if (timerValue > 0) { - var tmr = new Timer() { Enabled = true, Interval = timerValue * 1000, Tag = item.Key }; - tmr.Tick += Tmr_Tick; + var tmr = new System.Timers.Timer() { Enabled = true, Interval = timerValue * 1000, AutoReset = true }; + tmr.Elapsed += Tmr_Elapsed; timers.Add(item.Key, tmr); } } @@ -179,14 +177,15 @@ private void EnableAll(bool enable) btnSave.Enabled = enable; } - private void PushNewWork(int profileId, bool isFull) + private void PushNewWork(int profileId, bool isFull, DateTime execTime) { System.Threading.ThreadPool.QueueUserWorkItem(delegate { + (int ProfileId, bool IsFull, DateTime Timestamp) param = (profileId, isFull, execTime); are.WaitOne(); Invoke((System.Threading.ThreadStart)delegate { - bw.RunWorkerAsync(new Tuple(profileId, isFull)); + bw.RunWorkerAsync(param); }); }); } @@ -234,7 +233,7 @@ private void btnFastRefresh_Click(object sender, EventArgs e) int ind = cbProfiles.SelectedIndex; if (ind >= 0) { - PushNewWork(ind, false); + PushNewWork(ind, false, DateTime.Now); } } @@ -243,39 +242,40 @@ private void btnFullRefresh_Click(object sender, EventArgs e) int ind = cbProfiles.SelectedIndex; if (ind >= 0) { - PushNewWork(ind, true); + PushNewWork(ind, true, DateTime.Now); } } - private void Tmr_Tick(object sender, EventArgs e) + private void Tmr_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { - PushNewWork((int)(sender as Timer).Tag, false); + int profileId = timers.Select(o => o).Where(o => o.Value == sender as System.Timers.Timer).Select(o => o.Key).ToArray()[0]; + PushNewWork(profileId, false, e.SignalTime); } private void Bw_DoWork(object sender, DoWorkEventArgs e) { - var param = e.Argument as Tuple; - var profile = new Config(profiles[param.Item1] + ".profile"); + var param = ((int ProfileId, bool IsFull, DateTime Timestamp))e.Argument; + var profile = new Config(profiles[param.ProfileId] + ".profile"); Invoke((System.Threading.ThreadStart)delegate { - SelectProfile(param.Item1); + SelectProfile(param.ProfileId); EnableAll(false); }); DateTime dateForUpdate = DateTime.ParseExact(profile["LastUpdate"], "yyyyMMddHHmmss", CultureInfo.InvariantCulture); - string now = OracleDB.GetServerNow(); + string now = param.Timestamp.ToString("yyyyMMddHHmmss"); e.Result = CreateDumps ( profile["Path"], profile["Schemas"], - param.Item2 ? new DateTime(1900, 1, 1) : dateForUpdate, - param.Item1 + param.IsFull ? new DateTime(1900, 1, 1) : dateForUpdate, + param.ProfileId ); profile["LastUpdate"] = now ?? profile["LastUpdate"]; - if (GitRepository(param.Item1) != null && IsNeedPull(param.Item1)) + if (GitRepository(param.ProfileId) != null && IsNeedPull(param.ProfileId)) { - GitPullWithStash(param.Item1); + GitPullWithStash(param.ProfileId); } } diff --git a/SVC_ORACLE/SVC_ORACLE/SVC_ORACLE.csproj b/SVC_ORACLE/SVC_ORACLE/SVC_ORACLE.csproj index 40a32c4..991e49c 100644 --- a/SVC_ORACLE/SVC_ORACLE/SVC_ORACLE.csproj +++ b/SVC_ORACLE/SVC_ORACLE/SVC_ORACLE.csproj @@ -44,6 +44,9 @@ + + ..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll + diff --git a/SVC_ORACLE/SVC_ORACLE/packages.config b/SVC_ORACLE/SVC_ORACLE/packages.config index 07bb660..2005c32 100644 --- a/SVC_ORACLE/SVC_ORACLE/packages.config +++ b/SVC_ORACLE/SVC_ORACLE/packages.config @@ -3,4 +3,5 @@ + \ No newline at end of file diff --git a/SVC_ORACLE/SVC_ORACLE_INSTALL/SVC_ORACLE_INSTALL.vdproj b/SVC_ORACLE/SVC_ORACLE_INSTALL/SVC_ORACLE_INSTALL.vdproj index 9cbd6c9..fd3f838 100644 --- a/SVC_ORACLE/SVC_ORACLE_INSTALL/SVC_ORACLE_INSTALL.vdproj +++ b/SVC_ORACLE/SVC_ORACLE_INSTALL/SVC_ORACLE_INSTALL.vdproj @@ -124,7 +124,7 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_82CF70C1850E523F559A2A62E00963DF" + "OwnerKey" = "8:_EC8E85323A17B819C67D6075D9FFA7BD" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -136,7 +136,7 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_EC8E85323A17B819C67D6075D9FFA7BD" + "OwnerKey" = "8:_82CF70C1850E523F559A2A62E00963DF" "MsmSig" = "8:_UNDEFINED" } } @@ -361,11 +361,6 @@ "AssemblyAsmDisplayName" = "8:LibGit2Sharp, Version=1.0.22.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL" "ScatterAssemblies" { - "_79B243B0F8ED4080B48CBDAABBFA9188" - { - "Name" = "8:LibGit2Sharp.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:LibGit2Sharp.dll" "TargetName" = "8:" @@ -392,11 +387,6 @@ "AssemblyAsmDisplayName" = "8:Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL" "ScatterAssemblies" { - "_82CF70C1850E523F559A2A62E00963DF" - { - "Name" = "8:Oracle.ManagedDataAccess.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:Oracle.ManagedDataAccess.dll" "TargetName" = "8:" @@ -563,11 +553,6 @@ "AssemblyAsmDisplayName" = "8:System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" "ScatterAssemblies" { - "_EC8E85323A17B819C67D6075D9FFA7BD" - { - "Name" = "8:System.Net.Http.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:System.Net.Http.dll" "TargetName" = "8:" @@ -687,15 +672,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Oracle source exporter" - "ProductCode" = "8:{94AA7482-765A-4095-9AEF-B49C3396D43F}" - "PackageCode" = "8:{49951DC7-0E5B-4C66-BCE1-AFDBB75F4267}" + "ProductCode" = "8:{8F922E76-444C-4DBC-ACE3-DCBC1EF50648}" + "PackageCode" = "8:{DF17E0EA-DBB5-479A-9A76-BCAED7F92C64}" "UpgradeCode" = "8:{3362CCA1-1B03-4677-9CAB-BF7EBAB23D2D}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.0.3" + "ProductVersion" = "8:1.0.4" "Manufacturer" = "8:GLOVISRUS" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:"