protected Task On(AssetRenamed @event, EnvelopeHeaders headers) { return(Collection.UpdateAsync(@event, headers, a => { SimpleMapper.Map(@event, a); })); }
//specify newName without extension public IMediaAsset RenameAsset(IMediaAsset asset, String newName) { string OldName = asset.Name; IDictionaryEnumerator en = m_htAssetList.GetEnumerator(); while (en.MoveNext()) { if (en.Key.ToString() == asset.Name) { m_htAssetList.Remove(en.Key); asset.Name = newName; m_htAssetList.Add(asset.Name, asset); AssetRenamed ob_AssetRenamed = new AssetRenamed(asset, OldName); //ob_AssetRenamed.AssetRenamedEvent+= new DAssetRenamedEvent (ob_CatchEvents.CatchAssetRenamedEvent) ; //ob_AssetRenamed.NotifyAssetRenamed ( this, ob_AssetRenamed ) ; AssetRenamedEvent(this, ob_AssetRenamed); return(asset); } } MessageBox.Show("Key not found, null will be returned"); return(null); // end of function }
public string RenameAsset(IMediaAsset asset, String newName) { string OldName = asset.Name; bool boolRenamed = false; IDictionaryEnumerator enRemove = m_htAssetList.GetEnumerator(); while (enRemove.MoveNext()) { if (enRemove.Key.ToString() == asset.Name) { m_htAssetList.Remove(OldName); m_htExists.Remove(OldName); asset.Name = newName; m_htAssetList.Add(asset.Name, asset); m_htExists.Add(asset.Name, asset); boolRenamed = true; break; } } if (boolRenamed == false) { throw new Exception("Asset cannot be renamed : not in hashtable"); } AssetRenamed ob_AssetRenamed = new AssetRenamed(asset, OldName); ob_AssetRenamed.AssetRenamedEvent += new DAssetRenamedEvent(ob_Catch.CatchAssetRenamedEvent); ob_AssetRenamed.NotifyAssetRenamed(this, ob_AssetRenamed); return(OldName); }
private void RenameAssetInternal(string sourcePath, string destPath) { var asset = GetAsset(sourcePath); var value = asset.Importer.Value; var guid = asset.Guid; DeleteAssetInternal(asset, true); asset.UpdatePath(destPath); // AddAssetInternal deals with it // AssetGuidManager.AddNewGuid(guid, asset.Path, asset.Hash); if (!IsEditingAssets) { AssetGuidManager.Save(); } AddAssetInternal(asset, true); AssetRenamed?.Invoke(sourcePath, destPath); }
protected void On(AssetRenamed @event) { fileName = @event.FileName; }
public void CatchAssetRenamedEvent(object sender, AssetRenamed Asset) { MessageBox.Show(Asset.OldName.ToString()); }
/// <summary> /// Catch renamed asset events. /// </summary> public void OnAssetRenamed(object sender, AssetRenamed e) { }