├── README.md
├── packages.config
├── Event.cs
├── Humanizer.sln
├── Properties
└── AssemblyInfo.cs
├── Program.cs
├── HumanizerPost.csproj
└── .gitignore
/README.md:
--------------------------------------------------------------------------------
1 | # humanize-post
2 | Código del post "Humanizando tus aplicaciones" / Code from the post "Humanizing your apps"
3 |
--------------------------------------------------------------------------------
/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Event.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HumanizerPost
4 | {
5 | public class Event
6 | {
7 | public int Number {
8 | get;
9 | set;
10 | }
11 |
12 | public string Name {
13 | get;
14 | set;
15 | }
16 |
17 | public string Description {
18 | get;
19 | set;
20 | }
21 |
22 | public int Attendants {
23 | get;
24 | set;
25 | }
26 |
27 | public DateTime Start {
28 | get;
29 | set;
30 | }
31 |
32 | public DateTime End {
33 | get;
34 | set;
35 | }
36 |
37 | public Event ()
38 | {
39 |
40 | }
41 | }
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/Humanizer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HumanizerPost", "HumanizerPost.csproj", "{6961809D-1D17-448D-A013-29F6C7647DF2}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {6961809D-1D17-448D-A013-29F6C7647DF2}.Debug|x86.ActiveCfg = Debug|x86
13 | {6961809D-1D17-448D-A013-29F6C7647DF2}.Debug|x86.Build.0 = Debug|x86
14 | {6961809D-1D17-448D-A013-29F6C7647DF2}.Release|x86.ActiveCfg = Release|x86
15 | {6961809D-1D17-448D-A013-29F6C7647DF2}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | EndGlobal
18 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 |
7 | [assembly: AssemblyTitle ("Humanizer")]
8 | [assembly: AssemblyDescription ("")]
9 | [assembly: AssemblyConfiguration ("")]
10 | [assembly: AssemblyCompany ("")]
11 | [assembly: AssemblyProduct ("")]
12 | [assembly: AssemblyCopyright ("fferegrino")]
13 | [assembly: AssemblyTrademark ("")]
14 | [assembly: AssemblyCulture ("")]
15 |
16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
19 |
20 | [assembly: AssemblyVersion ("1.0.*")]
21 |
22 | // The following attributes are used to specify the signing key for the assembly,
23 | // if desired. See the Mono documentation for more information about signing.
24 |
25 | //[assembly: AssemblyDelaySign(false)]
26 | //[assembly: AssemblyKeyFile("")]
27 |
28 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Humanizer;
3 | using System.Threading;
4 | using System.Globalization;
5 |
6 | namespace HumanizerPost
7 | {
8 | class MainClass
9 | {
10 | private static CultureInfo CurrentCulture = new CultureInfo("es-ES");
11 |
12 | public static void Main (string[] args)
13 | {
14 | Thread.CurrentThread.CurrentUICulture = CurrentCulture;
15 |
16 | var contest = new Event
17 | {
18 | Number = 8,
19 | Name = "Concurso Anual de Programación",
20 | Description = "El Capitulo Estudiantil ACM de la Escuela Superior de Cómputo del Instituto Politécnico Nacional los invita a participar en esta edición del Concurso Anual de Programación, en el marco de las actividades de la ExpoESCOM.",
21 | Start = new DateTime(2016,2, 29, 10,0,0),
22 | End = new DateTime(2016,2,29,17,30,0)
23 | };
24 |
25 | Console.WriteLine ("No humanizado:\n");
26 | PrintEventInfo (contest);
27 | Console.WriteLine ("Humanizado:\n");
28 | PrintHumanizedEventInfo (contest);
29 | }
30 |
31 | public static void PrintEventInfo(Event evt){
32 | Console.WriteLine ("Evento número " + evt.Number);
33 | Console.WriteLine (evt.Name);
34 | Console.WriteLine (evt.Description);
35 | Console.WriteLine ("Número de asistentes: " + evt.Attendants);
36 | Console.WriteLine ("Fecha: " + evt.Start.ToLongDateString());
37 | Console.WriteLine ("Duración: de " + evt.Start.ToLongTimeString () + " a " + evt.End.ToLongTimeString ());
38 | }
39 |
40 | public static void PrintHumanizedEventInfo(Event evt){
41 | Console.WriteLine (evt.Number.ToOrdinalWords(GrammaticalGender.Masculine).Titleize() + " evento");
42 | Console.WriteLine (evt.Name);
43 | Console.WriteLine (evt.Description.Truncate(60,"..."));
44 | Console.WriteLine ("asistente".ToQuantity(evt.Attendants, ShowQuantityAs.Words));
45 | Console.WriteLine (evt.Start.Humanize(true, DateTime.Now,new CultureInfo("es")).Humanize(LetterCasing.Sentence));
46 | Console.WriteLine ((evt.End - evt.Start).Humanize(3));
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/HumanizerPost.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | {6961809D-1D17-448D-A013-29F6C7647DF2}
7 | Exe
8 | HumanizerPost
9 | Humanizer
10 | v4.5
11 |
12 |
13 | true
14 | full
15 | false
16 | bin\Debug
17 | DEBUG;
18 | prompt
19 | 4
20 | true
21 | x86
22 |
23 |
24 | full
25 | true
26 | bin\Release
27 | prompt
28 | 4
29 | true
30 | x86
31 |
32 |
33 |
34 |
35 | packages\Humanizer.Core.2.0.0-beta02-0092\lib\portable-win+net45+wp8+wpa81\Humanizer.dll
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.gitignore.io/api/visualstudio,osx,windows
3 |
4 | ### VisualStudio ###
5 | ## Ignore Visual Studio temporary files, build results, and
6 | ## files generated by popular Visual Studio add-ons.
7 |
8 | # User-specific files
9 | *.suo
10 | *.user
11 | *.userosscache
12 | *.sln.docstates
13 |
14 | # User-specific files (MonoDevelop/Xamarin Studio)
15 | *.userprefs
16 |
17 | # Build results
18 | [Dd]ebug/
19 | [Dd]ebugPublic/
20 | [Rr]elease/
21 | [Rr]eleases/
22 | x64/
23 | x86/
24 | build/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 |
29 | # Visual Studio 2015 cache/options directory
30 | .vs/
31 | # Uncomment if you have tasks that create the project's static files in wwwroot
32 | #wwwroot/
33 |
34 | # MSTest test Results
35 | [Tt]est[Rr]esult*/
36 | [Bb]uild[Ll]og.*
37 |
38 | # NUNIT
39 | *.VisualState.xml
40 | TestResult.xml
41 |
42 | # Build Results of an ATL Project
43 | [Dd]ebugPS/
44 | [Rr]eleasePS/
45 | dlldata.c
46 |
47 | # DNX
48 | project.lock.json
49 | artifacts/
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 |
88 | # Visual Studio profiler
89 | *.psess
90 | *.vsp
91 | *.vspx
92 | *.sap
93 |
94 | # TFS 2012 Local Workspace
95 | $tf/
96 |
97 | # Guidance Automation Toolkit
98 | *.gpState
99 |
100 | # ReSharper is a .NET coding add-in
101 | _ReSharper*/
102 | *.[Rr]e[Ss]harper
103 | *.DotSettings.user
104 |
105 | # JustCode is a .NET coding add-in
106 | .JustCode
107 |
108 | # TeamCity is a build add-in
109 | _TeamCity*
110 |
111 | # DotCover is a Code Coverage Tool
112 | *.dotCover
113 |
114 | # NCrunch
115 | _NCrunch_*
116 | .*crunch*.local.xml
117 | nCrunchTemp_*
118 |
119 | # MightyMoose
120 | *.mm.*
121 | AutoTest.Net/
122 |
123 | # Web workbench (sass)
124 | .sass-cache/
125 |
126 | # Installshield output folder
127 | [Ee]xpress/
128 |
129 | # DocProject is a documentation generator add-in
130 | DocProject/buildhelp/
131 | DocProject/Help/*.HxT
132 | DocProject/Help/*.HxC
133 | DocProject/Help/*.hhc
134 | DocProject/Help/*.hhk
135 | DocProject/Help/*.hhp
136 | DocProject/Help/Html2
137 | DocProject/Help/html
138 |
139 | # Click-Once directory
140 | publish/
141 |
142 | # Publish Web Output
143 | *.[Pp]ublish.xml
144 | *.azurePubxml
145 | # TODO: Comment the next line if you want to checkin your web deploy settings
146 | # but database connection strings (with potential passwords) will be unencrypted
147 | *.pubxml
148 | *.publishproj
149 |
150 | # NuGet Packages
151 | *.nupkg
152 | # The packages folder can be ignored because of Package Restore
153 | **/packages/*
154 | # except build/, which is used as an MSBuild target.
155 | !**/packages/build/
156 | # Uncomment if necessary however generally it will be regenerated when needed
157 | #!**/packages/repositories.config
158 |
159 | # Microsoft Azure Build Output
160 | csx/
161 | *.build.csdef
162 |
163 | # Microsoft Azure Emulator
164 | ecf/
165 | rcf/
166 |
167 | # Microsoft Azure ApplicationInsights config file
168 | ApplicationInsights.config
169 |
170 | # Windows Store app package directory
171 | AppPackages/
172 | BundleArtifacts/
173 |
174 | # Visual Studio cache files
175 | # files ending in .cache can be ignored
176 | *.[Cc]ache
177 | # but keep track of directories ending in .cache
178 | !*.[Cc]ache/
179 |
180 | # Others
181 | ClientBin/
182 | ~$*
183 | *~
184 | *.dbmdl
185 | *.dbproj.schemaview
186 | *.pfx
187 | *.publishsettings
188 | node_modules/
189 | orleans.codegen.cs
190 |
191 | # RIA/Silverlight projects
192 | Generated_Code/
193 |
194 | # Backup & report files from converting an old project file
195 | # to a newer Visual Studio version. Backup files are not needed,
196 | # because we have git ;-)
197 | _UpgradeReport_Files/
198 | Backup*/
199 | UpgradeLog*.XML
200 | UpgradeLog*.htm
201 |
202 | # SQL Server files
203 | *.mdf
204 | *.ldf
205 |
206 | # Business Intelligence projects
207 | *.rdl.data
208 | *.bim.layout
209 | *.bim_*.settings
210 |
211 | # Microsoft Fakes
212 | FakesAssemblies/
213 |
214 | # GhostDoc plugin setting file
215 | *.GhostDoc.xml
216 |
217 | # Node.js Tools for Visual Studio
218 | .ntvs_analysis.dat
219 |
220 | # Visual Studio 6 build log
221 | *.plg
222 |
223 | # Visual Studio 6 workspace options file
224 | *.opt
225 |
226 | # Visual Studio LightSwitch build output
227 | **/*.HTMLClient/GeneratedArtifacts
228 | **/*.DesktopClient/GeneratedArtifacts
229 | **/*.DesktopClient/ModelManifest.xml
230 | **/*.Server/GeneratedArtifacts
231 | **/*.Server/ModelManifest.xml
232 | _Pvt_Extensions
233 |
234 | # Paket dependency manager
235 | .paket/paket.exe
236 |
237 | # FAKE - F# Make
238 | .fake/
239 |
240 |
241 | ### OSX ###
242 | .DS_Store
243 | .AppleDouble
244 | .LSOverride
245 |
246 | # Icon must end with two \r
247 | Icon
248 |
249 |
250 | # Thumbnails
251 | ._*
252 |
253 | # Files that might appear in the root of a volume
254 | .DocumentRevisions-V100
255 | .fseventsd
256 | .Spotlight-V100
257 | .TemporaryItems
258 | .Trashes
259 | .VolumeIcon.icns
260 |
261 | # Directories potentially created on remote AFP share
262 | .AppleDB
263 | .AppleDesktop
264 | Network Trash Folder
265 | Temporary Items
266 | .apdisk
267 |
268 |
269 | ### Windows ###
270 | # Windows image file caches
271 | Thumbs.db
272 | ehthumbs.db
273 |
274 | # Folder config file
275 | Desktop.ini
276 |
277 | # Recycle Bin used on file shares
278 | $RECYCLE.BIN/
279 |
280 | # Windows Installer files
281 | *.cab
282 | *.msi
283 | *.msm
284 | *.msp
285 |
286 | # Windows shortcuts
287 | *.lnk
288 |
289 |
--------------------------------------------------------------------------------