使用C#製作可以錄製自動化執行Windows操作腳本工具——類似於按鍵精靈

来源:https://www.cnblogs.com/log9527blog/archive/2022/07/26/16520130.html
-Advertisement-
Play Games

我們知道,如果要對一個網站進行自動化測試,可以使用Python的selenium對獲取網頁的元素進行一系列操作。同樣,對於Windows應用,可以使用C#或者AutoIt(也是一種腳本語言,相比較與C#,AutoIt更適合做Windows應用的自動化腳本)捕獲窗體句柄進行操作。 今天主要記錄一下使用 ...


我們知道,如果要對一個網站進行自動化測試,可以使用Python的selenium對獲取網頁的元素進行一系列操作。同樣,對於Windows應用,可以使用C#或者AutoIt(也是一種腳本語言,相比較與C#,AutoIt更適合做Windows應用的自動化腳本)捕獲窗體句柄進行操作。

今天主要記錄一下使用WPF製作可以錄製自動化執行Windows操作腳本工具,類似於按鍵精靈的錄製腳本的操作。主要使用勾子捕獲滑鼠鍵盤事件。

<Window x:Class="AutoOperationTool.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:AutoOperationTool"
        mc:Ignorable="d"
        Title="自動化腳本" Height="450" Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid VerticalAlignment="Bottom" Margin="0 0 0 30">
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="當前滑鼠在屏幕的位置:"></Label>
            <Grid Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid Grid.Column="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Label  Content="X:"></Label>
                    <TextBlock x:Name="xPoint" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
                </Grid>
                <Grid Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Label  Content="Y:"></Label>
                    <TextBlock x:Name="yPoint" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
                </Grid>
            </Grid>
        </Grid>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Label Content="設置迴圈次數:" VerticalAlignment="Center" HorizontalAlignment="Right"></Label>
                <Border Grid.Column="1" Width="120" Height="35" BorderBrush="Black" HorizontalAlignment="Left" BorderThickness="1">
                    <TextBox Width="120" Height="35" x:Name="txtCycleCount" Text="1" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBox>
                </Border>
            </Grid>
            <Grid Grid.Column="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition Width="320"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Label Content="腳本路徑:" VerticalAlignment="Center" HorizontalAlignment="Right"></Label>
                <Border Grid.Column="1" Width="310" Height="35" BorderBrush="Black" HorizontalAlignment="Left" BorderThickness="1">
                    <TextBox Width="310" Height="35" x:Name="txtScriptPath" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap"></TextBox>
                </Border>
            </Grid>
        </Grid>
        <Grid Grid.Row="2" Margin="0 30 0 0" VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Button Grid.Column="0" x:Name="btnStart" Width="100" Height="40" Content="開始錄製" Click="Start_OnClick"></Button>
            <Button Grid.Column="1" x:Name="btnEnd" Width="100" Height="40" Content="結束錄製" Click="End_OnClick"></Button>
            <Button Grid.Column="2" x:Name="btnExec" Width="100" Height="40" Content="執行腳本" Click="Exec_OnClick"></Button>
            <Button Grid.Column="3" x:Name="btnCancel" Width="100" Height="40" Content="取消執行" Click="CancelExec_OnClick"></Button>
        </Grid>
    </Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Newtonsoft.Json;
using Path = System.IO.Path;

namespace AutoOperationTool
{
    /// <summary>
    /// MainWindow.xaml 的交互邏輯
    /// </summary>
    public partial class MainWindow : Window
    {
        // 用於取消任務的執行
        private CancellationTokenSource cancelTokenSource = new CancellationTokenSource();

        private Task ExecTask { get; set; }

        private KeyAction KeyAction { get; set; }

        public MainWindow()
        {
            InitializeComponent();
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            txtScriptPath.Text = config.AppSettings.Settings["path"].Value;
            KeyAction = new KeyAction();
            btnEnd.IsEnabled = false;
            btnCancel.IsEnabled = false;
        }

        private bool KMHook_MouseCallback(object arg)
        {
            if (arg is long[] arrs && arrs.Length == 3)
            {
                var type = arrs[0];
                var x = arrs[1];
                var y = arrs[2];
                if (type == 1)
                {
                    var model = new MouseOperation();
                    model.MouseOperationType = MouseOperationTypeEnum.Click;
                    model.Point = new Point(){ X = x, Y = y};
                    model.Time = DateTime.Now;
                    model.OperationType = OperationType.Mouse;
                    PrintLog.WriteTxt.GetInstance().AppendInfoLog(JsonConvert.SerializeObject(model));
                }

                xPoint.Text = x.ToString();
                yPoint.Text = y.ToString();
                Console.WriteLine($"X:{x};Y:{y}");
            }

            return true;
        }

