Gestion repa Ok
This commit is contained in:
23
ProjetTheAlone/Outil/picToByteArray.cs
Normal file
23
ProjetTheAlone/Outil/picToByteArray.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjetTheAlone.Outil
|
||||
{
|
||||
class picToByteArray
|
||||
{
|
||||
public static byte[] Convert(string imgPath)
|
||||
{
|
||||
FileStream fs = new System.IO.FileStream(@".\desert.jpg", FileMode.Open, FileAccess.Read);
|
||||
BinaryReader br = new BinaryReader(fs);
|
||||
byte[] result = br.ReadBytes((int)fs.Length);
|
||||
br.Close();
|
||||
fs.Close();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
ProjetTheAlone/Outil/toByteArray.cs
Normal file
21
ProjetTheAlone/Outil/toByteArray.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjetTheAlone.Outil
|
||||
{
|
||||
class toByteArray
|
||||
{
|
||||
public static byte[] Convert(byte?[] bytes)
|
||||
{
|
||||
byte[] bb = Array.ConvertAll<byte?, byte>(bytes,
|
||||
delegate (byte? b)
|
||||
{
|
||||
return b.Value;
|
||||
});
|
||||
return bb;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
ProjetTheAlone/Outil/toNullableByteArray.cs
Normal file
21
ProjetTheAlone/Outil/toNullableByteArray.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjetTheAlone.Outil
|
||||
{
|
||||
class toNullableByteArray
|
||||
{
|
||||
public static byte?[] Convert(byte[] bytes)
|
||||
{
|
||||
byte?[] bb = Array.ConvertAll<byte, byte?>(bytes,
|
||||
delegate (byte b)
|
||||
{
|
||||
return b;
|
||||
});
|
||||
return bb;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user