public void Sud_SaveMetadataReference() { Given_Architecture(); Given_TestOS_Platform(); var project = new Project { Programs = { new Program { Architecture = arch, Platform = platform, Filename = "c:\\test\\foo.exe", } }, MetadataFiles = { new MetadataFile { Filename = "c:\\test\\foo.def", ModuleName = "foo.def", } } }; mr.ReplayAll(); var ps = new ProjectSaver(sc); ps.Save("c:\\test\\foo.project", project); Assert.AreEqual(1, project.MetadataFiles.Count); Assert.AreEqual("c:\\test\\foo.def", project.MetadataFiles[0].Filename); Assert.AreEqual("foo.def", project.MetadataFiles[0].ModuleName); }
public void Sud_SaveMetadataReference() { var project = new Project { Programs = { new Program { Filename = "c:\\test\\foo.exe", } }, MetadataFiles = { new MetadataFile { Filename = "c:\\test\\foo.def", ModuleName = "foo.def", } } }; var ps = new ProjectSaver(); var sProject = ps.Save(project); Assert.AreEqual(1, project.MetadataFiles.Count); Assert.AreEqual("c:\\test\\foo.def", project.MetadataFiles[0].Filename); Assert.AreEqual("foo.def", project.MetadataFiles[0].ModuleName); }
/// <summary> /// Saves the project. /// </summary> /// <returns>False if the user cancelled the save, true otherwise.</returns> public bool Save() { if (decompilerSvc.Decompiler == null) return true; if (string.IsNullOrEmpty(this.ProjectFileName)) { string newName = PromptForFilename( Path.ChangeExtension( decompilerSvc.Decompiler.Project.Programs[0].Filename, Project_v3.FileExtension)); if (newName == null) return false; ProjectFileName = newName; mru.Use(newName); } var fsSvc = Services.RequireService<IFileSystemService>(); using (var xw = fsSvc.CreateXmlWriter(ProjectFileName)) { var saver = new ProjectSaver(sc); var sProject = saver.Serialize(ProjectFileName, decompilerSvc.Decompiler.Project); saver.Save(sProject, xw); } return true; }