        private bool KMHook_KeyCallback(object arg)
        {
            if (arg is long[] arrs && arrs.Length == 3)
            {
                var type = arrs[0];
                var code = arrs[1];
                var time = arrs[2];
                var model = new KeyOperation();
                if (type == 0)
                {
                    model.KeyOperationType = KeyOperationTypeEnum.Press;
                }
                else if (type == 1)
                {
                    model.KeyOperationType = KeyOperationTypeEnum.Up;
                }

                model.KeyCode = (Key)Enum.Parse(typeof(Key), code.ToString());
                model.OperationType = OperationType.Key;
                model.Time = DateTime.Now;
                PrintLog.WriteTxt.GetInstance().AppendInfoLog(JsonConvert.SerializeObject(model));
            }

            return true;
        }

        private void Start_OnClick(object sender, RoutedEventArgs e)
        {
            btnEnd.IsEnabled = true;
            btnStart.IsEnabled = false;
            btnExec.IsEnabled = false;
            btnCancel.IsEnabled = false;

            // 如果存在腳本名稱,序號往前加
            PrintLog.WriteTxt.GetInstance().FileLogName = "script1.txt";
            var fileLogName = PrintLog.WriteTxt.GetInstance().FileLogName;
            if (File.Exists(PrintLog.WriteTxt.GetInstance().FileStartupPath + PrintLog.WriteTxt.GetInstance().FileLogName))
            {
                var fileName = PrintLog.WriteTxt.GetInstance().FileLogName;
                while (File.Exists(PrintLog.WriteTxt.GetInstance().FileStartupPath + fileName))
                {
                    if (fileName.StartsWith("script") && fileName.EndsWith(".txt"))
                    {
                        var strCount = fileName.Replace("script", "").Replace(".txt", "");
                        int count;
                        if (int.TryParse(strCount, out count))
                        {
                            count++;
                            fileName = $"script{count}.txt";
                        }
                    }
                    else
                    {
                        Directory.Delete(PrintLog.WriteTxt.GetInstance().FileStartupPath + PrintLog.WriteTxt.GetInstance().FileLogName);
                        break;
                    }
                }

                fileLogName = fileName;
            }

            PrintLog.WriteTxt.GetInstance().FileLogName = fileLogName;
            txtScriptPath.Text = Path.Combine(PrintLog.WriteTxt.GetInstance().FileStartupPath, fileLogName);
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            config.AppSettings.Settings["path"].Value = txtScriptPath.Text;
            config.Save();
            KMHook.MouseCallback += KMHook_MouseCallback;
            KMHook.KeyCallback += KMHook_KeyCallback;
            KMHook.InsertHook();
        }

        private void End_OnClick(object sender, RoutedEventArgs e)
        {
            KMHook.MouseCallback -= KMHook_MouseCallback;
            KMHook.KeyCallback -= KMHook_KeyCallback;
            KMHook.RemoveHook();
            btnStart.IsEnabled = true;
            btnEnd.IsEnabled = !btnStart.IsEnabled;
            btnExec.IsEnabled = true;
            btnCancel.IsEnabled = !btnExec.IsEnabled;
        }

