Skip to content

Commit 19d00a2

Browse files
disables logging for final version
1 parent bc6fe23 commit 19d00a2

File tree

8 files changed

+48
-63
lines changed

8 files changed

+48
-63
lines changed

Src/BridgeVs.Locations/CommonRegistryConfigurations.cs

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class CommonRegistryConfigurations
77
private const string LINQPadInstallationPathRegistryValue = "LINQPadInstallationPath";
88
private const string LINQPadVersionPathRegistryValue = "LINQPadVersion";
99

10+
// ReSharper disable once InconsistentNaming
1011
public static string LINQPadInstallationPath
1112
{
1213
get
@@ -25,6 +26,7 @@ public static string LINQPadInstallationPath
2526
}
2627
}
2728

29+
// ReSharper disable once InconsistentNaming
2830
public static string LINQPadVersion
2931
{
3032
get

Src/DynamicCore/DynamicObjectSource.cs

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public static void BroadCastData(object target, Stream outgoingData)
8989
catch (Exception e)
9090
{
9191
Log.Write(e, "Error in BroadCastData");
92+
throw;
9293
}
9394
}
9495

Src/DynamicVisualizer.V11/DynamicDebuggerVisualizerObjectSourceV11.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ public override void GetData(object target, Stream outgoingData)
3636
DynamicObjectSource.BroadCastData(target, outgoingData);
3737
}
3838
}
39-
}
39+
}

Src/Grapple/Truck.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ public Truck(string truckName)
6565

6666
internal Truck(string truckName, IGrapple grapple)
6767
{
68-
Log.Configure("Grapple", string.Empty);
68+
Log.Write($"Setting Up the Truck {truckName}");
6969

70-
Log.Write("Setting Up the Truck {0}", truckName);
7170
_truckName = truckName;
7271
_grapple = grapple;
7372
CreateDeliveryFolder(TruckPosition);
@@ -100,7 +99,7 @@ public void LoadCargo<T>(T item)
10099
/// <returns></returns>
101100
public bool DeliverTo(string address)
102101
{
103-
Log.Write("Delivering Cargo to {0}", address);
102+
Log.Write($"Delivering Cargo to {address}");
104103

105104
try
106105
{
@@ -120,7 +119,7 @@ public bool DeliverTo(string address)
120119
stream.Write(buffer.Item2, 0, buffer.Item2.Length);
121120
}
122121
}
123-
Log.Write("Cargo Successfully Delivered {0}", address);
122+
Log.Write($"Cargo Successfully Delivered {address}");
124123

125124
return true;
126125
}

Src/Logging/Log.cs

+13-17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#endregion
2525

