@@ -68,7 +68,7 @@ public class ModelGenerator
6868 [ Option ( CommandOptionType . NoValue , ShortName = "N" , LongName = "is-nullable" , Description = "The features that protect against throwing a System.NullReferenceException can be disruptive when turned on." ) ]
6969 public bool IsNullable { get ; }
7070
71- [ VersionOption ( "0.5.0 " ) ]
71+ [ VersionOption ( "0.5.1 " ) ]
7272 public bool Version { get ; }
7373
7474 private readonly string _templateStart = @"using System;
@@ -150,73 +150,73 @@ public async Task<int> OnExecute(CommandLineApplication app, IConsole console)
150150
151151 try
152152 {
153- Console . WriteLine ( $ "Fetching Stack details for API Key { ApiKey } " ) ;
153+ Console . WriteLine ( Messages . FetchingStackDetails ) ;
154154 stack = await client . GetStack ( ) ;
155155 }
156156 catch ( Exception e )
157157 {
158158 Console . WriteLine ( e ) ;
159159 Console . ForegroundColor = ConsoleColor . Red ;
160- Console . Error . WriteLine ( "There was an error communicating with the Contentstack API: " + e . Message ) ;
161- Console . Error . WriteLine ( "Please verify that your api key and authtoken are correct" ) ;
160+ Console . Error . WriteLine ( Messages . ApiCommunicationError ) ;
161+ Console . Error . WriteLine ( Messages . AuthenticationFailed ) ;
162162 return Program . ERROR ;
163163 }
164164
165165 var path = "" ;
166166 if ( string . IsNullOrEmpty ( Path ) )
167167 {
168168 path = Directory . GetCurrentDirectory ( ) ;
169- Console . WriteLine ( $ "No path specified, creating files in current working directory { path } " ) ;
169+ Console . WriteLine ( Messages . NoPathSpecified ( path ) ) ;
170170 }
171171 else
172172 {
173- Console . WriteLine ( $ "Path specified. Files will be created at { Path } " ) ;
173+ Console . WriteLine ( Messages . OutputPathSpecified ( Path ) ) ;
174174 path = Path ;
175175 }
176176 path = $ "{ path } /Models";
177177 DirectoryInfo dir = CreateDirectory ( path ) ;
178178
179179 try
180180 {
181- Console . WriteLine ( $ "Fetching Content Types from { stack . Name } " ) ;
181+ Console . WriteLine ( Messages . FetchingContentTypes ( stack . Name ) ) ;
182182 var totalCount = await getContentTypes ( client , 0 ) ;
183183 var skip = 100 ;
184- Console . WriteLine ( $ "Found { totalCount } Content Types ." ) ;
184+ Console . WriteLine ( Messages . FoundContentTypes ( totalCount ) ) ;
185185
186186 while ( totalCount > skip )
187187 {
188- Console . WriteLine ( $ " { skip } Content Types Fetched." ) ;
188+ Console . WriteLine ( Messages . FetchedContentTypes ( skip ) ) ;
189189 totalCount = await getContentTypes ( client , skip ) ;
190190 skip += 100 ;
191191 }
192- Console . WriteLine ( $ "Total { totalCount } Content Types fetched." ) ;
192+ Console . WriteLine ( Messages . TotalContentTypesFetched ( totalCount ) ) ;
193193
194194 CreateEmbeddedObjectClass ( Namespace , dir ) ;
195195
196- Console . WriteLine ( $ "Fetching Global Fields from { stack . Name } " ) ;
196+ Console . WriteLine ( Messages . FetchingGlobalFields ( stack . Name ) ) ;
197197 totalCount = await getGlobalFields ( client , 0 ) ;
198198 skip = 100 ;
199- Console . WriteLine ( $ "Found { totalCount } Global Fields." ) ;
199+ Console . WriteLine ( Messages . FoundGlobalFields ( totalCount ) ) ;
200200
201201 while ( totalCount > skip )
202202 {
203- Console . WriteLine ( $ " { skip } Global Fields Fetched." ) ;
203+ Console . WriteLine ( Messages . FetchedGlobalFields ( skip ) ) ;
204204 totalCount = await getGlobalFields ( client , skip ) ;
205205 skip += 100 ;
206206 }
207- Console . WriteLine ( $ "Total { totalCount } Global Fields fetched." ) ;
207+ Console . WriteLine ( Messages . TotalGlobalFieldsFetched ( totalCount ) ) ;
208208 }
209209 catch ( Exception e )
210210 {
211211 Console . ForegroundColor = ConsoleColor . Red ;
212- Console . Error . WriteLine ( "There was an error communicating with the Contentstack API: " + e . Message ) ;
213- Console . Error . WriteLine ( "Please verify that your api key and authtoken are correct" ) ;
212+ Console . Error . WriteLine ( Messages . ApiCommunicationError ) ;
213+ Console . Error . WriteLine ( Messages . AuthenticationFailed ) ;
214214 return Program . ERROR ;
215215 }
216216 Console . ResetColor ( ) ;
217217
218218 Console . ForegroundColor = ConsoleColor . Green ;
219- Console . WriteLine ( $ "Generating files from content type" ) ;
219+ Console . WriteLine ( Messages . GeneratingFiles ) ;
220220 Console . ResetColor ( ) ;
221221
222222 Console . ForegroundColor = ConsoleColor . DarkYellow ;
@@ -231,9 +231,9 @@ public async Task<int> OnExecute(CommandLineApplication app, IConsole console)
231231 }
232232
233233 Console . ForegroundColor = ConsoleColor . Green ;
234- Console . WriteLine ( $ "Files successfully created!" ) ;
234+ Console . WriteLine ( Messages . FilesCreatedSuccessfully ) ;
235235 Console . ResetColor ( ) ;
236- Console . WriteLine ( $ "Opening { dir . FullName } " ) ;
236+ Console . WriteLine ( Messages . OpeningOutputDirectory ( dir . FullName ) ) ;
237237 OpenFolderatPath ( dir . FullName ) ;
238238
239239 // Logout from OAuth if OAuth was used
@@ -306,7 +306,7 @@ private string GetDatatype(Field field, string contentTypeName)
306306 case "group" :
307307 return GetDataTypeForGroup ( field , contentTypeName ) ;
308308 default :
309- Console . WriteLine ( field . DataType ) ;
309+ Console . WriteLine ( Messages . FieldDataType ( field . DataType ) ) ;
310310 break ;
311311 }
312312 return "object" ;
@@ -625,7 +625,7 @@ private void CreateGlobalFieldModular(string contentTypeName, string nameSpace,
625625 private void CreateModularFile ( string contentTypeName , string nameSpace , Contenttype contentType , DirectoryInfo directoryInfo , string extendsClass = null )
626626 {
627627
628- Console . WriteLine ( $ "Extracting Modular Blocks in { contentTypeName } ." ) ;
628+ Console . WriteLine ( Messages . ExtractingModularBlocksInContentType ( contentTypeName ) ) ;
629629
630630 // Get modular Block within ContentType
631631 var usingDirectiveList = new List < string > ( ) ;
@@ -635,7 +635,7 @@ private void CreateModularFile(string contentTypeName, string nameSpace, Content
635635 usingDirectiveList . Add ( modularUsingDirective ) ;
636636 }
637637
638- Console . WriteLine ( $ "Extracting Groups in { contentTypeName } ." ) ;
638+ Console . WriteLine ( Messages . ExtractingGroupsInContentType ( contentTypeName ) ) ;
639639
640640 string groupUsingDirective = CreateGroup ( nameSpace , contentTypeName , contentType . Schema , directoryInfo ) ;
641641 usingDirectiveList . Add ( groupUsingDirective ) ;
@@ -699,7 +699,7 @@ private Boolean findRTEReference(List<Field> Schema)
699699 private void CreateFile ( string contentTypeName , string nameSpace , Contenttype contentType , DirectoryInfo directoryInfo )
700700 {
701701
702- Console . WriteLine ( $ "Extracting Modular Blocks in { contentTypeName } ." ) ;
702+ Console . WriteLine ( Messages . ExtractingModularBlocksInContentType ( contentTypeName ) ) ;
703703
704704 var fields = findRTEReference ( contentType . Schema ) ;
705705
@@ -711,7 +711,7 @@ private void CreateFile(string contentTypeName, string nameSpace, Contenttype co
711711 usingDirectiveList . Add ( modularUsingDirective ) ;
712712 }
713713
714- Console . WriteLine ( $ "Extracting Groups in { contentTypeName } ." ) ;
714+ Console . WriteLine ( Messages . ExtractingGroupsInContentType ( contentTypeName ) ) ;
715715
716716 string groupUsingDirective = CreateGroup ( nameSpace , contentTypeName , contentType . Schema , directoryInfo ) ;
717717 usingDirectiveList . Add ( groupUsingDirective ) ;
@@ -775,12 +775,12 @@ private FileInfo shouldCreateFile(string fileName, DirectoryInfo directoryInfo)
775775 if ( ! prompt )
776776 {
777777 Console . ForegroundColor = ConsoleColor . Red ;
778- Console . WriteLine ( $ "Skipping { file . Name } " ) ;
778+ Console . WriteLine ( Messages . SkippingFile ( file . Name ) ) ;
779779 Console . ResetColor ( ) ;
780780 return null ;
781781 }
782782 }
783- Console . WriteLine ( $ "Adding File { fileName } to { directoryInfo . FullName } ." ) ;
783+ Console . WriteLine ( Messages . AddingFile ( fileName , directoryInfo . FullName ) ) ;
784784 return file ;
785785 }
786786
@@ -789,7 +789,7 @@ private DirectoryInfo CreateDirectory(string path)
789789 var dir = new DirectoryInfo ( path ) ;
790790 if ( ! dir . Exists )
791791 {
792- Console . WriteLine ( $ "Path { path } does not exist and will be created." ) ;
792+ Console . WriteLine ( Messages . OutputPathNotFound ( path ) ) ;
793793 dir . Create ( ) ;
794794 }
795795 return dir ;
@@ -947,7 +947,7 @@ private void AddEnum(string enumName, in StringBuilder sb)
947947
948948 private void CreateGroupClass ( string groupName , string nameSpace , Field field , DirectoryInfo directoryInfo )
949949 {
950- Console . WriteLine ( $ "Extracting Modular Blocks in { groupName } ." ) ;
950+ Console . WriteLine ( Messages . ExtractingModularBlocksInGroup ( groupName ) ) ;
951951
952952 // Get modular Block within Group
953953 var usingDirectiveList = new List < string > ( ) ;
@@ -957,7 +957,7 @@ private void CreateGroupClass(string groupName, string nameSpace, Field field, D
957957 usingDirectiveList . Add ( modularUsingDirective ) ;
958958 }
959959
960- Console . WriteLine ( $ "Extracting Groups in { groupName } ." ) ;
960+ Console . WriteLine ( Messages . ExtractingGroupsInGroup ( groupName ) ) ;
961961 // Get Group within Group
962962 string grpupUsingDirective = CreateGroup ( nameSpace , groupName , field . Schema , directoryInfo ) ;
963963 usingDirectiveList . Add ( grpupUsingDirective ) ;
0 commit comments