示例#1
0
        private List <lhh_LoginList_info> Local_IP1()
        {
            string[] ob = Regex.Split(ZFCEPath, @"\\", RegexOptions.IgnoreCase);
            //bool status = SharedTool.connectState(@"\\192.168.1.2", @"administrator", "333333");
            string ipadd  = "\\\\" + ob[2];
            bool   status = SharedTool.connectState(ipadd, @netuser, netpassword);

            if (!File.Exists(ZFCEPath) && status != true)
            {
                MessageBox.Show("没有找到此路径或此文件,请保证共享文件存在或权限共享机登录账户密码配置正确!");
                System.Environment.Exit(0);
                return(null);
            }

            InfoList = new List <lhh_LoginList_info>();

            //string A_Path = AppDomain.CurrentDomain.BaseDirectory + "辣皇后\\user control.txt";

            try
            {
                if (File.Exists(ZFCEPath))
                {
                    string[] fileText = File.ReadAllLines(ZFCEPath);

                    if (fileText.Length > 0 && fileText[0] != null && fileText[0] != "")
                    {
                        for (int i = 1; i < fileText.Length; i++)
                        {
                            string[]           texttemp = System.Text.RegularExpressions.Regex.Split(fileText[i], "\t");
                            lhh_LoginList_info temp     = new lhh_LoginList_info();
                            if (texttemp[0] != null)
                            {
                                temp.loginid = texttemp[0].ToString().Trim();
                            }
                            if (texttemp[1] != null)
                            {
                                temp.pwd = texttemp[1].ToString().Trim();
                            }
                            if (texttemp[2] != null)
                            {
                                temp.startTime = texttemp[2].ToString().Trim();
                            }
                            if (texttemp[3] != null)
                            {
                                temp.endTime = Convert.ToDateTime(texttemp[3].ToString());
                            }
                            InfoList.Add(temp);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常,请参照使用说明修改:" + ex.Message);
                return(null);

                throw;
            }
            return(InfoList);
        }
示例#2
0