$user = [
'id' => 1,
'name' => 'Ivan Ivanov',
'role' => 'developer',
'salary' => 100
];
$ats = [
'/api/items/%id%/%name%',
'/api/items/%id%/%role%',
'/api/items/%id%/%salary%'
];
$res = [];
foreach($ats as $tem){
foreach($user as $key=>$v)
$tem = str_replace("%$key%",$v,$tem);
array_push($res,$tem);
}
array(3) {
[0]=>
string(24) "/api/items/1/Ivan Ivanov"
[1]=>
string(22) "/api/items/1/developer"
[2]=>
string(16) "/api/items/1/100"
}
if (length_block > 6) {
$(".ajax_button_next_Load_section").removeClass("displat_none");
$(".portfolio_hiden").addClass("portfolio_hiden_ajax_six");
for (let i = 0; 6 > i; i++)
$(".portfolio_active:eq(" + i + ")").removeClass("portfolio_hiden_ajax_six");
}
class Program{
static void Main(string[] args){
if (args.Length == 0){
Console.WriteLine("No arguments");
Console.ReadKey();
return;
}
var pathToLoad = args[0].ToString();
var f1 = new FileInfo(pathToLoad);
if (!f1.Exists){
Console.WriteLine("File non found");
Console.ReadKey();
return;
}
var pathToSave = f1.FullName + ".png";
if (args.Length > 1)
pathToSave = args[1].ToString();
var file = File.Open(pathToLoad, FileMode.Open);
var byteLen = file.Length;
int size = (int)Math.Floor(Math.Sqrt(byteLen / 4));
Bitmap bm = new Bitmap(size,size);
for (int y = 0; y < size ; y++){
for (int x= 0; x < size ; x++){
byte[] rgba = new byte[]{ 0xFF,0xFF,0xFF, 0xFF};
short cnt = 0;
while (cnt < 4 && file.CanRead){
byte[] buff= new byte[1];
file.Read(buff,0,1);
rgba[cnt++] = buff[0];
}
bm.SetPixel(x, y, Color.FromArgb(rgba[0], rgba[1], rgba[2], rgba[3]));
}
}
file.Close();
var saveFile = File.Open(pathToSave, FileMode.Create);
bm.Save(saveFile,ImageFormat.Png);
saveFile.Close();
Console.WriteLine(String.Format("File saved to '{0}'",pathToSave));
Console.ReadKey();
}
}
ConsoleApplication1.exe [Путь к файлу] [Путь к сохранению(не обязательно)]
ConsoleApplication1.exe D:\myfile.exe
ConsoleApplication1.exe D:\myfile.exe D:\my.png