Skip to content

Commit

Permalink
Merge branch 'newfeature'
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepan Logvin committed Sep 18, 2018
2 parents d9ecd84 + 7ff0e26 commit 21d2bba
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 41 deletions.
42 changes: 21 additions & 21 deletions SVC_ORACLE/SVC_ORACLE/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace SVC_ORACLE
{
public partial class Form1 : Form
{
Dictionary<int, Timer> timers = new Dictionary<int, Timer>();
Dictionary<int, System.Timers.Timer> timers = new Dictionary<int, System.Timers.Timer>();
BackgroundWorker bw;
string[] AllObjects = { "PROCEDURE", "FUNCTION", "PACKAGE", "PACKAGE BODY", "TRIGGER", "TYPE" };
string[] ExecutingObjects = { "PROCEDURE", "FUNCTION", "PACKAGE", "PACKAGE BODY", "TRIGGER", "TYPE" };
Expand All @@ -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();
Expand All @@ -51,8 +49,8 @@ private void LoadProfiles()
int timerValue = Convert.ToInt32((new Config<string, string>(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);
}
}
Expand Down Expand Up @@ -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<int, bool>(profileId, isFull));
bw.RunWorkerAsync(param);
});
});
}
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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<int, bool>;
var profile = new Config<string, string>(profiles[param.Item1] + ".profile");
var param = ((int ProfileId, bool IsFull, DateTime Timestamp))e.Argument;
var profile = new Config<string, string>(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);
}
}

Expand Down
3 changes: 3 additions & 0 deletions SVC_ORACLE/SVC_ORACLE/SVC_ORACLE.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down
1 change: 1 addition & 0 deletions SVC_ORACLE/SVC_ORACLE/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<package id="LibGit2Sharp-SSH.NativeBinaries-libssh2-1.8.1.0" version="1.0.15" targetFramework="net45" />
<package id="LibGit2Sharp-SSH-updated-libssh2" version="1.0.25" targetFramework="net45" />
<package id="Oracle.ManagedDataAccess" version="12.2.1100" targetFramework="net45" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net45" />
</packages>
25 changes: 5 additions & 20 deletions SVC_ORACLE/SVC_ORACLE_INSTALL/SVC_ORACLE_INSTALL.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_82CF70C1850E523F559A2A62E00963DF"
"OwnerKey" = "8:_EC8E85323A17B819C67D6075D9FFA7BD"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
Expand All @@ -136,7 +136,7 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_EC8E85323A17B819C67D6075D9FFA7BD"
"OwnerKey" = "8:_82CF70C1850E523F559A2A62E00963DF"
"MsmSig" = "8:_UNDEFINED"
}
}
Expand Down Expand Up @@ -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:"
Expand All @@ -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:"
Expand Down Expand Up @@ -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:"
Expand Down Expand Up @@ -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:"
Expand Down

0 comments on commit 21d2bba

Please sign in to comment.