File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -27,11 +27,11 @@ public class CopyrightInfo
2727 /// <summary>
2828 /// An empty object used for initialization.
2929 /// </summary>
30- public static CopyrightInfo Empty
30+ public static CopyrightInfo Empty
3131 {
3232 get
3333 {
34- return new CopyrightInfo ( "author" , 1 ) ;
34+ return new CopyrightInfo ( "author" , DateTime . Now . Year ) ;
3535 }
3636 }
3737
@@ -115,12 +115,13 @@ public static CopyrightInfo Default
115115 case MaybeType . Just :
116116 return new CopyrightInfo ( copyrightAttr . FromJustOrFail ( ) ) ;
117117 default :
118- // if no copyright attribute exist but a company attribute does, use it as copyright holder
119- return new CopyrightInfo (
120- ReflectionHelper . GetAttribute < AssemblyCompanyAttribute > ( ) . FromJustOrFail (
121- new InvalidOperationException ( "CopyrightInfo::Default requires that you define AssemblyCopyrightAttribute or AssemblyCompanyAttribute." )
122- ) . Company ,
123- DateTime . Now . Year ) ;
118+ var companyAttr = ReflectionHelper . GetAttribute < AssemblyCompanyAttribute > ( ) ;
119+ return companyAttr . IsNothing ( )
120+ //if both copyrightAttr and companyAttr aren't available in Assembly,don't fire Exception
121+ ? Empty
122+ // if no copyright attribute exist but a company attribute does, use it as copyright holder
123+ : new CopyrightInfo ( companyAttr . FromJust ( ) . Company , DateTime . Now . Year ) ;
124+
124125 }
125126 }
126127 }
@@ -192,4 +193,4 @@ protected virtual string FormatYears(int[] years)
192193 return yearsPart . ToString ( ) ;
193194 }
194195 }
195- }
196+ }
You can’t perform that action at this time.
0 commit comments