프로그램 Port List  ( C# / WPF / .NET Framework 4.8.1 )

Serial Port 목록을 보여주는 단순한 프로그램

작업관리자 띄우기가 귀찮아 직접 만듬.

 

[ v ] Auto  : 체크시 2초마다 자동으로 COM 포트 목록 업데이트

[ v ] Top Most : 프로그램을 최상위 화면으로 고정

 

 

PortList.exe
0.42MB

 

라이센스 x ( 마구 가져다 써도 됨. )

MD5 : cb6850e842a06ca764e11081fb6f5be2

 

※ MD5 확인 방법 (윈도우 only)

명령 프롬프트에서 실행
> Get-FileHash -Path PortList.exe -Algorithm md5
Algorithm       Hash                                
---------       ----                                
MD5             CB6850E842A06CA764E11081FB6F5BE2  

 

또는 

명령 프롬프트에서 실행
> certutil -hashfile PortList.exe md5
MD5의 PortList.exe 해시:
cb6850e842a06ca764e11081fb6f5be2

 

'Programming > WPF' 카테고리의 다른 글

WPF, Image Control, bitmap 수정 및 업데이트하기  (0) 2023.10.17

 

# xaml 

    <Grid Background="Black">
        <Image x:Name="DrawCanvas" Width="100" Height="100"/>
    </Grid>

 

# 비트맵 변경

        public void init(int w, int h)
        {
            DrawCanvas.Width = w;
            DrawCanvas.Height = h;
        }


        public void DrawColorCanvas2(int x, int y, int color)
        {
            int bitmapWidth = (int)DrawCanvas.Width;
            int bitmapHeight = (int)DrawCanvas.Height;

            if (_writeableBitmap == null)
            {
                _writeableBitmap = new WriteableBitmap(bitmapWidth, bitmapHeight, 96, 96, PixelFormats.Bgra32, null);

                int length = _writeableBitmap.BackBufferStride * bitmapHeight;
                byte[] buffer = new byte[length];

                _writeableBitmap.WritePixels(new Int32Rect(0, 0, (int)_writeableBitmap.Width, (int)_writeableBitmap.Height), buffer, _writeableBitmap.BackBufferStride, 0);
                DrawCanvas.Source = _writeableBitmap;
            }

            try
            {
                // Reserve the back buffer for updates.
                _writeableBitmap.Lock();

                // Compute the pixel's color.
                int color_data = 0;
                color_data |= color << 0;   // B
                color_data |= color << 8;   // G
                color_data |= color << 16;  // R
                color_data |= 0xff << 24;   // A 

                unsafe
                {
                    int length = _writeableBitmap.BackBufferStride * bitmapHeight;

                    //for (int y = 0; y < bitmapHeight; y++)
                    {
                        //for (int x = 0; x < bitmapWidth; x++)
                        {
                            int i = (y * _writeableBitmap.BackBufferStride) + (x * 4);

                            IntPtr pBackBuffer = _writeableBitmap.BackBuffer;

                            // Find the address of the pixel to draw.
                            pBackBuffer += y * _writeableBitmap.BackBufferStride;
                            pBackBuffer += x * 4;

                            // Assign the color data to the pixel.
                            *((int*)pBackBuffer) = color_data;
                        }
                    }
                }

                // Specify the area of the bitmap that changed.
                _writeableBitmap.AddDirtyRect(new Int32Rect(x, y, 1, 1));
            }
            finally
            {
                // Release the back buffer and make it available for display.
                _writeableBitmap.Unlock();
            }
        }

 

# 테스트

        public void Test()
        {
            int bitmapWidth = (int)DrawCanvas.Width;
            int bitmapHeight = (int)DrawCanvas.Height;

            for (int y = 0; y < bitmapHeight; y++)
            {
                for (int x = 0; x < bitmapWidth; x++)
                {
                    DrawColorCanvas2(x, y, 0, false);
                }
            }

            // 화면 업데이트
            System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(
                            System.Windows.Threading.DispatcherPriority.Background
                           , new System.Threading.ThreadStart(delegate { }));
        }

 

'Programming > WPF' 카테고리의 다른 글

[무료] Serial Port List 프로그램 (windows)  (0) 2023.10.26

+ Recent posts