Skip to content

Commit

Permalink
Merge branch 'release/4.6.24'
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Jun 30, 2019
2 parents 6f2cb14 + 6914a47 commit 76d18d6
Show file tree
Hide file tree
Showing 103 changed files with 1,140 additions and 560 deletions.
Binary file modified bin/Nett.dll
Binary file not shown.
Binary file removed bin/engines/273/pyRevitLoader.pdb
Binary file not shown.
Binary file removed bin/engines/273/pyRevitRunner.pdb
Binary file not shown.
Binary file modified bin/engines/277/pyRevitLoader.dll
Binary file not shown.
Binary file removed bin/engines/277/pyRevitLoader.pdb
Binary file not shown.
Binary file removed bin/engines/277/pyRevitRunner.pdb
Binary file not shown.
Binary file removed bin/engines/278/pyRevitLoader.pdb
Binary file not shown.
Binary file removed bin/engines/278/pyRevitRunner.pdb
Binary file not shown.
Binary file removed bin/engines/279/pyRevitLoader.pdb
Binary file not shown.
Binary file removed bin/engines/279/pyRevitRunner.pdb
Binary file not shown.
Binary file modified bin/engines/368/Python.Runtime.dll
Binary file not shown.
Binary file modified bin/engines/372/Python.Runtime.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Common.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonCLI.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonWPF.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.DeffrelDB.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Language.dll
Binary file not shown.
Binary file added bin/pyRevitLabs.NLog.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.AutoCAD.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.Navisworks.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.Revit.dll
Binary file not shown.
Binary file modified bin/pyrevit-updater
Binary file not shown.
Binary file modified bin/pyrevit.exe
Binary file not shown.
14 changes: 13 additions & 1 deletion dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,20 @@ Changes listed here were made to the Visual Studio project
- Refactored `StaticResource` and `DynamicResource` references to `pyRevitLabs.MahAppsMetro`
- Renamed project assembly name to `pyRevitLabs.MahAppsMetro`

## NLog

