Example #1
0
        private void index_Load(object sender, EventArgs e)
        {
            using (FileStream fs = File.Open("entity\\user.xml", FileMode.Open, FileAccess.Read))
            {
                StreamReader sr   = new StreamReader(fs);
                string       text = sr.ReadToEnd();
                var          list = XmlSerializeHelper.DeSerialize <userList>(text);
                list.DataSource.ForEach((user) =>
                {
                    Program.userList.Add(user);
                });
                comboBox1.DataSource    = list.DataSource;
                comboBox1.ValueMember   = "token";
                comboBox1.DisplayMember = "token";
            }

            using (FileStream fs = File.Open("entity\\ip.xml", FileMode.Open, FileAccess.Read))
            {
                StreamReader sr   = new StreamReader(fs);
                string       text = sr.ReadToEnd();
                var          list = XmlSerializeHelper.DeSerialize <IPList>(text);
                list.DataSource.ForEach((user) =>
                {
                    Program.IPList.Add(user);
                });
                cbiplist.DataSource    = list.DataSource;
                cbiplist.ValueMember   = "ip";
                cbiplist.DisplayMember = "ip";
            }
        }
Example #2
0
 private void LoadConfigInfo(string path)
 {
     if (File.Exists(path))
     {
         FileStream   fs   = File.Open(path, FileMode.Open, FileAccess.Read);
         StreamReader sr   = new StreamReader(fs);
         string       text = sr.ReadToEnd();
         configInfo = XmlSerializeHelper.DeSerialize <ConfigInfo>(text);
         fs.Close();
     }
 }
Example #3
0
    public T LoadConfigInfo <T>(string path) where T : new()
    {
        T t = default;

        if (File.Exists(path))
        {
            FileStream   fs   = File.Open(path, FileMode.Open, FileAccess.Read);
            StreamReader sr   = new StreamReader(fs);
            string       text = sr.ReadToEnd();
            t = XmlSerializeHelper.DeSerialize <T>(text);
            fs.Close();
        }
        return(t);
    }
 private IEnumerator LoadVideoList()
 {
     string path = NRealTool.GetNrealResPath() + "/MultiScreenVideoList/MultiScreenVideoConfig.xml";
     WWW www = new WWW(path);
     yield return www;
     if (www.isDone && string.IsNullOrEmpty(www.error))
     {
         videoConfig = XmlSerializeHelper.DeSerialize<VideoConfig>(www.text);
         CreateVideoItems();
         www.Dispose();
         www = null;
     }
     else
     {
         NRDebug.LogError(www.error);
     }
 }