锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 鍦ㄦ墦鍖呮椂榪愯濡備笅鐨勬壒澶勭悊鏂囦歡灝變細鑷姩鐢熸垚鎴栬呮洿鏂皏ersion.h pause
' 鏇存敼鎵鏈夎祫婧愮殑杈撳嚭璺緞
2
3
' get folder path
4
scriptName = wscript.scriptfullname
5
scriptPath = Left(scriptName, instrRev(scriptName, "\"))
6
scriptPath = Left(scriptPath, Len(scriptPath) -1)
7
scriptPath = Left(scriptPath, instrRev(scriptPath,"\"))
8
folderPath = scriptPath & "Loc\"
9
10
' create filesystemobject activex object
11
Set fso = CreateObject("Scripting.FileSystemObject")
12
Set fol = fso.GetFolder(folderPath)
13
14
' visit each file which in the folder
15
fileshortName = ""
16
Set fileArr = fol.Files
17
For each fil in fileArr
18
fileName = fil.name
19
If LCase(Right(fileName, 7)) = ".vcproj" Then
20
fileshortName = Left(fileName,Len(fileName) - 7)
21
If LCase(Right(fileshortName, 4)) <> "_enu" Then
22
modifyResource fil.path,status
23
If status =False Then
24
errlist = errlist & fil.Path & vbCr
25
End If
26
End If
27
End If
28
Next
29
30
' Tip when complete the work
31
If Len(errlist) > 0 Then
32
MsgBox errlist & "Can not modify"
33
Else
34
MsgBox "modify successfully"
35
End If
36
37
' modify the resource project setting.
38
Function modifyResource(filePath,status)
39
On Error Resume Next
40
41
resLanguage = UCase(Right(fileshortName, 3))
42
43
' Read Content
44
Set fRead = fso.opentextfile(filePath, 1)
45
fContent = fRead.readAll
46
fRead.close
47
48
' Replace each output file
49
changed = False
50
Set regEx = New RegExp
51
regEx.pattern = "\bOutputFile=.+"
52
regEx.Global = True
53
Set matches = regEx.Execute(fContent)
54
Set childReg = New RegExp
55
For Each match in matches
56
If LCase(Right(match.Value, 9)) <> "\loc.dll""" Then
57
tmpValue = match.Value
58
childReg.pattern = tmpValue
59
If instrRev(tmpValue, "\")>0 Then
60
tmpValue = Left(tmpValue, instrRev(tmpvalue, "\"))
61
ElseIf instrRev(tmpValue,"/") > 0 Then
62
tmpValue = Left(tmpValue,instrRev(tmpValue,"/"))
63
End If
64
tmpValue = tmpValue & resLanguage & "\loc.dll"""
65
childMatches = childReg.Execute(fContent)
66
' fContent = childReg.Replace(fContent, tmpValue)
67
fContent = Replace(fContent, match.Value, tmpValue)
68
changed = True
69
End If
70
Next
71
72
' write back
73
If changed=True Then
74
Set fWrite = fso.opentextfile(filePath, 2, False)
75
fWrite.Write fContent
76
fWrite.close
77
End If
78
' clear error
79
If Not err.number = 0 Then
80
err.clear
81
status = False
82
Else
83
status = True
84
End If
85
End Function
榪愯緇撴灉絎﹀悎鎴戜滑鐨勮姹傘?br> 鐢╱ltraEdit鎵撳紑鏂囦歡鏃訛紝浼氭彁紺烘槸鍚﹁杞崲鎴怐OS鏂囦歡鏍煎紡錛屼絾鍦ㄨ漿鎹㈠墠鐢╱ltraEdit鎵撳紑涓嶄細鍑虹幇榪欑闂銆傞棶棰樺嚭鍦ㄥ摢鍎垮憿錛熻繖榪樺緱浠嶥OS鏂囦歡涓庨潪DOS鏂囦歡鏍煎紡鐨勫尯鍒垎鏋愶紝榪欎袱縐嶆枃浠剁殑宸埆灝辨槸涓浜涙帶鍒剁涓嶅悓錛屽DOS鏄敤\r\n鏉ユ崲琛岋紝鑰孶nix鏄敤\n鏉ユ崲琛屻傛湁浜嗚繖涓垎鏋愶紝灝辯煡閬撻棶棰樺嚭鍦ㄥ摢浜嗐傚師鍥犳槸姝e垯琛ㄨ揪寮?br>regEx.pattern = "\bOutputFile=.+"榪欎釜琛ㄨ揪寮忔妸鍚庨潰鐨?\r"涔熷尮閰嶈繘鍘諱簡錛岃屽悗鏉ラ殢鐫鏇挎崲瀛楃涓叉椂鑰屾秷澶變簡銆傛墍浠ヤ笂闈㈢殑姝e垯搴斿啓鎴恟egEx.pattern = "\bOutputFile=.+"""銆傛敼濂戒箣鍚庤繍琛岋紝鍐嶇敤ultraEdit鎵撳紑涓嶄細鍑虹幇榪欎釜鎻愮ず浜嗐?
//Version.h
#define SHADOW_MAJOR_VERSION 4
#define SHADOW_MINOR_VERSION 5
#define SHADOW_BETA_MAJOR_VERSION 7
#define SHADOW_BETA_MINOR_VERSION 155
#define SHADOW_VERSION "4.5.7.155"
#define SHADOW_REVISION "0"
鍦╲ersion.rc涓紝鍖呭惈Version.h騫舵妸鐩稿簲鐨勭増鏈俊鎭敤涓婇潰鐨凷HADOW_REVISION鍙?SHADOW_VERSION璧嬪?br>
' Set the revision for the application
2
'
3
4
' Get File path
5
scriptName = wscript.scriptfullname
6
scriptPath = Left(scriptName, instrRev(scriptName, "\"))
7
8
' create svn object and get the last revision
9
Set svnObj = CreateObject("SubWCRev.object")
10
svnObj.GetWCInfo scriptPath,0,0
11
versionDes = "Revision: " & svnObj.Revision & ". Date:" & svnObj.Date
12
13
' update the version.h with the lastest version
14
Set fs = CreateObject("Scripting.FileSystemObject")
15
scriptPath = Left(scriptPath, Len(scriptPath) -1)
16
slnPath = Left(scriptName, instrRev(scriptPath, "\"))
17
versionFullName = slnPath & "Version.h"
18
19
' check file valid
20
If Not fs.fileexists(versionFullName) Then
21
MsgBox "The file version.h does not exists."
22
wscript.quit
23
End If
24
25
' read content from the file
26
Set fRead = fs.OpenTextFile(versionFullName, 1)
27
fContent = fRead.ReadAll
28
fRead.close
29
30
' modify the revision value
31
Set regEx = New RegExp
32
regEx.Pattern = "#define\s+SHADOW_REVISION\s+""(.*)"""
33
Set Matches = regEx.Execute(fContent)
34
For Each Match in Matches
35
RetStr = RetStr & "Match found at position "
36
RetStr = RetStr & Match.FirstIndex & ". Match Value is '"
37
RetStr = RetStr & Match.Value & "'." & vbCRLF
38
If Match.submatches(0) = versionDes Then
39
MsgBox "The revision is already lastest"
40
wscript.quit
41
End If
42
Next
43
fContent = regEx.Replace(fContent, "#define SHADOW_REVISION """ & versionDes & """")
44
45
' Write to version.h
46
Set fWrite = fs.OpenTextFile(versionFullName, 2)
47
fWrite.Write fContent
48
fwrite.close
49
MsgBox "Update the revision successful"
鍙互鐪嬪嚭瀹炵幇璧鋒潵姣旇緝楹葷儲銆?br>榪欓噷浠嬬粛涓縐嶆柊鐨勬柟娉曘傛柊娣諱竴涓ā鏉挎枃浠訛紝鏍煎紡濡備笅銆?br>

/**//*
2
Substitution keyword file for SubWCRev (part of Tortoise SVN), to autochange version number with SVN Rev number
3
*/
4
5
#pragma once
6
7
8
#define _ProductVersion "3.0.0.1"
9
#define _FileVersion "3.2.0.$WCREV$";
10
#define _Revision "$WCREV$";
11
#define _Modified "$WCMODS?Modified:Not modified$";
12
#define _Date "$WCDATE$";
13
#define _Range "$WCRANGE$";
14
#define _Mixed "$WCMIXED?Mixed revision WC:Not mixed$";
15
#define _URL "$WCURL$";
16
#define _ProductName "Software 1.0"
17
#define _CompanyName "Company"
18
#define _FileDescription "SoftWare module"
19
#define _LegalCopyright "Company, All rights reserved."
20
#define _FileVersion_0 3
21
#define _FileVersion_1 2
22
#define _FileVersion_2 0
23
#define _FileVersion_3 $WCREV$
24
#define _ProductVersion_0 3
25
#define _ProductVersion_1 2
26
#define _ProductVersion_2 0
27
#define _ProductVersion_3 1
SubWCRev.exe ..\ SubWCRev.txt ..\version.h
mydir = "E:\klfd" ' 鎸囧畾瑕佸垹闄ゅ摢涓洰褰曚笅鐨勬枃浠?br>specifyExt = "exe,dll,ilk,pdb,obj,exp,lib,pch,res,dep,idb,manifest" '鎸囧畾瑕佸垹闄ょ殑鏂囦歡綾誨瀷錛屽彲鍗冧竾涓嶈鐢? 鍝?br>extArr = split(specifyExt, ",")
Set fs = CreateObject("scripting.filesystemobject")
Set rootFolder = fs.getfolder(mydir)
DeleteFile rootFolder
MsgBox "Delete complete"
Sub DeleteFile(myfolder)
On Error Resume Next
Set subfolders = myfolder.Subfolders
For Each Subfolder in subfolders
DeleteFile subfolder
Next
For Each strExt in extArr
strTemp = myfolder.path & "\*." & strExt
fs.deletefile strTemp, True
Next
'For each myfile in myfolder.files
' strFileExt = LCase(fs.getextensionname(myfile.name))
' For each strExt in extArr
' If strExt = strFileExt Then
' fs.deletefile myfile.path, True
' End If
' Next
'Next
End Sub
Sub LogIt(text)
If Not debugging Then Exit Sub
Set output = fs.OpenTextFile(logfile, 8, True, -2)
output.writeLine Now() & vbTab & "Information: " & text
output.close
End Sub
Microsoft corporation is proud of user account control銆?/span>It provides maximum protect ability for computer銆?/span>It is very useful for beginner and generally users錛?/span>but people that has experience is very unsuitable銆?/span>Especially program developer錛?/span>When we debug our program錛?/span>some access reject銆?/span>
We must run the executable file without debug under administrator銆?/span>At Last I can not bear it銆?/span>And I disable it銆?/span>
Method
Open Control panel and go into “user account and family safety”銆?/span>Click Change your windows password linkbutton銆?/span>Now at end of row is “Turn user Account Control on or off”.
Run msconfig.exe. and open the tools tab page. Here provide tool to disable and enable user account control.
Okay.We can change the pattern now. change it and restart computer. The annoying pop dialog about the permission go away. Oh the Sky is blue back.
Above I resolve the debug trouble. But I can not be sure that the client hate this control yet. Before We release our program, we should configure the project property to request the administrator right.
If we work under Vs2008 environment. Open the project property page,configuration properties->linker->manifest file. Here you can configurate it.
If we work under VS2005 environment. It is difficult to configuate. Follow me.
Add a xml document which comment like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
This document must is a embedded resource. And in property page specify this file as additional manifest file. build your program.
At end
function employee()

{
this.Name="zhang";
this.Birthday="2007-8-9";
}
var em=new emplyee();
var str=em.toJSONString();
/**//*************************************
*str={"Name":"zhang"}浼氭槸榪欎釜鏍峰瓙
* 浠 }鎷綇鐨勫悕縐?鍊煎
*
*************************************/
var str="zhang";
var i=67;
var strJS=str.toJSONSting();
var iJS=i.toJSONString();
/**//************************
*strJS "zhang"
*iJS=67
*
*************************/
var arr=new Array();
arr.push("a");
arr.push("b");
arr.push("c");
arr.push("d");
var arrJS=arr.toJSONString();
/**//***********************************
*arrJS :["a","b","c","d"]
*鏄互 [ ]鎷綇鐨勫兼垨鑰呭璞°?br>
***********************************
StringBuilder sb=new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.OmitXmlDeclaration = true;
settings.NewLineOnAttributes = false;
_writer = XmlWriter.Create(sb,settings);
_writer.WriteStartDocument();
_writer.WriteStartElement("ITEMS");
_writer.WriteStartElement("ITEM");
_writer.WriteAttributeString("ID","10");
_writer.WriteAttributeString("Name","PH");
_writer.WriteEndElement();
_writer.WriteFullEndElement()
//浜х敓鍑烘潵鐨勬牱瀛?br>
<ITEMS>
<ITEM ID="10" Name="PH"/>
</ITEMS>
xmlDom=new ActiveXObject("MSXML2.DOMDocument");
xmlDom.loadXML(strXml);//榪欐槸涓涓瓧絎︿覆
var root=xmlDom.selectSingleNode("ITEMS");
var items=root.selectNodes("ITEM");//鎵綬OOT涓嬫墍鏈夌殑ITEM瀛愯妭鐐廣?br>
var item=root.selectSingleNode("ITEM[@id=10]");//鍒欐槸鎵懼叾涓嬩竴涓狪TEM鍏禝D灞炴т負10浜嗐?br>
鍏充簬XQL鐨勮娉曪紝鎴戝湪鏈夌┖鏃朵細浠ヤ竴涓煭鏂囨潵璇翠竴璇寸殑浜嗐?/div>