Skip to content
Snippets Groups Projects
Commit 78dfe504 authored by Etienne Charpin's avatar Etienne Charpin
Browse files

ajout projetfinau

parent 08c2c2f3
Branches master
No related tags found
No related merge requests found
Showing
with 419 additions and 0 deletions
File added
using System;
using System.Collections.Generic;
using System.Text;
namespace Datas
{
[Serializable] //Indicateur pour permettre la serialization
public class Contact
{
public string Nom; //Attribut de l'objet contact
public string Prenom;
public string Courriel;
public string Societe;
public Lien Link;
public DateTime DateCreation;
public DateTime DateModification;
public Contact(string nom, string prenom, string courriel, string societe, Lien link) //Constructeur de contact
{
Nom = nom;
Prenom = prenom;
Courriel = courriel;
Societe = societe;
Link = link;
DateCreation = DateTime.Now;
DateModification = DateTime.Now;
}
public Contact()
{
}
public void afficherContact(int nb) //Affichage du contact avec ses attributs
{
string tab = "";
for (int j = 0; j < nb; j++)
{
tab += " "; //Ajout d'un espace pour representer les différence de niveau à l'affichage
}
Console.WriteLine(tab + " | [C] " + Prenom + " " + Nom + " (" + Societe + "), " + Courriel + ", " + Link);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{56350D46-CF4E-4CBD-B9DB-4553DF0CB90E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Datas</RootNamespace>
<AssemblyName>Datas</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Contact.cs" />
<Compile Include="Dossier.cs" />
<Compile Include="ExplorateurDeFichier.cs" />
<Compile Include="Lien.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
namespace Datas
{
[Serializable] //Indicateur pour permettre la serialization
public class Dossier
{
public static int nb = 0; //Attribut static du nombre de dossier crées
public string Nom; //Autres attributs du dossier
public DateTime DateCreation;
public DateTime DateModification;
public List<Dossier> Dossiers;
public List<Contact> Contacts;
public Dossier(string nom) //Constructeur de dossier avec sa liste de contact et de dossier
{
Nom = nom;
DateCreation = DateTime.Now;
DateModification = DateTime.Now;
Dossiers = new List<Dossier>();
Contacts = new List<Contact>();
}
public Dossier()
{
}
public void afficherDossier(int prof) //Affichage du dossier avec pour paramettre la profondeur de l'arbre
{
string tab = "";
for (int j = 0; j < prof; j++)
{
tab += " "; //Ajout d'un espace pour representer les différence de niveau à l'affichage
}
Console.WriteLine(tab + "[D] " + Nom + " (creation " + DateCreation.ToString() + ")");
nb++;
foreach (Contact con in Contacts) //Affichage de tous les contacts
{
con.afficherContact(nb);
}
foreach (Dossier doss in Dossiers) //Affichage récursif de tous les dossier de la liste de dossier inferieur
{
doss.afficherDossier(nb);
nb--;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Datas
{
[Serializable] //Indicateur pour permettre la serialization
public class ExplorateurDeFichier
{
public List<Dossier> Dossiers; //Liste de dossier de l'arboressance
public ExplorateurDeFichier() //Constructeur de l'explorateur de fichier
{
Dossiers = new List<Dossier>();
}
public void afficherFichiers() //Affichage de l'arboressance de dossier
{
foreach (Dossier doss in Dossiers) //Foreach sur le nombre de dossier de 1er niveau
{
doss.afficherDossier(0);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Datas
{
public enum Lien //Enum des type de relation possible dans un contact
{
ami,
collegue,
relation,
reseaux
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("Datas")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Datas")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("56350d46-cf4e-4cbd-b9db-4553df0cb90e")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
File added
File added
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
File added
771d86bc51271bd9e59294d9adf2ebe0b6df1048
C:\Users\Etienne\source\repos\Datas\bin\Debug\Datas.dll
C:\Users\Etienne\source\repos\Datas\bin\Debug\Datas.pdb
C:\Users\Etienne\source\repos\Datas\obj\Debug\Datas.csproj.AssemblyReference.cache
C:\Users\Etienne\source\repos\Datas\obj\Debug\Datas.csproj.CoreCompileInputs.cache
C:\Users\Etienne\source\repos\Datas\obj\Debug\Datas.dll
C:\Users\Etienne\source\repos\Datas\obj\Debug\Datas.pdb
File added
File added
File added
using Datas;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Serialisation
{
class BinSerialisation : ISerialisable //Implemente l'interface
{
public IFormatter formatter = new BinaryFormatter(); //Creation du formateur
public BinSerialisation() //Constructeur
{
}
public void serialise(ExplorateurDeFichier o, string path, byte[] key) //Fonction de serialization d'un objet dans un fichier avec un cle
{
FileStream stream = new FileStream(path, //Fichier d'ecriture
FileMode.OpenOrCreate, FileAccess.Write);
CryptoStream crStream = new CryptoStream(stream, new DESCryptoServiceProvider().CreateEncryptor(key, key), CryptoStreamMode.Write);
//Flux chiffré pour serializer
formatter.Serialize(crStream, o); //Serialisation Binaire de l'objet dans le flux chiffré
crStream.Close(); //Fermeture de stream ouverts
stream.Close();
}
public ExplorateurDeFichier deserialise(string path, byte[] key) //Fonction de serialization d'un objet depuis un fichier avec un cle
{
FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); //Fichier de lecture
CryptoStream crStream = new CryptoStream(stream,
new DESCryptoServiceProvider().CreateDecryptor(key, key), CryptoStreamMode.Read); //Flux chiffré pour deserializer
return (ExplorateurDeFichier)formatter.Deserialize(crStream); //Retour de l'objet deseraliser dans le flux chiffré
}
}
}
using Datas;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Serialisation
{
public interface ISerialisable //Interface de serialization
{
void serialise(ExplorateurDeFichier o, string path, byte[] key); //Fonction de serialization d'un objet
ExplorateurDeFichier deserialise(string path, byte[] key); //Fonction de deserialization d'un objet
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("Serialisation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Serialisation")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("d6a27e03-18a1-41dc-abf3-40bc5661c8fc")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{D6A27E03-18A1-41DC-ABF3-40BC5661C8FC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Serialisation</RootNamespace>
<AssemblyName>Serialisation</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BinSerialisation.cs" />
<Compile Include="ISerialisable.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SerialisationFactory.cs" />
<Compile Include="XMLSerialisation.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Datas\Datas.csproj">
<Project>{56350d46-cf4e-4cbd-b9db-4553df0cb90e}</Project>
<Name>Datas</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment