Skip to content

Commit 76d18d6

Browse files
committed
Merge branch 'release/4.6.24'
2 parents 6f2cb14 + 6914a47 commit 76d18d6

File tree

103 files changed

+1140
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1140
-560
lines changed

bin/Nett.dll

2.5 KB
Binary file not shown.

bin/engines/273/pyRevitLoader.pdb

-25.5 KB
Binary file not shown.

bin/engines/273/pyRevitRunner.pdb

-35.5 KB
Binary file not shown.

bin/engines/277/pyRevitLoader.dll

102 KB
Binary file not shown.

bin/engines/277/pyRevitLoader.pdb

-25.5 KB
Binary file not shown.

bin/engines/277/pyRevitRunner.pdb

-35.5 KB
Binary file not shown.

bin/engines/278/pyRevitLoader.pdb

-25.5 KB
Binary file not shown.

bin/engines/278/pyRevitRunner.pdb

-35.5 KB
Binary file not shown.

bin/engines/279/pyRevitLoader.pdb

-25.5 KB
Binary file not shown.

bin/engines/279/pyRevitRunner.pdb

-35.5 KB
Binary file not shown.

bin/engines/368/Python.Runtime.dll

5 KB
Binary file not shown.

bin/engines/372/Python.Runtime.dll

5 KB
Binary file not shown.

bin/pyRevitLabs.Common.dll

1.5 KB
Binary file not shown.

bin/pyRevitLabs.CommonCLI.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.CommonWPF.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.DeffrelDB.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.Language.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.NLog.dll

797 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

bin/pyRevitLabs.TargetApps.Revit.dll

1.5 KB
Binary file not shown.

bin/pyrevit-updater

1.11 MB
Binary file not shown.

bin/pyrevit.exe

2.5 KB
Binary file not shown.

dev/README.md

+13-1

dev/pyRevitLabs/pyRevitLabs.Common/CommonUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Text.RegularExpressions;
1010
using IWshRuntimeLibrary;
1111

12-
using NLog;
12+
using pyRevitLabs.NLog;
1313

