Friday, December 13, 2019

Issue: Visual Studio Displaying integer values in hexadecimal

Solution: Debugging time Go To quick watch in a visual studio And right-click quick watch and unselect hexadecimal

Friday, June 28, 2019

Nuget package Generation for customized DLL

first download "nuget.exe"

open cmd and change the path to  particular folder in which "nuget.exe" is downloaded.

generate nuspec file using folling command - nuget spec "E:\Naresh\proj.csproj"

package -  it will generate this type of file like proj.csproj.nuspec

edit that file to make necessary changes like below


<?xml version="1.0"?>
<package >
  <metadata>
    <id>proj</id> // project name
    <version>1.0.0</version>
    <authors>Naresh</authors>
    <owners>Naresh</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Package description</description>
    <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
    <copyright>Copyright 2019</copyright>
    <tags>Tag1 Tag2</tags> // no need
    <dependencies>
      <dependency id="SampleDependency" version="1.0" /> //no need of samples
    </dependencies>
  </metadata>
  <files>
    <file src="E:\Naresh\proj\bin\Debug\*.*" target="lib\net461" /> // main project file to package - means debug location
  </files>
</package>


we need build the package based on that nuspec file- example cmd path E:\download> nuget pack proj.csproj.nuspec

done...

application goto project manage nuget packages - settings - add one available package source - + click and set the path to nuget package in our local system. goto manage and we will see the new package source.. njoyyyy.. by Vasista Bhargav

How to change a DLL version ?

1. Right click on your project. 
2. Click properties. 
3. Go to the Application tab. 
4. Click Assembly Information. 
5. Change Assembly Version or / and File Version. 
6. Click OK. 
7. Click the save button. 
8. Recompile 
this is one way... njoyyyy.. by Vasista Bhargav

Tuesday, June 11, 2019

Monday, June 10, 2019

Resource file "Properties\Resources.resx" cannot be found

Solution: Right-click on the solution and go to resource tab click on add and save that's it 

Tuesday, May 28, 2019

How to encrypt in C# and decrypt in Apex


public class Program
{
private static byte[] cryptkey = Encoding.ASCII.GetBytes("01234567890123456789abcdefabcdef");
private static byte[] initVector = Encoding.ASCII.GetBytes("0123456789012359");
public static void Main()
{
var testo1 = "test";
var testo2 = "pippo\n";
string value = CryptAES(testo1);
Console.WriteLine("Crittare '{0}' produce: {1}", testo1, CryptAES(testo1));
Console.WriteLine("Crittare '{0}' produce: {1}", testo2, CryptAES(testo2));
Console.ReadLine();
}
public static string DecryptAES(string cipherData)
{
try
{
using (var rijndaelManaged =
new RijndaelManaged { Key = cryptkey, IV = initVector, Mode = CipherMode.CBC })
using (var memoryStream =
new MemoryStream(Convert.FromBase64String(cipherData)))
using (var cryptoStream =
new CryptoStream(memoryStream,
rijndaelManaged.CreateDecryptor(cryptkey, initVector),
CryptoStreamMode.Read))
{
return new StreamReader(cryptoStream).ReadToEnd();
}
}
catch (CryptographicException e)
{
Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
return null;
}
}
public static string CryptAES(string textToCrypt)
{
try
{
using (var rijndaelManaged =
new RijndaelManaged { Key = cryptkey, IV = initVector, Mode = CipherMode.CBC })
using (var memoryStream = new MemoryStream())
using (var cryptoStream =
new CryptoStream(memoryStream,
rijndaelManaged.CreateEncryptor(cryptkey, initVector),
CryptoStreamMode.Write))
{
using (var ws = new StreamWriter(cryptoStream))
{
ws.Write(textToCrypt);
}
return Convert.ToBase64String(memoryStream.ToArray());
}
}
catch (CryptographicException e)
{
Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
return null;
}
}
}


Thursday, March 28, 2019

LINQ TO ENTITY: Removing special characters inside the “where” expression


IEnumerable<Person> personsList = (from person in repoPersons.All()
         where person.Phone.Replace("+", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace(" ", "").Contains(PhoneNumber)
         select person).ToList()