4

For my requirement of comparing package with another model package, I need to import a baseline from one model to another model in EA.I know EA doesn't provide any direct API calls for importing baseline.

Tried using *DoBaselineCompare*but it doesn't work.

So I exported 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 gets exported successfully in the given path. I just tried importing the baseline manually in a package to check whether it works, and it's working perfectly. Now I need the same to do it programmatically .

  • How to create a blob data from that exported baseline file?
  • If blob data is created I will just create a new value in the t_document table and insert that blob content in BinContent property.

I tried to insert a new row of existing blob data from BinContent column. It's getting inserted and displayed in the Baselines screen-But couldn't able to restore or import\export from the inserted baseline

Can anyone suggest a way to import baseline into a package programmatically.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dah Sra
  • 4,107
  • 3
  • 30
  • 69

0 Answers0