Example #1
0
        public static void WriteFile(HashSet <string> data, StreamWriter writer, string username)
        {
            StringBuilder sb            = new StringBuilder(username);
            List <string> sortedListApp = data.OrderBy(a => a).ToList();

            foreach (var app in sortedListApp.OrderBy(a => a))
            {
                sb.Append(";");
                sb.Append(app);
            }
            var tmp = sb.ToString();

            writer.Write(RSAEncryptUltility.MD5Encrypt(sb.ToString()));
        }
Example #2
0
        public static string CreateFileResult(HashSet <string> listApp)
        {
            var      username = WindowsIdentity.GetCurrent().Name.Split('\\')[1];
            FileInfo file     = new FileInfo(username + "_list_app" + DateTime.Now.ToString("yyyy-MM-dd_hh-mm") + ".klo");

            if (file.Exists)
            {
                file.Delete();
            }
            using (var writer = file.AppendText())
            {
                writer.Write(RSAEncryptUltility.GetEncryptedKey() + ";");

                WriteFile(listApp, writer, username);
                writer.Close();
            }
            return(file.FullName);
        }