private static void loadSecurity() { string lFile = RsViewEngine.ProfileManager.SecurityFile; if (!File.Exists(lFile)) { _Security = CSecurityData.CreateNew(); _Security.Save(lFile); } else { if (RsOldSecurity.IsOldFormat(lFile)) { RsOldSecurity.ConvertToNew(lFile); } _Security = new CSecurityData(); _Security.Load(lFile); } }
public static void ConvertToNew(string aFile) { CSecurityData lNewDoc = CSecurityData.CreateNew(); XmlDocument lOldDoc = new XmlDocument(); lOldDoc.Load(aFile); XmlNode lRootNode = XmlTools.getXmlNodeByName("ReportSmartSecurity", lOldDoc); foreach (XmlNode iNode in lRootNode) { CSecurityNode iSecNode = CSecurityData.AddSecNode( lNewDoc, XmlTools.GetAttrib(iNode, "datasource"), iNode.Name ); iSecNode.UserName = XmlTools.GetAttrib(iNode, "userid"); iSecNode.Password = XmlTools.GetAttrib(iNode, "passwd"); } lNewDoc.Save(aFile); }