public void AddNameTwice() { Dataset dataset = new Dataset(); Assert.AreEqual(0, dataset.Count); dataset.Add(fooExtension); Assert.AreEqual(1, dataset.Count); Assert.AreEqual(fooExtension, dataset[0]); Assert.AreEqual(fooExtension, dataset[fooExtension.Name]); dataset.Add(fooExtension); }
//--------------------------------------------------------------------- /// <summary> /// Executes the command. /// </summary> public void Execute() { #if ENABLE_OLD_CODE // TODO: This code is from the old AddCommand, so it needs to be // updated eventually. Dataset dataset = Dataset.LoadOrCreate(Dataset.DefaultPath); EditableExtensionInfo.Dataset = dataset; ExtensionParser parser = new ExtensionParser(); ExtensionInfo extension = Data.Load <ExtensionInfo>(extensionInfoPath, parser); List <string> missingLibs = new List <string>(); foreach (string library in extension.ReferencedAssemblies) { if (!dataset.ReferencedByEntries(library)) { missingLibs.Add(library); } } List <string> libsToBeInstalled = new List <string>(); foreach (string libPath in extension.LibraryPaths) { libsToBeInstalled.Add(Path.GetFileNameWithoutExtension(libPath)); } foreach (string libToBeInstalled in libsToBeInstalled) { missingLibs.Remove(libToBeInstalled); } if (missingLibs.Count > 0) { MultiLineText message = new MultiLineText(); message.Add("Error: The extension requires the following libraries which are not"); message.Add(" currently installed and are not listed in the extension info file:"); foreach (string lib in missingLibs) { message.Add(" " + lib); } throw new MultiLineException(message); } Console.WriteLine("Installation directory: {0}", installDir); Console.WriteLine("Copying files to installation directory ..."); CopyFileToInstallDir(extension.AssemblyPath); foreach (string libPath in extension.LibraryPaths) { CopyFileToInstallDir(libPath); } dataset.Add(extension); dataset.Save(); Console.WriteLine("Extension {0} installed", extension.Name); #endif }
//--------------------------------------------------------------------- /// <summary> /// Executes the command. /// </summary> public void Execute() { Dataset dataset = Util.OpenDatasetForChange(Dataset.DefaultPath); EditableExtensionInfo.Dataset = dataset; ExtensionParser parser = new ExtensionParser(); ExtensionInfo extension = Data.Load <ExtensionInfo>(extensionInfoPath, parser); dataset.Add(extension); dataset.Save(); Console.WriteLine("Added the extension \"{0}\"", extension.Name); }
public void IDataset_Indexer() { Dataset dataset = new Dataset(); dataset.Add(fooExtension); dataset.Add(barExtension); Landis.PlugIns.IDataset coreDataset = dataset; AssertAreEqual(fooExtension.CoreInfo, coreDataset[fooExtension.Name]); AssertAreEqual(barExtension.CoreInfo, coreDataset[barExtension.Name]); }
public void SaveAs() { Dataset dataset = new Dataset(); dataset.Add(fooExtension); dataset.Add(barExtension); eventDataset = null; string path = Data.MakeOutputPath("SaveAs_Test.xml"); dataset.SaveAs(path); Assert.AreEqual(path, dataset.Path); Assert.AreSame(dataset, eventDataset); Dataset loadedDataset = new Dataset(path); Assert.IsNotNull(loadedDataset); AssertAreEqual(dataset, loadedDataset); }
public void Remove_UnknownName() { Dataset dataset = new Dataset(); dataset.Add(fooExtension); dataset.Add(barExtension); Assert.IsNull(dataset.Remove("Unknown Plug-In")); }
public void Remove() { Dataset dataset = new Dataset(); dataset.Add(fooExtension); dataset.Add(barExtension); ExtensionInfo removedExtension = dataset.Remove(fooExtension.Name); AssertAreEqual(fooExtension, removedExtension); Assert.AreEqual(1, dataset.Count); AssertAreEqual(barExtension, dataset[0]); removedExtension = dataset.Remove(barExtension.Name); AssertAreEqual(barExtension, removedExtension); Assert.AreEqual(0, dataset.Count); }