cli
This commit is contained in:
@ -1,57 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Versioning;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
|
||||
namespace cli_2
|
||||
{
|
||||
public class ApplicationEnvironment : IApplicationEnvironment
|
||||
{
|
||||
internal ApplicationEnvironment( FrameworkName targetFramework, string appRootDir )
|
||||
{
|
||||
this.RuntimeFramework = targetFramework;
|
||||
ApplicationBasePath = appRootDir;
|
||||
}
|
||||
public string ApplicationBasePath
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string ApplicationName
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string ApplicationVersion
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string Configuration
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public FrameworkName RuntimeFramework
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public object GetData(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetData(string name, object value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace cli.Modules
|
||||
{
|
||||
public interface IModule
|
||||
{
|
||||
void Run (string[] args);
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using RazorEngine.Templating;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
|
||||
namespace cli.Modules
|
||||
{
|
||||
public class MonthlyEMailGenerator : IModule
|
||||
{
|
||||
IRazorEngineService engine;
|
||||
IEmailSender emailSender;
|
||||
|
||||
ApplicationDbContext dbContext;
|
||||
public MonthlyEMailGenerator(ApplicationDbContext context, IRazorEngineService res, IEmailSender sender)
|
||||
{
|
||||
dbContext = context;
|
||||
engine = res;
|
||||
emailSender = sender;
|
||||
// engine.AddTemplate(new Tem)
|
||||
}
|
||||
public void Run(string[] args)
|
||||
{
|
||||
Console.WriteLine($"Hello from second module using {engine}");
|
||||
string template = "Hello @Model.Name, welcome to RazorEngine!";
|
||||
var result = engine.RunCompile(template, "templateKey", null, new { Name = "World" });
|
||||
Console.WriteLine(result);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RazorEngine.Configuration;
|
||||
using RazorEngine.Templating;
|
||||
|
||||
namespace cli.Modules
|
||||
{
|
||||
public class MyGenerator : IModule
|
||||
{
|
||||
|
||||
ILogger logger;
|
||||
public MyGenerator(ILoggerFactory loggerfactory)
|
||||
{
|
||||
logger = loggerfactory.CreateLogger<MyGenerator>();
|
||||
}
|
||||
|
||||
public void Run(string[] args)
|
||||
{
|
||||
logger.LogInformation(nameof(MyGenerator));
|
||||
}
|
||||
}
|
||||
}
|
303
cli/Program.cs
303
cli/Program.cs
@ -1,216 +1,123 @@
|
||||
using System;
|
||||
using System.Runtime.Versioning;
|
||||
using Google.Apis.Util.Store;
|
||||
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using System;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Yavsc;
|
||||
using Yavsc.Models;
|
||||
|
||||
using Yavsc.Services;
|
||||
using cli_2;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.Data.Entity;
|
||||
using cli.Modules;
|
||||
using RazorEngine.Configuration;
|
||||
using RazorEngine.Templating;
|
||||
using System.Security.Policy;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using Yavsc.Services;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using RazorEngine;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using RazorEngine.Compilation;
|
||||
// using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Builder;
|
||||
// using Microsoft.AspNet.Diagnostics;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
// using Microsoft.AspNet.Localization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Filters;
|
||||
using Microsoft.AspNet.Mvc.Razor;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Microsoft.AspNet.Razor;
|
||||
using Microsoft.Extensions.DependencyInjection.Abstractions;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using cli.Services;
|
||||
|
||||
public class Program
|
||||
namespace cli
|
||||
{
|
||||
private static IServiceProvider serviceProvider;
|
||||
public string ConnectionString
|
||||
public class Program
|
||||
{
|
||||
get { return DbHelpers.ConnectionString; }
|
||||
private set { DbHelpers.ConnectionString = value; }
|
||||
}
|
||||
|
||||
public static SiteSettings SiteSetup { get; private set; }
|
||||
public static SmtpSettings SmtpSettup { get; private set; }
|
||||
public IConfigurationRoot Configuration { get; set; }
|
||||
|
||||
public static IdentityOptions AppIdentityOptions { get; private set; }
|
||||
public Program()
|
||||
{
|
||||
ConfigureServices(new ServiceCollection());
|
||||
}
|
||||
|
||||
private void ConfigureServices(IServiceCollection services, string environmentName = "Development")
|
||||
{
|
||||
|
||||
|
||||
|
||||
var confbuilder = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile($"appsettings.{environmentName}.json", optional: true);
|
||||
|
||||
Configuration = confbuilder.Build();
|
||||
|
||||
|
||||
var siteSettingsconf = Configuration.GetSection("Site");
|
||||
services.Configure<SiteSettings>(siteSettingsconf);
|
||||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||
services.Configure<SmtpSettings>(smtpSettingsconf);
|
||||
|
||||
services.AddTransient(typeof(IModule), typeof(MonthlyEMailGenerator));
|
||||
// services.AddTransient( typeof(Microsoft.AspNet.Mvc.Razor.Compilation.ICompilationService), typeof (Microsoft.AspNet.Mvc.Razor.Compilation.RazorCompilationService) );
|
||||
services.AddLogging();
|
||||
|
||||
// services.AddTransient(typeof(Microsoft.AspNet.Mvc.Razor.Compilation.IRazorCompilationService), typeof(Microsoft.AspNet.Mvc.Razor.Compilation.RazorCompilationService));
|
||||
|
||||
|
||||
services.AddEntityFramework()
|
||||
.AddNpgsql()
|
||||
.AddDbContext<ApplicationDbContext>(options => options.UseNpgsql(Configuration["Data:DefaultConnection:ConnectionString"]))
|
||||
;
|
||||
services.AddLocalization(options =>
|
||||
{
|
||||
options.ResourcesPath = "Resources";
|
||||
});
|
||||
services.AddOptions();
|
||||
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>(
|
||||
option =>
|
||||
{
|
||||
option.User.AllowedUserNameCharacters += " ";
|
||||
option.User.RequireUniqueEmail = true;
|
||||
// option.Cookies.ApplicationCookieAuthenticationScheme = Constants.ApplicationAuthenticationSheme;
|
||||
option.Cookies.ApplicationCookie.LoginPath = "/signin";
|
||||
// option.Cookies.ApplicationCookie.AuthenticationScheme = Constants.ApplicationAuthenticationSheme;
|
||||
/*
|
||||
option.Cookies.ApplicationCookie.DataProtectionProvider = protector;
|
||||
option.Cookies.ApplicationCookie.LoginPath = new PathString(Constants.LoginPath.Substring(1));
|
||||
option.Cookies.ApplicationCookie.AccessDeniedPath = new PathString(Constants.AccessDeniedPath.Substring(1));
|
||||
option.Cookies.ApplicationCookie.AutomaticAuthenticate = true;
|
||||
option.Cookies.ApplicationCookie.AuthenticationScheme = Constants.ApplicationAuthenticationSheme;
|
||||
option.Cookies.ApplicationCookieAuthenticationScheme = Constants.ApplicationAuthenticationSheme;
|
||||
option.Cookies.TwoFactorRememberMeCookie.ExpireTimeSpan = TimeSpan.FromDays(30);
|
||||
option.Cookies.TwoFactorRememberMeCookie.DataProtectionProvider = protector;
|
||||
option.Cookies.ExternalCookieAuthenticationScheme = Constants.ExternalAuthenticationSheme;
|
||||
option.Cookies.ExternalCookie.AutomaticAuthenticate = true;
|
||||
option.Cookies.ExternalCookie.AuthenticationScheme = Constants.ExternalAuthenticationSheme;
|
||||
option.Cookies.ExternalCookie.DataProtectionProvider = protector;
|
||||
*/
|
||||
}
|
||||
).AddEntityFrameworkStores<ApplicationDbContext>()
|
||||
.AddTokenProvider<EmailTokenProvider<ApplicationUser>>(Yavsc.Constants.DefaultFactor)
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.DefaultFactor)
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.SMSFactor)
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.EMailFactor)
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.AppFactor)
|
||||
// .AddDefaultTokenProviders()
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Add application services.
|
||||
services.AddTransient<IEmailSender, MessageSender>();
|
||||
services.AddTransient<IGoogleCloudMessageSender, MessageSender>();
|
||||
services.AddTransient<IBillingService, BillingService>();
|
||||
services.AddTransient<IDataStore, FileDataStore>((sp) => new FileDataStore("googledatastore", false));
|
||||
services.AddTransient<ICalendarManager, CalendarManager>();
|
||||
|
||||
// TODO for SMS: services.AddTransient<ISmsSender, AuthMessageSender>();
|
||||
|
||||
services.AddLocalization(options =>
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
options.ResourcesPath = "Resources";
|
||||
});
|
||||
var host = new WebHostBuilder();
|
||||
|
||||
services.AddIdentity<ApplicationUser, IdentityRole>();
|
||||
var hostengnine = host.UseEnvironment("Develpment")
|
||||
.UseServer("Yavsc.Server")
|
||||
.UseStartup<Startup>()
|
||||
/*
|
||||
.UseServices(services => {
|
||||
Console.WriteLine($"> Using {services.Count} services:");
|
||||
|
||||
// Razor
|
||||
foreach (var s in services) Console.WriteLine($"> * {s.ServiceType}");
|
||||
} )
|
||||
*/
|
||||
.Build();
|
||||
|
||||
var basePath = AppDomain.CurrentDomain.BaseDirectory;
|
||||
// FIXME null ref var appName = AppDomain.CurrentDomain.ApplicationIdentity.FullName;
|
||||
|
||||
var config = new TemplateServiceConfiguration();
|
||||
// TODO .. configure your instance
|
||||
|
||||
// config.DisableTempFileLocking = true; // loads the files in-memory (gives the templates full-trust permissions)
|
||||
// config.CachingProvider = new DefaultCachingProvider(t => { }); //disables the warnings
|
||||
// Use the config
|
||||
|
||||
var mcso = new Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary);
|
||||
var compilerServiceFactory = config.CompilerServiceFactory.CreateCompilerService(Language.CSharp);
|
||||
|
||||
var razorService = RazorEngineService.Create(config);
|
||||
Engine.Razor = razorService;
|
||||
|
||||
services.AddInstance(typeof(ICompilerService), compilerServiceFactory);
|
||||
services.AddInstance(typeof(IRazorEngineService), razorService);
|
||||
services.AddInstance<CSharpCompilationOptions>(mcso);
|
||||
// Razor.SetTemplateService(new TemplateService(config)); // legacy API
|
||||
serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
//configure console logging
|
||||
// needs a logger factory ...
|
||||
var loggerFactory = serviceProvider
|
||||
.GetService<ILoggerFactory>()
|
||||
.AddConsole(LogLevel.Verbose);
|
||||
var logger = loggerFactory.CreateLogger<Program>();
|
||||
logger.LogInformation("Configuring application ...");
|
||||
|
||||
var projectRoot = "/home/paul/workspace/yavsc/Yavsc";
|
||||
|
||||
|
||||
var targetFramework = new FrameworkName("dnx", new Version(4, 5, 1));
|
||||
//
|
||||
//
|
||||
ApplicationEnvironment appEnv = new ApplicationEnvironment(targetFramework, projectRoot);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ConnectionString = Configuration["Data:DefaultConnection:ConnectionString"];
|
||||
|
||||
|
||||
logger.LogInformation($"cx: {ConnectionString} ({environmentName})");
|
||||
|
||||
var sitesetupjson = Configuration.GetSection("Site");
|
||||
services.Configure<SiteSettings>(sitesetupjson);
|
||||
|
||||
var smtpsetupjson = Configuration.GetSection("Smtp");
|
||||
services.Configure<SmtpSettings>(smtpsetupjson);
|
||||
|
||||
IOptions<SiteSettings> siteSettings = serviceProvider.GetService(typeof(IOptions<SiteSettings>)) as IOptions<SiteSettings>;
|
||||
IOptions<SmtpSettings> smtpSettings = serviceProvider.GetService(typeof(IOptions<SmtpSettings>)) as IOptions<SmtpSettings>;
|
||||
|
||||
|
||||
SiteSetup = siteSettings.Value;
|
||||
SmtpSettup = smtpSettings.Value;
|
||||
|
||||
logger.LogInformation($"done with {SiteSetup.Title} config.");
|
||||
}
|
||||
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
ILoggerFactory loggerFactory = serviceProvider.GetService<ILoggerFactory>();
|
||||
var logger = loggerFactory.CreateLogger<Program>();
|
||||
logger.LogInformation("Hello.");
|
||||
var mods = serviceProvider.GetServices<IModule>();
|
||||
foreach (var mod in mods) {
|
||||
logger.LogInformation($"running {mod.GetType().Name}");
|
||||
mod.Run(args);
|
||||
var app = hostengnine.Start();
|
||||
app.Services.GetService<EMailer>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace cli
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public string ConnectionString
|
||||
{
|
||||
get { return DbHelpers.ConnectionString; }
|
||||
private set { DbHelpers.ConnectionString = value; }
|
||||
}
|
||||
|
||||
public static SiteSettings SiteSetup { get; private set; }
|
||||
public static SmtpSettings SmtpSettup { get; private set; }
|
||||
public static IConfiguration Configuration { get; set; }
|
||||
|
||||
public static string HostingFullName { get; private set; }
|
||||
|
||||
ILogger logger;
|
||||
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
|
||||
{
|
||||
var devtag = env.IsDevelopment()?"D":"";
|
||||
var prodtag = env.IsProduction()?"P":"";
|
||||
var stagetag = env.IsStaging()?"S":"";
|
||||
|
||||
HostingFullName = $"{appEnv.RuntimeFramework.FullName} [{env.EnvironmentName}:{prodtag}{devtag}{stagetag}]";
|
||||
// Set up configuration sources.
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
|
||||
builder.AddEnvironmentVariables();
|
||||
Configuration = builder.Build();
|
||||
|
||||
}
|
||||
public void ConfigureServices (IServiceCollection services)
|
||||
{
|
||||
services.AddOptions();
|
||||
var siteSettingsconf = Configuration.GetSection("Site");
|
||||
services.Configure<SiteSettings>(siteSettingsconf);
|
||||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||
services.Configure<SmtpSettings>(smtpSettingsconf);
|
||||
|
||||
services.AddInstance(typeof(ILoggerFactory), new LoggerFactory());
|
||||
services.AddTransient(typeof(IEmailSender), typeof(MessageSender));
|
||||
services.AddTransient(typeof(RazorEngineHost), typeof(YaRazorEngineHost));
|
||||
|
||||
|
||||
services.AddEntityFramework().AddNpgsql().AddDbContext<ApplicationDbContext>();
|
||||
|
||||
services.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>()));
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
services.AddLogging();
|
||||
services.AddTransient<EMailer>();
|
||||
|
||||
}
|
||||
|
||||
public void Configure (IApplicationBuilder app, IHostingEnvironment env,
|
||||
IOptions<SiteSettings> siteSettings, ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
loggerFactory.AddDebug();
|
||||
logger = loggerFactory.CreateLogger<Startup>();
|
||||
logger.LogInformation("Hello World from Configure ...");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
26
cli/Properties/AssemblyInfo.cs
Normal file
26
cli/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("cli")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("${AuthorCopyright}")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
63
cli/Resources/cli.Services.EMailer.fr.resx
Normal file
63
cli/Resources/cli.Services.EMailer.fr.resx
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="MonthlySubjectTemplate"><value>[{0} Monthly] {1}</value></data>
|
||||
|
||||
</root>
|
29
cli/Services/EMailer.cs
Normal file
29
cli/Services/EMailer.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Microsoft.AspNet.Razor;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace cli.Services
|
||||
{
|
||||
public class EMailer
|
||||
{
|
||||
RazorTemplateEngine razorEngine;
|
||||
IStringLocalizer<EMailer> stringLocalizer;
|
||||
ILogger logger;
|
||||
public EMailer(RazorTemplateEngine razorTemplateEngine, IStringLocalizer<EMailer> localizer, ILoggerFactory loggerFactory)
|
||||
{
|
||||
logger = loggerFactory.CreateLogger<EMailer>();
|
||||
|
||||
razorEngine = razorTemplateEngine;
|
||||
|
||||
stringLocalizer = localizer;
|
||||
}
|
||||
|
||||
public string Gen(long templateCode)
|
||||
{
|
||||
string subtemp = stringLocalizer["MonthlySubjectTemplate"].Value;
|
||||
logger.LogInformation ( $"Using code: {templateCode} and subject: {subtemp} " );
|
||||
throw new NotImplementedException("razorEngine.GenerateCode");
|
||||
}
|
||||
}
|
||||
}
|
12
cli/YaRazorEngineHost.cs
Normal file
12
cli/YaRazorEngineHost.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using Microsoft.AspNet.Razor;
|
||||
|
||||
namespace cli
|
||||
{
|
||||
public class YaRazorEngineHost: RazorEngineHost
|
||||
{
|
||||
public YaRazorEngineHost(): base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -7,5 +7,13 @@
|
||||
"HomeViewName": "Home",
|
||||
"FavIcon": "/favicon.ico",
|
||||
"Icon": "/images/yavsc.png"
|
||||
},
|
||||
"Logging": {
|
||||
"IncludeScopes": true,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Warning",
|
||||
"Microsoft": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
95
cli/cli.csproj
Normal file
95
cli/cli.csproj
Normal file
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9580B70F-0C6F-4C5A-868D-97517BD51D55}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>cli</RootNamespace>
|
||||
<AssemblyName>cli</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ExternalConsole>true</ExternalConsole>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ExternalConsole>true</ExternalConsole>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\EMailer.cs" />
|
||||
<Compile Include="YaRazorEngineHost.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Microsoft.Web.Infrastructure">
|
||||
<HintPath>packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="Mono.Security">
|
||||
<HintPath>packages\Npgsql.2.2.0-rc1\lib\net45\Mono.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="EntityFramework7.Npgsql">
|
||||
<HintPath>..\packages\EntityFramework7.Npgsql.3.1.0-rc1-3\lib\net451\EntityFramework7.Npgsql.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.Core">
|
||||
<HintPath>..\packages\EntityFramework.Core.7.0.0-rc1-final\lib\net451\EntityFramework.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Yavsc.Server">
|
||||
<HintPath>..\packages\Yavsc.Server.1.0.5-rc9\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Yavsc.Server.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Yavsc.Abstract">
|
||||
<HintPath>..\packages\Yavsc.Abstract.1.0.5-rc9\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Yavsc.Abstract.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Interactive.Async">
|
||||
<HintPath>..\packages\Ix-Async.1.2.5\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CommandLine">
|
||||
<HintPath>..\packages\Machine.Specifications.Runner.Console.0.9.0\tools\CommandLine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Machine.Specifications.Reporting">
|
||||
<HintPath>..\packages\Machine.Specifications.Runner.Console.0.9.0\tools\Machine.Specifications.Reporting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Machine.Specifications.Reporting.Templates">
|
||||
<HintPath>..\packages\Machine.Specifications.Runner.Console.0.9.0\tools\Machine.Specifications.Reporting.Templates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Machine.Specifications.Runner.Utility">
|
||||
<HintPath>..\packages\Machine.Specifications.Runner.Console.0.9.0\tools\Machine.Specifications.Runner.Utility.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
60
cli/packages.config
Normal file
60
cli/packages.config
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
|
||||
<package id="Microsoft.AspNet.Server.Kestrel" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="EntityFramework.Relational.Design" version="7.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.Hosting.Abstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
|
||||
<package id="EntityFramework.Core" version="7.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="EntityFramework.Relational" version="7.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.Identity.EntityFramework" version="3.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.Mvc.Razor" version="6.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0" targetFramework="net451" />
|
||||
<package id="Microsoft.CodeAnalysis.Common" version="1.1.0-rc1" targetFramework="net451" />
|
||||
<package id="Microsoft.CodeAnalysis.CSharp" version="1.1.0-rc1" targetFramework="net451" />
|
||||
<package id="Microsoft.Dnx.Compilation.Abstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Dnx.Compilation.CSharp.Abstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Dnx.Compilation.CSharp.Common" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Caching.Abstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Caching.Memory" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Configuration" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Configuration.Abstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Configuration.Json" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Localization" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Localization.Abstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Logging" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.MemoryPool" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.OptionsModel" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.PlatformAbstractions" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Extensions.Primitives" version="1.0.0-rc1-final" targetFramework="net451" />
|
||||
<package id="Microsoft.Framework.ConfigurationModel" version="1.0.0-beta4" targetFramework="net451" />
|
||||
<package id="Microsoft.Framework.ConfigurationModel.Interfaces" version="1.0.0-beta4" targetFramework="net451" />
|
||||
<package id="Microsoft.Framework.ConfigurationModel.Json" version="1.0.0-beta4" targetFramework="net451" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net451" />
|
||||
<package id="Remotion.Linq" version="2.0.1" targetFramework="net451" />
|
||||
<package id="System.Collections" version="4.0.11" targetFramework="net451" />
|
||||
<package id="System.Collections.Immutable" version="1.1.37" targetFramework="net451" />
|
||||
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="net451" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.0.0-beta-23516" targetFramework="net451" />
|
||||
<package id="System.Diagnostics.Tracing" version="4.0.0" targetFramework="net451" />
|
||||
<package id="System.Globalization" version="4.0.11" targetFramework="net451" />
|
||||
<package id="System.IO" version="4.0.0" targetFramework="net451" />
|
||||
<package id="System.Linq" version="4.1.0" targetFramework="net451" />
|
||||
<package id="System.Reflection" version="4.1.0" targetFramework="net451" />
|
||||
<package id="System.Reflection.Extensions" version="4.0.0" targetFramework="net451" />
|
||||
<package id="System.Reflection.Metadata" version="1.1.0" targetFramework="net451" />
|
||||
<package id="System.Reflection.Primitives" version="4.0.0" targetFramework="net451" />
|
||||
<package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="net451" />
|
||||
<package id="System.Runtime" version="4.0.0" targetFramework="net451" />
|
||||
<package id="System.Runtime.Extensions" version="4.1.0" targetFramework="net451" />
|
||||
<package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="net451" />
|
||||
<package id="System.Text.Encoding" version="4.0.0" targetFramework="net451" />
|
||||
<package id="System.Text.Encoding.Extensions" version="4.0.0" targetFramework="net451" />
|
||||
<package id="System.Threading" version="4.0.0" targetFramework="net451" />
|
||||
<package id="Yavsc.Abstract" version="1.0.5-rc9" targetFramework="net451" />
|
||||
<package id="Yavsc.Server" version="1.0.5-rc9" targetFramework="net451" />
|
||||
</packages>
|
@ -1,37 +1,35 @@
|
||||
{
|
||||
"version": "1.0.0-*",
|
||||
"commands": {
|
||||
"run": "cli"
|
||||
},
|
||||
"resource": "Resources/**/*.resx",
|
||||
"buildOptions": {
|
||||
"debugType": "full",
|
||||
"emitEntryPoint": true,
|
||||
"compile": {
|
||||
"include": "*.cs",
|
||||
"exclude": [
|
||||
"contrib"
|
||||
]
|
||||
"version": "1.0.0-*",
|
||||
"commands": {
|
||||
"run": "cli"
|
||||
},
|
||||
"embed": [
|
||||
"Resources/**/*.resx"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"Yavsc.Server": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
"resource": "Resources/**/*.resx",
|
||||
"buildOptions": {
|
||||
"debugType": "full",
|
||||
"emitEntryPoint": true,
|
||||
"compile": {
|
||||
"include": "*.cs",
|
||||
"exclude": [
|
||||
"contrib"
|
||||
]
|
||||
},
|
||||
"embed": [
|
||||
"Resources/**/*.resx"
|
||||
]
|
||||
},
|
||||
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
|
||||
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.DependencyInjection": "1.0.0-rc1-final",
|
||||
"RazorEngine": "4.5.1-alpha001",
|
||||
"Microsoft.CodeAnalysis.CSharp": "2.8.0-beta3"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {},
|
||||
"net451": {}
|
||||
}
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.DependencyInjection": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Framework.Configuration.Json": "1.0.0-*",
|
||||
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*",
|
||||
"Yavsc.Server": "1.0.5-rc9",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user