Skip to content

Commit

Permalink
fix name string define attribute larger 64 character
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed May 22, 2022
1 parent cf8352d commit 4f2ae58
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions CadAddinManager/Model/AssemLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ private string SaveAssemblyModifyToTemp(string originalFilePath)
}
private CustomAttribute CreateCustomAttribute3Type(CustomAttribute customAttribute)
{
string valueAttribute = ResolveValueAttribute(customAttribute);
return new CustomAttribute(customAttribute.Constructor)
{
ConstructorArguments =
{
new CustomAttributeArgument(
customAttribute.ConstructorArguments[0].Type,
customAttribute.ConstructorArguments[0].Value + Guid.NewGuid().ToString()),
customAttribute.ConstructorArguments[0].Type,valueAttribute),
new CustomAttributeArgument(
customAttribute.ConstructorArguments[1].Type,
customAttribute.ConstructorArguments[1].Value),
Expand All @@ -182,13 +182,14 @@ private CustomAttribute CreateCustomAttribute3Type(CustomAttribute customAttribu
}
private CustomAttribute CreateCustomAttribute2Type(CustomAttribute customAttribute)
{
string valueAttribute = ResolveValueAttribute(customAttribute);
return new CustomAttribute(customAttribute.Constructor)
{
ConstructorArguments =
{
new CustomAttributeArgument(
customAttribute.ConstructorArguments[0].Type,
customAttribute.ConstructorArguments[0].Value + Guid.NewGuid().ToString()),
valueAttribute),
new CustomAttributeArgument(
customAttribute.ConstructorArguments[1].Type,
customAttribute.ConstructorArguments[1].Value),
Expand All @@ -197,16 +198,24 @@ private CustomAttribute CreateCustomAttribute2Type(CustomAttribute customAttribu
}
private CustomAttribute CreateCustomAttribute1Type(CustomAttribute customAttribute)
{
string valueAttribute = ResolveValueAttribute(customAttribute);

return new CustomAttribute(customAttribute.Constructor)
{
ConstructorArguments =
{
new CustomAttributeArgument(
customAttribute.ConstructorArguments[0].Type,
customAttribute.ConstructorArguments[0].Value + Guid.NewGuid().ToString()),
customAttribute.ConstructorArguments[0].Type,valueAttribute),
}
};
}
private string ResolveValueAttribute(CustomAttribute att)
{
string suffix = DateTime.Now.ToString("yyyyMMddhhmmssfff");
string value = att.ConstructorArguments[0].Value +suffix;
if (value.Length >= 64) value = "Execute" + suffix;
return value;
}
private Assembly CopyAndLoadAddin(string srcFilePath, bool onlyCopyRelated)
{
var text = string.Empty;
Expand Down

0 comments on commit 4f2ae58

Please sign in to comment.