1414
namespace pyRevitLabs.Common {
1515
public static class CommonUtils {

dev/pyRevitLabs/pyRevitLabs.Common/Extensions/Extensions.cs

+53-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
using System.Threading.Tasks;
77
using System.Text.RegularExpressions;
88
using System.Globalization;
9+
using System.CodeDom.Compiler;
10+
using System.CodeDom;
11+
using System.Web;
912

10-
using NLog;
13+
using pyRevitLabs.NLog;
1114
using pyRevitLabs.Json;
1215

1316
namespace pyRevitLabs.Common.Extensions {
@@ -264,6 +267,55 @@ public static string ConvertToCommaSeparatedString(this IEnumerable<string> sour
264267
public static List<string> ConvertFromCommaSeparatedString(this string commaSeparatedValue) {
265268
return new List<string>(commaSeparatedValue.Split(','));
266269
}
270+
271+
public static string ToLiteral(this string input) {
272+
using (var writer = new StringWriter()) {
273+
using (var provider = CodeDomProvider.CreateProvider("CSharp")) {
274+
provider.GenerateCodeFromExpression(new CodePrimitiveExpression(input), writer, null);
275+
return writer.ToString();
276+
}
277+
}
278+
}
279+
280+
public static string ToEscaped(this string input, bool WrapInQuotes = false) {
281+
var literal = new StringBuilder(input.Length + 2);
282+
if (WrapInQuotes)
283+
literal.Append("\"");
284+
285+
foreach (var c in input) {
286+
switch (c) {
287+
case '\'': literal.Append(@"\'"); break;
288+
case '\"': literal.Append("\\\""); break;
289+
case '\\': literal.Append(@"\\"); break;
290+
case '\0': literal.Append(@"\0"); break;
291+
case '\a': literal.Append(@"\a"); break;
292+
case '\b': literal.Append(@"\b"); break;
293+
case '\f': literal.Append(@"\f"); break;
294+
case '\n': literal.Append(@"\n"); break;
295+
case '\r': literal.Append(@"\r"); break;
296+
case '\t': literal.Append(@"\t"); break;
297+
case '\v': literal.Append(@"\v"); break;
298+
default:
299+
if (Char.GetUnicodeCategory(c) != UnicodeCategory.Control) {
300+
literal.Append(c);
301+
}
302+
else {
303+
literal.Append(@"\u");
304+
literal.Append(((ushort)c).ToString("x4"));
305+
}
306+
break;
307+
}
308+
}
309+
310+
if (WrapInQuotes)
311+
literal.Append("\"");
312+
313+
return literal.ToString();
314+
}
315+
316+
public static string PrepareJSONForCSV(this string input) {
317+
return "\"" + input.Replace("\"", "\"\"") + "\"";
318+
}
267319
}
268320

269321
public static class DateTimeExtensions {

dev/pyRevitLabs/pyRevitLabs.Common/GitInstaller.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Threading.Tasks;
66

77
using LibGit2Sharp;
8-
using NLog;
8+
using pyRevitLabs.NLog;
99

1010
namespace pyRevitLabs.Common {
1111
// git exceptions

dev/pyRevitLabs/pyRevitLabs.Common/UserEnv.cs

+16-10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System.Security.AccessControl;
1212

1313
using DotNetVersionFinder;
14+
using pyRevitLabs.NLog;
1415

1516

1617
// user default folder implementation from https://stackoverflow.com/a/21953690/2350244
@@ -37,6 +38,8 @@ public enum KnownFolder {
3738
}
3839

3940
public static class UserEnv {
41+
private static Logger logger = LogManager.GetCurrentClassLogger();
42+
4043
public static string GetWindowsVersion() {
4144
// https://docs.microsoft.com/en-us/windows/desktop/SysInfo/operating-system-version
4245
// https://stackoverflow.com/a/37700770/2350244
@@ -66,17 +69,20 @@ public static List<string> GetInstalledDotnetCoreTargetPacks() {
6669
}
6770

6871
public static string GetLoggedInUserName() {
69-
ConnectionOptions oConn = new ConnectionOptions();
70-
ManagementScope oMs = new ManagementScope("\\\\localhost", oConn);
71-
72-
ObjectQuery oQuery = new ObjectQuery("select * from Win32_ComputerSystem");
73-
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
74-
ManagementObjectCollection oReturnCollection = oSearcher.Get();
75-
76-
foreach (ManagementObject oReturn in oReturnCollection) {
77-
return oReturn["UserName"].ToString();
72+
try {
73+
ConnectionOptions oConn = new ConnectionOptions();
74+
ManagementScope oMs = new ManagementScope("\\\\localhost", oConn);
75+
76+
ObjectQuery oQuery = new ObjectQuery("select * from Win32_ComputerSystem");
77+
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
78+
ManagementObjectCollection oReturnCollection = oSearcher.Get();
79+
80+
foreach (ManagementObject oReturn in oReturnCollection) {
81+
return oReturn["UserName"].ToString();
82+
}
83+
} catch (Exception ex) {
84+
logger.Debug("Failed to get logged in username. | {0}", ex.Message);
7885
}
79-
8086
return null;
8187
}
8288

dev/pyRevitLabs/pyRevitLabs.Common/pyRevitLabs.Common.csproj

+5-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@
4040
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
4141
</PropertyGroup>
4242
<ItemGroup>
43+
<Reference Include="Microsoft.CSharp" />
4344
<Reference Include="pyRevitLabs.Json">
4445
<HintPath>..\..\..\bin\pyRevitLabs.Json.dll</HintPath>
4546
</Reference>
47+
<Reference Include="pyRevitLabs.NLog">
48+
<HintPath>..\..\..\bin\pyRevitLabs.NLog.dll</HintPath>
49+
</Reference>
4650
<Reference Include="System" />
4751
<Reference Include="System.Configuration" />
4852
<Reference Include="System.Core" />
@@ -51,6 +55,7 @@
5155
<Reference Include="System.Runtime.Serialization" />
5256
<Reference Include="System.ServiceModel" />
5357
<Reference Include="System.Transactions" />
58+
<Reference Include="System.Web" />
5459
<Reference Include="System.Xml.Linq" />
5560
<Reference Include="System.Data.DataSetExtensions" />
5661
<Reference Include="System.Data" />
@@ -82,9 +87,6 @@
8287
<PackageReference Include="NETStandard.Library">
8388
<Version>2.0.3</Version>
8489
</PackageReference>
85-
<PackageReference Include="NLog">
86-
<Version>4.6.3</Version>
87-
</PackageReference>
8890
<PackageReference Include="OpenMcdf">
8991
<Version>2.2.1.3</Version>
9092
</PackageReference>

dev/pyRevitLabs/pyRevitLabs.DeffrelDB/DataBase.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
using System.Text;
44

55
using pyRevitLabs.Common;
6-
using NLog.Targets;
7-
using NLog.Config;
6+
using pyRevitLabs.NLog.Targets;
7+
using pyRevitLabs.NLog.Config;
88

99
#if DEBUG
1010
using pyRevitLabs.CommonCLI;
1111
#endif
1212

13-
using NLog;
13+
using pyRevitLabs.NLog;
1414

1515

1616
// TODO: add log messages

dev/pyRevitLabs/pyRevitLabs.DeffrelDB/DataStore.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
using pyRevitLabs.Common;
1111

12-
using NLog;
12+
using pyRevitLabs.NLog;
1313

1414
namespace pyRevitLabs.DeffrelDB {
1515
// datastore

dev/pyRevitLabs/pyRevitLabs.DeffrelDB/DefaultDataFormatter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Text;
55
using System.Text.RegularExpressions;
66

7-
using NLog;
7+
using pyRevitLabs.NLog;
88

99
namespace pyRevitLabs.DeffrelDB {
1010
internal class DefaultDataFormatter: IDataFormatter {

dev/pyRevitLabs/pyRevitLabs.DeffrelDB/packages.config

-4
This file was deleted.

dev/pyRevitLabs/pyRevitLabs.DeffrelDB/pyRevitLabs.DeffrelDB.csproj

+2-5
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
3737
</PropertyGroup>
3838
<ItemGroup>
39-
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
40-
<HintPath>..\packages\NLog.4.6.3\lib\net45\NLog.dll</HintPath>
39+
<Reference Include="pyRevitLabs.NLog">
40+
<HintPath>..\..\..\bin\pyRevitLabs.NLog.dll</HintPath>
4141
</Reference>
4242
<Reference Include="System" />
4343
<Reference Include="System.Configuration" />
@@ -75,9 +75,6 @@
7575
<Name>pyRevitLabs.Common</Name>
7676
</ProjectReference>
7777
</ItemGroup>
78-
<ItemGroup>
79-
<None Include="packages.config" />
80-
</ItemGroup>
8178
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
8279
<PropertyGroup>
8380
<PostBuildEvent>copy "$(TargetPath)" "$(TargetDir)..\..\..\..\..\bin"</PostBuildEvent>

dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/Addons.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
using pyRevitLabs.Common;
1010
using pyRevitLabs.Common.Extensions;
11-
using NLog;
11+
using pyRevitLabs.NLog;
1212

1313
namespace pyRevitLabs.TargetApps.Revit {
1414
public class RevitAddonManifest {

dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/Controls/FillPatternViewerControl.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
using pyRevitLabs.CommonWPF.Converters;
1111

12-
using NLog;
12+
using pyRevitLabs.NLog;
1313

1414
using Image = System.Drawing.Image;
1515
using Matrix = System.Drawing.Drawing2D.Matrix;

dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.19.0.0")]
36-
[assembly: AssemblyFileVersion("0.19.0.0")]
35+
[assembly: AssemblyVersion("0.20.0.0")]
36+
[assembly: AssemblyFileVersion("0.20.0.0")]

dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/PyRevit/PyRevit.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
using MadMilkman.Ini;
1313
using pyRevitLabs.Json.Linq;
14-
using NLog;
14+
using pyRevitLabs.NLog;
1515

1616
namespace pyRevitLabs.TargetApps.Revit {
1717
// main pyrevit functionality class
@@ -434,7 +434,7 @@ public static void UpdateAllClones() {
434434
// @handled @logs
435435
public static void Attach(int revitYear,
436436
PyRevitClone clone,
437-
int engineVer = 000,
437+
int engineVer,
438438
bool allUsers = false,
439439
bool force = false) {
440440
// make the addin manifest file
@@ -453,7 +453,7 @@ public static void Attach(int revitYear,
453453
allusers: allUsers);
454454
}
455455
else
456-
throw new pyRevitException(string.Format("Engine \"{0}\" can not be used as runtime.", engineVer));
456+
throw new pyRevitException(string.Format("Engine {0} can not be used as runtime.", engineVer));
457457
}
458458

459459
// attach clone to all installed revit versions

dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/PyRevit/PyRevitClone.cs

+5-13
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using pyRevitLabs.Common.Extensions;
1010

1111
using Nett;
12-
using NLog;
12+
using pyRevitLabs.NLog;
1313

1414
namespace pyRevitLabs.TargetApps.Revit {
1515
// helper struct
@@ -164,7 +164,7 @@ public void Rename(string newName) {
164164

165165
public List<PyRevitEngine> GetEngines() => GetEngines(ClonePath);
166166

167-
public PyRevitEngine GetEngine(int engineVer = 000) => GetEngine(ClonePath, engineVer: engineVer);
167+
public PyRevitEngine GetEngine(int engineVer) => GetEngine(ClonePath, engineVer: engineVer);
168168

169169
public List<PyRevitEngine> GetConfiguredEngines() => GetConfiguredEngines(ClonePath);
170170

@@ -263,17 +263,9 @@ public static bool IsCloneValid(string clonePath) {
263263
// get engine from clone path
264264
// returns latest with default engineVer value
265265
// @handled @logs
266-
public static PyRevitEngine GetEngine(string clonePath, int engineVer = 000) {
266+
public static PyRevitEngine GetEngine(string clonePath, int engineVer) {
267267
logger.Debug("Finding engine \"{0}\" path in \"{1}\"", engineVer, clonePath);
268-
269-
// find latest
270-
if (engineVer == 000) {
271-
return GetEngines(clonePath).OrderByDescending(x => x.Version).First();
272-
}
273-
// or specified
274-
else {
275-
return GetEngines(clonePath).Where(x => x.Version == engineVer).First();
276-
}
268+
return GetEngines(clonePath).Where(x => x.Version == engineVer).First();
277269
}
278270

279271
// get all engines from clone path
@@ -302,7 +294,7 @@ public static List<PyRevitEngine> GetConfiguredEngines(string clonePath) {
302294
logger.Debug("Engine configuration found: {0}", engineCfg.Key);
303295
var infoTable = engineCfg.Value as TomlTable;
304296
foreach (KeyValuePair<string, TomlObject> entry in infoTable)
305-
logger.Debug("\"{0}\" : \"{1}\"", entry.Key, entry.Value.TomlType);
297+
logger.Debug("\"{0}\" : \"{1}\"", entry.Key, entry.Value);
306298

307299
engines.Add(
308300
new PyRevitEngine(

dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/PyRevit/PyRevitExtension.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using pyRevitLabs.Common;
99

1010
using pyRevitLabs.Json.Linq;
11-
using NLog;
11+
using pyRevitLabs.NLog;
1212

1313
namespace pyRevitLabs.TargetApps.Revit {
1414
public class PyRevitExtensionDefinition {

dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/PyRevit/PyRevitRelease.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using pyRevitLabs.Common;
1111
using pyRevitLabs.Common.Extensions;
1212

13-
using NLog;
13+
using pyRevitLabs.NLog;
1414
using pyRevitLabs.Json;
1515
using pyRevitLabs.Json.Linq;
1616

dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/PyRevit/PyRevitRunner.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
using pyRevitLabs.Common;
1010
using pyRevitLabs.Common.Extensions;
11-
using NLog;
11+
using pyRevitLabs.NLog;
1212

1313
namespace pyRevitLabs.TargetApps.Revit {
1414
public class PyRevitRunnerExecEnv {

0 commit comments

Comments
 (0)