Beispiel #1
0
        public void writeconfig(string jiedian, string set, string value)
        {
            Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123");
            FileStream fs = new FileStream(@"345.txt", FileMode.Open);

            Tool_Class.IO_tool dd = new Tool_Class.IO_tool();
            string             w  = dd.Readfile(fs);

            string[] s  = Regex.Split(w, jiedian, RegexOptions.IgnoreCase);
            string   ee = s[1];

            string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase);

            List <string> ipList = new List <string>();

            foreach (string aa in ss)
            {
                ipList.Add(aa);
            }
            string ttttt = "\n" + set;

            foreach (string ttt in ipList)
            {
                string[] ssss = Regex.Split(ttt, "=", RegexOptions.IgnoreCase);
                string   tttt = ttttt;

                if (ssss[0].Substring(1).ToString() == tttt)
                {
                    bbb.eee = ssss[0] + "=" + ssss[1];
                    ddd.eee = ssss[0] + "=";
                }

                //return ssss[0].Substring(1).ToString();
            }

            string values = bbb.eee;

            string[] wt        = Regex.Split(w, values, RegexOptions.IgnoreCase);
            string   valuee    = ddd.eee + "=" + value;
            string   total     = wt[0] + valuee + wt[1];
            string   sourceDir = @"..\Debug";

            string[] txtList = Directory.GetFiles(sourceDir, "345.txt");
            foreach (string f in txtList)
            {
                File.Delete(f);
            }
            dd.Write2file(@"345.txt", total);
            string[] configList = Directory.GetFiles(sourceDir, "config.txt");
            foreach (string f in configList)
            {
                File.Delete(f);
            }
            Tool_Class.DESFileClass.EncryptFile("345.txt", "config.txt", "123");
            string[] txtList2 = Directory.GetFiles(sourceDir, "345.txt");
            foreach (string f in txtList2)
            {
                File.Delete(f);
            }
        }
 public void writeip(string node, string ipp)
 {
     //Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123");
     FileStream fs = new FileStream(@"345.txt", FileMode.Open);
     Tool_Class.IO_tool dd = new Tool_Class.IO_tool();
     string w = dd.Readfile(fs);
     string[] s = Regex.Split(w, node, RegexOptions.IgnoreCase);
     string ee = s[0];
     string ff = s[2];
     string gg = ee + "ip" + ipp + "ip" + ff;
     string str5 = System.Windows.Forms.Application.StartupPath;
     string sourceDir = @str5;
     string[] txtList = Directory.GetFiles(sourceDir, "345.txt");
     foreach (string f in txtList)
     {
         File.Delete(f);
     }
     dd.Write2file(@"345.txt", gg);
     /*string[] configList = Directory.GetFiles(sourceDir, "config.txt");
     foreach (string f in configList)
     {
         File.Delete(f);
     }
     //Tool_Class.DESFileClass.EncryptFile("345.txt", "config.txt", "123");
     string[] txtList2 = Directory.GetFiles(sourceDir, "345.txt");
     foreach (string f in txtList2)
     {
         File.Delete(f);
     }*/
 }
        public void writeip(string node, string ipp)
        {
            //Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123");
            FileStream fs = new FileStream(@"345.txt", FileMode.Open);

            Tool_Class.IO_tool dd = new Tool_Class.IO_tool();
            string             w  = dd.Readfile(fs);

            string[] s         = Regex.Split(w, node, RegexOptions.IgnoreCase);
            string   ee        = s[0];
            string   ff        = s[2];
            string   gg        = ee + "ip" + ipp + "ip" + ff;
            string   str5      = System.Windows.Forms.Application.StartupPath;
            string   sourceDir = @str5;

            string[] txtList = Directory.GetFiles(sourceDir, "345.txt");
            foreach (string f in txtList)
            {
                File.Delete(f);
            }
            dd.Write2file(@"345.txt", gg);

            /*string[] configList = Directory.GetFiles(sourceDir, "config.txt");
             * foreach (string f in configList)
             * {
             *  File.Delete(f);
             * }
             * //Tool_Class.DESFileClass.EncryptFile("345.txt", "config.txt", "123");
             * string[] txtList2 = Directory.GetFiles(sourceDir, "345.txt");
             * foreach (string f in txtList2)
             * {
             *  File.Delete(f);
             * }*/
        }
Beispiel #4
0
        public string readconfig(string jiedian, string set)
        {
            Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123");
            FileStream fs = new FileStream(@"345.txt", FileMode.Open);

            Tool_Class.IO_tool dd = new Tool_Class.IO_tool();
            string             w  = dd.Readfile(fs);

            string[] s  = Regex.Split(w, jiedian, RegexOptions.IgnoreCase);
            string   ee = s[1];

            string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase);

            List <string> ipList = new List <string>();

            foreach (string aa in ss)
            {
                ipList.Add(aa);
            }
            string ttttt = "\n" + set;

            foreach (string ttt in ipList)
            {
                string[] ssss = Regex.Split(ttt, "=", RegexOptions.IgnoreCase);
                string   tttt = ttttt;

                if (ssss[0].Substring(1).ToString() == tttt)
                {
                    bbb.eee = ssss[1];
                }

                //return ssss[0].Substring(1).ToString();
            }
            string sourceDir = @"..\Debug";

            string[] txtList = Directory.GetFiles(sourceDir, "345.txt");
            foreach (string f in txtList)
            {
                File.Delete(f);
            }
            return(bbb.eee);
        }
