C#语言实例源码系列-实现对文件进行加密保护

news2024/9/25 17:12:31
专栏分享
  • 点击跳转=>Unity3D特效百例
  • 点击跳转=>案例项目实战源码
  • 点击跳转=>游戏脚本-辅助自动化
  • 点击跳转=>Android控件全解手册

👉关于作者

众所周知,人生是一个漫长的流程,不断克服困难,不断反思前进的过程。在这个过程中会产生很多对于人生的质疑和思考,于是我决定将自己的思考,经验和故事全部分享出来,以此寻找共鸣 !!!
专注于Android/Unity和各种游戏开发技巧,以及各种资源分享(网站、工具、素材、源码、游戏等)
有什么需要欢迎私我,交流群让学习不再孤单

在这里插入图片描述

👉实践过程

😜效果

在这里插入图片描述

😜代码

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        CheckForIllegalCrossThreadCalls = false;
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        FileMenu(Application.ExecutablePath + ",0", Application.ExecutablePath);
        string[] str = Environment.GetCommandLineArgs();
        try
        {
            string strFile = "";
            for (int i = 2; i < str.Length; i++)
                strFile += str[i];
            FileInfo FInfo = new FileInfo(strFile);
            if (FInfo.Extension.ToLower() == ".mr")
            {
                textBox1.Text = strFile;
                button2.Enabled = false;
                button3.Enabled = true;
            }
        }
        catch
        {
        }
    }

    //选择加密、解密文件
    private void button1_Click(object sender, EventArgs e)
    {
        if (openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            textBox1.Text = openFileDialog1.FileName;
            FileInfo FInfo = new FileInfo(textBox1.Text);
            if (FInfo.Extension.ToLower() == ".mr")
            {
                button2.Enabled = false;
                button3.Enabled = true;
            }
            else
            {
                button2.Enabled = true;
                button3.Enabled = false;
            }
        }
    }

    //加密
    private void button2_Click(object sender, EventArgs e)
    {
        if (textBox1.Text != "")
        {
            if (textBox2.Text.Length < 6)
                MessageBox.Show("密码不能小于6位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            else
            {
                EDncrypt myEDncrypt = new EDncrypt(textBox1.Text, textBox2.Text, progressBar1);
                myEDncrypt.StartEncrypt();
                progressBar1.Value = 0;
            }
        }
    }

    //解密
    private void button3_Click(object sender, EventArgs e)
    {
        if (textBox1.Text != "")
        {
            if (textBox2.Text.Length < 6)
                MessageBox.Show("密码不能小于6位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            else
            {
                EDncrypt myEDncrypt = new EDncrypt(textBox1.Text, textBox2.Text, progressBar1);
                myEDncrypt.StartDncrypt();
                progressBar1.Value = 0;
            }
        }
    }

    //创建快捷菜单
    public static void FileMenu(string strPath, string strName)
    {
        try
        {
            Registry.ClassesRoot.CreateSubKey(".mr");
            RegistryKey RKey1 = Registry.ClassesRoot.OpenSubKey(".mr", true);
            RKey1.SetValue("", "mrfile");
            RKey1.Close();
            Registry.ClassesRoot.CreateSubKey("mrfile");
            RegistryKey RKey2 = Registry.ClassesRoot.OpenSubKey("mrfile", true);
            RKey2.CreateSubKey("DefaultIcon");
            RKey2.CreateSubKey("shell");
            RKey2.Close();
            RegistryKey RKey3 = Registry.ClassesRoot.OpenSubKey("mrfile\\DefaultIcon", true);
            RKey3.SetValue("", strPath);
            RKey3.Close();
            RegistryKey RKey4 = Registry.ClassesRoot.OpenSubKey("mrfile\\shell", true);
            RKey4.CreateSubKey("解密");
            RKey4.Close();
            RegistryKey RKey5 = Registry.ClassesRoot.OpenSubKey("mrfile\\shell\\解密", true);
            RKey5.CreateSubKey("command");
            RKey5.Close();
            RegistryKey RKey6 = Registry.ClassesRoot.OpenSubKey("mrfile\\shell\\解密\\command", true);
            RKey6.SetValue("", strName + " \\F %1");
            RKey6.Close();
        }
        catch
        {
        }
    }
}

#region 加密、解密类

class EDncrypt
{
    #region 定义全局变量及类对象

    private string strFile = "";
    private string strNewFile = "";
    private string strPwd = "";
    private ProgressBar PBar = null;
    private Thread EThread = null;
    private Thread DThread = null;

    #endregion

    //含参数的构造函数,用来初始化全局变量及对象
    public EDncrypt(string name, string pwd, ProgressBar pb)
    {
        strFile = name;
        strPwd = pwd;
        PBar = pb;
        EThread = new Thread(new ThreadStart(this.myEThread));
        DThread = new Thread(new ThreadStart(this.myDThread));
    }

    //文件加密
    private void myEThread()
    {
        byte[] btRKey = new byte[0];
        if (strPwd.Length == 6)
        {
            btRKey = new byte[]
            {
                (byte) strPwd[0], (byte) strPwd[1], (byte) strPwd[2], (byte) strPwd[3], (byte) strPwd[4],
                (byte) strPwd[5], (byte) strPwd[0], (byte) strPwd[1]
            };
        }

        if (strPwd.Length == 7)
        {
            btRKey = new byte[]
            {
                (byte) strPwd[0], (byte) strPwd[1], (byte) strPwd[2], (byte) strPwd[3], (byte) strPwd[4],
                (byte) strPwd[5], (byte) strPwd[6], (byte) strPwd[0]
            };
        }

        if (strPwd.Length >= 8)
        {
            btRKey = new byte[]
            {
                (byte) strPwd[0], (byte) strPwd[1], (byte) strPwd[2], (byte) strPwd[3], (byte) strPwd[4],
                (byte) strPwd[5], (byte) strPwd[6], (byte) strPwd[7]
            };
        }

        FileStream FStream = new FileStream(strFile, FileMode.Open, FileAccess.Read);
        FileStream NewFStream = new FileStream(strFile + ".mr", FileMode.OpenOrCreate, FileAccess.Write);
        NewFStream.SetLength((long) 0);
        byte[] buffer = new byte[0x400];
        int MinNum = 0;
        long length = FStream.Length;
        int MaxNum = (int) (length / ((long) 0x400));
        PBar.Maximum = MaxNum;
        DES myDES = new DESCryptoServiceProvider();
        CryptoStream CStream =
            new CryptoStream(NewFStream, myDES.CreateEncryptor(btRKey, btRKey), CryptoStreamMode.Write);
        while (MinNum < length)
        {
            int count = FStream.Read(buffer, 0, 0x400);
            CStream.Write(buffer, 0, count);
            MinNum += count;
            try
            {
                if (PBar.Value < PBar.Maximum)
                {
                    PBar.Value++;
                }
            }
            catch
            {
            }
        }

        CStream.Close();
        NewFStream.Close();
        FStream.Close();
        File.Delete(strFile);
        MessageBox.Show("文件加密成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }

    //运行加密线程
    public void StartEncrypt()
    {
        EThread.Start();
    }

    //文件解密
    private void myDThread()
    {
        FileStream FStream = null;
        FileStream NewFStream = null;
        CryptoStream CStream = null;
        try
        {
            try
            {
                byte[] btRKey = new byte[0];
                if (strPwd.Length == 6)
                {
                    btRKey = new byte[]
                    {
                        (byte) strPwd[0], (byte) strPwd[1], (byte) strPwd[2], (byte) strPwd[3], (byte) strPwd[4],
                        (byte) strPwd[5], (byte) strPwd[0], (byte) strPwd[1]
                    };
                }

                if (strPwd.Length == 7)
                {
                    btRKey = new byte[]
                    {
                        (byte) strPwd[0], (byte) strPwd[1], (byte) strPwd[2], (byte) strPwd[3], (byte) strPwd[4],
                        (byte) strPwd[5], (byte) strPwd[6], (byte) strPwd[0]
                    };
                }

                if (strPwd.Length >= 8)
                {
                    btRKey = new byte[]
                    {
                        (byte) strPwd[0], (byte) strPwd[1], (byte) strPwd[2], (byte) strPwd[3], (byte) strPwd[4],
                        (byte) strPwd[5], (byte) strPwd[6], (byte) strPwd[7]
                    };
                }

                FStream = new FileStream(strFile, FileMode.Open, FileAccess.Read);
                strNewFile = strFile.Substring(0, strFile.Length - 3);
                NewFStream = new FileStream(strNewFile, FileMode.OpenOrCreate, FileAccess.Write);
                NewFStream.SetLength((long) 0);
                byte[] buffer = new byte[0x400];
                int MinNum = 0;
                long length = FStream.Length;
                int MaxNum = (int) (length / ((long) 0x400));
                PBar.Maximum = MaxNum;
                DES myDES = new DESCryptoServiceProvider();
                CStream = new CryptoStream(NewFStream, myDES.CreateDecryptor(btRKey, btRKey),
                    CryptoStreamMode.Write);
                while (MinNum < length)
                {
                    int count = FStream.Read(buffer, 0, 0x400);
                    CStream.Write(buffer, 0, count);
                    MinNum += count;
                    try
                    {
                        if (PBar.Value < PBar.Maximum)
                        {
                            PBar.Value++;
                        }
                    }
                    catch
                    {
                    }
                }

                MessageBox.Show("文件解密成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                MessageBox.Show("文件解密失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        finally
        {
            CStream.Close();
            FStream.Close();
            NewFStream.Close();
        }
    }

    //运行解密线程
    public void StartDncrypt()
    {
        DThread.Start();
    }
}

#endregion
partial class Form1
{
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows 窗体设计器生成的代码

    /// <summary>
    /// 设计器支持所需的方法 - 不要
    /// 使用代码编辑器修改此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
        this.label1 = new System.Windows.Forms.Label();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.button1 = new System.Windows.Forms.Button();
        this.label2 = new System.Windows.Forms.Label();
        this.textBox2 = new System.Windows.Forms.TextBox();
        this.label3 = new System.Windows.Forms.Label();
        this.label4 = new System.Windows.Forms.Label();
        this.progressBar1 = new System.Windows.Forms.ProgressBar();
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.button2 = new System.Windows.Forms.Button();
        this.button3 = new System.Windows.Forms.Button();
        this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
        this.groupBox1.SuspendLayout();
        this.SuspendLayout();
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.Location = new System.Drawing.Point(6, 17);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(161, 12);
        this.label1.TabIndex = 0;
        this.label1.Text = "请选择要加密或解密的文件:";
        // 
        // textBox1
        // 
        this.textBox1.Location = new System.Drawing.Point(32, 35);
        this.textBox1.Name = "textBox1";
        this.textBox1.Size = new System.Drawing.Size(263, 21);
        this.textBox1.TabIndex = 1;
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(301, 33);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(33, 23);
        this.button1.TabIndex = 2;
        this.button1.Text = "…";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.Location = new System.Drawing.Point(7, 71);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(83, 12);
        this.label2.TabIndex = 3;
        this.label2.Text = "加/解密密码:";
        // 
        // textBox2
        // 
        this.textBox2.Location = new System.Drawing.Point(92, 68);
        this.textBox2.Name = "textBox2";
        this.textBox2.PasswordChar = '*';
        this.textBox2.Size = new System.Drawing.Size(151, 21);
        this.textBox2.TabIndex = 4;
        // 
        // label3
        // 
        this.label3.AutoSize = true;
        this.label3.ForeColor = System.Drawing.Color.Red;
        this.label3.Location = new System.Drawing.Point(243, 71);
        this.label3.Name = "label3";
        this.label3.Size = new System.Drawing.Size(95, 12);
        this.label3.TabIndex = 5;
        this.label3.Text = "(密码应大于6位)";
        // 
        // label4
        // 
        this.label4.AutoSize = true;
        this.label4.Location = new System.Drawing.Point(7, 101);
        this.label4.Name = "label4";
        this.label4.Size = new System.Drawing.Size(83, 12);
        this.label4.TabIndex = 6;
        this.label4.Text = "加/解密进度:";
        // 
        // progressBar1
        // 
        this.progressBar1.Location = new System.Drawing.Point(92, 99);
        this.progressBar1.Name = "progressBar1";
        this.progressBar1.Size = new System.Drawing.Size(242, 18);
        this.progressBar1.TabIndex = 7;
        // 
        // groupBox1
        // 
        this.groupBox1.Controls.Add(this.label1);
        this.groupBox1.Controls.Add(this.progressBar1);
        this.groupBox1.Controls.Add(this.textBox1);
        this.groupBox1.Controls.Add(this.label4);
        this.groupBox1.Controls.Add(this.button1);
        this.groupBox1.Controls.Add(this.label3);
        this.groupBox1.Controls.Add(this.label2);
        this.groupBox1.Controls.Add(this.textBox2);
        this.groupBox1.Location = new System.Drawing.Point(5, 5);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new System.Drawing.Size(342, 123);
        this.groupBox1.TabIndex = 8;
        this.groupBox1.TabStop = false;
        this.groupBox1.Text = "文件加/解密设置";
        // 
        // button2
        // 
        this.button2.Enabled = false;
        this.button2.Location = new System.Drawing.Point(223, 134);
        this.button2.Name = "button2";
        this.button2.Size = new System.Drawing.Size(59, 27);
        this.button2.TabIndex = 9;
        this.button2.Text = "加密";
        this.button2.UseVisualStyleBackColor = true;
        this.button2.Click += new System.EventHandler(this.button2_Click);
        // 
        // button3
        // 
        this.button3.Enabled = false;
        this.button3.Location = new System.Drawing.Point(288, 134);
        this.button3.Name = "button3";
        this.button3.Size = new System.Drawing.Size(59, 27);
        this.button3.TabIndex = 9;
        this.button3.Text = "解密";
        this.button3.UseVisualStyleBackColor = true;
        this.button3.Click += new System.EventHandler(this.button3_Click);
        // 
        // openFileDialog1
        // 
        this.openFileDialog1.FileName = "openFileDialog1";
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(353, 167);
        this.Controls.Add(this.button3);
        this.Controls.Add(this.button2);
        this.Controls.Add(this.groupBox1);
        this.MaximizeBox = false;
        this.Name = "Form1";
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.Text = "对文件进行加密保护";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox textBox2;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.ProgressBar progressBar1;
    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.Button button2;
    private System.Windows.Forms.Button button3;
    private System.Windows.Forms.OpenFileDialog openFileDialog1;
}

需要的再直接Call我V,直接发。XQLong88

👉其他

📢作者:小空和小芝中的小空
📢转载说明-务必注明来源:https://zhima.blog.csdn.net/
📢这位道友请留步☁️,我观你气度不凡,谈吐间隐隐有王者霸气💚,日后定有一番大作为📝!!!旁边有点赞👍收藏🌟今日传你,点了吧,未来你成功☀️,我分文不取,若不成功⚡️,也好回来找我。

温馨提示点击下方卡片获取更多意想不到的资源。
空名先生

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/129972.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

jmeter压测使用实践

环境搭建篇见https://blog.csdn.net/weixin_42498050/article/details/12847945 参考Jmter压测使用实践 jmeter压测实战总结 搭建 Apache Jmeter 分布式压测与监控 Jmeter常用断言 1. 添加线程组 测试计划 &#xff08;右键->添加->Threads&#xff08;Users&#x…

做了这么久的自动化测试现在才知道API 接口测试还能...

接口测试作为最常用的集成测试方法的一部分&#xff0c;通过直接调用被测试的接口来确定系统在功能性、可靠性、安全性和性能方面是否能达到预期&#xff0c;有些情况是功能测试无法覆盖的&#xff0c;所以接口测试是非常必要的。首先需要对接口测试的基本信息做一些了解&#…

Linux如何安装BeyondCompare

博客主页&#xff1a;https://tomcat.blog.csdn.net 博主昵称&#xff1a;农民工老王 主要领域&#xff1a;Java、Linux、K8S 期待大家的关注&#x1f496;点赞&#x1f44d;收藏⭐留言&#x1f4ac; 目录安装yumtar.gz使用示例BeyondCompare是一款广受好评的文本对比工具。本…

文件上传漏洞渗透与攻防(一)

目录 前言 文件上传漏洞原理 Webshell介绍 一句话木马&#xff1a; 小马&#xff1a; 大马&#xff1a; Webshell集合&#xff1a; 网站控制工具 文件上传漏洞危害 文件上传漏洞靶场练习 Pass-01 Pass-02 Pass-03 Pass-04 Pass-06 Pass-07 Pass-08 Pass-09 Pass-10 Pas…

Java并发编程(二)

线程方法 API Thread 类 API&#xff1a; 方法说明public void start()启动一个新线程&#xff0c;Java虚拟机调用此线程的 run 方法public void run()线程启动后调用该方法public void setName(String name)给当前线程取名字public void getName()获取当前线程的名字 线程存…

实战演练 | 使用 Navicat Premium 自动运行数据库复制

与同步&#xff08;使两个数据库的模式和数据同步的一次性过程&#xff09;不同&#xff0c;复制是一个连续&#xff08;自动&#xff09;在两个数据库之间重现数据的过程&#xff08;尽管模式更新也是可能的&#xff09;。复制可以异步完成&#xff0c;因此不需要永久连接两个…

【Lniux】目录的权限,默认权限,粘滞位详细讲解

大家好&#xff0c;今天详细讲解一些关于目录权限的细节 很多细节都是通过问答方式&#xff0c;希望大家可以先自己思考一下答案然后再听我的分析 欢迎指正错误&#xff0c;我们共同成长 目录 1.目录的权限 2.默认权限 3.粘滞位 1.目录的权限 如果我们要进图一个目录只需要…

ArcGIS基础实验操作100例--实验25统一多分辨率栅格数据

本实验专栏来自于汤国安教授《地理信息系统基础实验操作100例》一书 实验平台&#xff1a;ArcGIS 10.6 实验数据&#xff1a;请访问实验1&#xff08;传送门&#xff09; 基础编辑篇--实验25 统一多分辨率栅格数据 目录 一、实验背景 二、实验数据 三、实验步骤 &#xff0…

springboot admin-server的使用

指标监控可视化文档&#xff1a; 用于管理 Spring Boot 应用程序的管理 UI Spring Boot Admin Reference Guide 一、创建项目 就勾选Spring Web项目即可 二、基础设置 (1) 依赖引入 <dependency><groupId>de.codecentric</groupId><artifactId>sp…

Android: Binder: 彻底顿悟Android Binder

Binder机制可谓是Android 知识体系的重中之中&#xff0c;作为偏底层的基础组件&#xff0c;平时我们很少关注它&#xff0c;但是它却无处不在&#xff0c;这也是android面试考察点之一&#xff0c;本篇将从流程上将Binder通信过一遍。 文章目录 1&#xff1a;Binder作用 2&…

STM32F7-Discovery使用ITM作为调试工具

关于代码的调试手段&#xff0c;我在自己的一篇文章(http://bbs.ickey.cn/index.php?appgroup&actopic&id54944链接中的《STM32F030 Nucleo-开发调试的经验USART的重要性.pdf》)中已经详细谈到&#xff0c;为什么在调试中我们通常使用J-Link或ULINK或ST-Link(ST)或Ope…

机器学习——细节补充

1.matplotlib与seaborn的区别 来源&#xff1a;https://geek-docs.com/matplotlib/matplotlib-ask-answer/difference-between-matplotlib-and-seaborn.html 2.%matplotlib inline使图片嵌入notebook&#xff0c;而不需要使用show()方法 3.IPython与python&#xff1a;IPyth…

中小企业如何选择进销存软件?

企业信息化转型趋势的推动&#xff0c;让很多中小企业也开启了转型的探索。对于企业&#xff0c;一款合适的进销存管理软件&#xff0c;绝对是转型之路上的必备工具&#xff0c;可以帮助企业对经营中的采购、库存、销售等环节进行有效管理监督。 目前&#xff0c;市面上的各种…

three.js 的渲染结构

理解three.js 的渲染结构 1 three.js 的渲染 Three.js 封装了场景、灯光、阴影、材质、纹理和三维算法&#xff0c;让你不必再直接用WebGL 开发项目。three.js 在渲染三维场景时&#xff0c;需要创建很多对象&#xff0c;并将它们关联在一起。 下图便是一个基本的three.js 渲…

Python通知Epic白嫖游戏信息

每周都有免费游戏 - Epic Games 近期看到Epic在送游戏&#xff0c;目前每周都会有活动白嫖。 身为白嫖党&#xff0c;肯定要操作一下。 游戏列表&#xff1a;Epic Games Store 每周免费游戏&#xff08;331&#xff09; | indienova GameDB 游戏库 大致思路&#xff1a; 1、…

把teamtalk中的网络库(netlib)拆出来单独测试实现双工通信效果

这篇文章的基础是上一篇对于将teamtalk中的线程池&#xff0c;连接池单独拆出来的讲解 不是说这个网络库会依赖线程池&#xff0c;连接池&#xff0c;而是上一篇文章中讲了一些base目录中的文件&#xff0c;并且这个网络库会依赖一些base目录里的文件&#xff0c; 文末会将所有…

基于fpga的自动售货机(三段式状态机)

目录 1、VL38 自动贩售机1 题目介绍 思路分析 代码实现 仿真文件 2、VL39 自动贩售机2 题目介绍&#xff1a; 题目分析 代码实现 仿真文件 3、状态机基本知识 1、VL38 自动贩售机1 题目介绍 设计一个自动贩售机&#xff0c;输入货币有三种&#xff0c;为0.5/1/2元&…

JS概览 (JS基础 DOM BOM)

目录 JavaScript JS基础 JS数据类型 函数 变量的作用域 作用域链 预解析 DOM DOM树 获取元素的方法 事件高级 注册和解绑事件 DOM事件流 BOM 和DOM的区别 window 对象的常见事件 window.onload JS执行机制 具体的执行流程 例子 JavaScript JS基础 JS数据类…

鉴源论坛 · 观模丨基于AUTOSAR的TTCAN通信协议的形式化建模与分析

作者 | 郭建 上海控安可信软件创新研究院特聘专家 版块 | 鉴源论坛 观模 汽车工业发展至今&#xff0c;硬件方面如车身材料、发动机等已无太大升值空间&#xff0c;而汽车电子则有着广阔的前景。为此各大汽车厂商对汽车电子的研究都投入了大量的人力财力。2003 年&#xff0c…

链式二叉树的代码总结

今天我带来链式二叉树的代码总结。 目录前言链式二叉树代码实现的五个文档二叉树的例子前序遍历中序遍历后序遍历层序遍历求结点个数的函数求叶子的个数的函数求k层结点个数的函数查找某一个值的函数求二叉树高度的函数判断二叉树是否是完全二叉树的函数开辟二叉树结点的函数销…