public virtual InternalModelBuilder Apply(InternalModelBuilder modelBuilder) { Check.NotNull(modelBuilder, nameof(modelBuilder)); foreach (var entityType in modelBuilder.Metadata.GetEntityTypes()) { var unmappedProperty = entityType.GetProperties().FirstOrDefault(p => !IsMappedPrimitiveProperty(((IProperty)p).ClrType)); if (unmappedProperty != null) { throw new InvalidOperationException(CoreStrings.PropertyNotMapped(unmappedProperty.Name, entityType.Name)); } if (entityType.HasClrType()) { var clrProperties = new HashSet<string>(); clrProperties.UnionWith(entityType.ClrType.GetRuntimeProperties() .Where(pi => pi.IsCandidateProperty()) .Select(pi => pi.Name)); clrProperties.ExceptWith(entityType.GetProperties().Select(p => p.Name)); clrProperties.ExceptWith(entityType.GetNavigations().Select(p => p.Name)); var entityTypeBuilder = modelBuilder.Entity(entityType.ClrType, ConfigurationSource.Convention); clrProperties.RemoveWhere(p => entityTypeBuilder.IsIgnored(p, ConfigurationSource.Convention)); if (clrProperties.Count > 0) { foreach (var clrProperty in clrProperties) { var actualProperty = entityType.ClrType.GetRuntimeProperty(clrProperty); var targetType = FindCandidateNavigationPropertyType(actualProperty); if (targetType != null) { if (!modelBuilder.IsIgnored(targetType.DisplayName(), ConfigurationSource.Convention)) { throw new InvalidOperationException(CoreStrings.NavigationNotAdded(actualProperty.Name, entityType.Name)); } } else { throw new InvalidOperationException(CoreStrings.PropertyNotAdded(actualProperty.Name, entityType.Name)); } } } } } return modelBuilder; }
public void onProductListReceived (string productListString) { if (productListString.Length == 0) { biller.logError (UnibillError.STOREKIT_RETURNED_NO_PRODUCTS); biller.onSetupComplete (false); return; } Dictionary<string, object> response = (Dictionary<string, object>)Unibill.Impl.MiniJSON.jsonDecode(productListString); HashSet<PurchasableItem> productsReceived = new HashSet<PurchasableItem>(); foreach (var identifier in response.Keys) { var item = remapper.getPurchasableItemFromPlatformSpecificId(identifier.ToString()); Dictionary<string, object> details = (Dictionary<string, object>)response[identifier]; PurchasableItem.Writer.setLocalizedPrice(item, details["price"].ToString()); PurchasableItem.Writer.setLocalizedTitle(item, details["localizedTitle"].ToString()); PurchasableItem.Writer.setLocalizedDescription(item, details["localizedDescription"].ToString()); productsReceived.Add(item); } HashSet<PurchasableItem> productsNotReceived = new HashSet<PurchasableItem> (products); productsNotReceived.ExceptWith (productsReceived); if (productsNotReceived.Count > 0) { foreach (PurchasableItem product in productsNotReceived) { biller.logError(UnibillError.STOREKIT_REQUESTPRODUCTS_MISSING_PRODUCT, product.Id, remapper.mapItemIdToPlatformSpecificId(product)); } } this.productsNotReturnedByStorekit = new HashSet<string>(productsNotReceived.Select(x => remapper.mapItemIdToPlatformSpecificId(x))); // We should complete so long as we have at least one purchasable product. biller.onSetupComplete(true); }
public void onProductListReceived (string productListString) { Hashtable response = (Hashtable)MiniJSON.jsonDecode (productListString); if (response.Count == 0) { callback.logError (UnibillError.AMAZONAPPSTORE_GETITEMDATAREQUEST_NO_PRODUCTS_RETURNED); callback.onSetupComplete (false); return; } HashSet<PurchasableItem> productsReceived = new HashSet<PurchasableItem>(); foreach (var identifier in response.Keys) { var item = remapper.getPurchasableItemFromPlatformSpecificId(identifier.ToString()); Hashtable details = (Hashtable) response[identifier]; PurchasableItem.Writer.setLocalizedPrice(item, (string) details["price"]); PurchasableItem.Writer.setLocalizedTitle(item, (string) details["localizedTitle"]); PurchasableItem.Writer.setLocalizedDescription(item, (string) details["localizedDescription"]); productsReceived.Add(item); } HashSet<PurchasableItem> productsNotReceived = new HashSet<PurchasableItem> (db.AllPurchasableItems); productsNotReceived.ExceptWith (productsReceived); if (productsNotReceived.Count > 0) { foreach (PurchasableItem product in productsNotReceived) { this.unknownAmazonProducts.Add(remapper.mapItemIdToPlatformSpecificId(product)); callback.logError(UnibillError.AMAZONAPPSTORE_GETITEMDATAREQUEST_MISSING_PRODUCT, product.Id, remapper.mapItemIdToPlatformSpecificId(product)); } } callback.onSetupComplete(true); }
public override void Visit(AST.MethodDeclNode node) { MethodBeingVisited = ClassBeingVisited.Methods.Lookup(node.methodName.name); if (node.paramDeclList != null) foreach (AST.ParamDeclNode paramDecl in node.paramDeclList) paramDecl.Accept(this); if (node.variableDeclList != null) foreach (AST.VariableDeclNode variableDecl in node.variableDeclList) variableDecl.Accept(this); if (node.statementList != null) { var reverseList = node.statementList.statementList; reverseList.Reverse(); HashSet<AST.IdentifierNode> afterLiveness = new HashSet<AST.IdentifierNode>(); foreach (AST.StatementNode statement in reverseList) { m_R.Clear(); m_W.Clear(); statement.Accept(this); afterLiveness.ExceptWith(m_W); afterLiveness.UnionWith(m_R); m_livenessAtNode[statement] = new HashSet<AST.IdentifierNode>(afterLiveness); } } }
public EntityJoinOperation(Process process, Relationship rel) : base(process) { _rel = rel; var rightFields = new HashSet<string>(rel.RightEntity.OutputFields().Aliases()); rightFields.ExceptWith(rel.LeftEntity.OutputFields().Aliases()); _fields = rightFields.ToArray(); }
public void onProductListReceived(string productListString) { Dictionary<string, object> response = (Dictionary<string, object>)Unibill.Impl.MiniJSON.jsonDecode(productListString); if (response.Count == 0) { callback.logError (UnibillError.SAMSUNG_APPS_NO_PRODUCTS_RETURNED); callback.onSetupComplete (false); return; } HashSet<PurchasableItem> productsReceived = new HashSet<PurchasableItem>(); foreach (var identifier in response.Keys) { if (remapper.canMapProductSpecificId(identifier.ToString())) { var item = remapper.getPurchasableItemFromPlatformSpecificId(identifier.ToString()); Dictionary<string, object> details = (Dictionary<string, object>)response[identifier]; PurchasableItem.Writer.setLocalizedPrice(item, details["price"].ToString()); PurchasableItem.Writer.setLocalizedTitle(item, (string) details["localizedTitle"]); PurchasableItem.Writer.setLocalizedDescription(item, (string) details["localizedDescription"]); productsReceived.Add(item); } else { logger.LogError("Warning: Unknown product identifier: {0}", identifier.ToString()); } } HashSet<PurchasableItem> productsNotReceived = new HashSet<PurchasableItem> (config.AllPurchasableItems); productsNotReceived.ExceptWith (productsReceived); if (productsNotReceived.Count > 0) { foreach (PurchasableItem product in productsNotReceived) { this.unknownSamsungProducts.Add(remapper.mapItemIdToPlatformSpecificId(product)); callback.logError(UnibillError.SAMSUNG_APPS_MISSING_PRODUCT, product.Id, remapper.mapItemIdToPlatformSpecificId(product)); } } callback.onSetupComplete (true); }
/// <summary> /// start /// </summary> public override void Start() { if (this._config.Discovery != null && this._config.Discovery.Zookeeper != null && !string.IsNullOrEmpty(this._config.Discovery.Zookeeper.ConfigPath) && !string.IsNullOrEmpty(this._config.Discovery.Zookeeper.ConfigName) && !string.IsNullOrEmpty(this._config.Discovery.Zookeeper.ZNode)) { this._zkDiscovery = new ZoomkeeperDiscovery(this._config.Client, this._config.Discovery.Zookeeper.ConfigPath, this._config.Discovery.Zookeeper.ConfigName, this._config.Discovery.Zookeeper.ZNode, endpoints => { lock (this._lockObj) { var set = new HashSet<string>(this.GetAllRegisteredEndPoint().Select(c => c.Key).Distinct().ToArray()); set.ExceptWith(endpoints.Select(p => string.Concat(p.Address.ToString(), ":", p.Port.ToString())).Distinct().ToArray()); if (set.Count > 0) { foreach (var name in set) this.UnRegisterEndPoint(name); } foreach (var p in endpoints) this.TryRegisterEndPoint(string.Concat(p.Address.ToString(), ":", p.Port.ToString()), new EndPoint[] { p }); } }); } base.Start(); }
public override void WalkGrammar(Grammar grammar) { var rules = grammar.Rules.ToDictionary(r => r.Identifier.Name, r => r); var startRule = grammar.Settings.Where(s => s.Key.Name == "start").Select(s => s.Value.ToString()).SingleOrDefault() ?? grammar.Rules[0].Identifier.Name; this.usedRules.Add(startRule); this.rulesToVisit.Enqueue(startRule); var publicRules = grammar.Rules.Where(r => r.Flags.Any(f => f.Name == "public" || f.Name == "export")); foreach (var rule in publicRules) { if (this.usedRules.Add(rule.Identifier.Name)) { this.rulesToVisit.Enqueue(rule.Identifier.Name); } } while (this.rulesToVisit.Count > 0) { var ruleName = this.rulesToVisit.Dequeue(); this.WalkRule(rules[ruleName]); } var unusedRules = new HashSet<string>(grammar.Rules.Select(r => r.Identifier.Name)); unusedRules.ExceptWith(this.usedRules); foreach (var ruleName in unusedRules) { var rule = rules[ruleName]; this.result.AddCompilerError(rule.Identifier.Start, () => Resources.PEG0017_WARNING_UnusedRule, rule.Identifier.Name); } }
private async Task DeleteInDestination(HashSet<Tuple<string, string, string>> src, HashSet<Tuple<string, string, string>> dst) { dst.ExceptWith(src); int n = 0; // group by table + partition foreach (var batch1 in dst.GroupBy(x => x.Item1 + x.Item2)) { CloudTable dstTable = _dstClient.GetTableReference(batch1.First().Item1); if (_token.IsCancellationRequested) return; foreach (var batch2 in batch1.Batch(100)) { if (_token.IsCancellationRequested) return; var op = new TableBatchOperation(); foreach (var tuple in batch2) { op.Delete(new TableEntity(tuple.Item2, tuple.Item3) {ETag = "*"}); } await dstTable.ExecuteBatchAsync(op, _token); n += Math.Min(op.Count, 100); Console.WriteLine("deleted {0} rows", n); } } }
static void Main(string[] args) { var letters = new HashSet<char>("the quick brown fox"); Console.WriteLine(letters.Contains('t')); // true Console.WriteLine(letters.Contains('j')); // false foreach (char c in letters) { Console.Write(c); // the quickbrownfx } letters.IntersectWith("aeiou"); foreach (char c in letters) { Console.Write(c); // euio } var letters2 = new HashSet<char>("the quick brown fox"); letters2.ExceptWith("aeiou"); foreach (char c in letters2) { Console.Write(c); // th qckbrwnfx } var letters3 = new HashSet<char>("the quick brown fox"); letters3.SymmetricExceptWith("the lazy brown fox"); foreach (char c in letters3) { Console.Write(c); // quicklazy } }
/// <summary> /// start /// </summary> public void Start() { if (this._config == null || this._config.Discovery == null || this._config.Discovery.Zookeeper == null || string.IsNullOrEmpty(this._config.Discovery.Zookeeper.ZNode)) return; var keeperConfig = this._config.Discovery.Zookeeper; var zk = ZookClientPool.Get(keeperConfig.ConfigPath, "zookeeper", keeperConfig.ConfigName); //ensure root node... var nodes = new NodeInfo[2]; nodes[0] = new NodeInfo(string.Concat("/", keeperConfig.ZNode), null, IDs.OPEN_ACL_UNSAFE, CreateModes.Persistent); nodes[1] = new NodeInfo(string.Concat("/", keeperConfig.ZNode, "/consumers"), null, IDs.OPEN_ACL_UNSAFE, CreateModes.Persistent); NodeFactory.TryEnsureCreate(zk, nodes, () => { var currProcess = Process.GetCurrentProcess(); var path = string.Concat("/", keeperConfig.ZNode, "/consumers/", Uri.EscapeDataString(string.Format( "consumer://{0}/{1}?application={2}&category=consumers&check=false&dubbo=2.5.1&interface={1}&methods={6}&owner={3}&pid={4}&revision=0.0.2-SNAPSHOT&side=consumer×tamp={5}", IPUtility.GetLocalIntranetIP().ToString(), keeperConfig.ZNode, currProcess.ProcessName, string.Empty, currProcess.Id.ToString(), Date.ToMillisecondsSinceEpoch(DateTime.UtcNow).ToString(), this._methods))); this._sessionNode = new SessionNode(zk, path, null, IDs.OPEN_ACL_UNSAFE); }); this._watcher = new ChildrenWatcher(zk, string.Concat("/", keeperConfig.ZNode, "/providers"), (names) => { //已存在的servers var arrExistServers = this._thriftClient.GetAllNodeNames(); //当前从zk获取到servers var arrNowServers = names.Select(s => { var t = Uri.UnescapeDataString(s); t = t.Substring(t.IndexOf(":") + 3); return t.Substring(0, t.IndexOf("/")); }).ToArray(); var set = new HashSet<string>(arrExistServers); set.ExceptWith(arrNowServers); if (set.Count > 0) { foreach (var child in set) this._thriftClient.UnRegisterServerNode(child); } set = new HashSet<string>(arrNowServers); set.ExceptWith(arrExistServers); if (set.Count > 0) { foreach (var child in set) { int index = child.IndexOf(":"); this._thriftClient.RegisterServerNode(child, new IPEndPoint(IPAddress.Parse(child.Substring(0, index)), int.Parse(child.Substring(index + 1)))); } } }); }
/// <summary> /// Returns all Edges that connect the two nodes (which are assumed to be different). /// </summary> /// <param name="node0"></param> /// <param name="node1"></param> /// <returns></returns> public static IList<DirectedEdge> GetEdgesBetween(Node node0, Node node1) { IList<Edge> edges0 = DirectedEdge.ToEdges(node0.OutEdges.Edges); var commonEdges = new HashSet<DirectedEdge>(Utilities.Caster.Cast<DirectedEdge>(edges0)); IList<Edge> edges1 = DirectedEdge.ToEdges(node1.OutEdges.Edges); commonEdges.ExceptWith(Utilities.Caster.Cast<DirectedEdge>(edges1)); return new List<DirectedEdge>(commonEdges); }
public IEnumerable<string> GetCommands(string profile) { var commands = new HashSet<string>(_requirements.SelectMany(x => x.Commands)); var removeCommands = _remove.Where(x => x.Profile == profile) .SelectMany(x => x.Commands).ToArray(); commands.ExceptWith(removeCommands); return commands; }
protected void SynchronizeModelChildren() { HashSet<object> set = new HashSet<object>(ModelChildren); Children.RemoveAll(n => !set.Contains(n.Model)); set.ExceptWith(Children.Select(n => n.Model)); InsertChildren(set); if (IsSpecialNode()) InsertSpecialNodes(); }
public Cell[] GetSurroundingCells() { HashSet<Cell> surrounding = new HashSet<Cell>(); foreach (var member in members) foreach (var move in MoveTypeExt.LinearMoves) surrounding.Add(member.Move(move)); surrounding.ExceptWith(members); return surrounding.ToArray(); }
public IEnumerable<IStylingRule> GetUnusedRules() { lock (_sync) { var unusedRules = new HashSet<IStylingRule>(GetAllRules()); unusedRules.ExceptWith(_ruleUsages.Select(x => x.Rule).Distinct()); return unusedRules.Where(x => !UsageRegistry.IsAProtectedClass(x)).ToList(); } }
/// <summary> /// Determines whether the interpreter factory contains the specified /// modules. /// </summary> /// <returns>The names of the modules that were found.</returns> public static async Task<HashSet<string>> FindModulesAsync(this IPythonInterpreterFactory factory, params string[] moduleNames) { var finding = new HashSet<string>(moduleNames); var found = new HashSet<string>(); var withPackages = factory.PackageManager; if (withPackages != null) { foreach (var m in finding) { if ((await withPackages.GetInstalledPackageAsync(new PackageSpec(m), CancellationToken.None)).IsValid) { found.Add(m); } } finding.ExceptWith(found); if (!finding.Any()) { // Found all of them, so stop searching return found; } } var withDb = factory as PythonInterpreterFactoryWithDatabase; if (withDb != null && withDb.IsCurrent) { var db = withDb.GetCurrentDatabase(); found.UnionWith(finding.Where(m => db.GetModule(m) != null)); // Always stop searching after this step return found; } if (withDb != null) { try { var paths = await PythonTypeDatabase.GetDatabaseSearchPathsAsync(withDb); found.UnionWith(PythonTypeDatabase.GetDatabaseExpectedModules(withDb.Configuration.Version, paths) .SelectMany() .Select(g => g.ModuleName) .Where(m => finding.Contains(m))); } catch (InvalidOperationException) { } finding.ExceptWith(found); if (!finding.Any()) { // Found all of them, so stop searching return found; } } return await Task.Run(() => { foreach (var mp in ModulePath.GetModulesInLib(factory.Configuration)) { if (finding.Remove(mp.ModuleName)) { found.Add(mp.ModuleName); } if (!finding.Any()) { break; } } return found; }); }
static HashSet<string> GetWaitingURLs(HashSet<string> crawled_urls) { HashSet<string> ret = new HashSet<string>(); for(int idx = 0; idx < seed_category_urls_fmt.Length; idx++) { ret.UnionWith(GetURLsByCategory(idx)); } ret.ExceptWith(crawled_urls); return ret; }
public static HashSet<int> Func(HashSet<int> X1, HashSet<int> X2, HashSet<int> X3) { HashSet<int> Y1 = new HashSet<int>(X2); Y1.ExceptWith(X3); HashSet<int> Y2 = new HashSet<int>(X1); Y2.ExceptWith(X3); HashSet<int> Y = new HashSet<int>(Y1); Y.UnionWith(Y2); return Y; }
public override void Process(IEnumerable<string> expected, IEnumerable<string> result) { d++; HashSet<string> delta = new HashSet<string>(expected); delta.UnionWith(result); HashSet<string> section = new HashSet<string>(expected); section.IntersectWith(result); delta.ExceptWith(section); score += (double) delta.Count; }
public override void SetExpandedWithChildren(TreeViewItem item, bool expand) { HashSet<int> source = new HashSet<int>((IEnumerable<int>) this.expandedIDs); HashSet<int> parentsBelow = this.GetParentsBelow(item.id); if (expand) source.UnionWith((IEnumerable<int>) parentsBelow); else source.ExceptWith((IEnumerable<int>) parentsBelow); this.SetExpandedIDs(source.ToArray<int>()); }
public static ushort GetFreePort() { var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); var tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections(); var usedPorts = new HashSet<ushort>(tcpConnInfoArray.Select(x => (ushort)x.LocalEndPoint.Port)); var availablePorts = new HashSet<ushort>(Enumerable.Range(1024, 65535 - 1024).Select(x => (ushort)x)); availablePorts.ExceptWith(usedPorts); return availablePorts.Skip(new Random().Next(availablePorts.Count - 1)).First(); }
public IEnumerable<int> find(int i) { var finder = new HashSet<int>(full_digit); HashSet<int> existed_digits=new HashSet<int>(); foreach (char digit in i.ToString()) { existed_digits.Add(int.Parse(digit.ToString())); } finder.ExceptWith(existed_digits); return finder; }
public void TestExceptWith () { var aSet = new HashSet<int> { 1, 2 }; var bSet = new HashSet<int> { 1 }; aSet.ExceptWith (bSet); Assert.IsTrue (aSet.Contains (2)); Assert.IsFalse (aSet.Contains (1)); Assert.AreEqual (1, aSet.Count); }
public double GetDistance(string a, string b) { HashSet<string> ta = new HashSet<string>(StringUtils.GetLuceneTokens(a)); HashSet<string> tb = new HashSet<string>(StringUtils.GetLuceneTokens(b)); HashSet<string> xor = new HashSet<string>(ta); xor.UnionWith(tb); HashSet<string> intersec = new HashSet<string>(ta); intersec.IntersectWith(tb); xor.ExceptWith(intersec); return Math.Sqrt(xor.Count); }
private HashSet<IProjectEntry> GetNewDependencies(HashSet<IProjectEntry> oldDependencies) { HashSet<IProjectEntry> deps; lock (_dependencies) { deps = new HashSet<IProjectEntry>(_dependencies); } if (oldDependencies != null) { deps.ExceptWith(oldDependencies); } return deps; }
public static IEnumerable<IEnumerable<Vertex>> GetConnectedComponents( this IGraph graph) { HashSet<Vertex> remainingVertices = new HashSet<Vertex>(graph.Vertices()); while (remainingVertices.Count > 0) { IEnumerable<Vertex> componentVertices = graph.BreadthFirstTreeTraversal(remainingVertices.First()); remainingVertices.ExceptWith(componentVertices); yield return componentVertices; } }
public void SyncAll() { bool started = false; var cloudBlobs = container.ListBlobs(new BlobRequestOptions() { UseFlatBlobListing = true, BlobListingDetails = BlobListingDetails.Metadata }).OfType<CloudBlob>(); var cloudBlobNames = new HashSet<string>(cloudBlobs.Select(b => b.Uri.ToString())); var localBlobNames = new HashSet<string>(localBlobs.Keys); localBlobNames.ExceptWith(cloudBlobNames); foreach (var name in localBlobNames) { started = true; if (!started && SyncStarted != null) { SyncStarted(this); } File.Delete(GetLocalPath(name)); localBlobs.Remove(name); } foreach (var blob in cloudBlobs) { if (!localBlobs.ContainsKey(blob.Uri.ToString()) || blob.Attributes.Properties.ETag != localBlobs[blob.Uri.ToString()]) { if (!started) { started = true; if (SyncStarted != null) { SyncStarted(this); } } var path = GetLocalPath(blob.Uri.ToString()); var args = new UpdatingFileEventArgs(blob, path); if (UpdatingFile != null) { UpdatingFile(this, args); } if (!args.Cancel) { Directory.CreateDirectory(Path.GetDirectoryName(path)); using (var stream = File.Create(GetLocalPath(blob.Uri.ToString()))) { blob.DownloadToStream(stream); } } localBlobs[blob.Uri.ToString()] = blob.Properties.ETag; } } if (started && SyncCompleted != null) { SyncCompleted(this); } }
public static void CopyDirectory(string sourceDir, string destDir) { sourceDir = sourceDir.TrimEnd('\\'); destDir = destDir.TrimEnd('\\'); try { Directory.CreateDirectory(destDir); } catch (IOException) { } var newDirectories = new HashSet<string>(from d in Directory.EnumerateDirectories(sourceDir, "*", SearchOption.AllDirectories) where d.StartsWith(sourceDir) select d.Substring(sourceDir.Length + 1), StringComparer.OrdinalIgnoreCase); newDirectories.ExceptWith(from d in Directory.EnumerateDirectories(destDir, "*", SearchOption.AllDirectories) where d.StartsWith(destDir) select d.Substring(destDir.Length + 1)); foreach (var newDir in newDirectories.OrderBy(i => i.Length).Select(i => Path.Combine(destDir, i))) { try { if (newDir.Length < NativeMethods.MAX_FOLDER_PATH) { Directory.CreateDirectory(newDir); } } catch { Debug.WriteLine("Failed to create directory " + newDir); } } var newFiles = new HashSet<string>(from f in Directory.EnumerateFiles(sourceDir, "*", SearchOption.AllDirectories) where f.StartsWith(sourceDir) select f.Substring(sourceDir.Length + 1), StringComparer.OrdinalIgnoreCase); newFiles.ExceptWith(from f in Directory.EnumerateFiles(destDir, "*", SearchOption.AllDirectories) where f.StartsWith(destDir) select f.Substring(destDir.Length + 1)); foreach (var newFile in newFiles) { var copyFrom = Path.Combine(sourceDir, newFile); var copyTo = Path.Combine(destDir, newFile); try { if (copyTo.Length < NativeMethods.MAX_PATH && copyFrom.Length < NativeMethods.MAX_PATH) { var copyToDir = Path.GetDirectoryName(copyTo); if (copyToDir.Length < NativeMethods.MAX_FOLDER_PATH) { File.Copy(copyFrom, copyTo); File.SetAttributes(copyTo, FileAttributes.Normal); } else { Debug.WriteLine("Failed to copy " + copyFrom + " to " + copyTo + " due to max path limit"); } } else { Debug.WriteLine("Failed to copy " + copyFrom + " to " + copyTo + " due to max path limit"); } } catch { Debug.WriteLine("Failed to copy " + copyFrom + " to " + copyTo + " for unknown reason"); } } }
public IDictionary<string, SDProgramImageResponse> GetImages(ISet<string> imageIDs) { ISet<string> imagesNeeded = new HashSet<string>(imageIDs.Except(imageCache_.Keys)); IDictionary<string, SDProgramImageResponse> dbImages = DBManager.instance.GetImagesByIds(imagesNeeded); foreach (var kv in dbImages) imageCache_[kv.Key] = kv.Value; imagesNeeded.ExceptWith(dbImages.Keys); foreach(var imageResponse in DownloadProgramImages(imagesNeeded)) { imageCache_[imageResponse.programID] = imageResponse; } return imageCache_; }