Skip to content

Commit ce1116d

Browse files
Update LibraryCreator.cs
1 parent 4f4c114 commit ce1116d

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

class/LibraryCreator.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,27 @@ private string FillAssemblyControllerCase(Assembly assembly, string EntryAssembl
483483
string NameSpace = (string.IsNullOrEmpty(TmpClass.Namespace) || (TmpClass.Namespace == EntryAssemblyName)) ? "" : TmpClass.Namespace + ".";
484484
string ClassName = "Tmp" + TmpClass.Namespace + "_" + TmpClass.Name;
485485

486-
if ((TmpClass.Name.ToLower() != TmpClass.Name))
486+
string ClassNameForCall = TmpClass.Name;
487+
if (options.PutTwoUnderlinesEqualToDashForController)
488+
ClassNameForCall = ClassNameForCall.Replace("__", '-'.ToString());
489+
if (ClassNameForCall.StartsWith(options.IgnorePrefixController))
490+
ClassNameForCall = ClassNameForCall.Remove(0, options.IgnorePrefixController.Length);
491+
if (ClassNameForCall.EndsWith(options.IgnoreSuffixController))
492+
ClassNameForCall = ClassNameForCall.GetTextBeforeLastValue(options.IgnoreSuffixController);
493+
494+
495+
if (ClassNameForCall.ToLower() != ClassNameForCall)
487496
{
488497
if (!options.JustAccessControllerByLowerCase)
489-
ReturnValue += " case \"" + TmpClass.Name + "\":" + Environment.NewLine;
498+
ReturnValue += " case \"" + ClassNameForCall + "\":" + Environment.NewLine;
490499

491500
if (options.AccessControllerByLowerCase || options.JustAccessControllerByLowerCase)
492-
ReturnValue += " case \"" + TmpClass.Name.ToLower() + "\":" + Environment.NewLine;
501+
ReturnValue += " case \"" + ClassNameForCall.ToLower() + "\":" + Environment.NewLine;
493502
}
494503
else
495-
ReturnValue += " case \"" + TmpClass.Name + "\":" + Environment.NewLine;
504+
ReturnValue += " case \"" + ClassNameForCall + "\":" + Environment.NewLine;
496505

497-
if (StaticObject.SetBreakForDefaultController && (TmpClass.Name == StaticObject.DefaultController))
506+
if (StaticObject.SetBreakForDefaultController && (TmpClass.Name == options.DefaultController))
498507
{
499508
ReturnValue += " if (!IsDefaultController)" + Environment.NewLine;
500509
ReturnValue += " {" + Environment.NewLine;
@@ -521,7 +530,7 @@ private string FillAssemblyControllerCase(Assembly assembly, string EntryAssembl
521530
}
522531

523532
ReturnValue += " " + NameSpace + TmpClass.Name + " " + ClassName + " = new " + NameSpace + TmpClass.Name + "();" + Environment.NewLine;
524-
ReturnValue += " " + ClassName + ".FillSection(context, \"/" + TmpClass.Name + "\");" + Environment.NewLine;
533+
ReturnValue += " " + ClassName + ".FillSection(context, \"/\" + ControllerClass);" + Environment.NewLine;
525534
ReturnValue += " " + ClassName + ".PageLoad(context);" + Environment.NewLine;
526535
ReturnValue += " this.WebFormsValue += " + ClassName + ".WebFormsValue;" + Environment.NewLine;
527536

0 commit comments

Comments
 (0)