        private void Exec_OnClick(object sender, RoutedEventArgs e)
        {
            btnStart.IsEnabled = false;
            btnEnd.IsEnabled = !btnStart.IsEnabled;
            btnExec.IsEnabled = false;
            btnCancel.IsEnabled = !btnExec.IsEnabled;
            var listOperations = new List<Operation>();
            var path = txtScriptPath.Text;
            var listStrs = File.ReadLines(path)?.ToList();
            if (listStrs != null && listStrs.Count > 0)
            {
                foreach (var strScript in listStrs)
                {
                    try
                    {
                        var operation = JsonConvert.DeserializeObject<Operation>(strScript);
                        if (operation.OperationType == OperationType.Mouse)
                        {
                            var mouseOperation = JsonConvert.DeserializeObject<MouseOperation>(strScript);
                            listOperations.Add(mouseOperation);
                        }
                        else if (operation.OperationType == OperationType.Key)
                        {
                            var keyOperation = JsonConvert.DeserializeObject<KeyOperation>(strScript);
                            listOperations.Add(keyOperation);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }

            int count;
            if (int.TryParse(txtCycleCount.Text, out count))
            {
                ExecTask = Task.Factory.StartNew(() =>
                {
                    if (count < 1) count = 1;
                    for (int i = 0; i < count; i++)
                    {
                        DateTime lastTime = new DateTime();
                        DateTime nextTime = new DateTime();
                        for (int j = 0; j < listOperations.Count; j++)
                        {
                            if (lastTime == new DateTime())
                            {
                                lastTime = listOperations[j].Time;

                                Exec(listOperations, j);
                            }
                            else
                            {
                                nextTime = listOperations[j].Time;
                                if (j > 0)
                                {
                                    lastTime = listOperations[j - 1].Time;
                                }

                                Thread.Sleep(nextTime - lastTime);
                                Exec(listOperations, j);
                            }
                        }

                        Thread.Sleep(1000);
                    }

                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        btnStart.IsEnabled = true;
                        btnEnd.IsEnabled = !btnStart.IsEnabled;
                        btnExec.IsEnabled = true;
                        btnCancel.IsEnabled = !btnExec.IsEnabled;
                    });
                }, cancelTokenSource.Token);
            }
        }

        private void Exec(List<Operation> listOperations, int j)
        {
            if (listOperations[j].OperationType == OperationType.Mouse)
            {
                var mouse = listOperations[j] as MouseOperation;
                MouseAction.DoClick((int)mouse.Point.X, (int)mouse.Point.Y);
            }
            else if (listOperations[j].OperationType == OperationType.Key)
            {
                var key = listOperations[j] as KeyOperation;
                if (key.KeyOperationType == KeyOperationTypeEnum.Press)
                {
                    KeyAction.MykeyDown(key.KeyCode);
                }
                else if (key.KeyOperationType == KeyOperationTypeEnum.Up)
                {
                    KeyAction.MykeyUp(key.KeyCode);
                }
            }
        }

        private void CancelExec_OnClick(object sender, RoutedEventArgs e)
        {
            if (ExecTask != null)
            {
                for (int i = 0; i < 3; i++)
                {
                    try
                    {
                        cancelTokenSource.Cancel();
                        if (cancelTokenSource.IsCancellationRequested)
                        {
                            cancelTokenSource = new CancellationTokenSource();
                            ExecTask.Dispose();
                            btnStart.IsEnabled = true;
                            btnEnd.IsEnabled = !btnStart.IsEnabled;
                            btnExec.IsEnabled = true;
                            btnCancel.IsEnabled = !btnExec.IsEnabled;
                            break;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
    }
}

勾子監聽鍵盤滑鼠事件

using System;
using System.Runtime.InteropServices;

namespace AutoOperationTool
{
    public class KMHook
    {
        public static bool InsertHook()
        {
            bool iRet;
            iRet = InsertKeyboardHook();
            if (!iRet)
            {
                return false;
            }

            iRet = InsertMouseHook();
            if (!iRet)
            {
                removeKeyboardHook();
                return false;
            }

            return true;
        }

        public static bool RemoveHook()
        {
            bool iRet;
            iRet = removeKeyboardHook();
            if (iRet)
            {
                iRet = removeMouseHook();
            }

            return iRet;
        }

        public static event Func<object, bool> MouseCallback;
        public static event Func<object, bool> KeyCallback;

        internal struct Keyboard_LL_Hook_Data
        {
            public UInt32 vkCode;
            public UInt32 scanCode;
            public UInt32 flags;
            public UInt32 time;
            public IntPtr extraInfo;
        }

        internal struct Mouse_LL_Hook_Data
        {
            internal long yx;
            internal readonly int mouseData;
            internal readonly uint flags;
            internal readonly uint time;
            internal readonly IntPtr dwExtraInfo;
        }

        private static IntPtr pKeyboardHook = IntPtr.Zero;
        private static IntPtr pMouseHook = IntPtr.Zero;
        //鉤子委托聲明
        public delegate int HookProc(int code, IntPtr wParam, IntPtr lParam);
        private static HookProc keyboardHookProc;
        private static HookProc mouseHookProc;

        //安裝鉤子
        [DllImport("user32.dll")]
        public static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr pInstance, int threadID);

        //卸載鉤子
        [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern bool UnhookWindowsHookEx(IntPtr pHookHandle);
        [DllImport("user32.dll")]
        public static extern int CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam); //parameter 'hhk' is ignored.

        private static int keyboardHookCallback(int code, IntPtr wParam, IntPtr lParam)
        {
            if (code < 0)
            {
                return CallNextHookEx(IntPtr.Zero, code, wParam, lParam);
            }

            Keyboard_LL_Hook_Data khd = (Keyboard_LL_Hook_Data)Marshal.PtrToStructure(lParam, typeof(Keyboard_LL_Hook_Data));
            System.Diagnostics.Debug.WriteLine($"key event:{wParam}, key code:{khd.vkCode}, event time:{khd.time}");

            var keyType = 0L;
            var iWParam = (int)wParam;
            if (iWParam == 256)
            {
                keyType = 0;
            }
            else if (iWParam == 257)
            {
                keyType = 1;
            }
            else
            {
                keyType = 0;
            }
            KeyCallback?.Invoke(new long[3] { keyType, (int)khd.vkCode, (int)khd.time });
            return 0;
        }

        private static int mouseHookCallback(int code, IntPtr wParam, IntPtr lParam)
        {
            if (code < 0)
            {
                return CallNextHookEx(IntPtr.Zero, code, wParam, lParam);
            }

            Mouse_LL_Hook_Data mhd = (Mouse_LL_Hook_Data)Marshal.PtrToStructure(lParam, typeof(Mouse_LL_Hook_Data));
            System.Diagnostics.Debug.WriteLine($"mouse event:{wParam}, ({mhd.yx & 0xffffffff},{mhd.yx >> 32})");
            var mouseType = 0L;
            var iWParam = (int)wParam;
            if (iWParam == 513)
            {
                mouseType = 1;
            }
            else if (iWParam == 514)
            {
                mouseType = 2;
            }
            else
            {
                mouseType = 0;
            }

            MouseCallback?.Invoke(new long[3]{ mouseType , mhd.yx & 0xffffffff, mhd.yx >> 32 });
            return 0;
        }

        //安裝鉤子方法
        private static bool InsertKeyboardHook()
        {
            if (pKeyboardHook == IntPtr.Zero)//不存在鉤子時
            {
                //創建鉤子
                keyboardHookProc = keyboardHookCallback;
                pKeyboardHook = SetWindowsHookEx(13, //13表示全局鍵盤事件。
                    keyboardHookProc,
                    (IntPtr)0,
                    0);

                if (pKeyboardHook == IntPtr.Zero)//如果安裝鉤子失敗
                {
                    removeKeyboardHook();
                    return false;
                }
            }

            return true;
        }

        private static bool InsertMouseHook()
        {
            if (pMouseHook == IntPtr.Zero)
            {
                mouseHookProc = mouseHookCallback;
                pMouseHook = SetWindowsHookEx(14, //14表示全局滑鼠事件
                    mouseHookProc,
                    (IntPtr)0,
                    0);

                if (pMouseHook == IntPtr.Zero)
                {
                    removeMouseHook();
                    return false;
                }
            }

            return true;
        }

        private static bool removeKeyboardHook()
        {
            if (pKeyboardHook != IntPtr.Zero)
            {
                if (UnhookWindowsHookEx(pKeyboardHook))
                {
                    pKeyboardHook = IntPtr.Zero;
                }
                
              
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 兄弟們,今天咱們試試用Python從文件中讀取學生成績,並計算最高分/最低分/平均分。 涉及知識點 文件讀寫 基礎語法 字元串處理 迴圈遍歷 代碼展示 模塊 import platform # 我還給大家準備了這些資料:Python視頻教程、100本Python電子書、基礎、爬蟲、數據分析、web開 ...
  • 多商戶商城系統,也稱為B2B2C(BBC)平臺電商模式多商家商城系統。可以快速幫助企業搭建類似拼多多/京東/天貓/淘寶的綜合商城。 多商戶商城系統支持商家入駐加盟,同時滿足平臺自營、旗艦店等多種經營方式。平臺可以通過收取商家入駐費,訂單交易服務費,提現手續費,簡訊通道費等多手段方式,實現整體盈利。 ...
  • 1.認識REST 1.1什麼是REST REST是軟體架構的規範體繫結構,它將資源的狀態以適合客戶端的形式從伺服器端發送到客戶端(或相反方向)。在REST中,通過URL進行資源定位,用HTTP動作GET、POST、DELETE、PUSH等)描述操作,完成功能。 道循RESTful風格,可以使開發的接 ...
  • 1. ElasticSearch快速入門 1.1. 基本介紹 ElasticSearch特色 Elasticsearch是實時的分散式搜索分析引擎,內部使用Lucene做索引與搜索 實時性:新增到 ES 中的數據在1秒後就可以被檢索到,這種新增數據對搜索的可見性稱為“準實時搜索” 分散式:意味著可以 ...
  • 選擇結構 if 選擇結構 語法 if(布爾表達式) { //當布爾表達式為true將執行的語句 } if(布爾表達式) { //當布爾表達式為true將執行的語句 }else{ //當布爾表達式為false時執行的語句 } if(條件1) { //條件1為ture時執行的語句 }else if(條件 ...
  • 前言 當我們使用DI方式寫了很多的Service後, 可能會發現我們的有些做法並不是最優的. 獲取註入的對象, 大家經常在構造函數中獲取, 這樣也是官方推薦的方式, 但有時不是效率最高的方法. 如果在構造函數中獲取對象,那麼每次對象的初始化都會把構造函數中的對象初始化一遍, 如果某個方法只用到其中一 ...
  • Word中設置水印時,可使用預設的文字或自定義文字設置為水印效果,但通常添加水印效果時,會對所有頁面都設置成統一效果,如果需要對每一頁或者某個頁面設置不同的水印效果,則可以參考本文中的方法。下麵,將以C# 代碼為例,對Word每一頁設置不同的文字水印效果作詳細介紹。 方法思路 在給Word每一頁添加 ...
  • 在日常開發 webapi 時,我們往往會集成 swagger doc 進行 api 的文檔呈現,當api數量比較多的時候就會導致 swagger ui 上的 api 因為數量太多而顯得雜亂,今天教大家如何利用 GroupName 屬性來對 api 的 Controller 進行分組,然後利用 swa ...
一周排行
    -Advertisement-
    Play Games
  • .Net8.0 Blazor Hybird 桌面端 (WPF/Winform) 實測可以完整運行在 win7sp1/win10/win11. 如果用其他工具打包,還可以運行在mac/linux下, 傳送門BlazorHybrid 發佈為無依賴包方式 安裝 WebView2Runtime 1.57 M ...
  • 目錄前言PostgreSql安裝測試額外Nuget安裝Person.cs模擬運行Navicate連postgresql解決方案Garnet為什麼要選擇Garnet而不是RedisRedis不再開源Windows版的Redis是由微軟維護的Windows Redis版本老舊,後續可能不再更新Garne ...
  • C#TMS系統代碼-聯表報表學習 領導被裁了之後很快就有人上任了,幾乎是無縫銜接,很難讓我不想到這早就決定好了。我的職責沒有任何變化。感受下來這個系統封裝程度很高,我只要會調用方法就行。這個系統交付之後不會有太多問題,更多應該是做小需求,有大的開發任務應該也是第二期的事,嗯?怎麼感覺我變成運維了?而 ...
  • 我在隨筆《EAV模型(實體-屬性-值)的設計和低代碼的處理方案(1)》中介紹了一些基本的EAV模型設計知識和基於Winform場景下低代碼(或者說無代碼)的一些實現思路,在本篇隨筆中,我們來分析一下這種針對通用業務,且只需定義就能構建業務模塊存儲和界面的解決方案,其中的數據查詢處理的操作。 ...
  • 對某個遠程伺服器啟用和設置NTP服務(Windows系統) 打開註冊表 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer 將 Enabled 的值設置為 1,這將啟用NTP伺服器功 ...
  • title: Django信號與擴展:深入理解與實踐 date: 2024/5/15 22:40:52 updated: 2024/5/15 22:40:52 categories: 後端開發 tags: Django 信號 松耦合 觀察者 擴展 安全 性能 第一部分:Django信號基礎 Djan ...
  • 使用xadmin2遇到的問題&解決 環境配置: 使用的模塊版本: 關聯的包 Django 3.2.15 mysqlclient 2.2.4 xadmin 2.0.1 django-crispy-forms >= 1.6.0 django-import-export >= 0.5.1 django-r ...
  • 今天我打算整點兒不一樣的內容,通過之前學習的TransformerMap和LazyMap鏈,想搞點不一樣的,所以我關註了另外一條鏈DefaultedMap鏈,主要調用鏈為: 調用鏈詳細描述: ObjectInputStream.readObject() DefaultedMap.readObject ...
  • 後端應用級開發者該如何擁抱 AI GC?就是在這樣的一個大的浪潮下,我們的傳統的應用級開發者。我們該如何選擇職業或者是如何去快速轉型,跟上這樣的一個行業的一個浪潮? 0 AI金字塔模型 越往上它的整個難度就是職業機會也好,或者說是整個的這個運作也好,它的難度會越大,然後越往下機會就會越多,所以這是一 ...
  • @Autowired是Spring框架提供的註解,@Resource是Java EE 5規範提供的註解。 @Autowired預設按照類型自動裝配,而@Resource預設按照名稱自動裝配。 @Autowired支持@Qualifier註解來指定裝配哪一個具有相同類型的bean,而@Resourc... ...