public void DeleteAsset(asset removeAsset) { List <asset> assetList = new List <asset>(asset); assetList.Remove(removeAsset); asset = assetList.ToArray(); }
public void AddAsset(asset newAsset) { if (asset == null) { asset = new asset[0]; } var local_asset = asset; Array.Resize(ref local_asset, local_asset.Length + 1); local_asset[local_asset.Length - 1] = newAsset; asset = local_asset; }
public void AddLocalAsset(string assetPath) { asset newAsset = new asset(); FileInfo fileInfo = new FileInfo(assetPath); newAsset.Value = fileInfo.Name; string activeDir = _activeProjectDirectory; string back = ""; // generating the relative path for the asset. do { if (assetPath.Contains(activeDir + "\\")) { newAsset.path = back + assetPath.Replace(activeDir + "\\", ""); break; } else { int pos = activeDir.LastIndexOf('\\', activeDir.Length - 1); if (pos < 0) { // file is located in a different driver. Copy the entire assetPath. newAsset.path = assetPath; break; } else { back += "..\\"; activeDir = activeDir.Remove(pos); } } } while (true); if (_config.Name == "All Configurations") _qnxSchema.AddLocalAsset(newAsset); else { foreach (qnxConfiguration config in _qnxSchema.configuration) { if (config.name == _config.Name) { config.AddAsset(newAsset); } } } DesignerDirty = true; if (ViewModelChanged != null) { // Update the Designer View ViewModelChanged(this, new EventArgs()); } }
public void DeleteAsset(asset removeAsset) { List<asset> assetList = new List<asset>(asset); assetList.Remove(removeAsset); asset = assetList.ToArray(); }
public void AddLocalAsset(string assetPath) { asset newAsset = new asset(); FileInfo fileInfo = new FileInfo(assetPath); newAsset.Value = fileInfo.Name; newAsset.path = assetPath.Replace(_activeProjectDirectory + "\\", ""); if (_config.Name == "All Configurations") _qnxSchema.AddLocalAsset(newAsset); else { foreach (qnxConfiguration config in _qnxSchema.configuration) { if (config.name == _config.Name) { config.AddAsset(newAsset); } } } DesignerDirty = true; if (ViewModelChanged != null) { // Update the Designer View ViewModelChanged(this, new EventArgs()); } }