用winform实现一个B/S代码更新打包工具
一个.net程序员必须拥有的能力就是可以随时随地写出一个自己需要的小工具,于是记录一下我的个人工具吧。
新建一个窗体应用项目,代码如下:
namespace 打包工具
{
partial class 代码打包工具
{
/// <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()
{
System.Windows.Forms.Label label2;
System.Windows.Forms.Label label5;
System.Windows.Forms.Label label6;
this.panel2 = new System.Windows.Forms.Panel();
this.Package_Btn = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.AsOfTheDate = new System.Windows.Forms.DateTimePicker();
this.panel3 = new System.Windows.Forms.Panel();
this.Show_Box = new System.Windows.Forms.RichTextBox();
this.OpenFileUrl = new System.Windows.Forms.TextBox();
this.OpenFile_Btn = new System.Windows.Forms.Button();
this.OpenPackageFileUrl = new System.Windows.Forms.TextBox();
this.PackageOpen_Btn = new System.Windows.Forms.Button();
this.IgnoreDic = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.IgnoreFormate = new System.Windows.Forms.TextBox();
this.Refresh_btn = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
label2 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
label6 = new System.Windows.Forms.Label();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// label2
//
label2.AutoSize = true;
label2.Location = new System.Drawing.Point(, );
label2.Name = "label2";
label2.Size = new System.Drawing.Size(, );
label2.TabIndex = ;
label2.Text = "忽略文件夹:";
//
// label5
//
label5.AutoSize = true;
label5.Location = new System.Drawing.Point(, );
label5.Name = "label5";
label5.Size = new System.Drawing.Size(, );
label5.TabIndex = ;
label5.Text = "忽略文件格式:";
//
// label6
//
label6.AutoSize = true;
label6.Font = new System.Drawing.Font("新宋体", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
label6.Location = new System.Drawing.Point(, );
label6.Name = "label6";
label6.Size = new System.Drawing.Size(, );
label6.TabIndex = ;
label6.Text = "忽略文件夹和格式请用,(英文逗号)隔开";
//
// panel2
//
this.panel2.Controls.Add(this.Package_Btn);
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.AsOfTheDate);
this.panel2.Location = new System.Drawing.Point(, );
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(, );
this.panel2.TabIndex = ;
//
// Package_Btn
//
this.Package_Btn.BackColor = System.Drawing.Color.Red;
this.Package_Btn.Cursor = System.Windows.Forms.Cursors.Hand;
this.Package_Btn.Enabled = false;
this.Package_Btn.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
this.Package_Btn.ForeColor = System.Drawing.SystemColors.Control;
this.Package_Btn.Location = new System.Drawing.Point(, );
this.Package_Btn.Name = "Package_Btn";
this.Package_Btn.Size = new System.Drawing.Size(, );
this.Package_Btn.TabIndex = ;
this.Package_Btn.Text = "打包";
this.Package_Btn.UseVisualStyleBackColor = false;
this.Package_Btn.Click += new System.EventHandler(this.Package_Btn_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(, );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(, );
this.label1.TabIndex = ;
this.label1.Text = "打包时间:";
//
// AsOfTheDate
//
this.AsOfTheDate.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.AsOfTheDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.AsOfTheDate.Location = new System.Drawing.Point(, );
this.AsOfTheDate.Name = "AsOfTheDate";
this.AsOfTheDate.Size = new System.Drawing.Size(, );
this.AsOfTheDate.TabIndex = ;
//
// panel3
//
this.panel3.Controls.Add(this.Show_Box);
this.panel3.Location = new System.Drawing.Point(, );
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(, );
this.panel3.TabIndex = ;
//
// Show_Box
//
this.Show_Box.Dock = System.Windows.Forms.DockStyle.Fill;
this.Show_Box.Location = new System.Drawing.Point(, );
this.Show_Box.Name = "Show_Box";
this.Show_Box.Size = new System.Drawing.Size(, );
this.Show_Box.TabIndex = ;
this.Show_Box.Text = "";
//
// OpenFileUrl
//
this.OpenFileUrl.Location = new System.Drawing.Point(, );
this.OpenFileUrl.Name = "OpenFileUrl";
this.OpenFileUrl.ReadOnly = true;
this.OpenFileUrl.Size = new System.Drawing.Size(, );
this.OpenFileUrl.TabIndex = ;
//
// OpenFile_Btn
//
this.OpenFile_Btn.Location = new System.Drawing.Point(, );
this.OpenFile_Btn.Name = "OpenFile_Btn";
this.OpenFile_Btn.Size = new System.Drawing.Size(, );
this.OpenFile_Btn.TabIndex = ;
this.OpenFile_Btn.Text = "…";
this.OpenFile_Btn.UseVisualStyleBackColor = true;
this.OpenFile_Btn.Click += new System.EventHandler(this.OpenFile_Btn_Click);
//
// OpenPackageFileUrl
//
this.OpenPackageFileUrl.Location = new System.Drawing.Point(, );
this.OpenPackageFileUrl.Name = "OpenPackageFileUrl";
this.OpenPackageFileUrl.ReadOnly = true;
this.OpenPackageFileUrl.Size = new System.Drawing.Size(, );
this.OpenPackageFileUrl.TabIndex = ;
//
// PackageOpen_Btn
//
this.PackageOpen_Btn.Location = new System.Drawing.Point(, );
this.PackageOpen_Btn.Name = "PackageOpen_Btn";
this.PackageOpen_Btn.Size = new System.Drawing.Size(, );
this.PackageOpen_Btn.TabIndex = ;
this.PackageOpen_Btn.Text = "…";
this.PackageOpen_Btn.UseVisualStyleBackColor = true;
this.PackageOpen_Btn.Click += new System.EventHandler(this.PackageOpen_Btn_Click);
//
// IgnoreDic
//
this.IgnoreDic.Location = new System.Drawing.Point(, );
this.IgnoreDic.Name = "IgnoreDic";
this.IgnoreDic.Size = new System.Drawing.Size(, );
this.IgnoreDic.TabIndex = ;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(, );
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(, );
this.label3.TabIndex = ;
this.label3.Text = "打包文件夹:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(, );
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(, );
this.label4.TabIndex = ;
this.label4.Text = "结果文件夹:";
//
// IgnoreFormate
//
this.IgnoreFormate.Location = new System.Drawing.Point(, );
this.IgnoreFormate.Name = "IgnoreFormate";
this.IgnoreFormate.Size = new System.Drawing.Size(, );
this.IgnoreFormate.TabIndex = ;
//
// Refresh_btn
//
this.Refresh_btn.Location = new System.Drawing.Point(, );
this.Refresh_btn.Name = "Refresh_btn";
this.Refresh_btn.Size = new System.Drawing.Size(, );
this.Refresh_btn.TabIndex = ;
this.Refresh_btn.Text = "更新配置";
this.Refresh_btn.UseVisualStyleBackColor = true;
this.Refresh_btn.Click += new System.EventHandler(this.Refresh_btn_Click);
//
// panel1
//
this.panel1.Controls.Add(label6);
this.panel1.Controls.Add(this.Refresh_btn);
this.panel1.Controls.Add(this.IgnoreFormate);
this.panel1.Controls.Add(this.OpenFileUrl);
this.panel1.Controls.Add(label5);
this.panel1.Controls.Add(this.OpenFile_Btn);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.OpenPackageFileUrl);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.PackageOpen_Btn);
this.panel1.Controls.Add(this.IgnoreDic);
this.panel1.Controls.Add(label2);
this.panel1.Location = new System.Drawing.Point(, );
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(, );
this.panel1.TabIndex = ;
//
// 代码打包工具
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Name = "代码打包工具";
this.Text = "代码打包工具 By 余承浩";
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false); } #endregion private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button Package_Btn;
private System.Windows.Forms.DateTimePicker AsOfTheDate;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.RichTextBox Show_Box;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox OpenFileUrl;
private System.Windows.Forms.Button OpenFile_Btn;
private System.Windows.Forms.TextBox OpenPackageFileUrl;
private System.Windows.Forms.Button PackageOpen_Btn;
private System.Windows.Forms.TextBox IgnoreDic;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox IgnoreFormate;
private System.Windows.Forms.Button Refresh_btn;
private System.Windows.Forms.Panel panel1;
}
}
逻辑代码如下:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using 打包工具.Util; namespace 打包工具
{
public partial class 代码打包工具 : Form
{
/// <summary>
/// 打包文件存储位置
/// </summary>
private static string OpenPackageFolder = string.Empty;
/// <summary>
/// 需打包文件位置
/// </summary>
private static string PackageFolder = string.Empty;
/// <summary>
/// 不参与打包的文件格式
/// </summary>
private static string noPackageFormatListStr = string.Empty;
/// <summary>
/// 不参与打包的文件夹
/// </summary>
private static string noPackageDicListStr = string.Empty;
/// <summary>
/// 不参与打包的文件格式列表
/// </summary>
private static List<string> noPackageFormatList = new List<string>();
/// <summary>
/// 不参与打包的文件夹列表
/// </summary>
private static List<string> noPackageDicList = new List<string>();
public 代码打包工具()
{
InitializeComponent();
GetAllConfig();
this.OpenFileUrl.Text = PackageFolder;
this.OpenPackageFileUrl.Text = OpenPackageFolder;
this.IgnoreDic.Text = noPackageDicListStr;
this.IgnoreFormate.Text = noPackageFormatListStr;
if (!string.IsNullOrEmpty(OpenPackageFolder))
{
Package_Btn.Enabled = true;
Package_Btn.BackColor = System.Drawing.Color.Green;
}
}
private void GetAllConfig() {
var configJson = Config.GetConfig();
OpenPackageFolder = configJson.OpenPackageFolder;
PackageFolder = configJson.PackageFolder;
noPackageFormatListStr = configJson.noPackageFormatList;
noPackageDicListStr = configJson.noPackageDicList;
noPackageFormatList = noPackageFormatListStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
noPackageDicList = noPackageDicListStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
/// <summary>
/// 选择需要打包的文件夹
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OpenFile_Btn_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.ShowNewFolderButton = true;
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.OpenFileUrl.Text = dialog.SelectedPath;
PackageFolder = dialog.SelectedPath;
ShowTime_Box("成功获取打包文件夹。");
if (!string.IsNullOrEmpty(OpenPackageFolder))
{
Package_Btn.Enabled = true;
Package_Btn.BackColor = System.Drawing.Color.Green;
} }
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PackageOpen_Btn_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.ShowNewFolderButton = true;
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.OpenPackageFileUrl.Text = dialog.SelectedPath;
OpenPackageFolder = dialog.SelectedPath;
ShowTime_Box("成功获取打包后保存文件夹。");
if (!string.IsNullOrEmpty(PackageFolder))
{
Package_Btn.Enabled = true;
Package_Btn.BackColor = System.Drawing.Color.Green;
}
}
}
private void Package_Btn_Click(object sender, EventArgs e)
{
var date = AsOfTheDate.Value;
ShowTime_Box("正在打包,请稍后……");
CopyDirectory(PackageFolder,OpenPackageFolder, date);
ShowTime_Box("打包完成。");
} public void ShowTime_Box(string msg)
{
Invoke(new Action(delegate {
Show_Box.AppendText(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\r\n" + msg + "\r\n");
Show_Box.Focus();//获取焦点
Show_Box.Select(Show_Box.TextLength, );//光标定位到文本最后
Show_Box.ScrollToCaret();//滚动到光标处
}));
}
/// <summary>
/// 打包文件方法
/// </summary>
/// <param name="srcPath">打包路径</param>
/// <param name="destPath">更新包路径</param>
/// <param name="date">筛选时间</param>
public static void CopyDirectory(string srcPath, string destPath,DateTime date)
{
try
{
var dir = new DirectoryInfo(srcPath);
var fileinfo = dir.GetFileSystemInfos(); //获取目录下(不包含子目录)的文件和子目录
foreach (FileSystemInfo i in fileinfo)
{
if (i is DirectoryInfo) //判断是否文件夹
{
if (!noPackageDicList.Contains(i.Name))
{
var iDir = i as DirectoryInfo;
long len = ;
foreach (var ilen in iDir.GetDirectories())
{
CopyDirectory(ilen.FullName, ilen.FullName.Replace(srcPath, destPath), date); //递归调用复制子文件夹
}
foreach (var ilen in iDir.GetFiles())
{
if (!noPackageFormatList.Contains(ilen.Extension.ToLower()) && date <= ilen.LastWriteTime)
len += ilen.Length;
}
if (len > )
{
if (!Directory.Exists(destPath + "\\" + i.Name))
{
Directory.CreateDirectory(destPath + "\\" + i.Name); //目标目录下不存在此文件夹即创建子文件夹
}
CopyDirectory(i.FullName, destPath + "\\" + i.Name, date); //递归调用复制子文件夹
}
} }
else
{
if (!noPackageFormatList.Contains(i.Extension.ToLower()) && date <= i.LastWriteTime)
{
if (!Directory.Exists(destPath))
{
Directory.CreateDirectory(destPath); //目标目录下不存在此文件夹即创建子文件夹
}
File.Copy(i.FullName, destPath + "\\" + i.Name, true); //不是文件夹即复制文件,true表示可以覆盖同名文件
}
}
}
}
catch (Exception e)
{
throw;
}
}
private void Refresh_btn_Click(object sender, EventArgs e)
{
Config.ModifeConfig(new ConfigJson {
OpenPackageFolder= this.OpenPackageFileUrl.Text,
PackageFolder = this.OpenFileUrl.Text,
noPackageFormatList = this.IgnoreFormate.Text,
noPackageDicList = this.IgnoreDic.Text,
});
GetAllConfig();
ShowTime_Box("更新成功。");
}
}
}
一些相关的Util.Config工具类代码如下:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json; namespace 打包工具.Util
{
public class Config
{
private static string urlConfig = "../../Config.json";
/// <summary>
/// 根据Key修改Value
/// </summary>
/// <param name="key">要修改的Key</param>
/// <param name="value">要修改为的值</param>
public static void SetValue(string key, string value)
{
System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
xDoc.Load("../../App.config");
System.Xml.XmlNode xNode;
System.Xml.XmlElement xElem1;
System.Xml.XmlElement xElem2;
xNode = xDoc.SelectSingleNode("//appSettings");
xElem1 = (System.Xml.XmlElement)xNode.SelectSingleNode("//add[@key='" + key + "']");
if (xElem1 != null) xElem1.SetAttribute("value", value);
else
{
xElem2 = xDoc.CreateElement("add");
xElem2.SetAttribute("key", key);
xElem2.SetAttribute("value", value);
xNode.AppendChild(xElem2);
}
xDoc.Save("../../App.config");
}
/// <summary>
/// 获取配置信息
/// </summary>
/// <returns></returns>
public static ConfigJson GetConfig() {
StreamReader file = File.OpenText(urlConfig);
var Json = file.ReadToEnd();
file.Dispose();
return Json == null ? null : JsonConvert.DeserializeObject<ConfigJson>(Json);
}
/// <summary>
/// 修改配置信息
/// </summary>
/// <returns></returns>
public static void ModifeConfig(ConfigJson configJson)
{
var configJsonStr = JsonConvert.SerializeObject(configJson);
FileStream fs = new FileStream(urlConfig, FileMode.OpenOrCreate);
StreamReader sr = new StreamReader(fs, Encoding.GetEncoding("GB2312"));
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
sw.Write(configJsonStr); //这里是写入的内容
sw.Flush();
sw.Close();
sr.Close();
}
}
public class ConfigJson
{
/// <summary>
/// 打包文件存储位置
/// </summary>
public string OpenPackageFolder { set; get; }
/// <summary>
/// 需打包文件位置
/// </summary>
public string PackageFolder { set; get; }
/// <summary>
/// 不参与打包的文件格式
/// </summary>
public string noPackageFormatList { set; get; }
/// <summary>
/// 不参与打包的文件夹
/// </summary>
public string noPackageDicList { set; get; }
}
}
其中相关的配置项使用的是json文件,格式如下:
{
"OpenPackageFolder": "C",
"PackageFolder": "D",
"noPackageFormatList": ".config,.csproj,.cs,.pdb,.user,.sln",
"noPackageDicList": ".svn,.nuget,.vs,obj"
}
最开始的版本思路是筛选所有的符合条件的文件夹并复制到目标文件夹内,等所有的复制工作完成之后,再遍历目标文件夹并删除空的文件夹。后来想了一下,可能会误删文件,导致一些不好的后果;于是改变思路,每次复制文件夹之前先判断该文件夹符合条件的文件大小是否为0,为0则不复制该文件夹,这样就避免了删除的操作。
用winform实现一个B/S代码更新打包工具的更多相关文章
- doctest --- 一个改善python代码质量的工具
[简介] 说实话吧,之前一直没有怎么重视给自己的代码加上测试逻辑:也就是说我只是写了代码,但是并没有给自己的代码加上测试代码: 整个过程就是写完后自己测试一下,看一下跑出来的结果是正确的就心满意足了. ...
- linux 代码更新-打包-重启脚本
#! /bin/sh base=/home/project/myblog cd $base git pull ] then echo "Error in git pull!!! Stop d ...
- Snippet Compiler——代码段编译工具
原文地址:http://www.cnblogs.com/conexpress/archive/2011/07/24/2115308.html 不知道大家在工作中是否遇到过下面的情况:在项目中实现了一段 ...
- Linux下9种优秀的代码比对工具推荐
大家好,我是良许. 在我们编写代码的时候,我们经常需要知道两个文件之间,或者同一个文件不同版本之间有什么差异性.在 Windows 下有个很强大的工具叫作 BeyondCompare ,那在 Linu ...
- Winform(C#.NET)自动更新组件的使用及部分功能实现
声明:核心功能的实现是由园子里圣殿骑士大哥写的,本人是基于他核心代码,按照自己需求进行修改的. 而AutoUpdaterService.xml文件生成工具是基于评论#215楼 ptangbao的代 ...
- WinForm应用程序中实现自动更新功能
WinForm应用程序中实现自动更新功能 编写人:左丘文 2015-4-20 近来在给一客户实施ECM系统,但他们使用功能并不是我们ECM制造版提供的标准功能,他们要求对系统作一些定制功能,为了避免因 ...
- 关于Winform 2.0以后多线程不能更新UI的办法
DotNet 2.0以后Winform在多线程Debug模式下更新UI会报这个错: 线程间操作无效: 从不是创建控件"XXX"的线程访问它. 解决办法如下: 1.在Winform的 ...
- Unity手游之路<十三>手游代码更新策略探讨
http://blog.csdn.net/janeky/article/details/25923151 这几个月公司项目非常忙,加上家里事情也多,所以blog更新一直搁置了.最近在项目开发上线过程中 ...
- android开发之在activity中控制另一个activity的UI更新
转自:http://blog.csdn.net/jason0539/article/details/18075293 第一种方法: 遇到一个问题,需要在一个activity中控制另一个acitivit ...
随机推荐
- shell脚本备份当前日期文件
#!/bin/bash #一月前 historyTime=$(date "+%Y-%m-%d %H" -d '1 month ago') echo ${historyTime} h ...
- ora-01578
SQL> exec DBMS_STATS.GATHER_DATABASE_STATS; BEGIN DBMS_STATS.GATHER_DATABASE_STATS; END; * ERROR ...
- 编译原理 DFA(确定性有穷自动机)&& NFA(非确定性有穷自动机)
https://www.cnblogs.com/fpcbk/p/11004913.html
- Go项目的测试代码2(项目运用)
上一篇文章介绍了最基本的测试代码的写法.Go项目的测试代码(基础) 这里简单的共享一下我在项目中使用的方式. 项目结构 我们实际项目中, 结构简单地分了控制层controllers和模块层models ...
- RDS数据库全量恢复方案
一.全量恢复 恢复最近的快照,将快找之前的数据全量恢复 二.增量恢复 下载对应的binlog日志导入到数据库 三.还没有备份的binlog日志获取方法 首先连接 RDS for MySQL 后查看当前 ...
- 错误代码 2003不能连接到MySQL服务器在*.*.*.*(10061)
错误代码 2003不能连接到MySQL服务器在*.*.*.*(10061) 错误代码 2003不能连接到MySQL服务器在*.*.*.*(10061)哪位大侠知道怎么解决啊? 在线等!!! [[i] ...
- JavaScript中原型链存在的问题解析
我们知道使用原型链实现继承是一个goodway:)看个原型链继承的例子. function A () { this.abc = 44; } A.prototype.getAbc = function ...
- Jsp +Js + Jquery + EasyUI + Servlet + Lucene,完成分页
package loaderman.fy.action; import java.io.IOException; import java.io.PrintWriter; import java.uti ...
- Java相关框架概念以及思想
1.什么是IoC Ioc—Inversion of Control,即“控制反转”,是一种思想, 一个重要的面向对象编程的法则,它能指导我们如何设计出松耦合.更优良的程序. 高内聚低耦合的设计能够让构 ...
- 用Python计算三角函数之acos()方法的使用
用Python计算三角函数之acos()方法的使用 acos()方法返回x的反余弦值,以弧度表示. 语法 以下是acos()方法的语法: acos(x) 注意:此函数是无法直接访问的,所以我们 ...