예제 #1
0
 public MainService()
 {
     st            = readconfig("config.xml", "configRestSMS", "SqlitePath");
     smsreader     = new SMSReader(st.SQlitePath, st.DongleCOM);
     smsreaderproc = new Thread(new ThreadStart(smsreader.ReadProc));
     server        = new ProductService();
     behavior      = new WebHttpBehavior();
     InitializeComponent();
 }
예제 #2
0
        public static StConfig readconfig(string pathtoXML, string RootElement, string Node)
        {
            StConfig cf = new StConfig();

            // XElement el = new XElement();
            using (XmlReader reader = XmlReader.Create(pathtoXML))
            {
                while (reader.Read())
                {
                    if (reader.Name == "SqlitePath")
                    {
                        reader.Read();
                        if (reader.Value.IndexOf('\n') == -1)
                        {
                            cf.SQlitePath = reader.Value;
                        }
                    }
                    else if (reader.Name == "DongleCOM")
                    {
                        reader.Read();
                        if (reader.Value.IndexOf('\n') == -1)
                        {
                            cf.DongleCOM = reader.Value;
                        }
                    }
                    else if (reader.Name == "IP")
                    {
                        reader.Read();
                        if (reader.Value.IndexOf('\n') == -1)
                        {
                            cf.IP = reader.Value;
                        }
                    }
                }
            }
            return(cf);
        }