Commit 6327ac74 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+22 −0
Changes for Programming in Microsoft C# - Exam 70-483 - Working Files/Chapter 10/Encrypting Files/Encrypting Files.sln: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Encrypting Files", "Encrypting Files\Encrypting Files.csproj", "{9AB41F37-DDDA-4115-8DE2-2B191671F406}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{9AB41F37-DDDA-4115-8DE2-2B191671F406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9AB41F37-DDDA-4115-8DE2-2B191671F406}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9AB41F37-DDDA-4115-8DE2-2B191671F406}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9AB41F37-DDDA-4115-8DE2-2B191671F406}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal
+25 KiB

File added.

No diff preview for this file type.

+6 −0
Changes for Programming in Microsoft C# - Exam 70-483 - Working Files/Chapter 10/Encrypting Files/Encrypting Files/App.config: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>
 No newline at end of file
+58 −0
Changes for Programming in Microsoft C# - Exam 70-483 - Working Files/Chapter 10/Encrypting Files/Encrypting Files/Encrypting Files.csproj: 58 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{9AB41F37-DDDA-4115-8DE2-2B191671F406}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Encrypting_Files</RootNamespace>
    <AssemblyName>Encrypting Files</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
 No newline at end of file
+61 −0
Changes for Programming in Microsoft C# - Exam 70-483 - Working Files/Chapter 10/Encrypting Files/Encrypting Files/Program.cs: 61 added lines, 0 removed lines.
Original line number Diff line number Diff line
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Encrypting_Files
{
    class Program
    {
        static void Main(string[] args)
        {



          ReadFile();

          Console.WriteLine("Press enter to encrypt the file...");
          Console.ReadLine();

          EncryptFile(@"C:\MLFiles\ml.txt");

          ReadFile();

          Console.WriteLine("Press enter to decrypt the file...");
          Console.Read();

          File.Decrypt(@"C:\MLFiles\ml.txt");
 	}
		
        public static void ReadFile()
        {
          int counter = 0;
          string line;

          // Read the file and display it line by line.
          System.IO.StreamReader file =
             new System.IO.StreamReader(@"C:\MLFiles\ml.txt");
          while ((line = file.ReadLine()) != null)
              Console.WriteLine(line);
              counter++;
         
          file.Close();

        }
         

       public static void EncryptFile(string x)
       {
            File.Encrypt(x);
       }

        public static void DecryptFile(string x)
        {
            File.Decrypt(x);
        }

        
    }
}
Loading