Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
jkb
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Text; namespace Rextester { public class Program { public static void Main(string[] args) { int key = 10; string pwd="Hunter12_secret"; string a = EncryptDecrypt(pwd,456); Console.WriteLine(a); Console.WriteLine(EncryptDecrypt(a,456)); } public static string EncryptDecrypt(string szPlainText, int szEncryptionKey) { StringBuilder szInputStringBuild = new StringBuilder(szPlainText); StringBuilder szOutStringBuild = new StringBuilder(szPlainText.Length); char Textch; for (int iCount = 0; iCount < szPlainText.Length; iCount++) { Textch = szInputStringBuild[iCount]; Textch = (char)(Textch ^ szEncryptionKey); szOutStringBuild.Append(Textch); } return szOutStringBuild.ToString(); } #region Class to CSV public static IEnumerable<string> ToCsv<T>(IEnumerable<T> objectlist, string separator = ",", bool header = true) { FieldInfo[] fields = typeof(T).GetFields(); PropertyInfo[] properties = typeof(T).GetProperties(); if (header) { yield return String.Join(separator, fields.Select(f => f.Name).Concat(properties.Select(p=>p.Name)).ToArray()); } foreach (var o in objectlist) { yield return string.Join(separator, fields.Select(f=>(f.GetValue(o) ?? "").ToString()) .Concat(properties.Select(p=>(p.GetValue(o,null) ?? "").ToString())).ToArray()); } } //using (TextWriter tw = File.CreateText("C:\testoutput.csv")) //{ // foreach (var line in ToCsv(objects)) // { // tw.WriteLine(line); // } //} #endregion } }
run
|
edit
|
history
|
help
0
hello world
123
Fórum ➡ GroupJoin ➡ Join ➡ Easily ‼
Tarkov Time
s
Knapsack Problem
Linear search
Main4-2
Math Main
Student Management System