/// ------------------------------------------------------------------------------------------ /// <summary> /// Executes the task. /// </summary> /// ------------------------------------------------------------------------------------------ protected override void ExecuteTask() { using (CacheManager cacheManager = new CacheManager()) { string handle = Properties[HandlePropertyName]; CachedFile[] outputFiles = cacheManager.GetCachedFiles(handle); foreach (CachedFile file in outputFiles) file.CopyTo(m_OutputDir); } }
/// ------------------------------------------------------------------------------------------ /// <summary> /// Executes the task. /// </summary> /// ------------------------------------------------------------------------------------------ protected override void ExecuteTask() { using (CacheManager cacheManager = new CacheManager()) { string handle = Properties[HandlePropertyName]; string[] outputFiles = new string[m_OutputFiles.FileNames.Count]; m_OutputFiles.FileNames.CopyTo(outputFiles, 0); cacheManager.CacheFile(handle, outputFiles); cacheManager.AddCacheMiss(); } }
/// ------------------------------------------------------------------------------------------ /// <summary> /// Executes the task. /// </summary> /// ------------------------------------------------------------------------------------------ protected override void ExecuteTask() { using (CacheManager cacheManager = new CacheManager()) { string[] includedFiles = new String[m_Files.FileNames.Count]; m_Files.FileNames.CopyTo(includedFiles, 0); string handle = cacheManager.GetHash(m_Parameters, includedFiles); if (Properties.Contains(HandlePropertyName)) Properties[HandlePropertyName] = handle; else Properties.Add(HandlePropertyName, handle); bool fCached = cacheManager.IsCached(handle); if (Properties.Contains(PropertyName)) Properties[PropertyName] = fCached.ToString(); else Properties.Add(PropertyName, fCached.ToString()); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Executes in two distinct scenarios. /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing">if set to <c>true</c> this method is called from the /// Dispose() method, if set to <c>false</c> it's called from finalizer.</param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// If subclasses override this method, they should call the base implementation. /// </remarks> /// ------------------------------------------------------------------------------------ protected virtual void Dispose(bool disposing) { if (m_fDisposed) return; if (disposing) { // Dispose managed resources here. m_CacheManager.Dispose(); } // Dispose unmanaged resources here m_CacheManager = null; }