[See related issues here](https://github.com/eirannejad/pyRevit/issues/579)
`NLog` (==4.6.4) was recompile to `pyRevitLabs.NLog` (==4.6.4 | .NET 4.5) to avoid the conflict.

Changes listed here were made to the Visual Studio project

- Refactored the root namespace to `pyRevitLabs.NLog`
- Changed Package settings to version 4.6.4
- Renamed project assembly name to `pyRevitLabs.NLog`


## natsort

natsort.natsort.py
wrapped natsort_key.__doc__ (line # 209) in try-except for IronPython 2.7.3 compatibility
wrapped natsort_key.__doc__ (line # 209) in try-except for IronPython 2.7.3 compatibility
2 changes: 1 addition & 1 deletion dev/pyRevitLabs/pyRevitLabs.Common/CommonUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Text.RegularExpressions;
using IWshRuntimeLibrary;

using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.Common {
public static class CommonUtils {
Expand Down
54 changes: 53 additions & 1 deletion dev/pyRevitLabs/pyRevitLabs.Common/Extensions/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Globalization;
using System.CodeDom.Compiler;
using System.CodeDom;
using System.Web;

using NLog;
using pyRevitLabs.NLog;
using pyRevitLabs.Json;

namespace pyRevitLabs.Common.Extensions {
Expand Down Expand Up @@ -264,6 +267,55 @@ public static string ConvertToCommaSeparatedString(this IEnumerable<string> sour
public static List<string> ConvertFromCommaSeparatedString(this string commaSeparatedValue) {
return new List<string>(commaSeparatedValue.Split(','));
}

public static string ToLiteral(this string input) {
using (var writer = new StringWriter()) {
using (var provider = CodeDomProvider.CreateProvider("CSharp")) {
provider.GenerateCodeFromExpression(new CodePrimitiveExpression(input), writer, null);
return writer.ToString();
}
}
}

public static string ToEscaped(this string input, bool WrapInQuotes = false) {
var literal = new StringBuilder(input.Length + 2);
if (WrapInQuotes)
literal.Append("\"");

foreach (var c in input) {
switch (c) {
case '\'': literal.Append(@"\'"); break;
case '\"': literal.Append("\\\""); break;
case '\\': literal.Append(@"\\"); break;
case '\0': literal.Append(@"\0"); break;
case '\a': literal.Append(@"\a"); break;
case '\b': literal.Append(@"\b"); break;
case '\f': literal.Append(@"\f"); break;
case '\n': literal.Append(@"\n"); break;
case '\r': literal.Append(@"\r"); break;
case '\t': literal.Append(@"\t"); break;
case '\v': literal.Append(@"\v"); break;
default:
if (Char.GetUnicodeCategory(c) != UnicodeCategory.Control) {
literal.Append(c);
}
else {
literal.Append(@"\u");
literal.Append(((ushort)c).ToString("x4"));
}
break;
}
}

if (WrapInQuotes)
literal.Append("\"");

return literal.ToString();
}

public static string PrepareJSONForCSV(this string input) {
return "\"" + input.Replace("\"", "\"\"") + "\"";
}
}

public static class DateTimeExtensions {
Expand Down
2 changes: 1 addition & 1 deletion dev/pyRevitLabs/pyRevitLabs.Common/GitInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading.Tasks;

using LibGit2Sharp;
using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.Common {
// git exceptions
Expand Down
26 changes: 16 additions & 10 deletions dev/pyRevitLabs/pyRevitLabs.Common/UserEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Security.AccessControl;

using DotNetVersionFinder;
using pyRevitLabs.NLog;


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

public static class UserEnv {
private static Logger logger = LogManager.GetCurrentClassLogger();

public static string GetWindowsVersion() {
// https://docs.microsoft.com/en-us/windows/desktop/SysInfo/operating-system-version
// https://stackoverflow.com/a/37700770/2350244
Expand Down Expand Up @@ -66,17 +69,20 @@ public static List<string> GetInstalledDotnetCoreTargetPacks() {
}

public static string GetLoggedInUserName() {
ConnectionOptions oConn = new ConnectionOptions();
ManagementScope oMs = new ManagementScope("\\\\localhost", oConn);

ObjectQuery oQuery = new ObjectQuery("select * from Win32_ComputerSystem");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();

foreach (ManagementObject oReturn in oReturnCollection) {
return oReturn["UserName"].ToString();
try {
ConnectionOptions oConn = new ConnectionOptions();
ManagementScope oMs = new ManagementScope("\\\\localhost", oConn);

ObjectQuery oQuery = new ObjectQuery("select * from Win32_ComputerSystem");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();

foreach (ManagementObject oReturn in oReturnCollection) {
return oReturn["UserName"].ToString();
}
} catch (Exception ex) {
logger.Debug("Failed to get logged in username. | {0}", ex.Message);
}

return null;
}

Expand Down
8 changes: 5 additions & 3 deletions dev/pyRevitLabs/pyRevitLabs.Common/pyRevitLabs.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="pyRevitLabs.Json">
<HintPath>..\..\..\bin\pyRevitLabs.Json.dll</HintPath>
</Reference>
<Reference Include="pyRevitLabs.NLog">
<HintPath>..\..\..\bin\pyRevitLabs.NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
Expand All @@ -51,6 +55,7 @@
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
Expand Down Expand Up @@ -82,9 +87,6 @@
<PackageReference Include="NETStandard.Library">
<Version>2.0.3</Version>
</PackageReference>
<PackageReference Include="NLog">
<Version>4.6.3</Version>
</PackageReference>
<PackageReference Include="OpenMcdf">
<Version>2.2.1.3</Version>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions dev/pyRevitLabs/pyRevitLabs.DeffrelDB/DataBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
using System.Text;

using pyRevitLabs.Common;
using NLog.Targets;
using NLog.Config;
using pyRevitLabs.NLog.Targets;
using pyRevitLabs.NLog.Config;

#if DEBUG
using pyRevitLabs.CommonCLI;
#endif

using NLog;
using pyRevitLabs.NLog;


// TODO: add log messages
Expand Down
2 changes: 1 addition & 1 deletion dev/pyRevitLabs/pyRevitLabs.DeffrelDB/DataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using pyRevitLabs.Common;

using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.DeffrelDB {
// datastore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Text.RegularExpressions;

using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.DeffrelDB {
internal class DefaultDataFormatter: IDataFormatter {
Expand Down
4 changes: 0 additions & 4 deletions dev/pyRevitLabs/pyRevitLabs.DeffrelDB/packages.config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.6.3\lib\net45\NLog.dll</HintPath>
<Reference Include="pyRevitLabs.NLog">
<HintPath>..\..\..\bin\pyRevitLabs.NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand Down Expand Up @@ -75,9 +75,6 @@
<Name>pyRevitLabs.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "$(TargetDir)..\..\..\..\..\bin"</PostBuildEvent>
Expand Down
2 changes: 1 addition & 1 deletion dev/pyRevitLabs/pyRevitLabs.TargetApps.Revit/Addons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

using pyRevitLabs.Common;
using pyRevitLabs.Common.Extensions;
using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.TargetApps.Revit {
public class RevitAddonManifest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using pyRevitLabs.CommonWPF.Converters;

using NLog;
using pyRevitLabs.NLog;

using Image = System.Drawing.Image;
using Matrix = System.Drawing.Drawing2D.Matrix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.19.0.0")]
[assembly: AssemblyFileVersion("0.19.0.0")]
[assembly: AssemblyVersion("0.20.0.0")]
[assembly: AssemblyFileVersion("0.20.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

using MadMilkman.Ini;
using pyRevitLabs.Json.Linq;
using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.TargetApps.Revit {
// main pyrevit functionality class
Expand Down Expand Up @@ -434,7 +434,7 @@ public static void UpdateAllClones() {
// @handled @logs
public static void Attach(int revitYear,
PyRevitClone clone,
int engineVer = 000,
int engineVer,
bool allUsers = false,
bool force = false) {
// make the addin manifest file
Expand All @@ -453,7 +453,7 @@ public static void Attach(int revitYear,
allusers: allUsers);
}
else
throw new pyRevitException(string.Format("Engine \"{0}\" can not be used as runtime.", engineVer));
throw new pyRevitException(string.Format("Engine {0} can not be used as runtime.", engineVer));
}

// attach clone to all installed revit versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using pyRevitLabs.Common.Extensions;

using Nett;
using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.TargetApps.Revit {
// helper struct
Expand Down Expand Up @@ -164,7 +164,7 @@ public void Rename(string newName) {

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

public PyRevitEngine GetEngine(int engineVer = 000) => GetEngine(ClonePath, engineVer: engineVer);
public PyRevitEngine GetEngine(int engineVer) => GetEngine(ClonePath, engineVer: engineVer);

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

Expand Down Expand Up @@ -263,17 +263,9 @@ public static bool IsCloneValid(string clonePath) {
// get engine from clone path
// returns latest with default engineVer value
// @handled @logs
public static PyRevitEngine GetEngine(string clonePath, int engineVer = 000) {
public static PyRevitEngine GetEngine(string clonePath, int engineVer) {
logger.Debug("Finding engine \"{0}\" path in \"{1}\"", engineVer, clonePath);

// find latest
if (engineVer == 000) {
return GetEngines(clonePath).OrderByDescending(x => x.Version).First();
}
// or specified
else {
return GetEngines(clonePath).Where(x => x.Version == engineVer).First();
}
return GetEngines(clonePath).Where(x => x.Version == engineVer).First();
}

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

engines.Add(
new PyRevitEngine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using pyRevitLabs.Common;

using pyRevitLabs.Json.Linq;
using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.TargetApps.Revit {
public class PyRevitExtensionDefinition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using pyRevitLabs.Common;
using pyRevitLabs.Common.Extensions;

using NLog;
using pyRevitLabs.NLog;
using pyRevitLabs.Json;
using pyRevitLabs.Json.Linq;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

using pyRevitLabs.Common;
using pyRevitLabs.Common.Extensions;
using NLog;
using pyRevitLabs.NLog;

namespace pyRevitLabs.TargetApps.Revit {
public class PyRevitRunnerExecEnv {
Expand Down
Loading

0 comments on commit 76d18d6

Please sign in to comment.