2626
using System;
27+
using System.Diagnostics;
2728
using System.Globalization;
2829
using System.IO;
2930
using System.IO.Compression;
@@ -36,43 +37,35 @@ namespace BridgeVs.Logging
3637
public static class Log
3738
{
3839
private static string _applicationName;
39-
private static readonly string LocalApplicationData =
40-
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
40+
private static readonly string LocalApplicationData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
4141

42-
private static readonly MailAddress MailAddressFrom = new MailAddress("[email protected]", "No Reply Log");
43-
private static string _logGzipFileName;
44-
45-
private static string _moduleName;
4642
private static string _logsDir;
4743
private static string _logTxtFilePath;
48-
private static SmtpClient _smtpClient;
4944

50-
public static void Configure(string applicationName, string moduleName, SmtpClient smtpClient = null)
45+
[Conditional("DEBUG")]
46+
public static void Configure(string applicationName, string moduleName)
5147
{
5248
if (string.IsNullOrEmpty(applicationName))
5349
throw new ArgumentNullException(nameof(applicationName), "Name of the application must not be null!");
5450

5551
_applicationName = applicationName;
56-
_moduleName = moduleName;
5752

58-
var logTxtFileName = string.Concat(moduleName, ".txt");
53+
string logTxtFileName = string.Concat(moduleName, ".txt");
5954

60-
_logGzipFileName = string.Concat(_applicationName, ".gz");
6155
_logsDir = Path.Combine(LocalApplicationData, _applicationName);
6256

6357
_logTxtFilePath = Path.Combine(_logsDir, logTxtFileName);
64-
65-
_smtpClient = smtpClient;
6658
}
6759

60+
[Conditional("DEBUG")]
6861
public static void Write(Exception ex, string context = null)
6962
{
7063
try
7164
{
72-
var text = string.Concat(ex.GetType().Name, ": ", ex.Message, "\r\n", ex.StackTrace ?? "");
65+
string text = string.Concat(ex.GetType().Name, ": ", ex.Message, "\r\n", ex.StackTrace ?? "");
7366
if (ex.InnerException != null)
7467
{
75-
var text2 = text;
68+
string text2 = text;
7669
text = string.Concat(text2, "\r\nINNER: ", ex.InnerException.GetType().Name, ex.InnerException.Message, (ex.InnerException.StackTrace ?? "").Replace("\n", "\n "));
7770
}
7871
if (!string.IsNullOrEmpty(context))
@@ -88,16 +81,17 @@ public static void Write(Exception ex, string context = null)
8881
}
8982
}
9083

84+
[Conditional("DEBUG")]
9185
private static void InternalWrite(string msg, params object[] args)
9286
{
9387

9488
if (!Directory.Exists(_logsDir))
9589
{
9690
try
9791
{
98-
var sec = new DirectorySecurity();
92+
DirectorySecurity sec = new DirectorySecurity();
9993
// Using this instead of the "Everyone" string means we work on non-English systems.
100-
var everyone = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
94+
SecurityIdentifier everyone = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
10195
sec.AddAccessRule(new FileSystemAccessRule(everyone, FileSystemRights.Modify | FileSystemRights.Synchronize, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
10296
Directory.CreateDirectory(_logsDir, sec);
10397
}
@@ -127,6 +121,7 @@ private static void InternalWrite(string msg, params object[] args)
127121
/// <param name="msg">A composite format string (see Remarks) that contains text intermixed with zero or more format items, which correspond to objects in the <paramref name="args"/> array.</param><param name="args">An object array that contains zero or more objects to format. </param>
128122

129123

124+
[Conditional("DEBUG")]
130125
public static void Write(string msg, params object[] args)
131126
{
132127
if (string.IsNullOrEmpty(_applicationName))
@@ -144,6 +139,7 @@ public static void Write(string msg, params object[] args)
144139
}
145140
}
146141

142+
[Conditional("DEBUG")]
147143
public static void WriteIf(bool condition, string msg, params object[] args)
148144
{
149145
if (!condition) return;

Src/VsExtension.Helper/Installer/Welcome.xaml.cs

+1-38
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,7 @@ public Welcome(DTE dte) : this()
3131
{
3232
_dte = dte;
3333
}
34-
35-
//private async void BtnNext_Click(object sender, RoutedEventArgs e)
36-
//{
37-
// SetNextTab();
38-
// if (_currentTab.Value.Name == "hdrSteady")
39-
// {
40-
// if (!IsElevated)
41-
// {
42-
// grdPrerequisites.Visibility = Visibility.Visible;
43-
// grdInstallation.Visibility = Visibility.Hidden;
44-
// btnNext.IsEnabled = false;
45-
// }
46-
// else
47-
// {
48-
// grdPrerequisites.Visibility = Visibility.Hidden;
49-
// grdInstallation.Visibility = Visibility.Visible;
50-
// await Task.Run(() => Install());
51-
// prgInstallProgress.IsActive = false;
52-
// SetNextTab();
53-
// btnNext.Visibility = Visibility.Hidden;
54-
// btnSkip.Content = "Finish";
55-
// }
56-
// }
57-
58-
// if (_currentTab.Value.Name == "hdrReady")
59-
// {
60-
// this.Close();
61-
// }
62-
//}
63-
64-
//private void SetNextTab()
65-
//{
66-
// _currentTab.Value.Focusable = false;
67-
// _currentTab = _currentTab.Next ?? _currentTab.List.First;
68-
// _currentTab.Value.Focusable = true;
69-
// _currentTab.Value.Focus();
70-
//}
71-
34+
7235
private void btnRestart_Click(object sender, RoutedEventArgs e)
7336
{
7437
this.Close();

Src/VsExtension/Package/BridgeVsPackage.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public sealed class BridgeVsPackage : Microsoft.VisualStudio.Shell.Package
6767

6868
//if this is not null means vs has to restart
6969
private Welcome _welcomePage;
70+
private bool? _installationResult;
7071
public static bool IsElevated => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
7172

7273
#region Package Members
@@ -135,9 +136,7 @@ protected override void Initialize()
135136
}
136137
else
137138
{
138-
MessageBox.Show(!PackageConfigurator.Install(_dte.Version, _dte.Edition)
139-
? "LINQBridgeVs wasn't successfully configured. Please restart Visual Studio"
140-
: "LINQBridgeVs has been successfully configured.");
139+
_installationResult = PackageConfigurator.Install(_dte.Version, _dte.Edition);
141140
}
142141
}
143142
catch (Exception e)
@@ -150,6 +149,12 @@ protected override void Initialize()
150149
private void _dteEvents_OnStartupComplete()
151150
{
152151
_welcomePage?.Show();
152+
if (_installationResult == null)
153+
return;
154+
155+
MessageBox.Show(_installationResult.Value
156+
? "LINQBridgeVs has been successfully configured."
157+
: "LINQBridgeVs wasn't successfully configured. Please restart Visual Studio");
153158
}
154159
#endregion
155160
}

Test/LINQBridgeVs.Test/LINQBridgeVsExtension.UnitTests/app.config

+19
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,24 @@
22
<configuration>
33
<runtime>
44

5+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
6+
7+
<dependentAssembly>
8+
9+
<assemblyIdentity name="Microsoft.VisualStudio.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
10+
11+
<bindingRedirect oldVersion="0.0.0.0-15.6.0.0" newVersion="15.6.0.0" />
12+
13+
</dependentAssembly>
14+
15+
<dependentAssembly>
16+
17+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
18+
19+
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
20+
21+
</dependentAssembly>
22+
23+
</assemblyBinding>
524
</runtime>
625
</configuration>

0 commit comments

Comments
 (0)