Beispiel #5
0
        public string[] readparameter(string jiedian)
        {
            Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123");
            FileStream fs = new FileStream(@"345.txt", FileMode.Open);

            Tool_Class.IO_tool dd = new Tool_Class.IO_tool();
            string             w  = dd.Readfile(fs);

            string[] s  = Regex.Split(w, jiedian, RegexOptions.IgnoreCase);
            string   ee = s[1];

            string[] ss        = Regex.Split(ee, ";", RegexOptions.IgnoreCase);
            string   sourceDir = @"..\Debug";

            string[] txtList = Directory.GetFiles(sourceDir, "345.txt");
            foreach (string f in txtList)
            {
                //File.Delete(f);
            }
            return(ss);
        }
Beispiel #6
0
        public void writeconfig(string jiedian, string set,string value)
        {
            Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123");
                FileStream fs = new FileStream(@"345.txt", FileMode.Open);
                Tool_Class.IO_tool dd = new Tool_Class.IO_tool();
                string w = dd.Readfile(fs);
                string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase);
                string ee = s[1];
                string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase);

                List<string> ipList = new List<string>();
                foreach (string aa in ss)
                {
                    ipList.Add(aa);
                }
                string ttttt = "\n" + set;
                foreach (string ttt in ipList)
                {
                    string[] ssss = Regex.Split(ttt, "=", RegexOptions.IgnoreCase);
                    string tttt = ttttt;

                    if (ssss[0].Substring(1).ToString() == tttt)
                    {

                        bbb.eee = ssss[0] + "=" + ssss[1];
                        ddd.eee = ssss[0] + "=";

                    }

                    //return ssss[0].Substring(1).ToString();

                }

                string values = bbb.eee;
                string[] wt = Regex.Split(w, values, RegexOptions.IgnoreCase);
                string valuee = ddd.eee + "=" + value;
                string total = wt[0] + valuee + wt[1];
                string sourceDir = @"..\Debug";
                string[] txtList = Directory.GetFiles(sourceDir, "345.txt");
                foreach (string f in txtList)
                {
                    File.Delete(f);
                }
                dd.Write2file(@"345.txt",total);
                string[] configList = Directory.GetFiles(sourceDir, "config.txt");
                foreach (string f in configList)
                {
                    File.Delete(f);
                }
                Tool_Class.DESFileClass.EncryptFile("345.txt", "config.txt", "123");
                string[] txtList2 = Directory.GetFiles(sourceDir, "345.txt");
                foreach (string f in txtList2)
                {
                    File.Delete(f);
                }
        }
Beispiel #7
0
 public string[] readparameter(string jiedian)
 {
     Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123");
         FileStream fs = new FileStream(@"345.txt", FileMode.Open);
         Tool_Class.IO_tool dd = new Tool_Class.IO_tool();
         string w = dd.Readfile(fs);
         string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase);
         string ee = s[1];
         string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase);
         string sourceDir = @"..\Debug";
         string[] txtList = Directory.GetFiles(sourceDir, "345.txt");
         foreach (string f in txtList)
         {
             //File.Delete(f);
         }
         return ss;
 }
Beispiel #8
0
        public string readconfig(string jiedian,string set)
        {
            Tool_Class.DESFileClass.DecryptFile("config.txt", "345.txt", "123");
                FileStream fs = new FileStream(@"345.txt", FileMode.Open);
                Tool_Class.IO_tool dd = new Tool_Class.IO_tool();
                string w = dd.Readfile(fs);
                string[] s = Regex.Split(w, jiedian, RegexOptions.IgnoreCase);
                string ee = s[1];
                string[] ss = Regex.Split(ee, ";", RegexOptions.IgnoreCase);

                List<string> ipList = new List<string>();
                foreach (string aa in ss)
                {
                    ipList.Add(aa);
                }
                string ttttt = "\n" + set;
                foreach (string ttt in ipList)
                {
                    string[] ssss = Regex.Split(ttt, "=", RegexOptions.IgnoreCase);
                    string tttt = ttttt;

                    if (ssss[0].Substring(1).ToString() == tttt)
                    {

                        bbb.eee = ssss[1];

                    }

                    //return ssss[0].Substring(1).ToString();

                }
                string sourceDir = @"..\Debug";
                string[] txtList = Directory.GetFiles(sourceDir, "345.txt");
                foreach (string f in txtList)
                {
                    File.Delete(f);
                }
                return bbb.eee;
        }