using System; using System.Security.Cryptography; using System.Configuration; using System.Web; using Microsoft.Win32; using System.IO; using DataLibrary; using EncryptDecryptEngine; namespace CoreWebServiceLibrary { public class Security { private XmlConfigService xmlconfig; private String wsPass; private String password; public XmlConfigService Xmlconfig { get { return this.xmlconfig; } } public String WinPrintIP { get { String var = ""; try { var = xmlconfig.WinReportIP; } catch { } return var; } } public int WinPrintPort { get { int var = -1; try { var = xmlconfig.WinReportPort; } catch { } return var; } } public String GcoopPath { get; set; } public String ConnectionString { get; set; } public String CoopId { get; set; } public String CoopControl { get; set; } public String SavingAddress { get; set; } public String ClientIp { get; set; } public String GcoopPathCore { get; set; } /* public String GcoopPathCore { get { return "C:\\GCOOP_ALL\\CORE\\GCOOP\\"; } } */ public bool IsPass { get { return true; } } public String Password { get { return password; } } public Security(String wsPass) { ConstructorEnding(wsPass, true); } public Security(String wsPass, bool autoCheckPassword) { ConstructorEnding(wsPass, autoCheckPassword); } private void ConstructorEnding(String wsPass, bool autoCheckPassword) { int gcoopPathIndex = wsPass.IndexOf(";gcoop_path="); string constr = wsPass.Substring(0, gcoopPathIndex); string others = wsPass.Substring(gcoopPathIndex + 1); string[] splits = others.Split(';'); string coop_id = "", coop_control = "", gcoop_path = "", saving_address = "", client_ip = ""; for (int i = 0; i < splits.Length; i++) { if (splits[i].IndexOf("gcoop_path") >= 0) { gcoop_path = splits[i].Split('=')[1]; } else if (splits[i].IndexOf("coop_id") >= 0) { coop_id = splits[i].Split('=')[1]; } else if (splits[i].IndexOf("coop_control") >= 0) { coop_control = splits[i].Split('=')[1]; } else if (splits[i].IndexOf("saving_address") >= 0) { saving_address = splits[i].Split('=')[1]; } else if (splits[i].IndexOf("client_ip") >= 0) { client_ip = splits[i].Split('=')[1]; } } this.ConnectionString = constr; this.CoopId = coop_id; this.CoopControl = coop_control; this.GcoopPath = gcoop_path; this.GcoopPathCore = gcoop_path.Substring(0, 1) + ":\\ICOOP_ALL\\ICORE\\ICOOP\\"; this.SavingAddress = saving_address; this.ClientIp = client_ip; xmlconfig = new XmlConfigService(gcoop_path); } } }