Import baseline into EA programmatically

For my requirement to compare the package with another model package, I need to import the baseline from one model to another model in EA. I know that EA does not provide any direct API calls to import the baseline.

Tried to use *DoBaselineCompare*, but it does not work.

So, I exported the baseline from one package using below code

Byte[] byteBLOBData = new Byte[0];
byteBLOBData = Convert.FromBase64String(sValues);
Stream data = new MemoryStream(byteBLOBData);
Stream otherData = new MemoryStream();
ZipArchive archive = new ZipArchive(data);
foreach (ZipArchiveEntry entry in archive.Entries)
{
  if (entry.Name == "str.dat")
  {
    otherData = entry.Open();
  }
}
MemoryStream ms = new MemoryStream();
otherData.CopyTo(ms);
byte[] bytesInStream = ms.ToArray(); // simpler way of converting to array
XmlDocument doc = new XmlDocument();
string sss = Encoding.Unicode.GetString(bytesInStream);
doc.LoadXml(sss);
doc.Save(@"C:\ExportedBaseline.xml");

And it is successfully exported to the given path. I just tried importing the source code manually into the package to check if it works and it works fine. Now I need the same thing to do this programmatically.

  • How to create blob data from this exported base file?
  • blob, t_document BinContent.

blob BinContent. " " - \

- .

+4

Source: https://habr.com/ru/post/1689663/


All Articles