Beispiel #1
0
 static void dbcon1()
 {
     using (var abo = new abo.aboContext())
     {
         using (var enabo = new enabo.enaboContext())
         {
         }
     }
 }
Beispiel #2
0
        static void filecon1()
        {
            var sourcep = "/home/endriver/back";
            var targetp = "/home/endriver/server/pictures";
            var sd      = new System.IO.DirectoryInfo(sourcep).GetDirectories();

            foreach (var id in sd)
            {
                var enid = CryptographyHelpers.StudyEncrypt(id.Name);
                using (var enabo = new enabo.enaboContext())
                {
                    var user = enabo.Aouser.FirstOrDefault(a => a.Identity == enid);
                    if (user == null)
                    {
                        continue;
                    }
                    var idp = Path.Combine(targetp, user.Photofile);
                    if (!System.IO.Directory.Exists(idp))
                    {
                        Directory.CreateDirectory(idp);
                    }
                    var idpics = new DirectoryInfo(id.FullName).GetDirectories();
                    foreach (var busi in idpics)
                    {
                        var busip = Path.Combine(idp, busi.Name);
                        if (!Directory.Exists(busip))
                        {
                            Directory.CreateDirectory(busip);
                        }
                        var pics = new DirectoryInfo(busi.FullName).GetFiles();
                        foreach (var pic in pics)
                        {
                            var filecontent = File.ReadAllBytes(pic.FullName);
                            var sfc         = Convert.ToBase64String(filecontent);
                            var ens         = CryptographyHelpers.StudyEncrypt(sfc);
                            var tfile       = Path.Combine(busip, pic.Name);
                            File.WriteAllText(tfile, ens);
                        }
                    }
                }
                Console.WriteLine("id={0}", id.Name);
            }
        }