Ejemplo n.º 1
0
        public ModulesViewModel()
        {
            _safeModules   = new ModuleInfo[0];
            _hashBlacklist = new List <string>();

            _installModuleDialog        = new OpenFileDialog();
            _installModuleDialog.Title  = "Tanji - Install Module";
            _installModuleDialog.Filter = ".NET Assembly (*.dll, *.exe)|*.dll; *.exe|Dynamic Link Library (*.dll)|*.dll|Executable (*.exe)|*.exe";

            InstallCommand   = new Command(Install);
            UninstallCommand = new Command(Uninstall, CanUninstall);

            Modules = new ObservableCollection <ModuleInfo>();
            Modules.CollectionChanged += Modules_CollectionChanged;

            if (App.Master != null)
            {
                ModulesDirectory      = Directory.CreateDirectory("Installed Modules");
                DependenciesDirectory = ModulesDirectory.CreateSubdirectory("Dependencies");
                LoadModules();
                try
                {
                    var listener = new TcpListener(IPAddress.Any, TService.REMOTE_MODULE_PORT);
                    listener.Start();

                    Task captureModulesTask = CaptureModulesAsync(listener);
                }
                catch (Exception ex) { App.Display(ex, $"Failed to start module listener on port '{TService.REMOTE_MODULE_PORT}'."); }
            }
        }
Ejemplo n.º 2
0
        public Contractor(string installDirectory)
        {
            _installedAsHashes  = new List <string>();
            _invalidAssemblies  = new List <Assembly>();
            _moduleTypes        = new Dictionary <string, Type>();
            _modulePaths        = new Dictionary <Type, string>();
            _initializedModules = new Dictionary <Type, IModule>();
            _moduleAttributes   = new Dictionary <Type, ModuleAttribute>();
            _authorAttributes   = new Dictionary <Type, IEnumerable <AuthorAttribute> >();

            ModulesDirectory      = Directory.CreateDirectory(installDirectory);
            DependenciesDirectory = ModulesDirectory.CreateSubdirectory("Dependencies");
        }