예제 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            db = new ArchiveContext();

            seedDbFromCSV();

            ClearAll();
            ReloadAll();
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();
            var options = new DbContextOptionsBuilder <ArchiveContext>().UseSqlServer(Configuration.GetSection("ConnectionString").Value).Options;
            var ArchiveContextServices = new ArchiveContext(options);

            services.AddSingleton(typeof(ArchiveContext), ArchiveContextServices);
            services.AddMemoryCache();
            services.AddSwaggerGen();
        }
예제 #3
0
        private LoadedPlugin LoadPluginFromZip(string path)
        {
            var archive = LoadPluginArchive(path);

            var manifestEntry = archive.GetEntry(PluginManifest.EntryName);

            if (manifestEntry == null)
            {
                throw new ExpectedException($"'{path}' is not valid *.plugin bundle. No {PluginManifest.EntryName} found.");
            }

            var manifest = LoadManifest(manifestEntry);

            var assemblyName = $"{AssemblyQualifiedNameParser.Parse(manifest.AssemblyQualifiedTypeName).AssemblyName}.dll";

            var mainAssemblyEntry = archive
                                    .Entries
                                    .FirstOrDefault(e => e.Name.Equals(assemblyName, StringComparison.InvariantCultureIgnoreCase));

            if (mainAssemblyEntry == null)
            {
                throw new ExpectedException($"Can't find '{assemblyName}' inside '{path}'");
            }

            var assemblyBytes = LoadAssemblyBytes(mainAssemblyEntry);

            var assembly = LoadAssemblyFromBytes(assemblyBytes, message => Log.Error($"Can't load '{assemblyName}' from '{path}': {message}"));

            if (assembly == null)
            {
                throw new ExpectedException($"Can't load plugin assembly from '{path}'.");
            }

            LogVerbose($"Loaded '{assemblyName}' from '{path}'");

            var archiveContext = new ArchiveContext(path, archive, assembly);

            try
            {
                PluginArchives.Add(archiveContext);

                var plugins = FindAllPluginImplementations(assembly).ToList();

                return(new LoadedPlugin(GetSinglePluginOrThrow(path, plugins), manifest, path));
            }
            catch (Exception)
            {
                PluginArchives.Remove(archiveContext);
                throw;
            }
        }
예제 #4
0
        private string GetSelectedItems([NotNull] ArchiveContext context)
        {
            Debug.ArgumentNotNull(context, nameof(context));

            var sb    = new StringBuilder();
            var first = true;

            foreach (var selectedItem in context.SelectedItems)
            {
                if (!first)
                {
                    sb.Append('|');
                }
                else
                {
                    first = false;
                }

                sb.Append(selectedItem.Id.ToString("B").ToUpperInvariant());
            }

            return(sb.ToString());
        }
예제 #5
0
 public SearchController(ArchiveContext context)
 {
     _context = context;
 }
예제 #6
0
 public EtudiantController(ArchiveContext context)
 {
     this.context = context;
     idgrp        = null;
 }
예제 #7
0
 public PopupAbstractClass(ArchiveContext context)
 {
     _context = context;
 }
예제 #8
0
 public Users(ArchiveContext context, IMapper mapper, UserManager <User> userManager)
 {
     _context     = context;
     _mapper      = mapper;
     _userManager = userManager;
 }
예제 #9
0
 public EnseignantController(ArchiveContext context)
 {
     _context = context;
 }
 public PopupController(ArchiveContext context, IMemoryCache cacheMemory)
 {
     _context     = context;
     _cacheMemory = cacheMemory;
 }