工程文件版本转换工具/Window/MainWindow.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace 工程文件版本转换工具
{
    public partial class MainWindow : MyForm
    {
        int currentIndex = 1;

        [DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")]
        public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize);
        /// <summary>
        /// 释放内存
        /// </summary>
        public static void ClearMemory()
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
            }
        }

        public MainWindow()
        {
            InitializeComponent();
        }

        private void MainWindow_Load(object sender, EventArgs e)
        {
            Size size = Screen.PrimaryScreen.WorkingArea.Size;
            Left = (size.Width - Width) / 2;
            Top = (size.Height - Height) / 2;
            WindowState = FormWindowState.Normal;
            InitListView();
            cbTargetVersion.SelectedIndex = cbTargetVersion.Items.IndexOf("X Studio 1.8.1(SVIP 6.0.0)");//设置目标版本下拉菜单默认值
            tbOutputPath.Text = Environment.CurrentDirectory;//设置输出目录的初始值为程序所在位置
            pictureBoxTitleIcon.Image = Image.FromFile(Environment.CurrentDirectory + @"\Resources\icon.png");
        }

        private void InitListView()
        {
            //设置表头
            ColumnHeader ch = new ColumnHeader
            {
                Text = "序号",
                Width = 60,
                TextAlign = HorizontalAlignment.Left
            };
            listView1.Columns.Add(ch);
            listView1.BeginUpdate();
            ColumnHeader ch2 = new ColumnHeader
            {
                Text = "文件路径",
后面还有 202 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。