Ejemplo n.º 1
0
 public void Load()
 {
     foreach (var dir in PluginDirectory.GetDirectories())
     {
         LoadPlugin(dir);
     }
 }
Ejemplo n.º 2
0
 internal void InitPlugin(PluginHolder pluginData)
 {
     _ExternalPluginData  = pluginData;
     PluginDirectory      = pluginData.PluginDirectory;
     LocalPluginDirectory = PluginDirectory.Substring(PluginDirectory.IndexOf($@"\{PluginExtensionPlugin.PluginsDirectory}\") + 1);
     DiagnosticTimer      = new Stopwatch();
 }
Ejemplo n.º 3
0
        public static IMvcBuilder AddPlugins(this IMvcBuilder source, string path)
        {
            var assemblyPaths = PluginDirectory.GetAssemblyPaths(path).ToDictionary(d => d, Assembly.LoadFile);

            source.ConfigureApplicationPartManager(manager =>
            {
                foreach (var assemblyPath in assemblyPaths)
                {
                    if (assemblyPath.Key.EndsWith("Views.dll"))
                    {
                        manager.ApplicationParts.Add(new CompiledRazorAssemblyPart(assemblyPath.Value));
                    }
                    else
                    {
                        manager.ApplicationParts.Add(new AssemblyPart(assemblyPath.Value));
                    }

                    var featureTypes = assemblyPath.Value.ExportedTypes.Where(d => typeof(IFeature).IsAssignableFrom(d));
                    foreach (var featureType in featureTypes)
                    {
                        var feature = Activator.CreateInstance(featureType) as IFeature;
                        if (feature == null)
                        {
                            throw new ArgumentNullException(nameof(feature), $"Failed to instantiate {nameof(IFeature)} from type {featureType.FullName}.");
                        }

                        source.Services.AddSingleton(feature);
                        feature.Register(source.Services);
                    }
                }
            });

            return(source);
        }
        public void Clean()
        {
            try
            {
                if (PluginDirectory.Exists)
                {
                    foreach (var file in PluginDirectory.GetFiles())
                    {
                        var newPath = Path.Join(PluginDirectory.FullName, file.Name.Replace(file.Extension, string.Empty), file.Name);
                        Directory.CreateDirectory(Directory.GetParent(newPath).FullName);
                        file.MoveTo(newPath);
                    }
                }

                if (TrashDirectory.Exists)
                {
                    Directory.Delete(TrashDirectory.FullName, true);
                }
                if (TemporaryDirectory.Exists)
                {
                    Directory.Delete(TemporaryDirectory.FullName, true);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
Ejemplo n.º 5
0
        public void ShouldInitializeLogIfCreatedWithDirectory()
        {
            FileInfo   thisAssemblyPath = new FileInfo(GetType().Assembly.Location);
            ILogWriter tested           = new PluginDirectory(thisAssemblyPath.Directory.FullName, false);

            Assert.IsNotNull(tested.Log);
        }
Ejemplo n.º 6
0
        public void Clean()
        {
            try
            {
                if (PluginDirectory.Exists)
                {
                    foreach (var file in PluginDirectory.GetFiles())
                    {
                        Log.Write("Plugin", $"Unexpected file found: '{file.FullName}'", LogLevel.Warning);
                    }
                }

                if (TrashDirectory.Exists)
                {
                    Directory.Delete(TrashDirectory.FullName, true);
                }
                if (TemporaryDirectory.Exists)
                {
                    Directory.Delete(TemporaryDirectory.FullName, true);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
Ejemplo n.º 7
0
        public void ShouldExposePathAsPathProperty()
        {
            var             expected = new FileInfo(GetType().Assembly.Location).Directory.FullName;
            PluginDirectory tested   = new PluginDirectory(expected, false);
            var             actual   = tested.Path;

            Assert.AreEqual(expected, actual);
        }
 public void CreatedShouldRaiseFileFound()
 {
     MockFileSystemWatcher fsw = new MockFileSystemWatcher();
       PluginDirectory tested = new PluginDirectory(fsw);
       int FileFoundRaised = 0;
       tested.FileFound += (s, e) => FileFoundRaised++;
       fsw.RaiseCreated(GetType().Assembly.Location);
       Assert.AreEqual(1, FileFoundRaised);
 }
        public void Load()
        {
            foreach (var dir in PluginDirectory.GetDirectories())
            {
                LoadPlugin(dir);
            }

            AssembliesChanged?.Invoke(this, EventArgs.Empty);
        }
        public void Load()
        {
            foreach (var dir in PluginDirectory.GetDirectories())
            {
                LoadPlugin(dir);
            }

            AppInfo.PluginManager.ResetServices();
        }
Ejemplo n.º 11
0
        public void DeletedShouldRaiseFileLost()
        {
            MockFileSystemWatcher fsw    = new MockFileSystemWatcher();
            PluginDirectory       tested = new PluginDirectory(fsw);
            int FileLostRaised           = 0;

            tested.FileLost += (s, e) => FileLostRaised++;
            fsw.RaiseDeleted(GetType().Assembly.Location);
            Assert.AreEqual(1, FileLostRaised);
        }
Ejemplo n.º 12
0
        public void Load()
        {
            foreach (var dir in PluginDirectory.GetDirectories())
            {
                LoadPlugin(dir);
            }

            AppInfo.PluginManager.ResetServices();
            AssembliesChanged?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 13
0
        public void ShouldLogToDebugWhenRaisingFileLost()
        {
            string expected = "SomePath";
            MockFileSystemWatcher mockWatcher = new MockFileSystemWatcher();
            PluginDirectory       tested      = new PluginDirectory(mockWatcher);
            MockLog mockLog = new MockLog(tested);

            mockWatcher.RaiseDeleted(expected);
            Assert.IsTrue(mockLog.Any(x => x.Level == MockLog.Level.Debug && x.Message.Contains(expected)));
        }
Ejemplo n.º 14
0
        public void ShouldNotDisposeExternalIFileSystemWatcher()
        {
            MockFileSystemWatcher mockwatcher = new MockFileSystemWatcher();
            IPluginDirectory      tested      = new PluginDirectory(mockwatcher);
            bool wasDisposed = false;

            mockwatcher.Disposed += (s, e) => wasDisposed = true;
            tested.Dispose();
            Assert.IsFalse(wasDisposed);
        }
Ejemplo n.º 15
0
 internal static void CreateDirectories()
 {
     if (!SettingsDirectory.Exists)
     {
         SettingsDirectory.Create();
     }
     if (!PluginDirectory.Exists)
     {
         PluginDirectory.Create();
     }
 }
Ejemplo n.º 16
0
        public void ShouldDisposeOwnedFileSystemWatcher()
        {
            MockFileSystemWatcher mockwatcher = new MockFileSystemWatcher();
            PluginDirectory       tested      = new PluginDirectory(new MockFileSystemWatcher());
            bool wasDisposed = false;

            tested.WatcherConnect(mockwatcher, true);
            mockwatcher.Disposed += (s, e) => wasDisposed = true;
            tested.Dispose();
            Assert.IsTrue(wasDisposed);
        }
Ejemplo n.º 17
0
        public void ConstructionWithValidPath()
        {
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(GetType().Assembly.Location);
            IPluginDirectory   tested   = null;

            try
            {
                tested = new PluginDirectory(fileInfo.Directory.FullName, false);
            }
            catch { }

            Assert.IsNotNull(tested);
        }
        public void ConstructionWithValidPath()
        {
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(GetType().Assembly.Location);
              IPluginDirectory tested = null;

              try
              {
            tested = new PluginDirectory(fileInfo.Directory.FullName, false);
              }
              catch { }

              Assert.IsNotNull(tested);
        }
Ejemplo n.º 19
0
        public void FileFoundShouldBeRasedForDlls()
        {
            MockFileSystemWatcher fsw = new MockFileSystemWatcher();

            PluginDirectory tested          = new PluginDirectory(fsw);
            int             FileFoundRaised = 0;

            tested.FileFound += (s, e) => FileFoundRaised++;

            fsw.RaiseCreated(@"file.dll");

            Assert.AreEqual(1, FileFoundRaised);
        }
 public void ChangedShouldRaiseFileLostFollowedByFileFound()
 {
     MockFileSystemWatcher fsw = new MockFileSystemWatcher();
       PluginDirectory tested = new PluginDirectory(fsw);
       DateTime FileFoundRaised = DateTime.MinValue;
       DateTime FileLostRaised = DateTime.MinValue;
       tested.FileFound += (s, e) => { FileFoundRaised = DateTime.Now; Thread.Sleep(1); };
       tested.FileLost += (s, e) => { FileLostRaised = DateTime.Now; Thread.Sleep(1); };
       fsw.RaiseChanged(GetType().Assembly.Location);
       Assert.AreNotEqual(DateTime.MinValue, FileFoundRaised);
       Assert.AreNotEqual(DateTime.MinValue, FileLostRaised);
       Assert.IsTrue(FileLostRaised < FileFoundRaised);
 }
Ejemplo n.º 21
0
        public void FileFoundShouldReportCurrentFilesFlatOnAdd()
        {
            MockFileSystemWatcher fsw = new MockFileSystemWatcher();

            fsw.Path = new FileInfo(GetType().Assembly.Location).Directory.FullName;

            PluginDirectory tested          = new PluginDirectory(fsw);
            int             FileFoundRaised = 0;

            tested.FileFound += (s, e) => FileFoundRaised++;

            Assert.AreNotEqual(0, FileFoundRaised);
        }
Ejemplo n.º 22
0
        public void FileLostShouldNotBeRasedForNonDlls()
        {
            MockFileSystemWatcher fsw = new MockFileSystemWatcher();

            PluginDirectory tested         = new PluginDirectory(fsw);
            int             FileLostRaised = 0;

            tested.FileLost += (s, e) => FileLostRaised++;

            fsw.RaiseDeleted(@"file.img");

            Assert.AreEqual(0, FileLostRaised);
        }
Ejemplo n.º 23
0
 public void Update()
 {
     if (PluginDirectory.EndsWith(@"\"))
     {
         PluginDirectory = PluginDirectory.Substring(0, PluginDirectory.Length - 1);
     }
     CheckDownloadFolder();
     Download();
     UnZip();
     StopService();
     Deploy();
     StartService();
 }
Ejemplo n.º 24
0
        public void RenamedShouldRaiseFileLostFollowedByFileFound()
        {
            MockFileSystemWatcher fsw    = new MockFileSystemWatcher();
            PluginDirectory       tested = new PluginDirectory(fsw);
            DateTime FileFoundRaised     = DateTime.MinValue;
            DateTime FileLostRaised      = DateTime.MinValue;

            tested.FileFound += (s, e) => { FileFoundRaised = DateTime.Now; Thread.Sleep(1); };
            tested.FileLost  += (s, e) => { FileLostRaised = DateTime.Now; Thread.Sleep(1); };
            fsw.RaiseRenamed(GetType().Assembly.Location, GetType().Assembly.Location);
            Assert.AreNotEqual(DateTime.MinValue, FileFoundRaised);
            Assert.AreNotEqual(DateTime.MinValue, FileLostRaised);
            Assert.IsTrue(FileLostRaised < FileFoundRaised);
        }
Ejemplo n.º 25
0
        public void FileFoundShouldNotBeReportedAfterRemoval()
        {
            MockFileSystemWatcher fsw = new MockFileSystemWatcher();

            PluginDirectory tested          = new PluginDirectory(fsw);
            int             FileFoundRaised = 0;

            EventHandler <PluginDirectoryEventArgs> handler = ((s, e) => FileFoundRaised++);

            tested.FileFound += handler;
            tested.FileFound -= handler;

            fsw.RaiseCreated(@"file.dll");
            Assert.AreEqual(0, FileFoundRaised);
        }
Ejemplo n.º 26
0
        private void Init()
        {
            AppDomain.CurrentDomain.AssemblyLoad += (s, e) => Console.WriteLine("{0} loaded {1}", AppDomain.CurrentDomain.FriendlyName, e.LoadedAssembly.FullName);

            Console.WriteLine("Creating plugin repository");
            this.pluginRepository  = new PluginRepository();
            this.assemblyContainer = new AssemblyContainer();
            this.pluginRepository.AddPluginSource(new PluginExtractor(this.assemblyContainer));

            DirectoryInfo pluginDir = new DirectoryInfo(@"..\..\..\Plugin\Bin");

            Console.WriteLine(@"Adding plugins from {0}", pluginDir.FullName);

            directoryWatcher = new PluginDirectory(pluginDir.FullName, true);
            this.assemblyContainer.AddDir(directoryWatcher);
        }
Ejemplo n.º 27
0
        public PluginList(PluginDirectory instance)
        {
            InitializeComponent();

            DirectoryInstance = instance;

            this.DataContext = instance;

            instance.OnUpdateDirectoryFinished     += instance_OnUpdateDirectoryFinished;
            instance.OnUpdateDirectoryStateChanged += instance_OnUpdateDirectoryStateChanged;
            instance.OnUpdateDirectoryFailed       += instance_OnUpdateDirectoryFailed;

            GrdLock.Visibility              = Visibility.Visible;
            GrdLockLoader.Visibility        = Visibility.Visible;
            GrdLockPluginDetails.Visibility = Visibility.Collapsed;

            this.Loaded += PluginListControl_Loaded;
        }
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            AssemblyContainer assemblyContainer = new AssemblyContainer();

              PluginRepository pluginRepository = new PluginRepository();
              pluginRepository.AddPluginSource(new PluginExtractor(assemblyContainer));

              System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
              string pluginDir = settingsReader.GetValue("PluginPath", typeof(string)) as string;
              PluginDirectory pluginDirectory = new PluginDirectory(pluginDir, true);
              assemblyContainer.AddDir(pluginDirectory);

              container.Register(
            Component.For<IPluginRepository>().LifestyleSingleton().Instance(pluginRepository),

            Component.For<IAssemblyRepository>().LifestyleSingleton().Instance(assemblyContainer)
            .OnDestroy(kernel => { assemblyContainer.RemoveDir(pluginDirectory); pluginDirectory.Dispose(); })
              );
        }
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            AssemblyContainer assemblyContainer = new AssemblyContainer();

            PluginRepository pluginRepository = new PluginRepository();

            pluginRepository.AddPluginSource(new PluginExtractor(assemblyContainer));

            System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
            string          pluginDir       = settingsReader.GetValue("PluginPath", typeof(string)) as string;
            PluginDirectory pluginDirectory = new PluginDirectory(pluginDir, true);

            assemblyContainer.AddDir(pluginDirectory);

            container.Register(
                Component.For <IPluginRepository>().LifestyleSingleton().Instance(pluginRepository),

                Component.For <IAssemblyRepository>().LifestyleSingleton().Instance(assemblyContainer)
                .OnDestroy(kernel => { assemblyContainer.RemoveDir(pluginDirectory); pluginDirectory.Dispose(); })
                );
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Public constructor for service. Here is where we start our file watcher and launch
        /// our periodic logging.
        /// </summary>
        public SimpleLogParserService(bool asMonitor = false)
        {
            _asMonitor = asMonitor;

            string connectionString = ConfigurationManager.ConnectionStrings["SimpleLogParserDataSource"].ConnectionString;
            // set up our log parser
            var metricService     = new MetricService(connectionString);
            var settingsService   = new PluginSettingsService(connectionString);
            var subscriberService = new SubscriberService(connectionString);
            var directory         = new PluginDirectory();

            _service = new StatefulParser(metricService, settingsService, directory, subscriberService, OnAlert);

            string path = ConfigurationManager.AppSettings["WatchDirectory"];
            bool   includeSubdirectories = false;

            try { includeSubdirectories = bool.Parse(ConfigurationManager.AppSettings["IncludeSubdirectories"]); }
            catch { }

            _queue = new FileSystemQueue(path, connectionString, includeSubdirectories);

            int intervalMinutes = int.Parse(ConfigurationManager.AppSettings["IntervalMinutes"] ?? "30");

            // if we want active monitoring we need to start the watcher
            if (asMonitor)
            {
                _queue.Start();
            }

            _timer = new Timer(FrequencyIntervalMilliseconds * intervalMinutes)
            {
                AutoReset = true
            };
            _timer.Elapsed += (sender, eventArgs) => this.SynchronizedMain();

            this.SynchronizedMain(); // call the timer callback right away to start
        }
 public void ShouldNotDisposeExternalIFileSystemWatcher()
 {
     MockFileSystemWatcher mockwatcher = new MockFileSystemWatcher();
       IPluginDirectory tested = new PluginDirectory(mockwatcher);
       bool wasDisposed = false;
       mockwatcher.Disposed += (s, e) => wasDisposed = true;
       tested.Dispose();
       Assert.IsFalse(wasDisposed);
 }
 public void ShouldLogToDebugWhenRaisingFileLost()
 {
     string expected = "SomePath";
       MockFileSystemWatcher mockWatcher = new MockFileSystemWatcher();
       PluginDirectory tested = new PluginDirectory(mockWatcher);
       MockLog mockLog = new MockLog(tested);
       mockWatcher.RaiseDeleted(expected);
       Assert.IsTrue(mockLog.Any(x => x.Level == MockLog.Level.Debug && x.Message.Contains(expected)));
 }
 public void ShouldInitializeLogIfCreatedWithIFileSystemWatcher()
 {
     ILogWriter tested = new PluginDirectory(new Mock<IFileSystemWatcher>().Object);
       Assert.IsNotNull(tested.Log);
 }
 public void ShouldInitializeLogIfCreatedWithDirectory()
 {
     FileInfo thisAssemblyPath = new FileInfo(GetType().Assembly.Location);
       ILogWriter tested = new PluginDirectory(thisAssemblyPath.Directory.FullName, false);
       Assert.IsNotNull(tested.Log);
 }
 public void ShouldImplementILogWriter()
 {
     PluginDirectory tested = new PluginDirectory(new Mock<IFileSystemWatcher>().Object);
       Assert.IsInstanceOfType(tested, typeof(ILogWriter));
 }
 public void ShouldExposePathAsPathProperty()
 {
     var expected = new FileInfo(GetType().Assembly.Location).Directory.FullName;
       PluginDirectory tested = new PluginDirectory(expected, false);
       var actual = tested.Path;
       Assert.AreEqual(expected, actual);
 }
 public void ShouldDisposeOwnedFileSystemWatcher()
 {
     MockFileSystemWatcher mockwatcher = new MockFileSystemWatcher();
       PluginDirectory tested = new PluginDirectory(new MockFileSystemWatcher());
       bool wasDisposed = false;
       tested.WatcherConnect(mockwatcher, true);
       mockwatcher.Disposed += (s, e) => wasDisposed = true;
       tested.Dispose();
       Assert.IsTrue(wasDisposed);
 }
        public void FileLostShouldNotBeRasedForNonDlls()
        {
            MockFileSystemWatcher fsw = new MockFileSystemWatcher();

              PluginDirectory tested = new PluginDirectory(fsw);
              int FileLostRaised = 0;
              tested.FileLost += (s, e) => FileLostRaised++;

              fsw.RaiseDeleted(@"file.img");

              Assert.AreEqual(0, FileLostRaised);
        }
        public void FileFoundShouldReportCurrentFilesRecursiveOnAdd()
        {
            MockFileSystemWatcher fsw = new MockFileSystemWatcher();
              fsw.Path = new FileInfo(GetType().Assembly.Location).Directory.Parent.FullName;
              fsw.IncludeSubdirectories = true;

              PluginDirectory tested = new PluginDirectory(fsw);
              int FileFoundRaised = 0;
              tested.FileFound += (s, e) => FileFoundRaised++;

              Assert.AreNotEqual(0, FileFoundRaised);
        }
Ejemplo n.º 40
0
 public void ConstructionWithIFileSystemWatcher()
 {
     MockFileSystemWatcher mockwatcher = new MockFileSystemWatcher();
     IPluginDirectory      tested      = new PluginDirectory(mockwatcher);
 }
 public void ConstructionWithIFileSystemWatcher()
 {
     MockFileSystemWatcher mockwatcher = new MockFileSystemWatcher();
       IPluginDirectory tested = new PluginDirectory(mockwatcher);
 }
Ejemplo n.º 42
0
        public void ShouldImplementILogWriter()
        {
            PluginDirectory tested = new PluginDirectory(new Mock <IFileSystemWatcher>().Object);

            Assert.IsInstanceOfType(tested, typeof(ILogWriter));
        }
        public void FileFoundShouldNotBeReportedAfterRemoval()
        {
            MockFileSystemWatcher fsw = new MockFileSystemWatcher();

              PluginDirectory tested = new PluginDirectory(fsw);
              int FileFoundRaised = 0;

              EventHandler<PluginDirectoryEventArgs> handler = ((s, e) => FileFoundRaised++);
              tested.FileFound += handler;
              tested.FileFound -= handler;

              fsw.RaiseCreated(@"file.dll");
              Assert.AreEqual(0, FileFoundRaised);
        }
Ejemplo n.º 44
0
        public void ShouldInitializeLogIfCreatedWithIFileSystemWatcher()
        {
            ILogWriter tested = new PluginDirectory(new Mock <IFileSystemWatcher>().Object);

            Assert.IsNotNull(tested.Log);
        }
        public void FileFoundShouldBeRasedForDlls()
        {
            MockFileSystemWatcher fsw = new MockFileSystemWatcher();

              PluginDirectory tested = new PluginDirectory(fsw);
              int FileFoundRaised = 0;
              tested.FileFound += (s, e) => FileFoundRaised++;

              fsw.RaiseCreated(@"file.dll");

              Assert.AreEqual(1, FileFoundRaised);
        }
Ejemplo n.º 46
0
    public PRT(ReadOnlyTargetRules Target) : base(Target)
    {
        // Debug print only enabled when plugin is installed directly into project (not in Engine)
        Debug = !PluginDirectory.EndsWith(Path.Combine("Plugins", "Marketplace", "Vitruvio"));

        bUseRTTI          = true;
        bEnableExceptions = true;
        Type = ModuleType.External;

        AbstractPlatform Platform;

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            Platform = new WindowsPlatform(Debug);
        }
        else
        {
            throw new System.PlatformNotSupportedException();
        }

        string LibDir     = Path.Combine(ModuleDirectory, "lib", Platform.Name, "Release");
        string BinDir     = Path.Combine(ModuleDirectory, "bin", Platform.Name, "Release");
        string IncludeDir = Path.Combine(ModuleDirectory, "include");

        // 1. Check if prt is already available and has correct version, otherwise download from official github repo
        bool PrtInstalled = Directory.Exists(LibDir) && Directory.Exists(BinDir);

        string PrtCorePath     = Path.Combine(BinDir, PrtCoreDllName);
        bool   PrtCoreExists   = File.Exists(PrtCorePath);
        bool   PrtVersionMatch = PrtCoreExists && CheckDllVersion(Platform, PrtCorePath, PrtMajor, PrtMinor, PrtBuild);

        if (!PrtInstalled || !PrtVersionMatch)
        {
            string PrtUrl     = "https://github.com/Esri/esri-cityengine-sdk/releases/download";
            string PrtVersion = string.Format("{0}.{1}.{2}", PrtMajor, PrtMinor, PrtBuild);

            string PrtLibName     = string.Format("esri_ce_sdk-{0}-{1}", PrtVersion, Platform.PrtPlatform);
            string PrtLibZipFile  = PrtLibName + ".zip";
            string PrtDownloadUrl = Path.Combine(PrtUrl, PrtVersion, PrtLibZipFile);

            try
            {
                if (Directory.Exists(LibDir))
                {
                    Directory.Delete(LibDir, true);
                }
                if (Directory.Exists(BinDir))
                {
                    Directory.Delete(BinDir, true);
                }
                if (Directory.Exists(IncludeDir))
                {
                    Directory.Delete(IncludeDir, true);
                }

                if (Debug)
                {
                    if (!PrtInstalled)
                    {
                        Console.WriteLine("PRT not found");
                    }
                    Console.WriteLine("Updating PRT");
                }

                if (Debug)
                {
                    System.Console.WriteLine("Downloading " + PrtDownloadUrl + "...");
                }

                Platform.DownloadFile(PrtDownloadUrl, Path.Combine(ModuleDirectory, PrtLibZipFile));

                if (Debug)
                {
                    System.Console.WriteLine("Extracting " + PrtLibZipFile + "...");
                }

                Platform.ZipExtractor.Unzip(ModuleDirectory, PrtLibZipFile, PrtLibName);

                Directory.CreateDirectory(LibDir);
                Directory.CreateDirectory(BinDir);
                Copy(Path.Combine(ModuleDirectory, PrtLibName, "lib"), Path.Combine(ModuleDirectory, LibDir), FilteredExtensionLibraries);
                Copy(Path.Combine(ModuleDirectory, PrtLibName, "bin"), Path.Combine(ModuleDirectory, BinDir));
                Copy(Path.Combine(ModuleDirectory, PrtLibName, "include"), Path.Combine(ModuleDirectory, "include"));
            }
            finally
            {
                Directory.Delete(Path.Combine(ModuleDirectory, PrtLibName), true);
                File.Delete(Path.Combine(ModuleDirectory, PrtLibZipFile));
            }
        }
        else if (Debug)
        {
            Console.WriteLine("PRT found");
        }

        // 2. Copy libraries to module binaries directory and add dependencies
        string ModuleBinariesDir = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../..", "Binaries", Platform.Name));

        if (Debug)
        {
            System.Console.WriteLine("PRT Source Lib Dir: " + LibDir);
            System.Console.WriteLine("PRT Source Bin Dir: " + BinDir);
            System.Console.WriteLine("PRT Source Include Dir: " + IncludeDir);
            System.Console.WriteLine("Module Binaries Dir: " + ModuleBinariesDir);
        }

        Directory.CreateDirectory(ModuleBinariesDir);
        PublicRuntimeLibraryPaths.Add(ModuleBinariesDir);

        // Add PRT core libraries
        if (Debug)
        {
            Console.WriteLine("Adding PRT core libraries");
        }
        foreach (string FilePath in Directory.GetFiles(BinDir))
        {
            string LibraryName = Path.GetFileName(FilePath);

            Platform.AddPrtCoreLibrary(FilePath, LibraryName, this);
        }

        // Add extension libraries as run-time dependencies
        if (Debug)
        {
            Console.WriteLine("Adding PRT extension libraries");
        }
        Platform.AddExtensionLibraries(LibDir, this);

        // Add include search path
        if (Debug)
        {
            Console.WriteLine("Adding include search path " + IncludeDir);
        }
        PublicSystemIncludePaths.Add(IncludeDir);
    }