示例#1
0
 public Audio(KamishibaServerContext context, Book book, Models.Audio audio)
 {
     id             = audio.ID;
     audio.Register = context.TUser.Single(u => u.ID == audio.RegisterID);
     title          = audio.Title;
     author         = audio.Register.Name;
     contact        = $"https://twitter.com/{audio.Register.ScreenName}";
     publish_date   = audio.PublishedDate;
     official       = audio.RegisterID == book.RegisterID;
     track_timing   = audio.TrackTiming.Trim('[', ']', ' ').Split(',').Select(d => double.Parse(d)).ToArray();
 }
示例#2
0
 public IndexTemplate(KamishibaServerContext context, Book book)
 {
     id         = book.IDName;
     title      = book.Title;
     author     = book.Auther;
     contact    = book.Contact;
     page_count = Directory.GetFiles("wwwroot"
                                     + Path.DirectorySeparatorChar + "packages"
                                     + Path.DirectorySeparatorChar + book.IDName, "*.jpg").Length;
     audio_count     = context.Audio.Count(a => a.BookID == book.ID);
     publish_date    = book.PublishedDate;
     genre           = book.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(t => t.Trim()).ToList();
     sexy            = book.Sexy;
     violence        = book.Violence;
     grotesque       = book.Grotesque;
     download_status = false;
 }
示例#3
0
        public static void Main(string[] args)
        {
            var host = BuildWebHost(args);

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                try
                {
                    var context = services.GetRequiredService <KamishibaServerContext>();
                    context.Database.Migrate();
                    KamishibaServerContext.Initialize(services);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred seeding the DB.");
                }
            }
            host.Run();
        }
示例#4
0
 public PackageTemplate(KamishibaServerContext context, Book book)
 {
     id         = book.IDName;
     title      = book.Title;
     author     = book.Auther;
     contact    = book.Contact;
     page_count = Directory.GetFiles("wwwroot"
                                     + Path.DirectorySeparatorChar + "packages"
                                     + Path.DirectorySeparatorChar + book.IDName, "???.jpg").Length;
     audio_count     = context.Audio.Count(a => a.BookID == book.ID);
     publish_date    = book.PublishedDate;
     genre           = book.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(t => t.Trim()).ToList();
     sexy            = book.Sexy;
     Violence        = book.Violence;
     grotesque       = book.Grotesque;
     download_status = false;
     description     = book.Description;
     audio           = new List <Audio>();
     foreach (var a in context.Audio.Where(a => a.BookID == book.ID))
     {
         audio.Add(new Audio(context, book, a));
     }
 }
示例#5
0
 public KamishibaController(KamishibaServerContext context) : base()
 {
     this.context = context;
 }
示例#6
0
 public ApiController(KamishibaServerContext context) : base(context)
 {
 }
示例#7
0
 public BooksController(KamishibaServerContext context) : base(context)
 {
 }
示例#8
0
 public AuthenticationController(IAuthenticationSchemeProvider authenticationSchemeProvider, KamishibaServerContext context) : base(context)
 {
     this.authenticationSchemeProvider = authenticationSchemeProvider;
 }