Author Topic: Importing Baseline in EA programatically  (Read 107 times)

EAUser3200

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Importing Baseline in EA programatically
« on: November 22, 2017, 05:16:21 pm »
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
Code: [Select]
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 get exported successfully in the given path. I just tried importing the baseline manually in a package to check whether it works , and its 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 t_document table and insert that blob content in BinContent property.
Can anyone suggest a way to import baseline into a package programmatically :( :o

qwerty

  • EA Guru
  • *****
  • Posts: 8952
  • Karma: +136/-123
  • I'm no guru at all
    • View Profile

EAUser3200

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Importing Baseline in EA programatically
« Reply #2 on: November 22, 2017, 10:35:57 pm »
Hii Qwerty
I tried inserting an existing blob content into a new row and its getting inserted.
Even in the Baseline UI its getting displayed, but couldn't able to restore or import\export that baseline .

qwerty

  • EA Guru
  • *****
  • Posts: 8952
  • Karma: +136/-123
  • I'm no guru at all
    • View Profile
Re: Importing Baseline in EA programatically
« Reply #3 on: November 23, 2017, 12:47:21 am »
I'll have a look, but it might take a moment. How did you transfer the record?

q.