cadencii.PluginLoader.cleanupUnusedAssemblyCache C# (CSharp) Method

cleanupUnusedAssemblyCache() public static method

使用されていないアセンブリのキャッシュを削除します
public static cleanupUnusedAssemblyCache ( ) : void
return void
        public static void cleanupUnusedAssemblyCache()
        {
            String dir = Utility.getCachedAssemblyPath();
            String[] files = PortUtil.listFiles( dir, ".dll" );
            foreach ( String file in files ) {
                String name = PortUtil.getFileName( file );
                String full = Path.Combine( dir, name );
                if ( !usedAssemblyChache.Contains( full ) ) {
                    try {
                        PortUtil.deleteFile( full );
                    } catch ( Exception ex ) {
                        serr.println( "Utility#cleanupUnusedAssemblyCache; ex=" + ex );
                        Logger.write( typeof( Utility ) + ".cleanupUnusedAssemblyCache; ex=" + ex + "\n" );
                    }
                }
            }
        }

Usage Example

Exemplo n.º 1
0
        public void loadTest()
        {
            PluginLoader.cleanupUnusedAssemblyCache();
            var files =
                from file in PortUtil.listFiles("./fixture/script", "")
                where
                file.EndsWith(".cs") | file.EndsWith(".txt")
                select file;

            foreach (var file in files)
            {
                var           loader  = new PluginLoader();
                ScriptInvoker invoker = null;
                Assert.DoesNotThrow(() => { invoker = loader.loadScript(file); });
                Assert.IsNotNull(invoker);
                Console.Error.WriteLine(file + "\n" + invoker.ErrorMessage);
                Assert.IsNotNull(invoker.scriptDelegate);
            }
        }