$ErrorActionPreference='Stop' Add-Type -AssemblyName System.Drawing Add-Type -ReferencedAssemblies System.Drawing -TypeDefinition @' using System;using System.IO;using System.Drawing; public class AmberClockIcon { const int W=48,H=48; static void Dot(byte[,]p,int x,int y,byte c){if(x>=0&&x=0&&y=dy){e+=dy;x0+=sx;}if(e2<=dx){e+=dx;y0+=sy;}}} static byte[,] Pixels(bool selected){var p=new byte[H,W]; for(int y=4;y<46;y++)for(int x=5;x<46;x++)if((x-25)*(x-25)+(y-25)*(y-25)<=400)Dot(p,x,y,2); for(int y=1;y<=43;y++)for(int x=2;x<=44;x++){double d=Math.Sqrt((x-23)*(x-23)+(y-22)*(y-22));if(d<=21){byte c=2;if(d>19)c=(byte)((x+y<45||selected)?1:2);else if(d>16)c=3;Dot(p,x,y,c);}} for(int t=0;t<12;t++){double a=t*Math.PI/6;int r0=t%3==0?12:14;Line(p,23+(int)Math.Round(Math.Sin(a)*r0),22-(int)Math.Round(Math.Cos(a)*r0),23+(int)Math.Round(Math.Sin(a)*15),22-(int)Math.Round(Math.Cos(a)*15),(byte)(t%3==0?1:3));} Line(p,23,22,15,15,1);Line(p,23,23,15,16,1); Line(p,23,22,34,13,1);Line(p,24,22,35,13,1); Line(p,23,22,26,35,3);Line(p,23,22,22,18,3); Dot(p,23,22,1);Dot(p,24,22,1);Dot(p,23,23,1); for(int y=43;y<=45;y++)for(int x=15;x<=31;x++)Dot(p,x,y,(byte)(y==43?3:2)); Line(p,12,46,34,46,3);Line(p,14,45,32,45,1); return p;} static int Word(byte[]b,int o){return b[o]*256+b[o+1];} static uint Long(byte[]b,int o){return ((uint)b[o]<<24)|((uint)b[o+1]<<16)|((uint)b[o+2]<<8)|b[o+3];} static void U16(BinaryWriter w,int v){w.Write((byte)(v>>8));w.Write((byte)v);} static void Image(BinaryWriter w,byte[,]p){U16(w,0);U16(w,0);U16(w,W);U16(w,H);U16(w,2);w.Write(new byte[]{0,0,0,1,3,0,0,0,0,0});for(int plane=0;plane<2;plane++)for(int y=0;y>bit);w.Write(v);}} public static void Make(string source,string output,string preview){var old=File.ReadAllBytes(source);int end=78;if(Long(old,66)!=0)throw new Exception("Clock icon unexpectedly has drawer data");foreach(int ptr in new[]{22,26})if(Long(old,ptr)!=0){bool next;do{int width=Word(old,end+4),height=Word(old,end+6),depth=Word(old,end+8);next=Long(old,end+16)!=0;end+=20+((width+15)/16)*2*height*depth;}while(next);} var header=new byte[78];Array.Copy(old,header,78);header[12]=0;header[13]=W;header[14]=0;header[15]=H;header[16]=0;header[17]=6;foreach(int ptr in new[]{22,26}){for(int k=0;k<4;k++)header[ptr+k]=0;header[ptr+3]=1;}for(int k=0;k<4;k++)header[44+k]=0; using(var f=File.Create(output))using(var w=new BinaryWriter(f)){w.Write(header);Image(w,Pixels(false));Image(w,Pixels(true));w.Write(old,end,old.Length-end);} Color[]colors={Color.FromArgb(53,50,44),Color.FromArgb(228,213,181),Color.FromArgb(25,23,19),Color.FromArgb(169,111,39)}; var pix=Pixels(false);using(var im=new Bitmap(W*6,H*6)){using(var g=Graphics.FromImage(im)){for(int y=0;y