Serialize.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Xml;
  8. namespace FileManager
  9. {
  10. //#define RootClassName "XMLData"
  11. //#define XMLClassEndTag std::string("</")+RootClassName+">"
  12. //#define Empty_String std::string("")
  13. public interface Convertinterface
  14. {
  15. void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode);
  16. }
  17. public class MemberBase
  18. {
  19. const string RootClassName = "XMLData";
  20. const string XMLClassEndTag = "</" + RootClassName + ">";
  21. const string Empty_String = "";
  22. protected string m_sValue;
  23. //public virtual ~MemberBase() { };
  24. public virtual void Dispose() { }
  25. public string toString() { return m_sValue; }
  26. //public const char* c_str() { return m_sValue.c_str(); }
  27. public string getStringPtr(string str) { return m_sValue = str; } //c++原代码为:std::string *getStringPtr() { return &m_sValue; };
  28. }
  29. /**
  30. serializable string
  31. */
  32. public class xString : MemberBase
  33. {
  34. public void AssignValue(string value) { m_sValue = value; } //因为c#无=重载,所以修改为public
  35. public xString() { }
  36. public xString(string value) { AssignValue(value); }
  37. public string value() { return m_sValue; }
  38. //public xString operator=(const string value) { AssignValue(value); return *this; } //c#不可以重载=
  39. //public xString operator=(const char* value) { AssignValue(value); return *this; } //c#不可以重载=
  40. }
  41. public class xInt : MemberBase
  42. {
  43. public void AssignValue(int value) { m_sValue = value.ToString(); } //因为c#无=重载,所以修改为public
  44. public xInt() { AssignValue(0); }
  45. public xInt(int value) { AssignValue(value); }
  46. public int value()
  47. {
  48. int value;
  49. value = int.Parse(m_sValue);
  50. return value;
  51. }
  52. //xInt operator=(const int value) { AssignValue(value); return *this; }; //c#不可以重载=
  53. }
  54. public class xDouble : MemberBase
  55. {
  56. public void AssignValue(double value) { m_sValue = value.ToString(); } //因为c#无=重载,所以修改为public
  57. public xDouble() { AssignValue(0); }
  58. public xDouble(double value) { AssignValue(value); }
  59. public double value()
  60. {
  61. double value;
  62. value = double.Parse(m_sValue);
  63. return value;
  64. }
  65. //xDouble operator=(const double value) { AssignValue(value); return *this; }; //c#不可以重载=
  66. }
  67. public class xLong : MemberBase
  68. {
  69. public void AssignValue(long value) { m_sValue = value.ToString(); } //因为c#无=重载,所以修改为public public xLong() { AssignValue(0); }
  70. public xLong(long value) { AssignValue(value); }
  71. public long value()
  72. {
  73. long value;
  74. value = long.Parse(m_sValue);
  75. return value;
  76. }
  77. //xLong operator=(const long value) { AssignValue(value); return *this; }; //c#不可以重载=
  78. }
  79. public class xDWORD : MemberBase
  80. {
  81. public void AssignValue(uint value) { m_sValue = value.ToString(); } //因为c#无=重载,所以修改为public
  82. public xDWORD() { AssignValue(0); }
  83. public xDWORD(uint value) { AssignValue(value); }
  84. public uint value()
  85. {
  86. uint value;
  87. value = uint.Parse(m_sValue);
  88. return value;
  89. }
  90. //xDWORD operator=(const DWORD value) { AssignValue(value); return *this; };
  91. }
  92. public class xBool : MemberBase
  93. {
  94. public void AssignValue(bool value) { m_sValue = value ? "true" : "false"; } //因为c#无=重载,所以修改为public
  95. public xBool() { AssignValue(false); }
  96. public xBool(bool value) { AssignValue(value); }
  97. public bool value()
  98. {
  99. bool value = false;
  100. string sHelp = m_sValue;
  101. //transform(sHelp.GetEnumerator(), sHelp.end(), sHelp.GetEnumerator(), toupper);
  102. sHelp=sHelp.ToUpper();
  103. if (sHelp == "TRUE")
  104. return true;
  105. return value;
  106. }
  107. //xBool operator=(const bool value) { AssignValue(value); return *this; };
  108. }
  109. public class xTime_t : MemberBase //time_t对应c#类型?long?
  110. {
  111. public void AssignValue(DateTime value) //因为c#无=重载,所以修改为public
  112. {
  113. m_sValue = value.ToString();
  114. }
  115. public xTime_t()
  116. {
  117. DateTime t = Convert.ToDateTime(null);
  118. AssignValue(t);
  119. }
  120. public xTime_t(DateTime value) { AssignValue(value); }
  121. public DateTime value()
  122. {
  123. return Convert.ToDateTime(m_sValue);
  124. }
  125. //xTime_t operator=(const time_t value) { AssignValue(value); return *this; };
  126. }
  127. // class __declspec(dllexport) xOleDateTime : public MemberBase //COleDateTime对应c#类型?统一改为time_t
  128. // {
  129. // {
  130. // private:
  131. // void AssignValue(const COleDateTime value);
  132. // public:
  133. // xOleDateTime() { };
  134. // xOleDateTime(COleDateTime value) { AssignValue(value); };
  135. // COleDateTime value();
  136. // xOleDateTime operator=(const COleDateTime value) { AssignValue(value); return *this; };
  137. // };
  138. public class xOleDateTimeSpan : MemberBase //COleDateTimeSpan对应c#类型?TimeSpan?
  139. {
  140. public void AssignValue(TimeSpan value) //因为c#无=重载,所以修改为public
  141. {
  142. m_sValue = value.ToString();
  143. }
  144. public xOleDateTimeSpan()
  145. {
  146. TimeSpan timeSpan = DateTime.Now - DateTime.Now;
  147. AssignValue(timeSpan);
  148. }
  149. public xOleDateTimeSpan(TimeSpan value) { AssignValue(value); }
  150. public TimeSpan value()
  151. {
  152. return TimeSpan.Parse(m_sValue);
  153. }
  154. //xOleDateTimeSpan operator=(const COleDateTimeSpan value) { AssignValue(value); return *this; };
  155. };
  156. public class xRect : MemberBase
  157. {
  158. public void AssignValue(Rect value, int shape = 1) //因为c#无=重载,所以修改为public
  159. {
  160. //Rect x = new Rect();
  161. // domain text body
  162. string strDomainTextBody = "";
  163. // value 1 -- shape
  164. string strValue = "";
  165. // value 2 -- center x
  166. // domain center
  167. int centerX = (int)(value.Left + value.Right) / 2;
  168. strValue = centerX.ToString();
  169. strDomainTextBody += strValue + ",";
  170. // value 3 -- center y
  171. int centerY = (int)(value.Top + value.Bottom) / 2;
  172. strValue = centerY.ToString();
  173. strDomainTextBody += strValue + ",";
  174. if (shape == 0)
  175. {
  176. // value 4 -- diameter
  177. int diameter = (int)value.Width;
  178. strValue = diameter.ToString();
  179. strDomainTextBody += strValue + ",";
  180. // value 5 -- 0
  181. strDomainTextBody += "0";
  182. }
  183. else
  184. {
  185. // value 4 -- width
  186. int width = (int)value.Width;
  187. strValue = width.ToString();
  188. strDomainTextBody += strValue + ",";
  189. // value 5 -- height
  190. int height = (int)value.Width;
  191. strValue = height.ToString();
  192. strDomainTextBody += strValue;
  193. }
  194. // return domain text body
  195. m_sValue = strDomainTextBody;
  196. }
  197. public xRect() //xRect() { AssignValue(0); };???
  198. {
  199. Rect value = new Rect();
  200. value.X = 0;
  201. value.Y = 0;
  202. value.Width = 1;
  203. value.Height = 1;
  204. AssignValue(value, 1);
  205. }
  206. xRect(Rect value, int shape) { AssignValue(value, shape); }
  207. void SplitString(string s, ref List<string> v, string c)
  208. {
  209. string[] sArray = System.Text.RegularExpressions.Regex.Split(s, c, System.Text.RegularExpressions.RegexOptions.None);
  210. foreach (string i in sArray)
  211. v.Add(i);
  212. }
  213. public Rect value()
  214. {
  215. Rect rectangle = new Rect();
  216. List<string> point = new List<string>();
  217. SplitString(m_sValue, ref point, ",");
  218. rectangle.X = int.Parse(point[0]);
  219. rectangle.Y = int.Parse(point[1]);
  220. rectangle.Width = Math.Abs(int.Parse(point[0]) + int.Parse(point[2]));
  221. rectangle.Height = Math.Abs(int.Parse(point[1]) + int.Parse(point[3]));
  222. return rectangle;
  223. }
  224. }
  225. public class xPoint : MemberBase
  226. {
  227. public void AssignValue(System.Drawing.Point value) //因为c#无=重载,所以修改为public
  228. {
  229. int X = value.Y;
  230. int Y = value.Y;
  231. string OutString;
  232. string sX = X.ToString();
  233. string sY = Y.ToString();
  234. OutString = sX + "," + sY;
  235. m_sValue = OutString;
  236. }
  237. xPoint()
  238. {
  239. System.Drawing.Point value = new System.Drawing.Point();
  240. value.X = 0;
  241. value.Y = 0;
  242. AssignValue(value);
  243. }
  244. xPoint(System.Drawing.Point value) { AssignValue(value); }
  245. void SplitString(string s, ref List<string> v, string c)
  246. {
  247. string[] sArray = System.Text.RegularExpressions.Regex.Split(s, c, System.Text.RegularExpressions.RegexOptions.None);
  248. foreach (string i in sArray)
  249. v.Add(i);
  250. }
  251. System.Drawing.Point value()
  252. {
  253. System.Drawing.Point p = new System.Drawing.Point();
  254. List<string> point = new List<string>();
  255. SplitString(m_sValue, ref point, ",");
  256. p.X = int.Parse(point[0]);
  257. p.Y = int.Parse(point[1]);
  258. return p;
  259. }
  260. };
  261. //typedef std::map<std::string, CollectionBase*>::iterator __declspec(dllexport) CollectionIterator; ???
  262. public abstract class CollectionBase<ISlo>
  263. {
  264. private string m_sCollectionName;
  265. private string m_sCollectionClassType;
  266. public CollectionBase() { m_sCollectionName = ""; m_sCollectionClassType = ""; }
  267. public List<ISlo> m_vCollection = new List<ISlo>(); //vector<ISlo*> m_vCollection; ISlo*转??
  268. public SortedDictionary<ISlo, bool> m_mOwner = new SortedDictionary<ISlo, bool>(); //map<ISlo*, bool> ??
  269. public void setCollectionName(string value) { m_sCollectionName = value; }
  270. public void setCollectionClassType(string value) { m_sCollectionClassType = value; }
  271. public abstract ISlo newElement();
  272. public string getCollectionName() { return m_sCollectionName; }
  273. public int size() { return m_vCollection.Count(); }
  274. public ISlo getItem(int itemID) { return m_vCollection[itemID]; }
  275. public void Clear()
  276. {
  277. if (m_vCollection.Count() > 0)
  278. {
  279. m_vCollection.Clear();
  280. }
  281. }
  282. }
  283. public class Collection<T> : CollectionBase<ISlo>
  284. {
  285. /**
  286. create new element of type T
  287. @return empty object of type T
  288. */
  289. public override ISlo newElement()
  290. {
  291. T newItem = System.Activator.CreateInstance<T>();
  292. //T newItem = default(T);
  293. object temp = newItem;
  294. ISlo sIo = (ISlo)temp;
  295. //Slo sIo = new Slo();
  296. m_vCollection.Add(sIo);
  297. //I change this value to be false forever(gsp).No matter what case there's no need to set the object's owner to the collection
  298. //after we created the object we'll put them to in a smartpointer.then the smartpointer will manage it.
  299. //m_mOwner[sIo] = false;//m_mOwner[newItem]=true
  300. //Type type = newItem.GetType();
  301. return sIo;
  302. }
  303. public void addItem(T item)
  304. {
  305. object temp = item;
  306. ISlo sIo = (ISlo)temp;
  307. m_vCollection.Add(sIo);/* m_mOwner[item] = false;*/
  308. }
  309. public T getItem(int itemID)
  310. {
  311. object temp = m_vCollection[itemID];
  312. T item = (T)temp;
  313. return item;
  314. }
  315. };
  316. public abstract class ISlo : Convertinterface
  317. {
  318. public abstract void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode);
  319. //virtual ~ISlo() = default;
  320. }
  321. //typedef std::vector<Slo*>::iterator __declspec(dllexport) SerializableIterator; //iterator?
  322. public class Slo : ISlo
  323. {
  324. //private (Slo const &s) { }
  325. //private Slo operator=(Slo const &s) { return *this; };
  326. public string strReplaceAll(string source, string searchFor, string replaceWith)
  327. {
  328. if ((searchFor == null) || (searchFor == ""))
  329. {
  330. return source;
  331. }
  332. source.Replace(searchFor, replaceWith);
  333. return source;
  334. }
  335. public string m_sXML;
  336. public string m_sClassName;
  337. public string m_sVersion;
  338. public SortedDictionary<string, MemberBase> m_AttributeMappings = new SortedDictionary<string, MemberBase>();
  339. public SortedDictionary<string, ISlo> m_MemberMappings = new SortedDictionary<string, ISlo>();
  340. public SortedDictionary<string, CollectionBase<ISlo>> m_MemberCollections = new SortedDictionary<string, CollectionBase<ISlo>>();
  341. public void setClassName(string ClassName) { m_sClassName = ClassName; }
  342. public Slo()
  343. {
  344. m_sClassName = null;
  345. m_sVersion = null;
  346. m_sXML = null;
  347. m_AttributeMappings.Clear();
  348. m_MemberMappings.Clear();
  349. m_MemberCollections.Clear();
  350. }
  351. /**
  352. Register a member
  353. @MemberName XML-Description/Name for the member
  354. @Member Member to register
  355. @return void
  356. */
  357. public void Register(string MemberName, MemberBase Member) // public void Register(string MemberName, MemberBase Member, string DefaultValue) DefaultValue无引用,c#无自动补充功能,故方法调整为双参数
  358. {
  359. m_AttributeMappings[MemberName] = Member;
  360. }
  361. /**
  362. Register a member-subclass
  363. @MemberName XML-Description/Name for the member-class
  364. @Member Member-class to register
  365. @return void
  366. */
  367. public void Register(string MemberName, ISlo Member)
  368. {
  369. m_MemberMappings[MemberName] = Member;
  370. }
  371. /**
  372. Register a class-collection
  373. @CollectionName XML-Description/Name for the collection
  374. @SubclassCollection Collection to register
  375. @return void
  376. */
  377. public void Register(string CollectionName, CollectionBase<ISlo> SubclassCollection)
  378. {
  379. SubclassCollection.setCollectionName(CollectionName);
  380. m_MemberCollections[CollectionName] = SubclassCollection;
  381. }
  382. public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
  383. {
  384. if (isStoring)
  385. {
  386. if (xml.DocumentElement != null)
  387. {
  388. toXML(xml, rootNode);
  389. }
  390. }
  391. else
  392. {
  393. fromXML(xml, rootNode);
  394. }
  395. }
  396. public void toXML(XmlDocument xml, XmlNode rootNode)
  397. {
  398. //XmlNode rootNode = xml.SelectSingleNode("XMLData");
  399. //for (auto it_member = m_AttributeMappings.begin(); it_member != m_AttributeMappings.end(); ++it_member)
  400. //{
  401. // rootNode->SetAttribute(it_member->first.c_str(), it_member->second->c_str());
  402. //}
  403. for (int it_member = 0; it_member < m_AttributeMappings.Count; it_member++)
  404. {
  405. var element = m_AttributeMappings.ElementAt(it_member);
  406. if (rootNode.Attributes[element.Key] == null)
  407. {
  408. XmlElement XmlEle = (XmlElement)rootNode;
  409. XmlEle.SetAttribute(element.Key, element.Value.toString());
  410. }
  411. else
  412. {
  413. rootNode.Attributes[element.Key].InnerText = element.Value.toString();
  414. }
  415. }
  416. //XmlElement element = (XmlElement)xmlDoc.SelectSingleNode("BookStore/NewBook");
  417. //for (auto it_subclass = m_MemberMappings.begin(); it_subclass != m_MemberMappings.end(); ++it_subclass)
  418. //{
  419. // ISlo* subMember = it_subclass->second;
  420. // tinyxml2::XMLElement* subClassNode = classDoc->NewElement("Member");
  421. // subClassNode->SetAttribute("RegName", it_subclass->first.c_str());
  422. // rootNode->InsertEndChild(subClassNode);
  423. // subMember->Serialize(true, classDoc, subClassNode);
  424. //}
  425. for (int it_subclass = 0; it_subclass < m_MemberMappings.Count; it_subclass++)
  426. {
  427. var element = m_MemberMappings.ElementAt(it_subclass);
  428. ISlo subMember = element.Value;
  429. XmlNode subClassNode = xml.CreateElement("Member");
  430. rootNode.AppendChild(subClassNode);
  431. //if (rootNode.Attributes["RegName"] == null)
  432. //{
  433. // XmlElement XmlEle_subclass = (XmlElement)rootNode;
  434. // XmlEle_subclass.SetAttribute("RegName", element.Key);
  435. //}
  436. //else
  437. //{
  438. // subClassNode.Attributes["RegName"].InnerText = element.Key;
  439. //}
  440. XmlElement XmlEle = (XmlElement)subClassNode;
  441. XmlEle.SetAttribute("RegName", element.Key);
  442. subMember.Serialize(true, xml, subClassNode);
  443. }
  444. //for (CollectionIterator it_collection = m_MemberCollections.begin(); it_collection != m_MemberCollections.end(); ++it_collection)
  445. //{
  446. // tinyxml2::XMLElement* listNode = classDoc->NewElement("Collection");
  447. // listNode->SetAttribute("RegName", (*it_collection).second->getCollectionName().c_str());
  448. // for (size_t c = 0; c < (*it_collection).second->size(); c++)
  449. // {
  450. // ISlo* item = (*it_collection).second->getItem(c);
  451. // tinyxml2::XMLElement* elementNode = classDoc->NewElement("Member");
  452. // item->Serialize(true, classDoc, elementNode);
  453. // listNode->InsertEndChild(elementNode);
  454. // }
  455. // rootNode->InsertEndChild(listNode);
  456. //}
  457. for (int it_collection = 0; it_collection < m_MemberCollections.Count; it_collection++)
  458. {
  459. var element = m_MemberCollections.ElementAt(it_collection);
  460. XmlNode listNode = xml.CreateElement("Collection");
  461. XmlElement XmlEle = (XmlElement)listNode;
  462. XmlEle.SetAttribute("RegName", element.Value.getCollectionName());
  463. for (int c = 0; c < element.Value.size(); c++)
  464. {
  465. ISlo item = element.Value.getItem(c);
  466. XmlNode elementNode = xml.CreateElement("Member");
  467. item.Serialize(true, xml, elementNode);
  468. listNode.AppendChild(elementNode);
  469. }
  470. rootNode.AppendChild(listNode);
  471. }
  472. }
  473. public void fromXML(XmlDocument xml, XmlNode rootNode)
  474. {
  475. //for (var it = this.m_AttributeMappings.First(); it != this.m_AttributeMappings.Last(); ++it)
  476. //{
  477. // if (rootNode->Attribute(it->first.c_str()))
  478. // {
  479. // *(it->second->getStringPtr()) = rootNode->Attribute(it->first.c_str());// *(*it)->getField() = memberNode->GetText();
  480. // }
  481. //}
  482. for (int count = 0; count < m_AttributeMappings.Count; count++)
  483. {
  484. var element = m_AttributeMappings.ElementAt(count);
  485. if (rootNode.Attributes[element.Key] != null)
  486. {
  487. string aa = rootNode.Attributes[element.Key].Value;
  488. element.Value.getStringPtr(rootNode.Attributes[element.Key].Value);
  489. }
  490. }
  491. //tinyxml2::XMLElement* classNode = rootNode->FirstChildElement("Member");
  492. //while (classNode != NULL)
  493. //{
  494. // std::string className = classNode->Attribute("RegName");
  495. // for (auto it_subclass = this->m_MemberMappings.begin(); it_subclass != this->m_MemberMappings.end(); ++it_subclass)
  496. // {
  497. // if (it_subclass->first == className)
  498. // {
  499. // it_subclass->second->Serialize(false, classDoc, classNode);
  500. // break;
  501. // }
  502. // }
  503. // classNode = classNode->NextSiblingElement("Member");
  504. //}
  505. XmlNodeList classNodeList = rootNode.SelectNodes("Member");
  506. if (classNodeList.Count != 0)
  507. {
  508. for (int i = 0; i < classNodeList.Count; i++)
  509. {
  510. string className = classNodeList[i].Attributes["RegName"].Value;
  511. for (int count = 0; count < m_MemberMappings.Count; count++)
  512. {
  513. var element = m_MemberMappings.ElementAt(count);
  514. if (element.Key == className)
  515. {
  516. element.Value.Serialize(false, xml, classNodeList[i]);
  517. break;
  518. }
  519. }
  520. }
  521. }
  522. //tinyxml2::XMLElement* collectionNode = rootNode->FirstChildElement("Collection");
  523. //while (collectionNode != NULL)
  524. //{
  525. // std::string collectionName = collectionNode->Attribute("RegName");
  526. // for (CollectionIterator it_collection = this->m_MemberCollections.begin(); it_collection != this->m_MemberCollections.end(); ++it_collection)
  527. // {
  528. // if ((*it_collection).second->getCollectionName() == collectionName)
  529. // {
  530. // (*it_collection).second->Clear();
  531. // tinyxml2::XMLElement* classNode = collectionNode->FirstChildElement("Member");
  532. // while (classNode != NULL)
  533. // {
  534. // ISlo* newItem = (*it_collection).second->newElement();
  535. // newItem->Serialize(false, classDoc, classNode);
  536. // classNode = classNode->NextSiblingElement("Member");
  537. // }
  538. // }
  539. // }
  540. // collectionNode = collectionNode->NextSiblingElement("Collection");
  541. //}
  542. //}
  543. XmlNodeList collectionNodeList = rootNode.SelectNodes("Collection");
  544. if (collectionNodeList.Count != 0)
  545. {
  546. for (int i = 0; i < collectionNodeList.Count; i++)
  547. {
  548. string collectionName = collectionNodeList[i].Attributes["RegName"].Value;
  549. for (int count = 0; count < m_MemberCollections.Count; count++)
  550. {
  551. var element = m_MemberCollections.ElementAt(count);
  552. if (element.Value.getCollectionName() == collectionName)
  553. {
  554. element.Value.Clear();
  555. XmlNodeList classNode2List = collectionNodeList[i].SelectNodes("Member");
  556. if (classNode2List.Count != 0)
  557. {
  558. for (int j = 0; j < classNode2List.Count; j++)
  559. {
  560. Convertinterface newItem = (Convertinterface)element.Value.newElement();
  561. //ISlo newItem = element.Value.newElement();
  562. //Object objectItem = element.Value.newElement();
  563. //ISlo newItem = (ISlo)objectItem;
  564. //newItem.m_AttributeMappings = m_AttributeMappings;
  565. //newItem.m_MemberMappings = m_MemberMappings;
  566. //newItem.m_MemberCollections = m_MemberCollections;
  567. newItem.Serialize(false, xml, classNode2List[j]);
  568. }
  569. }
  570. }
  571. }
  572. }
  573. }
  574. }
  575. string IdentifyClass(XmlNode rootNode, string XMLSource)
  576. {
  577. return rootNode.Attributes["RegName"].Value;
  578. }
  579. string IdentifyClassVersions(XmlNode rootNode, string XMLSource) //同 IdentifyClass ???
  580. {
  581. return rootNode.Attributes["RegName"].Value;
  582. }
  583. public string getClassName() { return m_sClassName; }
  584. public void setVersion(string value) { m_sVersion = value; }
  585. public string getVersion() { return m_sVersion; }
  586. public void Clear()
  587. {
  588. m_AttributeMappings.Clear();
  589. m_MemberMappings.Clear();
  590. m_MemberCollections.Clear();
  591. }
  592. }
  593. }