├── .gitattributes
├── .github
└── ISSUE_TEMPLATE
│ └── config.yml
├── .gitignore
├── README.md
├── WTGA.ico
├── iTuner
├── Properties
│ └── AssemblyInfo.cs
├── UsbDisk.cs
├── UsbDiskCollection.cs
├── UsbManager.cs
├── UsbStateChange.cs
├── UsbStateChangedEventArgs.cs
├── WmiExtensions.cs
└── iTuner.csproj
├── wintogo.sln
└── wintogo
├── 2001.ico
├── App.config
├── Classes
├── FileInitialization.cs
├── GetUdiskList.cs
├── ProcessManager.cs
├── PropertyGridDialogItem.cs
├── SWOnline.cs
├── SystemSleepManagement.cs
├── TestClass.cs
├── TestConverter.cs
├── WTGSettingItems.cs
└── WriteLog.cs
├── CopyFileApi.cs
├── Core
├── BootFileOperation.cs
├── CreateMain.cs
├── DiskOperation.cs
├── DiskpartScriptManager.cs
├── DismWrapper.cs
├── FileOperation.cs
├── GoWrite.cs
├── ImageOperation.cs
├── VHDOperation.cs
└── WTGModel.cs
├── Forms
├── AboutBox.Designer.cs
├── AboutBox.cs
├── AboutBox.en.resx
├── AboutBox.resx
├── AboutBox.zh-Hant.resx
├── BenchmarkProgress.Designer.cs
├── BenchmarkProgress.cs
├── BenchmarkProgress.en.resx
├── BenchmarkProgress.resx
├── ChoosePart.Designer.cs
├── ChoosePart.cs
├── ChoosePart.en.resx
├── ChoosePart.resx
├── ChoosePart.zh-Hant.resx
├── Clone.Designer.cs
├── Clone.cs
├── Clone.resx
├── EfiSize.Designer.cs
├── EfiSize.cs
├── EfiSize.en.resx
├── EfiSize.resx
├── EfiSize.zh-Hant.resx
├── ErrorMsg.Designer.cs
├── ErrorMsg.cs
├── ErrorMsg.en-AS.resx
├── ErrorMsg.en.resx
├── ErrorMsg.resx
├── ErrorMsg.zh-Hant.resx
├── Finish.cs
├── Finish.designer.cs
├── Finish.en.resx
├── Finish.resx
├── Finish.zh-Hant.resx
├── Form1.Designer.cs
├── Form1.cs
├── Form1.en.resx
├── Form1.resx
├── Form1.zh-Hans.resx
├── Form1.zh-Hant.resx
├── FormatAlert.Designer.cs
├── FormatAlert.cs
├── FormatAlert.en.resx
├── FormatAlert.resx
├── FormatAlert.zh-Hant.resx
├── SetTempPath.Designer.cs
├── SetTempPath.cs
├── SetTempPath.en.resx
├── SetTempPath.resx
├── SetTempPath.zh-Hant.resx
├── UdiskBenchmark.Designer.cs
├── UdiskBenchmark.cs
├── UdiskBenchmark.en.resx
├── UdiskBenchmark.resx
├── Update.cs
├── Update.designer.cs
├── Update.en.resx
├── Update.resx
├── Update.zh-Hant.resx
├── Win8PB.Designer.cs
├── Win8PB.cs
├── Win8PB.resx
├── WriteProgress.Designer.cs
├── WriteProgress.cs
├── WriteProgress.en.resx
├── WriteProgress.resx
└── WriteProgress.zh-Hant.resx
├── LICENSE
├── LanguageDefault.xml
├── MultiLanguage
├── MsgManager.cs
├── ResourceLang.Designer.cs
├── ResourceLang.en.Designer.cs
├── ResourceLang.en.resx
├── ResourceLang.resx
└── ResourceLang.zh-Hant.resx
├── OldCode.cs
├── Program.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── Resources
└── WTGA.ico
├── Utility
├── BenchMark.cs
├── FileNameConverter.cs
├── FormHelper.cs
├── GetDotNetVersion.cs
├── HttpPost.cs
├── ISOHelper.cs
├── IniOperation.cs
├── StringOperation.cs
├── TakeOwn.cs
├── WebUtility.cs
└── ZipHelper.cs
├── WTGA.ico
├── WTGA.png
├── Wimapi.cs
├── app.manifest
├── copy.Designer.cs
├── copy.cs
├── copy.resx
├── wintogo.csproj
└── wintogo.idc
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Submit an issue/General Questions
4 | url: https://bbs.luobotou.org/forum-88-1.html
5 | about: Please submit any issues or ask any questions at the Luobotou IT Forum.
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | [Xx]64/
19 | [Xx]86/
20 | [Bb]uild/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 |
85 | # Visual Studio profiler
86 | *.psess
87 | *.vsp
88 | *.vspx
89 | *.sap
90 |
91 | # TFS 2012 Local Workspace
92 | $tf/
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 | *.DotSettings.user
101 |
102 | # JustCode is a .NET coding add-in
103 | .JustCode
104 |
105 | # TeamCity is a build add-in
106 | _TeamCity*
107 |
108 | # DotCover is a Code Coverage Tool
109 | *.dotCover
110 |
111 | # NCrunch
112 | _NCrunch_*
113 | .*crunch*.local.xml
114 | nCrunchTemp_*
115 |
116 | # MightyMoose
117 | *.mm.*
118 | AutoTest.Net/
119 |
120 | # Web workbench (sass)
121 | .sass-cache/
122 |
123 | # Installshield output folder
124 | [Ee]xpress/
125 |
126 | # DocProject is a documentation generator add-in
127 | DocProject/buildhelp/
128 | DocProject/Help/*.HxT
129 | DocProject/Help/*.HxC
130 | DocProject/Help/*.hhc
131 | DocProject/Help/*.hhk
132 | DocProject/Help/*.hhp
133 | DocProject/Help/Html2
134 | DocProject/Help/html
135 |
136 | # Click-Once directory
137 | publish/
138 |
139 | # Publish Web Output
140 | *.[Pp]ublish.xml
141 | *.azurePubxml
142 |
143 | # TODO: Un-comment the next line if you do not want to checkin
144 | # your web deploy settings because they may include unencrypted
145 | # passwords
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # NuGet Packages
150 | *.nupkg
151 | # The packages folder can be ignored because of Package Restore
152 | **/packages/*
153 | # except build/, which is used as an MSBuild target.
154 | !**/packages/build/
155 | # Uncomment if necessary however generally it will be regenerated when needed
156 | #!**/packages/repositories.config
157 | # NuGet v3's project.json files produces more ignoreable files
158 | *.nuget.props
159 | *.nuget.targets
160 |
161 | # Microsoft Azure Build Output
162 | csx/
163 | *.build.csdef
164 |
165 | # Microsoft Azure Emulator
166 | ecf/
167 | rcf/
168 |
169 | # Microsoft Azure ApplicationInsights config file
170 | ApplicationInsights.config
171 |
172 | # Windows Store app package directory
173 | AppPackages/
174 | BundleArtifacts/
175 |
176 | # Visual Studio cache files
177 | # files ending in .cache can be ignored
178 | *.[Cc]ache
179 | # but keep track of directories ending in .cache
180 | !*.[Cc]ache/
181 |
182 | # Others
183 | ClientBin/
184 | [Ss]tyle[Cc]op.*
185 | ~$*
186 | *~
187 | *.dbmdl
188 | *.dbproj.schemaview
189 | *.pfx
190 | *.publishsettings
191 | node_modules/
192 | orleans.codegen.cs
193 |
194 | # RIA/Silverlight projects
195 | Generated_Code/
196 |
197 | # Backup & report files from converting an old project file
198 | # to a newer Visual Studio version. Backup files are not needed,
199 | # because we have git ;-)
200 | _UpgradeReport_Files/
201 | Backup*/
202 | UpgradeLog*.XML
203 | UpgradeLog*.htm
204 |
205 | # SQL Server files
206 | *.mdf
207 | *.ldf
208 |
209 | # Business Intelligence projects
210 | *.rdl.data
211 | *.bim.layout
212 | *.bim_*.settings
213 |
214 | # Microsoft Fakes
215 | FakesAssemblies/
216 |
217 | # GhostDoc plugin setting file
218 | *.GhostDoc.xml
219 |
220 | # Node.js Tools for Visual Studio
221 | .ntvs_analysis.dat
222 |
223 | # Visual Studio 6 build log
224 | *.plg
225 |
226 | # Visual Studio 6 workspace options file
227 | *.opt
228 |
229 | # Visual Studio LightSwitch build output
230 | **/*.HTMLClient/GeneratedArtifacts
231 | **/*.DesktopClient/GeneratedArtifacts
232 | **/*.DesktopClient/ModelManifest.xml
233 | **/*.Server/GeneratedArtifacts
234 | **/*.Server/ModelManifest.xml
235 | _Pvt_Extensions
236 |
237 | # LightSwitch generated files
238 | GeneratedArtifacts/
239 | ModelManifest.xml
240 |
241 | # Paket dependency manager
242 | .paket/paket.exe
243 |
244 | # FAKE - F# Make
245 | .fake/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
Windows To Go Assistant
2 | Description of Windows To Go(WTG)
3 |
4 | "Windows To Go(WTG)" is a technology originally provided by Microsoft.
5 | It allows you to fully install Windows on portable devices such as USB flash drives, portable hard drives, etc.,
6 | and can run directly on different computer hardware, so that the system can be carried with you!
7 | It's not a WinPE, nor a simplified version, but a complete Windows operating system, which is almost the same
8 | as a normal installation.
9 |
10 | About Windows To Go Assistant(WTGA)
11 | The Windows To Go Assistant(WTGA) provides a convenient and quick method to deploy Windows To Go on USB devices. Meanwhile, our community forum
12 | can provide effective technical support.
13 |
14 | Motivation:
15 | Initially, there is no GUI tool to deploy WTG, the only way is to use Command Line until the the official WTG creation tool was built in the Enterprise edition of Windows.
16 | The official tool is simpliy and stable enough, but it lacks some custom settings. Also, there are some portable devices that do not compatible with it.
17 |
18 | Community Forum:
19 | Luobotou IT Forum(Chinese) : https://bbs.luobotou.org/
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/WTGA.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nkc3g4/wtg-assistant/b8877edf86b73886d5413b20fc0b3b5fdaa0d449/WTGA.ico
--------------------------------------------------------------------------------
/iTuner/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("iTuner")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("iTuner")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("44fa4272-a10a-46ee-8258-02097400c032")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/iTuner/UsbDisk.cs:
--------------------------------------------------------------------------------
1 | //************************************************************************************************
2 | // Copyright © 2010 Steven M. Cohn. All Rights Reserved.
3 | //
4 | //************************************************************************************************
5 |
6 | namespace iTuner
7 | {
8 | using System;
9 | using System.Text;
10 |
11 |
12 | ///
13 | /// Represents the displayable information for a single USB disk.
14 | ///
15 |
16 | public class UsbDisk:IEquatable
17 | {
18 | private const int KB = 1024;
19 | private const int MB = KB * 1024;
20 | private const int GB = MB * 1024;
21 |
22 |
23 | ///
24 | /// Initialize a new instance with the given values.
25 | ///
26 | /// The Windows drive letter assigned to this device.
27 |
28 | public UsbDisk(string name)
29 | {
30 | this.Name = name;
31 | this.Model = String.Empty;
32 | Volume = String.Empty;
33 | Index = String.Empty;
34 | this.VolumeName = String.Empty;
35 | this.FreeSpace = 0;
36 | this.Size = 0;
37 | this.DriveType = String.Empty;
38 | }
39 |
40 |
41 | ///
42 | /// Gets the available free space on the disk, specified in bytes.
43 | ///
44 |
45 | public ulong FreeSpace
46 | {
47 | get;
48 | internal set;
49 | }
50 |
51 | public string DriveType
52 | {
53 | get;
54 | internal set;
55 | }
56 | ///
57 | /// Get the model of this disk. This is the manufacturer's name.
58 | ///
59 | ///
60 | /// When this class is used to identify a removed USB device, the Model
61 | /// property is set to String.Empty.
62 | ///
63 |
64 | public string Model
65 | {
66 | get;
67 | internal set;
68 | }
69 |
70 |
71 | ///
72 | /// Gets the name of this disk. This is the Windows identifier, drive letter.
73 | ///
74 |
75 | public string Name
76 | {
77 | get;
78 | private set;
79 | }
80 |
81 |
82 | ///
83 | /// Gets the total size of the volume, specified in bytes.
84 | ///
85 |
86 | public ulong Size
87 | {
88 | get;
89 | internal set;
90 | }
91 |
92 | ///
93 | /// Gets the total size of the disk, specified in bytes.
94 | ///
95 |
96 | public ulong DiskSize
97 | {
98 | get;
99 | internal set;
100 | }
101 | ///
102 | /// Get the volume name of this disk. This is the friently name ("Stick").
103 | ///
104 | ///
105 | /// When this class is used to identify a removed USB device, the Volume
106 | /// property is set to String.Empty.
107 | ///
108 | public string Index
109 | {
110 | get;
111 | internal set;
112 | }
113 | public string Volume
114 | {
115 | get;
116 | internal set;
117 | }
118 | public string VolumeName
119 | {
120 | get;
121 | internal set;
122 | }
123 | public ulong TotalSectors
124 | {
125 | get;
126 | internal set;
127 | }
128 |
129 | ///
130 | /// Pretty print the disk.
131 | ///
132 | ///
133 |
134 | public override string ToString()
135 | {
136 |
137 | //System.Windows.Forms.MessageBox.Show(this.Model); System.Windows.Forms.MessageBox.Show("Test");
138 | if (this.Model == string.Empty)
139 | {
140 | //System.Windows.Forms.MessageBox.Show(this.Name);
141 | return this.Name;
142 | }
143 | else
144 | {
145 | StringBuilder builder = new StringBuilder();
146 | //builder.Append(Name);
147 | //builder.Append(" ");
148 | //builder.Append(" (");
149 | builder.Append(Model);
150 | //builder.Append(") ");
151 | builder.Append(" ");
152 | builder.Append(FormatByteCount(Size));
153 | builder.Append(" (");
154 | builder.Append(DriveType);
155 | builder.Append(") ");
156 | //builder.Append(" (");
157 | builder.Append(Volume);
158 | //builder.Append(VolumeName);
159 | //builder.Append(") ");
160 | return builder.ToString();
161 | }
162 | }
163 | public void SetVolume(string volume)
164 | {
165 | Volume = volume;
166 | }
167 |
168 |
169 | private string FormatByteCount(ulong bytes)
170 | {
171 | string format = null;
172 |
173 | if (bytes < KB)
174 | {
175 | format = String.Format("{0} Bytes", bytes);
176 | }
177 | else if (bytes < MB)
178 | {
179 | bytes = bytes / KB;
180 | format = String.Format("{0} KB", bytes.ToString("N"));
181 | }
182 | else if (bytes < GB)
183 | {
184 | double dree = bytes / MB;
185 | format = String.Format("{0} MB", dree.ToString("N1"));
186 | }
187 | else
188 | {
189 | double gree = bytes / GB;
190 | format = String.Format("{0} GB", gree.ToString("N1"));
191 | }
192 |
193 | return format;
194 | }
195 |
196 | public bool Equals(UsbDisk other)
197 | {
198 | if (other is null)
199 | return false;
200 |
201 | return ToString() == other.ToString();
202 | }
203 | public override bool Equals(object obj) => Equals(obj as UsbDisk);
204 | public override int GetHashCode() => ToString().GetHashCode();
205 |
206 | }
207 | }
208 |
--------------------------------------------------------------------------------
/iTuner/UsbDiskCollection.cs:
--------------------------------------------------------------------------------
1 | //************************************************************************************************
2 | // Copyright © 2010 Steven M. Cohn. All Rights Reserved.
3 | //
4 | //************************************************************************************************
5 |
6 | namespace iTuner
7 | {
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Collections.ObjectModel;
11 | using System.Linq;
12 |
13 |
14 | ///
15 | /// Maintains a collection of USB disk objects.
16 | ///
17 |
18 | public class UsbDiskCollection : ObservableCollection
19 | {
20 |
21 | ///
22 | /// Determines if the named disk is contained in this collection.
23 | ///
24 | /// The Windows name, or drive letter, of the disk to remove.
25 | ///
26 | /// True if the item is found; otherwise false.
27 | ///
28 |
29 | public bool Contains (string name)
30 | {
31 | return this.AsQueryable().Any(d => d.Name == name) == true;
32 | }
33 |
34 |
35 | ///
36 | /// Remove the named disk from the collection.
37 | ///
38 | /// The Windows name, or drive letter, of the disk to remove.
39 | ///
40 | /// True if the item is removed; otherwise false.
41 | ///
42 |
43 | public bool Remove (string name)
44 | {
45 | UsbDisk disk =
46 | (this.AsQueryable()
47 | .Where(d => d.Name == name)
48 | .Select(d => d)).FirstOrDefault();
49 |
50 | if (disk != null)
51 | {
52 | return this.Remove(disk);
53 | }
54 |
55 | return false;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/iTuner/UsbStateChange.cs:
--------------------------------------------------------------------------------
1 | //************************************************************************************************
2 | // Copyright © 2010 Steven M. Cohn. All Rights Reserved.
3 | //
4 | //************************************************************************************************
5 |
6 | namespace iTuner
7 | {
8 | using System;
9 |
10 |
11 | ///
12 | /// Specifies the various state changes for USB disk devices.
13 | ///
14 |
15 | public enum UsbStateChange
16 | {
17 |
18 | ///
19 | /// A device has been added and is now available.
20 | ///
21 |
22 | Added,
23 |
24 |
25 | ///
26 | /// A device is about to be removed;
27 | /// allows consumers to intercept and deny the action.
28 | ///
29 |
30 | Removing,
31 |
32 |
33 | ///
34 | /// A device has been removed and is no longer available.
35 | ///
36 |
37 | Removed
38 | }
39 | }
--------------------------------------------------------------------------------
/iTuner/UsbStateChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | //************************************************************************************************
2 | // Copyright © 2010 Steven M. Cohn. All Rights Reserved.
3 | //
4 | //************************************************************************************************
5 |
6 | namespace iTuner
7 | {
8 | using System;
9 |
10 |
11 | ///
12 | /// Defines the signature of an event handler method for internally handling
13 | /// USB device state changes.
14 | ///
15 | /// A description of the device state change.
16 |
17 | public delegate void UsbStateChangedEventHandler (UsbStateChangedEventArgs e);
18 |
19 |
20 | ///
21 | /// Define the arguments passed internally from the DriverWindow to the KeyManager
22 | /// handlers.
23 | ///
24 |
25 | public class UsbStateChangedEventArgs : EventArgs
26 | {
27 |
28 | ///
29 | /// Initialize a new instance with the specified state and disk.
30 | ///
31 | /// The state change code.
32 | /// The USB disk description.
33 |
34 | public UsbStateChangedEventArgs (UsbStateChange state, UsbDisk disk)
35 | {
36 | this.State = state;
37 | this.Disk = disk;
38 | }
39 |
40 |
41 | ///
42 | /// Gets the USB disk information.
43 | ///
44 |
45 | public UsbDisk Disk
46 | {
47 | get;
48 | private set;
49 | }
50 |
51 |
52 | ///
53 | /// Gets the state change code.
54 | ///
55 |
56 | public UsbStateChange State
57 | {
58 | get;
59 | private set;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/iTuner/WmiExtensions.cs:
--------------------------------------------------------------------------------
1 | //************************************************************************************************
2 | // Copyright © 2010 Steven M. Cohn. All Rights Reserved.
3 | //
4 | //************************************************************************************************
5 |
6 | namespace iTuner
7 | {
8 | using System;
9 | using System.Management;
10 |
11 |
12 | public static class WmiExtensions
13 | {
14 |
15 | ///
16 | /// Fetch the first item from the search result collection.
17 | ///
18 | ///
19 | ///
20 |
21 | public static ManagementObject First (this ManagementObjectSearcher searcher)
22 | {
23 | ManagementObject result = null;
24 | foreach (ManagementObject item in searcher.Get())
25 | {
26 | result = item;
27 | break;
28 | }
29 | return result;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/iTuner/iTuner.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}
8 | Library
9 | Properties
10 | iTuner
11 | iTuner
12 | v4.8
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | false
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 | false
34 |
35 |
36 | true
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
66 |
--------------------------------------------------------------------------------
/wintogo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30320.27
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wintogo", "wintogo\wintogo.csproj", "{15037473-35DC-4AC6-8FC5-B2B3C14D382C}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTuner", "iTuner\iTuner.csproj", "{2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|Mixed Platforms = Debug|Mixed Platforms
14 | Debug|x64 = Debug|x64
15 | Debug|x86 = Debug|x86
16 | Release|Any CPU = Release|Any CPU
17 | Release|Mixed Platforms = Release|Mixed Platforms
18 | Release|x64 = Release|x64
19 | Release|x86 = Release|x86
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Debug|Any CPU.ActiveCfg = Debug|x86
23 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
24 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Debug|Mixed Platforms.Build.0 = Debug|x86
25 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Debug|x64.ActiveCfg = Debug|x64
26 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Debug|x64.Build.0 = Debug|x64
27 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Debug|x86.ActiveCfg = Debug|x86
28 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Debug|x86.Build.0 = Debug|x86
29 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Debug|x86.Deploy.0 = Debug|x86
30 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Release|Any CPU.ActiveCfg = Release|x86
31 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Release|Mixed Platforms.ActiveCfg = Release|x86
32 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Release|Mixed Platforms.Build.0 = Release|x86
33 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Release|x64.ActiveCfg = Release|x64
34 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Release|x64.Build.0 = Release|x64
35 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Release|x86.ActiveCfg = Release|x86
36 | {15037473-35DC-4AC6-8FC5-B2B3C14D382C}.Release|x86.Build.0 = Release|x86
37 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Debug|Any CPU.Build.0 = Debug|Any CPU
39 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
40 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
41 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Debug|x64.ActiveCfg = Debug|Any CPU
42 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Debug|x64.Build.0 = Debug|Any CPU
43 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Debug|x86.ActiveCfg = Debug|Any CPU
44 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Release|Any CPU.Build.0 = Release|Any CPU
46 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
47 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Release|Mixed Platforms.Build.0 = Release|Any CPU
48 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Release|x64.ActiveCfg = Release|Any CPU
49 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Release|x64.Build.0 = Release|Any CPU
50 | {2EBFB74E-FF39-4BB0-96F7-3AF1A99B1A15}.Release|x86.ActiveCfg = Release|Any CPU
51 | EndGlobalSection
52 | GlobalSection(SolutionProperties) = preSolution
53 | HideSolutionNode = FALSE
54 | EndGlobalSection
55 | GlobalSection(ExtensibilityGlobals) = postSolution
56 | SolutionGuid = {DF8A3E71-9295-49C6-A06B-B395565E745A}
57 | EndGlobalSection
58 | EndGlobal
59 |
--------------------------------------------------------------------------------
/wintogo/2001.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nkc3g4/wtg-assistant/b8877edf86b73886d5413b20fc0b3b5fdaa0d449/wintogo/2001.ico
--------------------------------------------------------------------------------
/wintogo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/wintogo/Classes/FileInitialization.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 | using System.Windows.Forms;
9 | using System.IO.Compression;
10 |
11 |
12 | namespace wintogo
13 | {
14 |
15 | public static class FileInitialization
16 | {
17 | public static List appFileList = new List { "bootice.exe", "BitlockerConfig_x64.exe", "BitlockerConfig_x86.exe", "imagex_x86.exe", "san_policy.xml", "unattend_oobe.xml", "unattend_templete.xml", "unattend_winre.xml" };
18 | public static void FileValidation()
19 | {
20 | if (StringUtility.IsChina(WTGModel.diskpartScriptPath))
21 | {
22 | if (StringUtility.IsChina(Application.StartupPath))
23 | {
24 | Log.WriteLog("Err_IsChinaOrContainSpace", "FileValidationErr");
25 | ErrorMsg er = new ErrorMsg(MsgManager.GetResString("IsChinaMsg", MsgManager.ci), false);
26 | er.ShowDialog();
27 | Environment.Exit(0);
28 | }
29 | else
30 | {
31 | WTGModel.diskpartScriptPath = WTGModel.logPath;
32 | }
33 | }
34 | ProcessManager.SyncCMD("taskkill.exe /f /IM BOOTICE.exe");
35 | //ProcessManager.KillProcessByName("bootice.exe");
36 | //解压文件
37 | try
38 | {
39 | if (Directory.Exists(WTGModel.applicationFilesPath))
40 | {
41 | Directory.Delete(WTGModel.applicationFilesPath, true);
42 | }
43 | ZipFile.ExtractToDirectory(Application.StartupPath + "\\files.dat", WTGModel.applicationFilesPath);
44 |
45 | //ZipHelper.UnZip(Application.StartupPath + "\\files.dat", WTGModel.applicationFilesPath);
46 | }
47 | catch (Exception ex)
48 | {
49 | Log.WriteLog("Err_Unzip", ex.ToString());
50 | }
51 | //Validate Files
52 | foreach (var item in appFileList)
53 | {
54 | if (!File.Exists(WTGModel.applicationFilesPath + "\\" + item))
55 | {
56 | ErrorMsg er = new ErrorMsg(MsgManager.GetResString("Msg_FileBroken", MsgManager.ci), false);
57 | er.ShowDialog();
58 | Environment.Exit(0);
59 |
60 | }
61 | }
62 | }
63 |
64 | }
65 | public static class Config
66 | {
67 | public static string settingFilePath = Application.StartupPath + "\\settings.ini";
68 |
69 | public static void ReadConfigFile(ref bool autoCheckUpdate)
70 | {
71 |
72 | string autoup;
73 | string tp;
74 | string language;
75 | autoup = IniFile.ReadVal("Main", "AutoUpdate", settingFilePath);
76 | tp = IniFile.ReadVal("Main", "TempPath", settingFilePath);
77 | language = IniFile.ReadVal("Main", "Language", settingFilePath);
78 | if (autoup == "0") { autoCheckUpdate = false; }
79 | if (!string.IsNullOrEmpty(tp))
80 | {
81 | WTGModel.vhdTempPath = tp;
82 | }
83 | else
84 | {
85 | WTGModel.vhdTempPath = Path.GetTempPath();
86 | }
87 | if (language == "EN")
88 | {
89 | MsgManager.ci = new System.Globalization.CultureInfo("en");
90 |
91 | Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
92 |
93 | }
94 | else if (language == "ZH-HANS")
95 | {
96 | MsgManager.ci = new System.Globalization.CultureInfo("zh-cn");
97 |
98 | Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
99 |
100 | }
101 | else if (language == "ZH-HANT")
102 | {
103 | MsgManager.ci = new System.Globalization.CultureInfo("zh-Hant");
104 |
105 | Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
106 |
107 | }
108 | }
109 |
110 | }
111 |
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/wintogo/Classes/GetUdiskList.cs:
--------------------------------------------------------------------------------
1 | using iTuner;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Windows.Forms;
8 |
9 | namespace wintogo
10 | {
11 |
12 | public static class GetUdiskList
13 | {
14 | private static Thread tListUDisks;
15 | public static UsbDiskCollection diskCollection = new UsbDiskCollection();
16 |
17 | #region Udisk
18 | public delegate void OutDelegate(bool isend, object dtSource,ComboBox combobox);
19 | public static void OutText(bool isend, object dtSource, ComboBox comboBoxUd)
20 | {
21 | if (comboBoxUd.InvokeRequired)
22 | {
23 | OutDelegate outdelegate = new OutDelegate(OutText);
24 | comboBoxUd.BeginInvoke(outdelegate, new object[] { isend, dtSource, comboBoxUd });
25 | return;
26 | }
27 | comboBoxUd.DataSource = null;
28 | comboBoxUd.DataSource = dtSource;
29 |
30 | if (comboBoxUd.Items.Count != 0)
31 | {
32 | comboBoxUd.SelectedIndex = 0;
33 | }
34 | if (isend)
35 | {
36 | comboBoxUd.SelectedIndex = comboBoxUd.Items.Count - 1;
37 | }
38 | }
39 | public static List GetVolumns(UsbDisk usbDisk)
40 | {
41 | UsbManager manager = new UsbManager();
42 | return manager.GetVolumns(int.Parse(usbDisk.Index), usbDisk.Model);
43 | }
44 | private static UsbDiskCollection GetUsbDiskCollection()
45 | {
46 | UsbManager manager = new UsbManager();
47 |
48 | UsbDiskCollection usbDisks = new UsbDiskCollection();
49 | try
50 | {
51 | UsbDisk udChoose = new UsbDisk(MsgManager.GetResString("Msg_chooseud", MsgManager.ci));
52 | usbDisks.Add(udChoose);
53 | foreach (UsbDisk disk in manager.GetAvailableDisks())
54 | {
55 | usbDisks.Add(disk);
56 | }
57 | }
58 | catch (Exception ex) { Log.WriteLog("Err_GetUdiskInfo", ex.ToString()); }
59 | return usbDisks;
60 | }
61 | public static void GetUdiskInfo()
62 | {
63 |
64 | UsbManager manager = new UsbManager();
65 | try
66 | {
67 | var newDiskCollection = GetUsbDiskCollection();
68 | if (!diskCollection.SequenceEqual(newDiskCollection))
69 | {
70 | diskCollection = newDiskCollection;
71 | OutText(false, diskCollection, cbb);
72 | }
73 | }
74 | catch (Exception ex) { Log.WriteLog("Err_GetUdiskInfo", ex.ToString()); }
75 | finally
76 | {
77 | manager.Dispose();
78 | }
79 |
80 | }
81 |
82 | public static void LoadUDList(ComboBox comboBoxUd)
83 | {
84 | cbb = comboBoxUd;
85 | GetUdiskInfo();
86 | //Udlist = new Udlist();
87 | System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
88 | timer1.Enabled = true;
89 | timer1.Tick += timer1_Tick;
90 | timer1.Interval = 2000;
91 | timer1.Start();
92 | }
93 | static ComboBox cbb = null;
94 | private static void timer1_Tick(object sender, EventArgs e)
95 | {
96 | if (cbb.SelectedIndex == 0)
97 | {
98 | tListUDisks = new Thread(GetUdiskInfo);
99 | tListUDisks.Start();
100 | }
101 | }
102 | #endregion
103 | }
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/wintogo/Classes/PropertyGridDialogItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Drawing.Design;
4 | using System.Windows.Forms;
5 | using System.Windows.Forms.Design;
6 |
7 | namespace wintogo
8 | {
9 | public class PropertyGridFolderBrowserDialogItem : UITypeEditor
10 | {
11 | public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
12 | {
13 | return UITypeEditorEditStyle.Modal;
14 | }
15 |
16 | public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
17 |
18 | {
19 | IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
20 | if (edSvc != null)
21 | {
22 | // 可以打开任何特定的对话框
23 | FolderBrowserDialog dialog = new FolderBrowserDialog();
24 | if (dialog.ShowDialog().Equals(DialogResult.OK))
25 | {
26 | return dialog.SelectedPath;
27 | //if (dialog.SelectedPath.Length != 3)
28 | //{
29 | // MessageBox.Show(MsgManager.GetResString("Msg_UDRoot", MsgManager.ci));
30 | // return string.Empty;
31 | //}
32 | //else
33 | //{
34 | // return dialog.SelectedPath;
35 | //}
36 | }
37 | }
38 | return value;
39 | }
40 |
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/wintogo/Classes/SystemSleepManagement.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 |
7 | namespace wintogo.Forms
8 | {
9 |
10 | class SystemSleepManagement
11 | {
12 | //定义API函数
13 | ///
14 | /// 它就一个flags参数,这个参数有三个选项,可以组合使用。主要说明如下:
15 | /// 只使用Continus参数时,则是恢复系统休眠策略。
16 | /// 不使用Continus参数时,实现阻止系统休眠或显示器关闭一次
17 | /// 组合使用Continus参数时,实现阻止系统休眠或显示器关闭至线程终止
18 | ///
19 | ///
20 | ///
21 | [DllImport("kernel32.dll")]
22 | static extern uint SetThreadExecutionState(ExecutionFlag flags);
23 |
24 | [Flags]
25 | enum ExecutionFlag : uint
26 | {
27 | System = 0x00000001,
28 | Display = 0x00000002,
29 | Continus = 0x80000000,
30 | }
31 |
32 | ///
33 | ///阻止系统休眠,直到线程结束恢复休眠策略
34 | ///
35 | /// 是否阻止关闭显示器
36 | public static void PreventSleep()
37 | {
38 | SetThreadExecutionState(ExecutionFlag.System | ExecutionFlag.Continus);
39 | }
40 |
41 | ///
42 | ///恢复系统休眠策略
43 | ///
44 | public static void ResotreSleep()
45 | {
46 | SetThreadExecutionState(ExecutionFlag.Continus);
47 | }
48 |
49 | ///
50 | ///重置系统休眠计时器
51 | ///
52 | /// 是否阻止关闭显示器
53 | public static void ResetSleepTimer(bool includeDisplay = false)
54 | {
55 | if (includeDisplay)
56 | SetThreadExecutionState(ExecutionFlag.System | ExecutionFlag.Display);
57 | else
58 | SetThreadExecutionState(ExecutionFlag.System);
59 | }
60 | }
61 |
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/wintogo/Classes/TestClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace wintogo
7 | {
8 | public class TestClass
9 | {
10 | public TestClass()
11 | {
12 |
13 | }
14 | public TestClass(int n)
15 | {
16 | MyProperty = n;
17 | }
18 | public int MyProperty { get; set; }
19 | public override int GetHashCode()
20 | {
21 | return base.GetHashCode();
22 | }
23 | public override string ToString()
24 | {
25 | return MyProperty.ToString();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/wintogo/Classes/TestConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace wintogo
8 | {
9 | class TestConverter : TypeConverter
10 | {
11 | public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
12 | {
13 | return true;
14 | }
15 |
16 | public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
17 | {
18 | return new StandardValuesCollection(new List() { new TestClass(1) });
19 | //return base.GetStandardValues(context);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/wintogo/Classes/WTGSettingItems.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | namespace wintogo
9 | {
10 | public class UserSetWTGSettingItems
11 | {
12 | //public string ActPartition { get; set; }
13 | //private bool ntfsUefiSupport = false;
14 | ////[DisplayName(MsgManager.GetResString("Msg_NtfsUefiSupport"))]
15 | //[Description("启用在NTFS分区的UEFI支持"), Category("分区")]
16 | //public bool NtfsUefiSupport
17 | //{
18 | // get { return ntfsUefiSupport; }
19 | // set { ntfsUefiSupport = value; }
20 | //}
21 | private int efiPartitionSize = 350;
22 |
23 | [Description("设定EFI分区大小"), Category("分区")]
24 | public int EFIPartitionSize
25 | {
26 | get { return efiPartitionSize; }
27 | set { efiPartitionSize = value; }
28 | }
29 |
30 | private PartitionTableType vhdPartitionType = PartitionTableType.MBR;
31 |
32 | [Description("虚拟硬盘格式"), Category("虚拟硬盘")]
33 | public PartitionTableType VHDPartitionType
34 | {
35 | get { return vhdPartitionType; }
36 | set { vhdPartitionType = value; }
37 | }
38 |
39 | private string vhdNameWithoutExt = "win8";
40 |
41 | [Description("虚拟硬盘文件名"), Category("虚拟硬盘")]
42 | public string VHDNameWithoutExt
43 | {
44 | get { return vhdNameWithoutExt; }
45 | set { vhdNameWithoutExt = value; }
46 | }
47 | private bool fixLetter = true;
48 | [Description("修复盘符"), Category("系统")]
49 |
50 | public bool FixLetter
51 | {
52 | get { return fixLetter; }
53 | set { fixLetter = value; }
54 | }
55 |
56 | private string imageIndex = "0 : 自动选择";
57 |
58 | [TypeConverter(typeof(ImagePartNameConverter)), Description("安装的镜像分卷"), Category("镜像")]
59 | public string ImageIndex
60 | {
61 | get { return imageIndex; }
62 | set { imageIndex = value; }
63 | }
64 | //private List myVar = new List() { new TestClass(1) };
65 |
66 | //public List MyProperty
67 | //{
68 | // get { return myVar = new List() { new TestClass(1) }; }
69 | // set { myVar = new List() { new TestClass(1) } = value; }
70 | //}
71 | //private TestClass[] myVar = new TestClass[] { new TestClass(1) };
72 |
73 | //public TestClass[] MyProperty
74 | //{
75 | // get { return myVar = new TestClass[] { new TestClass(1) }; }
76 | // set { myVar = new TestClass[] { new TestClass(1) } = value; }
77 | //}
78 |
79 | //[TypeConverter(typeof(TestConverter))]
80 | //public TestClass MyProperty
81 | //{
82 | // get;
83 | // set;
84 | //}
85 | private string vhdTempPath = Path.GetTempPath();
86 | [Editor(typeof(PropertyGridFolderBrowserDialogItem),
87 | typeof(System.Drawing.Design.UITypeEditor)), Description("虚拟硬盘临时目录"), Category("虚拟硬盘")]
88 | public string VHDTempPath
89 | {
90 | get { return vhdTempPath; }
91 | set { vhdTempPath = value; }
92 | }
93 |
94 |
95 | private bool disableWinRe = false;
96 | [Description("禁用Windows Recovery Environment"), Category("系统")]
97 |
98 | public bool DisableWinRe
99 | {
100 | get { return disableWinRe; }
101 | set { disableWinRe = value; }
102 | }
103 | private bool installDonet35;
104 | [Description("安装.NET3.5"), Category("系统")]
105 | public bool InstallDonet35
106 | {
107 | get { return installDonet35; }
108 | set { installDonet35 = value; }
109 | }
110 | private bool noDefaultDriveLetter;
111 | [Description("不自动分配盘符"), Category("分区")]
112 | public bool NoDefaultDriveLetter
113 | {
114 | get { return noDefaultDriveLetter; }
115 | set { noDefaultDriveLetter = value; }
116 | }
117 |
118 |
119 | private bool commonBootFiles;
120 | [Description("通用启动文件"), Category("系统")]
121 | public bool CommonBootFiles
122 | {
123 | get { return commonBootFiles; }
124 | set { commonBootFiles = value; }
125 |
126 | }
127 | private bool doNotFormat = false;
128 | [Description("不格式化移动磁盘,仅在非UEFI模式下有效"), Category("分区")]
129 | public bool DoNotFormat
130 | {
131 | get { return doNotFormat; }
132 | set { doNotFormat = value; }
133 | }
134 |
135 | }
136 | public enum PartitionTableType
137 | {
138 | GPT,
139 | MBR
140 | }
141 | }
142 |
143 |
--------------------------------------------------------------------------------
/wintogo/CopyFileApi.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32.SafeHandles;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Runtime.InteropServices;
7 | using System.Text;
8 |
9 | namespace wintogo
10 | {
11 |
12 | class CopyFileApi
13 | {
14 | public const short FILE_ATTRIBUTE_NORMAL = 0x80;
15 | public const short INVALID_HANDLE_VALUE = -1;
16 | public const uint GENERIC_READ = 0x80000000;
17 | public const uint GENERIC_WRITE = 0x40000000;
18 | public const uint FILE_SHARE_READ = 0x00000001;
19 | public const uint CREATE_NEW = 1;
20 | public const uint CREATE_ALWAYS = 2;
21 | public const uint OPEN_EXISTING = 3;
22 | [DllImport("kernel32", SetLastError = true,CallingConvention = CallingConvention.StdCall , CharSet = CharSet.Unicode)]
23 | public static extern SafeFileHandle CreateFile(
24 | string lpFileName,
25 | uint dwDesiredAccess,
26 | uint dwShareMode,
27 | IntPtr SecurityAttributes,
28 | uint dwCreationDisposition,
29 | uint dwFlagsAndAttributes,
30 | IntPtr hTemplateFile
31 | );
32 | [DllImport("kernel32.dll", SetLastError = true)]
33 | internal static extern int GetFileSize(IntPtr hFile, int highSize);
34 |
35 | [DllImport("kernel32", SetLastError = true)]
36 | static extern unsafe bool ReadFile
37 | (
38 | System.IntPtr hFile, // handle to file
39 | void* pBuffer, // data buffer
40 | int NumberOfBytesToRead, // number of bytes to read
41 | int* pNumberOfBytesRead, // number of bytes read
42 | int Overlapped // overlapped buffer
43 | );
44 |
45 |
46 | [DllImport("kernel32.dll")]
47 | static extern unsafe bool WriteFile(
48 | IntPtr hFile,
49 | void* lpBuffer,
50 | int nNumberOfBytesToWrite,
51 | int* lpNumberOfBytesWritten,
52 | int lpOverlapped);
53 |
54 | [System.Runtime.InteropServices.DllImport("kernel32", SetLastError = true)]
55 | static extern unsafe bool CloseHandle
56 | (
57 | System.IntPtr hObject // handle to object
58 | );
59 |
60 |
61 | public static unsafe void CopyFile()
62 | {
63 | SafeFileHandle hSourceFile = CreateFile(@"\\.\\Harddisk2Partition1\\bootmgr", GENERIC_READ, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
64 | SafeFileHandle hDestFile = CreateFile(@"\\.\\Harddisk2Partition2\\BCD", GENERIC_WRITE, 0, IntPtr.Zero, CREATE_NEW, 0, IntPtr.Zero);
65 | //System.Windows.Forms.MessageBox.Show(hSourceFile.ToString());
66 | if (hSourceFile.IsInvalid)
67 | {
68 | System.Windows.Forms.MessageBox.Show("Error hSourceFile.IsInvalid");
69 | }
70 | else
71 | {
72 | System.Windows.Forms.MessageBox.Show("OK");
73 | }
74 |
75 | if (hDestFile.IsInvalid)
76 | {
77 | System.Windows.Forms.MessageBox.Show("Error hDestFile.IsInvalid");
78 |
79 | }
80 | else
81 | {
82 | System.Windows.Forms.MessageBox.Show("OK");
83 | }
84 | //if (hDestFile == IntPtr.Zero)
85 | //{
86 | // System.Windows.Forms.MessageBox.Show("Error hDestFile.IsInvalid");
87 |
88 | //}
89 | //int dwRemainSize = GetFileSize(hSourceFile, 0); ;
90 | ////
91 | //System.Windows.Forms.MessageBox.Show(dwRemainSize.ToString());
92 | //byte[] buffer = new byte[1024];
93 | //while (dwRemainSize > 0)
94 | //{
95 |
96 |
97 | // int dwActualRead = 0;
98 | // fixed (byte* p = buffer)
99 | // {
100 | // ReadFile(hSourceFile, p, 1024, &dwActualRead, 0);
101 | // }
102 | // System.Windows.Forms.MessageBox.Show(dwActualRead.ToString());
103 | // //ReadFile(hSourceFile.DangerousGetHandle(), buffer, 1024, &dwActualRead, 0);
104 |
105 |
106 | // //System.Windows.Forms.MessageBox.Show(dwActualRead.ToString());
107 |
108 |
109 | // dwRemainSize -= dwActualRead;
110 | // int dwActualWrote = 0;
111 | // while (dwActualWrote < dwActualRead)
112 | // {
113 | // int dwOnceWrote = 0;
114 | // fixed (byte* p = buffer)
115 | // {
116 | // WriteFile(hDestFile, p + dwActualWrote, dwActualRead - dwActualWrote, &dwOnceWrote, 0);
117 | // }
118 | // dwActualWrote += dwOnceWrote;
119 |
120 |
121 | // }
122 |
123 | //}
124 | //CloseHandle(hSourceFile);
125 | //CloseHandle(hDestFile);
126 | //System.Windows.Forms.MessageBox.Show("Test");
127 |
128 |
129 |
130 | }
131 |
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/wintogo/Core/DiskpartScriptManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 |
5 | namespace wintogo
6 | {
7 | public class DiskpartScriptManager
8 | {
9 | ///
10 | /// Diskpart命令
11 | ///
12 | public string Args { private get; set; }
13 | private string TempScriptFile
14 | {
15 | get; set;
16 | }
17 | public bool OutputToFile { get; set; }
18 | ///
19 | /// 输出文件路径
20 | ///
21 | public string OutputFilePath { get; private set; }
22 | private string CurrentGuid = Guid.NewGuid().ToString();
23 | public DiskpartScriptManager()
24 | {
25 | this.OutputToFile = false;
26 | TempScriptFile = StringUtility.Combine(WTGModel.diskpartScriptPath, "\\" + CurrentGuid);
27 | //TempScriptFile = WTGModel.diskpartScriptPath + "\\" + CurrentGuid;
28 | }
29 | public DiskpartScriptManager(bool outputToFile)
30 | {
31 | if (outputToFile) this.OutputToFile = true;
32 | TempScriptFile = StringUtility.Combine(WTGModel.diskpartScriptPath, "\\" + CurrentGuid);
33 |
34 | //TempScriptFile = WTGModel.diskpartScriptPath + "\\" + CurrentGuid;
35 |
36 | }
37 | private void CreateScriptFile()
38 | {
39 |
40 | using (FileStream fs = new FileStream(TempScriptFile, FileMode.Create, FileAccess.Write))
41 | {
42 | fs.SetLength(0);
43 | using (StreamWriter sw = new StreamWriter(fs, Encoding.Default))
44 | {
45 | string ws = Args;
46 | //System.Windows.Forms.MessageBox.Show(args);
47 | sw.Write(ws);
48 | }
49 | }
50 | if (!File.Exists(TempScriptFile))
51 | {
52 | Log.WriteLog("Err_diskpart_" + CurrentGuid, Args);
53 | }
54 | Log.WriteLog("CMD_diskpart_" + CurrentGuid, Args);
55 | }
56 | ///
57 | /// 执行Diskpart命令
58 | ///
59 |
60 |
61 | //public void RunDiskpartScriptByScriptFile(string scriptFile)
62 | //{
63 | // StringBuilder dpargs = new StringBuilder();
64 | // dpargs.Append(" /s \"");
65 | // dpargs.Append(scriptFile);
66 | // try
67 | // {
68 | // ProcessManager.ECMD("diskpart.exe", dpargs.ToString());
69 | // }
70 | // catch (Exception)
71 | // {
72 | // //ProcessManager.KillProcessByName("diskpart.exe");
73 | // throw;
74 |
75 | // }
76 | //}
77 |
78 |
79 | public void RunDiskpartScript()
80 | {
81 | OutputFilePath = Path.GetTempFileName();
82 | CreateScriptFile();
83 | StringBuilder dpargs = new StringBuilder();
84 | dpargs.Append(" /s \"");
85 | dpargs.Append(TempScriptFile);
86 | dpargs.Append("\"");
87 | if (this.OutputToFile)
88 | {
89 | dpargs.Append(" > ");
90 | dpargs.Append("\"");
91 | dpargs.Append(this.OutputFilePath);
92 | dpargs.Append("\"");
93 | ProcessManager.SyncCMD("diskpart.exe "+ dpargs.ToString());
94 | }
95 | else
96 | {
97 | try
98 | {
99 | //Console.WriteLine("Diskpart.exe");
100 | ProcessManager.ECMD("diskpart.exe", dpargs.ToString());
101 | }
102 | catch (Exception)
103 | {
104 | //ProcessManager.KillProcessByName("diskpart.exe");
105 | throw;
106 |
107 | }
108 | }
109 | //System.Console.WriteLine(File.ReadAllText (this.scriptPath));
110 | //System.Console.WriteLine(dpargs.ToString());
111 | //System.Windows.Forms.MessageBox.Show(dpargs.ToString());
112 |
113 | //System.Console.WriteLine(File.ReadAllText (this.outputFilePath));
114 | //FileOperation.DeleteFile(TempScriptFile);
115 | }
116 | ///
117 | /// 删除输出文件
118 | ///
119 | public void DeleteOutputFile()
120 | {
121 | FileOperation.DeleteFile(this.OutputFilePath);
122 | }
123 |
124 |
125 |
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/wintogo/Core/DismWrapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace wintogo
10 | {
11 | internal class DismWrapper
12 | {
13 | //x,y - 要读取的Console窗口的矩形区域的起点位置X,Y坐标,以字符为单位,而非像素
14 | //width,height - 要读取的Console窗口的矩形区域的宽和高,以字符为单位,而非像素
15 | public static IEnumerable ReadFromBuffer(short x, short y, short width, short height)
16 | {
17 | IntPtr buffer = Marshal.AllocHGlobal(width * height * Marshal.SizeOf(typeof(CHAR_INFO)));
18 | if (buffer == null)
19 | throw new OutOfMemoryException();
20 |
21 | try
22 | {
23 | COORD coord = new COORD();
24 | SMALL_RECT rc = new SMALL_RECT();
25 | rc.Left = x;
26 | rc.Top = y;
27 | rc.Right = (short)(x + width - 1);
28 | rc.Bottom = (short)(y + height - 1);
29 |
30 | COORD size = new COORD();
31 | size.X = width;
32 | size.Y = height;
33 |
34 | const int STD_OUTPUT_HANDLE = -11;
35 | if (!ReadConsoleOutput(GetStdHandle(STD_OUTPUT_HANDLE), buffer, size, coord, ref rc))
36 | {
37 | // 'Not enough storage is available to process this command' may be raised for buffer size > 64K (see ReadConsoleOutput doc.)
38 | throw new Win32Exception(Marshal.GetLastWin32Error());
39 | }
40 |
41 | IntPtr ptr = buffer;
42 | for (int h = 0; h < height; h++)
43 | {
44 | StringBuilder sb = new StringBuilder();
45 | for (int w = 0; w < width; w++)
46 | {
47 | CHAR_INFO ci = (CHAR_INFO)Marshal.PtrToStructure(ptr, typeof(CHAR_INFO));
48 | char[] chars = Console.OutputEncoding.GetChars(ci.charData);
49 | sb.Append(chars[0]);
50 | ptr += Marshal.SizeOf(typeof(CHAR_INFO));
51 | }
52 | yield return sb.ToString();
53 | }
54 | }
55 | finally
56 | {
57 | Marshal.FreeHGlobal(buffer);
58 | }
59 | }
60 |
61 |
62 | [StructLayout(LayoutKind.Sequential)]
63 | private struct CHAR_INFO
64 | {
65 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
66 | public byte[] charData;
67 | public short attributes;
68 | }
69 |
70 | [StructLayout(LayoutKind.Sequential)]
71 | private struct COORD
72 | {
73 | public short X;
74 | public short Y;
75 | }
76 |
77 | [StructLayout(LayoutKind.Sequential)]
78 | private struct SMALL_RECT
79 | {
80 | public short Left;
81 | public short Top;
82 | public short Right;
83 | public short Bottom;
84 | }
85 |
86 | [StructLayout(LayoutKind.Sequential)]
87 | private struct CONSOLE_SCREEN_BUFFER_INFO
88 | {
89 | public COORD dwSize;
90 | public COORD dwCursorPosition;
91 | public short wAttributes;
92 | public SMALL_RECT srWindow;
93 | public COORD dwMaximumWindowSize;
94 | }
95 |
96 | [DllImport("kernel32.dll", SetLastError = true)]
97 | private static extern bool ReadConsoleOutput(IntPtr hConsoleOutput, IntPtr lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, ref SMALL_RECT lpReadRegion);
98 |
99 | [DllImport("kernel32.dll", SetLastError = true)]
100 | private static extern IntPtr GetStdHandle(int nStdHandle);
101 |
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/wintogo/Core/FileOperation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | //using System.Threading.Tasks;
5 | namespace wintogo
6 | {
7 | public static class FileOperation
8 | {
9 | public static void DeleteFolder(string dir)
10 | {
11 | if (Directory.Exists(dir)) //如果存在这个文件夹删除之
12 | {
13 | foreach (string d in Directory.GetFileSystemEntries(dir))
14 | {
15 | if (File.Exists(d))
16 | {
17 | FileInfo fi = new FileInfo(d);
18 | if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1)
19 | fi.Attributes = FileAttributes.Normal;
20 |
21 | File.Delete(d); //直接删除其中的文件
22 | }
23 | else
24 | DeleteFolder(d); //递归删除子文件夹
25 | }
26 | Directory.Delete(dir, true); //删除已空文件夹
27 | }
28 | }
29 | public static string GetFileVersion(string path)
30 | {
31 | try
32 | {
33 | // Get the file version for the notepad.
34 | FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(path);
35 | return myFileVersionInfo.FileVersion;
36 | // Print the file name and version number.
37 | //textBox1.Text = "File: " + myFileVersionInfo.FileDescription + '\n' +
38 | //"Version number: " + myFileVersionInfo.FileVersion;
39 | }
40 | catch(Exception ex)
41 | {
42 | Log.WriteLog("Err_GetFileVersion", ex.ToString());
43 | return string.Empty;
44 | }
45 | }
46 |
47 |
48 | public static void DeleteFile(string file)
49 | {
50 | if (File.Exists(file))
51 | {
52 | File.Delete(file);
53 | }
54 | }
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/wintogo/Core/WTGModel.cs:
--------------------------------------------------------------------------------
1 | using iTuner;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Windows.Forms;
6 |
7 | namespace wintogo
8 | {
9 | public class WTGModel
10 | {
11 | public static string espLetter;
12 | public static WriteProgress wp;
13 | public static string[] partitionSize;
14 | //public static string partitionSize1;
15 | //public static string partitionSize2;
16 | //public static string partitionSize3;
17 | public static bool rePartition;
18 | public static bool doNotFormat;
19 | public static bool noDefaultDriveLetter;
20 | public static bool installDonet35;
21 | public static bool disableWinRe;
22 | public static string vhdTempPath;
23 | //public static string imageIndex;
24 | public static bool fixLetter = true;
25 | public static string vhdNameWithoutExt;
26 | //0=MBR 1=GPT
27 | public static int vhdPartitionType;
28 | public static string efiPartitionSize;
29 | public static UsbDisk UdObj;
30 |
31 | ///
32 | /// 可使用ESD文件
33 | ///
34 | public static bool allowEsd = false;
35 | ///
36 | /// 优盘盘符
37 | ///
38 | public static string ud;
39 | ///
40 | /// 显示在ComboBox中的字符串信息
41 | ///
42 | public static string udString;
43 | public static bool isWimBoot;
44 | public static bool isBlockLocalDisk;
45 | ///
46 | /// 镜像文件路径
47 | ///
48 | public static string imageFilePath;
49 | ///
50 | /// WimIndex
51 | ///
52 | public static string wimPart = "0";
53 |
54 | public static bool isEsd = false;
55 | ///
56 | /// 默认为imagex_x86.exe
57 | ///
58 | public static string imagexFileName = "imagex_x86.exe";
59 | /////
60 | ///// 强制格式化
61 | /////
62 | //public static bool forceFormat = false;
63 | ///
64 | /// VHD文件用户设定大小
65 | ///
66 | public static int userSetSize;
67 | public static bool isFixedVHD;
68 | public static int win7togo;
69 | ///
70 | /// Application.StartupPath + "\\logs";
71 | ///
72 | public static string diskpartScriptPath = Path.GetTempPath();
73 | public static bool isUefiGpt;
74 | public static bool isUefiMbr;
75 | public static bool isNoTemp;
76 | public static bool isLegacyUdiskUefi;
77 | //public static bool isBlockLocalDisk;
78 | public static bool ntfsUefiSupport;
79 | public static bool skipOOBE;
80 | ///
81 | /// WTGOperation.filetype = Path.GetExtension(openFileDialog1.FileName.ToLower()).Substring(1);
82 | ///
83 | public static string choosedImageType;
84 | ///
85 | /// win8.vhd
86 | ///
87 | public static string win8VHDFileName = "win8.vhd";
88 | ///
89 | /// Path.GetTempPath() + "\\WTGA";
90 | ///
91 | public static string applicationFilesPath = StringUtility.Combine(Path.GetTempPath(), "WTGA");
92 | ///
93 | /// Application.StartupPath + "\\logs";
94 | ///
95 | public static string logPath = Application.StartupPath + "\\logs";
96 | ///
97 | /// VHD OR VHDX
98 | ///
99 | public static string vhdExtension = "vhd";
100 | public static bool isCompactOS;
101 | public static bool isBitlocker;
102 | public static OS CurrentOS;
103 | public static ApplyMode CheckedMode;
104 | public static string CreateGuid;
105 | public static bool disableUasp;
106 | public static bool isUserSetEfiPartition;
107 | public static string efiPartition = string.Empty;
108 | public static Version dismversion = new Version("0.0.0.0");
109 | public static string ffuFilePath;
110 | }
111 | public enum OS
112 | {
113 | XP,
114 | Vista,
115 | Win7,
116 | Win8_without_update,
117 | Win8_1_with_update,
118 | Win10,
119 | Other
120 | }
121 | public enum ApplyMode
122 | {
123 | Legacy,
124 | VHD,
125 | VHDX
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/wintogo/Forms/AboutBox.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class AboutBox
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | protected override void Dispose(bool disposing)
14 | {
15 | if (disposing && (components != null))
16 | {
17 | components.Dispose();
18 | }
19 | base.Dispose(disposing);
20 | }
21 |
22 | #region Windows 窗体设计器生成的代码
23 |
24 | ///
25 | /// 设计器支持所需的方法 - 不要
26 | /// 使用代码编辑器修改此方法的内容。
27 | ///
28 | private void InitializeComponent()
29 | {
30 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox));
31 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
32 | this.labelProductName = new System.Windows.Forms.Label();
33 | this.labelVersion = new System.Windows.Forms.Label();
34 | this.labelCopyright = new System.Windows.Forms.Label();
35 | this.labelCompanyName = new System.Windows.Forms.Label();
36 | this.textBoxDescription = new System.Windows.Forms.TextBox();
37 | this.okButton = new System.Windows.Forms.Button();
38 | this.tableLayoutPanel.SuspendLayout();
39 | this.SuspendLayout();
40 | //
41 | // tableLayoutPanel
42 | //
43 | resources.ApplyResources(this.tableLayoutPanel, "tableLayoutPanel");
44 | this.tableLayoutPanel.Controls.Add(this.labelProductName, 0, 0);
45 | this.tableLayoutPanel.Controls.Add(this.labelVersion, 0, 1);
46 | this.tableLayoutPanel.Controls.Add(this.labelCopyright, 0, 2);
47 | this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 0, 3);
48 | this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 0, 4);
49 | this.tableLayoutPanel.Controls.Add(this.okButton, 0, 5);
50 | this.tableLayoutPanel.Name = "tableLayoutPanel";
51 | //
52 | // labelProductName
53 | //
54 | resources.ApplyResources(this.labelProductName, "labelProductName");
55 | this.labelProductName.Name = "labelProductName";
56 | //
57 | // labelVersion
58 | //
59 | resources.ApplyResources(this.labelVersion, "labelVersion");
60 | this.labelVersion.Name = "labelVersion";
61 | //
62 | // labelCopyright
63 | //
64 | resources.ApplyResources(this.labelCopyright, "labelCopyright");
65 | this.labelCopyright.Name = "labelCopyright";
66 | //
67 | // labelCompanyName
68 | //
69 | resources.ApplyResources(this.labelCompanyName, "labelCompanyName");
70 | this.labelCompanyName.Name = "labelCompanyName";
71 | //
72 | // textBoxDescription
73 | //
74 | resources.ApplyResources(this.textBoxDescription, "textBoxDescription");
75 | this.textBoxDescription.Name = "textBoxDescription";
76 | this.textBoxDescription.ReadOnly = true;
77 | this.textBoxDescription.TabStop = false;
78 | //
79 | // okButton
80 | //
81 | resources.ApplyResources(this.okButton, "okButton");
82 | this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
83 | this.okButton.Name = "okButton";
84 | this.okButton.Click += new System.EventHandler(this.okButton_Click);
85 | //
86 | // AboutBox
87 | //
88 | this.AcceptButton = this.okButton;
89 | resources.ApplyResources(this, "$this");
90 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
91 | this.Controls.Add(this.tableLayoutPanel);
92 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
93 | this.Icon = global::wintogo.Properties.Resources.WTGA;
94 | this.MaximizeBox = false;
95 | this.MinimizeBox = false;
96 | this.Name = "AboutBox";
97 | this.ShowIcon = false;
98 | this.ShowInTaskbar = false;
99 | this.Load += new System.EventHandler(this.AboutBox_Load);
100 | this.tableLayoutPanel.ResumeLayout(false);
101 | this.tableLayoutPanel.PerformLayout();
102 | this.ResumeLayout(false);
103 |
104 | }
105 |
106 | #endregion
107 |
108 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
109 | private System.Windows.Forms.Label labelProductName;
110 | private System.Windows.Forms.Label labelVersion;
111 | private System.Windows.Forms.Label labelCopyright;
112 | private System.Windows.Forms.Label labelCompanyName;
113 | private System.Windows.Forms.TextBox textBoxDescription;
114 | private System.Windows.Forms.Button okButton;
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/wintogo/Forms/AboutBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Linq;
6 | using System.Reflection;
7 | using System.Windows.Forms;
8 |
9 | namespace wintogo
10 | {
11 | partial class AboutBox : Form
12 | {
13 | public AboutBox()
14 | {
15 | System.Threading.Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
16 |
17 | InitializeComponent();
18 | //this.Text = String.Format("关于(About) {0}", AssemblyTitle);
19 | this.labelProductName.Text = AssemblyProduct;
20 | this.labelVersion.Text = String.Format("版本(Version) {0}", AssemblyVersion);
21 | this.labelCopyright.Text = AssemblyCopyright;
22 | this.labelCompanyName.Text = AssemblyCompany;
23 | //this.textBoxDescription.Text = AssemblyDescription;
24 | }
25 |
26 | #region 程序集特性访问器
27 |
28 | public string AssemblyTitle
29 | {
30 | get
31 | {
32 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
33 | if (attributes.Length > 0)
34 | {
35 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
36 | if (titleAttribute.Title != "")
37 | {
38 | return titleAttribute.Title;
39 | }
40 | }
41 | return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
42 | }
43 | }
44 |
45 | public string AssemblyVersion
46 | {
47 | get
48 | {
49 | return Assembly.GetExecutingAssembly().GetName().Version.ToString();
50 | }
51 | }
52 |
53 | public string AssemblyDescription
54 | {
55 | get
56 | {
57 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
58 | if (attributes.Length == 0)
59 | {
60 | return "";
61 | }
62 | return ((AssemblyDescriptionAttribute)attributes[0]).Description;
63 | }
64 | }
65 |
66 | public string AssemblyProduct
67 | {
68 | get
69 | {
70 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
71 | if (attributes.Length == 0)
72 | {
73 | return "";
74 | }
75 | return ((AssemblyProductAttribute)attributes[0]).Product;
76 | }
77 | }
78 |
79 | public string AssemblyCopyright
80 | {
81 | get
82 | {
83 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
84 | if (attributes.Length == 0)
85 | {
86 | return "";
87 | }
88 | return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
89 | }
90 | }
91 |
92 | public string AssemblyCompany
93 | {
94 | get
95 | {
96 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
97 | if (attributes.Length == 0)
98 | {
99 | return "";
100 | }
101 | return ((AssemblyCompanyAttribute)attributes[0]).Company;
102 | }
103 | }
104 | #endregion
105 |
106 | private void okButton_Click(object sender, EventArgs e)
107 | {
108 | this.Close();
109 | }
110 |
111 | private void AboutBox_Load(object sender, EventArgs e)
112 | {
113 |
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/wintogo/Forms/BenchmarkProgress.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo.Forms
2 | {
3 | partial class BenchmarkProgress
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BenchmarkProgress));
32 | this.progressBar1 = new System.Windows.Forms.ProgressBar();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.SuspendLayout();
35 | //
36 | // progressBar1
37 | //
38 | resources.ApplyResources(this.progressBar1, "progressBar1");
39 | this.progressBar1.Name = "progressBar1";
40 | this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
41 | //
42 | // label1
43 | //
44 | resources.ApplyResources(this.label1, "label1");
45 | this.label1.Name = "label1";
46 | //
47 | // BenchmarkProgress
48 | //
49 | resources.ApplyResources(this, "$this");
50 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
51 | this.Controls.Add(this.label1);
52 | this.Controls.Add(this.progressBar1);
53 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
54 | this.Name = "BenchmarkProgress";
55 | this.ResumeLayout(false);
56 | this.PerformLayout();
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private System.Windows.Forms.ProgressBar progressBar1;
63 | private System.Windows.Forms.Label label1;
64 | }
65 | }
--------------------------------------------------------------------------------
/wintogo/Forms/BenchmarkProgress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace wintogo.Forms
12 | {
13 | public partial class BenchmarkProgress : Form
14 | {
15 | public BenchmarkProgress()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/wintogo/Forms/ChoosePart.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class ChoosePart
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChoosePart));
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
34 | this.label1 = new System.Windows.Forms.Label();
35 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
36 | this.SuspendLayout();
37 | //
38 | // button1
39 | //
40 | resources.ApplyResources(this.button1, "button1");
41 | this.button1.Name = "button1";
42 | this.button1.UseVisualStyleBackColor = true;
43 | this.button1.Click += new System.EventHandler(this.button1_Click);
44 | //
45 | // numericUpDown1
46 | //
47 | resources.ApplyResources(this.numericUpDown1, "numericUpDown1");
48 | this.numericUpDown1.Name = "numericUpDown1";
49 | //
50 | // label1
51 | //
52 | resources.ApplyResources(this.label1, "label1");
53 | this.label1.Name = "label1";
54 | //
55 | // choosepart
56 | //
57 | resources.ApplyResources(this, "$this");
58 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
59 | this.Controls.Add(this.label1);
60 | this.Controls.Add(this.numericUpDown1);
61 | this.Controls.Add(this.button1);
62 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
63 | this.Icon = global::wintogo.Properties.Resources._2001;
64 | this.Name = "choosepart";
65 | this.Load += new System.EventHandler(this.choosepart_Load);
66 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
67 | this.ResumeLayout(false);
68 | this.PerformLayout();
69 |
70 | }
71 |
72 | #endregion
73 |
74 | private System.Windows.Forms.Button button1;
75 | private System.Windows.Forms.NumericUpDown numericUpDown1;
76 | private System.Windows.Forms.Label label1;
77 |
78 | }
79 | }
--------------------------------------------------------------------------------
/wintogo/Forms/ChoosePart.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text.RegularExpressions;
4 | using System.Windows.Forms;
5 |
6 | namespace wintogo
7 | {
8 | public partial class ChoosePart : Form
9 | {
10 | //public static int part;
11 | public ChoosePart()
12 | {
13 | System.Threading.Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
14 |
15 | InitializeComponent();
16 | }
17 |
18 | private void choosepart_Load(object sender, EventArgs e)
19 | {
20 |
21 | ////string choseWim = WTGOperation.imageFilePath;
22 | //if (!string.IsNullOrEmpty(choseWim))
23 | ////{
24 | // string str=File.ReadAllText(@"c:\b.txt");
25 | //string str = @"Deployment Image Servicing and Management toolVersion: 6.3.9600.17031Details for image : E:\sources\install.wimIndex : 1Name : Windows 10 Pro Technical PreviewDescription : Windows 10 Pro Technical PreviewSize : 9, 338, 967, 521 bytesThe operation completed successfully.";
26 |
27 | //MessageBox.Show(mc[1].Value);
28 |
29 | //}
30 | numericUpDown1.Value = Int32.Parse(WTGOperation.wimPart);
31 | }
32 |
33 | private void button1_Click(object sender, EventArgs e)
34 | {
35 | WTGOperation.wimPart = numericUpDown1.Value.ToString();
36 | //part =(int) numericUpDown1.Value ;
37 |
38 | this.Close();
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/wintogo/Forms/ChoosePart.en.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | OK
122 |
123 |
124 | 0=automatic
125 |
126 |
127 | WIM index
128 |
129 |
--------------------------------------------------------------------------------
/wintogo/Forms/ChoosePart.zh-Hant.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 確定
122 |
123 |
124 | 0為自動選擇
125 |
126 |
127 | 選擇安裝分卷
128 |
129 |
--------------------------------------------------------------------------------
/wintogo/Forms/Clone.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo.Forms
2 | {
3 | partial class Clone
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.button1 = new System.Windows.Forms.Button();
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.button2 = new System.Windows.Forms.Button();
34 | this.SuspendLayout();
35 | //
36 | // button1
37 | //
38 | this.button1.Location = new System.Drawing.Point(76, 342);
39 | this.button1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
40 | this.button1.Name = "button1";
41 | this.button1.Size = new System.Drawing.Size(199, 89);
42 | this.button1.TabIndex = 0;
43 | this.button1.Text = "继续";
44 | this.button1.UseVisualStyleBackColor = true;
45 | this.button1.Click += new System.EventHandler(this.button1_Click);
46 | //
47 | // label1
48 | //
49 | this.label1.AutoSize = true;
50 | this.label1.Location = new System.Drawing.Point(30, 52);
51 | this.label1.Name = "label1";
52 | this.label1.Size = new System.Drawing.Size(321, 120);
53 | this.label1.TabIndex = 1;
54 | this.label1.Text = "克隆本机系统须知:\r\n1.本机系统必须为Win10 64位。\r\n2.WinRE镜像在C:\\Recovery目录中\r\n3.USB设备须有足够空间且识别为本地磁盘。\r" +
55 | "\n4.USB设备将会被重新分区,所有数据将删除。\r\n5.克隆后WTG系统启动模式为UEFI+MBR。";
56 | //
57 | // button2
58 | //
59 | this.button2.Location = new System.Drawing.Point(417, 342);
60 | this.button2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
61 | this.button2.Name = "button2";
62 | this.button2.Size = new System.Drawing.Size(199, 89);
63 | this.button2.TabIndex = 3;
64 | this.button2.Text = "取消";
65 | this.button2.UseVisualStyleBackColor = true;
66 | this.button2.Click += new System.EventHandler(this.button2_Click);
67 | //
68 | // Clone
69 | //
70 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
71 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
72 | this.ClientSize = new System.Drawing.Size(734, 481);
73 | this.Controls.Add(this.button2);
74 | this.Controls.Add(this.label1);
75 | this.Controls.Add(this.button1);
76 | this.Font = new System.Drawing.Font("Microsoft YaHei", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
77 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
78 | this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
79 | this.Name = "Clone";
80 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
81 | this.Text = "警告";
82 | this.ResumeLayout(false);
83 | this.PerformLayout();
84 |
85 | }
86 |
87 | #endregion
88 |
89 | private System.Windows.Forms.Button button1;
90 | private System.Windows.Forms.Label label1;
91 | private System.Windows.Forms.Button button2;
92 | }
93 | }
--------------------------------------------------------------------------------
/wintogo/Forms/Clone.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Diagnostics;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 |
12 | namespace wintogo.Forms
13 | {
14 | public partial class Clone : Form
15 | {
16 | public Clone()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 | private void button1_Click(object sender, EventArgs e)
22 | {
23 | DialogResult = DialogResult.Yes;
24 | Close();
25 | }
26 |
27 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
28 | {
29 | Process.Start("https://bbs.luobotou.org/thread-16579-1-1.html");
30 | }
31 |
32 | private void button2_Click(object sender, EventArgs e)
33 | {
34 | DialogResult = DialogResult.No;
35 | Close();
36 |
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/wintogo/Forms/Clone.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/wintogo/Forms/EfiSize.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class EfiSize
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EfiSize));
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.textBox1 = new System.Windows.Forms.TextBox();
36 | this.SuspendLayout();
37 | //
38 | // label1
39 | //
40 | resources.ApplyResources(this.label1, "label1");
41 | this.label1.Name = "label1";
42 | //
43 | // button1
44 | //
45 | resources.ApplyResources(this.button1, "button1");
46 | this.button1.Name = "button1";
47 | this.button1.UseVisualStyleBackColor = true;
48 | this.button1.Click += new System.EventHandler(this.button1_Click);
49 | //
50 | // label2
51 | //
52 | resources.ApplyResources(this.label2, "label2");
53 | this.label2.Name = "label2";
54 | //
55 | // textBox1
56 | //
57 | resources.ApplyResources(this.textBox1, "textBox1");
58 | this.textBox1.Name = "textBox1";
59 | //
60 | // Efisize
61 | //
62 | resources.ApplyResources(this, "$this");
63 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
64 | this.Controls.Add(this.textBox1);
65 | this.Controls.Add(this.label2);
66 | this.Controls.Add(this.label1);
67 | this.Controls.Add(this.button1);
68 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
69 | this.MaximizeBox = false;
70 | this.MinimizeBox = false;
71 | this.Name = "Efisize";
72 | this.Load += new System.EventHandler(this.Efisize_Load);
73 | this.ResumeLayout(false);
74 | this.PerformLayout();
75 |
76 | }
77 |
78 | #endregion
79 |
80 | private System.Windows.Forms.Label label1;
81 | private System.Windows.Forms.Button button1;
82 | private System.Windows.Forms.Label label2;
83 | private System.Windows.Forms.TextBox textBox1;
84 | }
85 | }
--------------------------------------------------------------------------------
/wintogo/Forms/EfiSize.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.RegularExpressions;
3 | using System.Windows.Forms;
4 |
5 | namespace wintogo
6 | {
7 | public partial class EfiSize : Form
8 | {
9 | private string efisize = "350";
10 |
11 | public string EfiSz
12 | {
13 | get { return efisize; }
14 | set { efisize = value; }
15 | }
16 |
17 | public EfiSize()
18 | {
19 | InitializeComponent();
20 | }
21 | public EfiSize(string efisz)
22 | : this()
23 | {
24 | this.efisize = efisz;
25 | }
26 |
27 | private void Efisize_Load(object sender, EventArgs e)
28 | {
29 | textBox1.Text = efisize;
30 | }
31 | public bool IsNumber(String strNumber)
32 | {
33 | Regex objNotNumberPattern = new Regex("[^0-9.-]");
34 | Regex objTwoDotPattern = new Regex("[0-9]*[.][0-9]*[.][0-9]*");
35 | Regex objTwoMinusPattern = new Regex("[0-9]*[-][0-9]*[-][0-9]*");
36 | String strValidRealPattern = "^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$";
37 | String strValidIntegerPattern = "^([-]|[0-9])[0-9]*$";
38 | Regex objNumberPattern = new Regex("(" + strValidRealPattern + ")|(" + strValidIntegerPattern + ")");
39 |
40 | return !objNotNumberPattern.IsMatch(strNumber) &&
41 | !objTwoDotPattern.IsMatch(strNumber) &&
42 | !objTwoMinusPattern.IsMatch(strNumber) &&
43 | objNumberPattern.IsMatch(strNumber);
44 | }
45 | private void button1_Click(object sender, EventArgs e)
46 | {
47 | if (!IsNumber(textBox1.Text)) { MessageBox.Show("Error!"); return; }
48 | efisize = textBox1.Text;
49 | this.Close();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/wintogo/Forms/EfiSize.zh-Hant.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 默認為350
122 |
123 |
124 | 確定
125 |
126 |
127 | EFI分區容量
128 |
129 |
--------------------------------------------------------------------------------
/wintogo/Forms/ErrorMsg.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class ErrorMsg
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ErrorMsg));
32 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.label1 = new System.Windows.Forms.Label();
35 | this.label2 = new System.Windows.Forms.Label();
36 | this.linkLabel1 = new System.Windows.Forms.LinkLabel();
37 | this.label3 = new System.Windows.Forms.Label();
38 | this.textBox1 = new System.Windows.Forms.TextBox();
39 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
40 | this.SuspendLayout();
41 | //
42 | // pictureBox1
43 | //
44 | resources.ApplyResources(this.pictureBox1, "pictureBox1");
45 | this.pictureBox1.Name = "pictureBox1";
46 | this.pictureBox1.TabStop = false;
47 | //
48 | // button1
49 | //
50 | resources.ApplyResources(this.button1, "button1");
51 | this.button1.Name = "button1";
52 | this.button1.UseVisualStyleBackColor = true;
53 | this.button1.Click += new System.EventHandler(this.button1_Click);
54 | //
55 | // label1
56 | //
57 | resources.ApplyResources(this.label1, "label1");
58 | this.label1.ForeColor = System.Drawing.Color.OrangeRed;
59 | this.label1.Name = "label1";
60 | //
61 | // label2
62 | //
63 | resources.ApplyResources(this.label2, "label2");
64 | this.label2.Name = "label2";
65 | //
66 | // linkLabel1
67 | //
68 | resources.ApplyResources(this.linkLabel1, "linkLabel1");
69 | this.linkLabel1.Name = "linkLabel1";
70 | this.linkLabel1.TabStop = true;
71 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
72 | //
73 | // label3
74 | //
75 | resources.ApplyResources(this.label3, "label3");
76 | this.label3.Cursor = System.Windows.Forms.Cursors.Hand;
77 | this.label3.ForeColor = System.Drawing.Color.Blue;
78 | this.label3.Name = "label3";
79 | this.label3.Click += new System.EventHandler(this.label3_Click);
80 | //
81 | // textBox1
82 | //
83 | this.textBox1.BackColor = System.Drawing.SystemColors.Control;
84 | resources.ApplyResources(this.textBox1, "textBox1");
85 | this.textBox1.ForeColor = System.Drawing.Color.OrangeRed;
86 | this.textBox1.Name = "textBox1";
87 | this.textBox1.ReadOnly = true;
88 | //
89 | // ErrorMsg
90 | //
91 | resources.ApplyResources(this, "$this");
92 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
93 | this.Controls.Add(this.textBox1);
94 | this.Controls.Add(this.label3);
95 | this.Controls.Add(this.linkLabel1);
96 | this.Controls.Add(this.label2);
97 | this.Controls.Add(this.label1);
98 | this.Controls.Add(this.button1);
99 | this.Controls.Add(this.pictureBox1);
100 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
101 | this.Icon = global::wintogo.Properties.Resources.WTGA;
102 | this.Name = "ErrorMsg";
103 | this.TopMost = true;
104 | this.Load += new System.EventHandler(this.error_Load);
105 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
106 | this.ResumeLayout(false);
107 | this.PerformLayout();
108 |
109 | }
110 |
111 | #endregion
112 |
113 | private System.Windows.Forms.PictureBox pictureBox1;
114 | private System.Windows.Forms.Button button1;
115 | private System.Windows.Forms.Label label1;
116 | private System.Windows.Forms.Label label2;
117 | private System.Windows.Forms.LinkLabel linkLabel1;
118 | private System.Windows.Forms.Label label3;
119 | private System.Windows.Forms.TextBox textBox1;
120 | }
121 | }
--------------------------------------------------------------------------------
/wintogo/Forms/ErrorMsg.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.IO.Compression;
5 | using System.Threading;
6 | using System.Windows.Forms;
7 | using wintogo.Utility;
8 |
9 | namespace wintogo
10 | {
11 | public partial class ErrorMsg : Form
12 | {
13 | string errmsg;
14 | bool critical;
15 | public ErrorMsg(string errmsg, bool critical)
16 | {
17 | FormHelper.Closewp();
18 |
19 | Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
20 |
21 | this.errmsg = errmsg;
22 | this.critical = critical;
23 | InitializeComponent();
24 |
25 | }
26 |
27 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
28 | {
29 | WebUtility.VisitWeb("https://bbs.luobotou.org/forum-88-1.html");
30 | }
31 |
32 | private void error_Load(object sender, EventArgs e)
33 | {
34 | Text += Application.ProductName + Application.ProductVersion;
35 | textBox1.Text = errmsg;
36 | Log.WriteLog("Info_ErrMsg", errmsg);
37 |
38 | if (critical)
39 | {
40 | try
41 | {
42 | if (File.Exists(Environment.GetEnvironmentVariable("windir") + @"\Logs\DISM\dism.log"))
43 | File.Copy(Environment.GetEnvironmentVariable("windir") + @"\Logs\DISM\dism.log", WTGModel.logPath + "\\" + "dism.log", true);
44 | }
45 | catch (Exception ex)
46 | {
47 | Log.WriteLog("Info_DISMLOG", ex.ToString());
48 | }
49 |
50 | //Upload ErrorLog
51 | Thread t = new Thread(UploadLogs);
52 | t.Start();
53 | }
54 |
55 | }
56 | private void UploadLogs()
57 | {
58 | try
59 | {
60 | Random r = new Random();
61 | string tmpFile = Path.GetTempFileName() + r.Next(65536).ToString();
62 | ZipFile.CreateFromDirectory(WTGModel.logPath, tmpFile);
63 |
64 | //ZipHelper.ZipFileDirectory(WTGModel.logPath, tmpFile);
65 | HttpPost.HttpUploadFile(@"https://laa.luobotou.org/wtgreport.ashx", tmpFile);
66 | File.Delete(tmpFile);
67 | }
68 | catch (Exception ex)
69 | {
70 | Log.WriteLog("Err_UploadLogs", ex.ToString());
71 | }
72 | }
73 |
74 | private void button1_Click(object sender, System.EventArgs e)
75 | {
76 | this.Close();
77 | }
78 |
79 | private void label3_Click(object sender, System.EventArgs e)
80 | {
81 | WebUtility.VisitWeb("https://bbs.luobotou.org/thread-8670-1-1.html");
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/wintogo/Forms/Finish.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Threading;
5 | using System.Windows.Forms;
6 | using wintogo.Utility;
7 |
8 | namespace wintogo
9 |
10 | {
11 | public partial class Finish : Form
12 | {
13 | public Finish(TimeSpan ts)
14 | {
15 | FormHelper.Closewp();
16 | Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
17 | InitializeComponent();
18 | lblTime.Text = ts.ToString(@"hh\:mm\:ss");
19 | }
20 |
21 | private void button2_Click(object sender, EventArgs e)
22 | {
23 | this.Close();
24 | }
25 |
26 | private void button1_Click(object sender, EventArgs e)
27 | {
28 | WebUtility.VisitWeb("https://bbs.luobotou.org/thread-804-1-1.html");
29 |
30 | }
31 |
32 | private void finish_Load(object sender, EventArgs e)
33 | {
34 | Thread t = new Thread(() =>
35 | {
36 | try
37 | {
38 | HttpPost.Post("https://laa.luobotou.org/wtgstats.ashx", new Dictionary() {
39 | {"type","finish" },
40 | {"guid",WTGModel.CreateGuid },
41 | {"timeElapsed",lblTime.Text}
42 | });
43 | }
44 | catch (Exception ex)
45 | {
46 | Log.WriteLog("Err_finish", ex.Message);
47 | }
48 | });
49 | t.Start();
50 | }
51 |
52 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
53 | {
54 | WebUtility.VisitWeb("https://bbs.luobotou.org/thread-5258-1-1.html");
55 | //System.Diagnostics.Process.Start("http://bbs.luobotou.org/thread-5258-1-1.html");
56 | }
57 |
58 |
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/wintogo/Forms/Finish.designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class Finish
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Finish));
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.button2 = new System.Windows.Forms.Button();
35 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
36 | this.lblTime = new System.Windows.Forms.Label();
37 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
38 | this.SuspendLayout();
39 | //
40 | // label1
41 | //
42 | resources.ApplyResources(this.label1, "label1");
43 | this.label1.Name = "label1";
44 | //
45 | // button1
46 | //
47 | resources.ApplyResources(this.button1, "button1");
48 | this.button1.Name = "button1";
49 | this.button1.UseVisualStyleBackColor = true;
50 | this.button1.Click += new System.EventHandler(this.button1_Click);
51 | //
52 | // button2
53 | //
54 | resources.ApplyResources(this.button2, "button2");
55 | this.button2.Name = "button2";
56 | this.button2.UseVisualStyleBackColor = true;
57 | this.button2.Click += new System.EventHandler(this.button2_Click);
58 | //
59 | // pictureBox1
60 | //
61 | resources.ApplyResources(this.pictureBox1, "pictureBox1");
62 | this.pictureBox1.Name = "pictureBox1";
63 | this.pictureBox1.TabStop = false;
64 | //
65 | // lblTime
66 | //
67 | resources.ApplyResources(this.lblTime, "lblTime");
68 | this.lblTime.Name = "lblTime";
69 | //
70 | // Finish
71 | //
72 | resources.ApplyResources(this, "$this");
73 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
74 | this.Controls.Add(this.lblTime);
75 | this.Controls.Add(this.pictureBox1);
76 | this.Controls.Add(this.button2);
77 | this.Controls.Add(this.button1);
78 | this.Controls.Add(this.label1);
79 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
80 | this.Icon = global::wintogo.Properties.Resources.WTGA;
81 | this.MaximizeBox = false;
82 | this.MinimizeBox = false;
83 | this.Name = "Finish";
84 | this.TopMost = true;
85 | this.Load += new System.EventHandler(this.finish_Load);
86 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
87 | this.ResumeLayout(false);
88 | this.PerformLayout();
89 |
90 | }
91 |
92 | #endregion
93 |
94 | private System.Windows.Forms.Label label1;
95 | private System.Windows.Forms.Button button1;
96 | private System.Windows.Forms.Button button2;
97 | private System.Windows.Forms.PictureBox pictureBox1;
98 | private System.Windows.Forms.Label lblTime;
99 | }
100 | }
--------------------------------------------------------------------------------
/wintogo/Forms/FormatAlert.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo.Forms
2 | {
3 | partial class FormatAlert
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormatAlert));
32 | this.btnOk = new System.Windows.Forms.Button();
33 | this.lblTxt = new System.Windows.Forms.Label();
34 | this.btnCancel = new System.Windows.Forms.Button();
35 | this.groupBox1 = new System.Windows.Forms.GroupBox();
36 | this.label1 = new System.Windows.Forms.Label();
37 | this.groupBox1.SuspendLayout();
38 | this.SuspendLayout();
39 | //
40 | // btnOk
41 | //
42 | resources.ApplyResources(this.btnOk, "btnOk");
43 | this.btnOk.Name = "btnOk";
44 | this.btnOk.UseVisualStyleBackColor = true;
45 | this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
46 | //
47 | // lblTxt
48 | //
49 | resources.ApplyResources(this.lblTxt, "lblTxt");
50 | this.lblTxt.Name = "lblTxt";
51 | //
52 | // btnCancel
53 | //
54 | resources.ApplyResources(this.btnCancel, "btnCancel");
55 | this.btnCancel.Name = "btnCancel";
56 | this.btnCancel.UseVisualStyleBackColor = true;
57 | this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
58 | //
59 | // groupBox1
60 | //
61 | this.groupBox1.Controls.Add(this.label1);
62 | resources.ApplyResources(this.groupBox1, "groupBox1");
63 | this.groupBox1.Name = "groupBox1";
64 | this.groupBox1.TabStop = false;
65 | //
66 | // label1
67 | //
68 | resources.ApplyResources(this.label1, "label1");
69 | this.label1.Name = "label1";
70 | //
71 | // FormatAlert
72 | //
73 | resources.ApplyResources(this, "$this");
74 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
75 | this.Controls.Add(this.groupBox1);
76 | this.Controls.Add(this.btnCancel);
77 | this.Controls.Add(this.lblTxt);
78 | this.Controls.Add(this.btnOk);
79 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
80 | this.Icon = global::wintogo.Properties.Resources.WTGA;
81 | this.MaximizeBox = false;
82 | this.MinimizeBox = false;
83 | this.Name = "FormatAlert";
84 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormatAlert_FormClosing);
85 | this.Load += new System.EventHandler(this.FormatAlert_Load);
86 | this.groupBox1.ResumeLayout(false);
87 | this.groupBox1.PerformLayout();
88 | this.ResumeLayout(false);
89 |
90 | }
91 |
92 | #endregion
93 |
94 | private System.Windows.Forms.Button btnOk;
95 | private System.Windows.Forms.Label lblTxt;
96 | private System.Windows.Forms.Button btnCancel;
97 | private System.Windows.Forms.GroupBox groupBox1;
98 | private System.Windows.Forms.Label label1;
99 | }
100 | }
--------------------------------------------------------------------------------
/wintogo/Forms/FormatAlert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Windows.Forms;
4 |
5 | namespace wintogo.Forms
6 | {
7 | public partial class FormatAlert : Form
8 | {
9 | Thread t;
10 | public FormatAlert(string msg)
11 | {
12 | Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
13 | InitializeComponent();
14 | lblTxt.Text = msg;
15 | DialogResult = DialogResult.No;
16 | }
17 |
18 | private void FormatAlert_Load(object sender, EventArgs e)
19 | {
20 |
21 |
22 | t = new Thread(() =>
23 | {
24 |
25 | string oriText = btnOk.Text;
26 | for (int i = 1; i >= 1; i--)
27 | {
28 | btnOk.Invoke(new Action(() => { btnOk.Text = oriText+"(" + i.ToString() + ")"; }));
29 | Thread.Sleep(1000);
30 | }
31 | btnOk.Invoke(new Action(() =>
32 | {
33 | btnOk.Text = oriText;
34 | btnOk.Enabled = true;
35 | }));
36 |
37 | });
38 | t.Start();
39 | }
40 |
41 | private void btnOk_Click(object sender, EventArgs e)
42 | {
43 | DialogResult = DialogResult.Yes;
44 | Close();
45 | }
46 |
47 | private void btnCancel_Click(object sender, EventArgs e)
48 | {
49 | DialogResult = DialogResult.No;
50 | Close();
51 | }
52 |
53 | private void FormatAlert_FormClosing(object sender, FormClosingEventArgs e)
54 | {
55 | try
56 | {
57 | if (t != null)
58 | {
59 | if (t.IsAlive)
60 | {
61 | t.Abort();
62 | }
63 | }
64 | }
65 | catch { }
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/wintogo/Forms/FormatAlert.zh-Hant.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 1.本程式與部分安全軟件不相容,可能使製作出錯。
122 | 2.不建議在虛擬機器環境下運行本程式。
123 |
124 |
125 | 製作提示
126 |
127 |
--------------------------------------------------------------------------------
/wintogo/Forms/SetTempPath.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class SetTempPath
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SetTempPath));
32 | this.textBox1 = new System.Windows.Forms.TextBox();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.button2 = new System.Windows.Forms.Button();
35 | this.button3 = new System.Windows.Forms.Button();
36 | this.label1 = new System.Windows.Forms.Label();
37 | this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
38 | this.label2 = new System.Windows.Forms.Label();
39 | this.SuspendLayout();
40 | //
41 | // textBox1
42 | //
43 | resources.ApplyResources(this.textBox1, "textBox1");
44 | this.textBox1.Name = "textBox1";
45 | this.textBox1.ReadOnly = true;
46 | //
47 | // button1
48 | //
49 | resources.ApplyResources(this.button1, "button1");
50 | this.button1.Name = "button1";
51 | this.button1.UseVisualStyleBackColor = true;
52 | this.button1.Click += new System.EventHandler(this.button1_Click);
53 | //
54 | // button2
55 | //
56 | resources.ApplyResources(this.button2, "button2");
57 | this.button2.Name = "button2";
58 | this.button2.UseVisualStyleBackColor = true;
59 | this.button2.Click += new System.EventHandler(this.button2_Click);
60 | //
61 | // button3
62 | //
63 | resources.ApplyResources(this.button3, "button3");
64 | this.button3.Name = "button3";
65 | this.button3.UseVisualStyleBackColor = true;
66 | this.button3.Click += new System.EventHandler(this.button3_Click);
67 | //
68 | // label1
69 | //
70 | resources.ApplyResources(this.label1, "label1");
71 | this.label1.Name = "label1";
72 | //
73 | // folderBrowserDialog1
74 | //
75 | resources.ApplyResources(this.folderBrowserDialog1, "folderBrowserDialog1");
76 | //
77 | // label2
78 | //
79 | resources.ApplyResources(this.label2, "label2");
80 | this.label2.Cursor = System.Windows.Forms.Cursors.Hand;
81 | this.label2.ForeColor = System.Drawing.Color.Blue;
82 | this.label2.Name = "label2";
83 | this.label2.Click += new System.EventHandler(this.label2_Click);
84 | //
85 | // SetTempPath
86 | //
87 | resources.ApplyResources(this, "$this");
88 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
89 | this.ControlBox = false;
90 | this.Controls.Add(this.label2);
91 | this.Controls.Add(this.label1);
92 | this.Controls.Add(this.button3);
93 | this.Controls.Add(this.button2);
94 | this.Controls.Add(this.button1);
95 | this.Controls.Add(this.textBox1);
96 | this.MaximizeBox = false;
97 | this.MinimizeBox = false;
98 | this.Name = "SetTempPath";
99 | this.Load += new System.EventHandler(this.SetTempPath_Load);
100 | this.ResumeLayout(false);
101 | this.PerformLayout();
102 |
103 | }
104 |
105 | #endregion
106 |
107 | private System.Windows.Forms.TextBox textBox1;
108 | private System.Windows.Forms.Button button1;
109 | private System.Windows.Forms.Button button2;
110 | private System.Windows.Forms.Button button3;
111 | private System.Windows.Forms.Label label1;
112 | private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
113 | private System.Windows.Forms.Label label2;
114 | }
115 | }
--------------------------------------------------------------------------------
/wintogo/Forms/SetTempPath.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.IO;
10 | namespace wintogo
11 | {
12 | public partial class SetTempPath : Form
13 | {
14 | public static string temppath = System.Environment.GetEnvironmentVariable("TEMP");
15 | public SetTempPath()
16 | {
17 | System.Threading.Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
18 |
19 | InitializeComponent();
20 | }
21 |
22 | private void button1_Click(object sender, EventArgs e)
23 | {
24 | folderBrowserDialog1.ShowDialog();
25 | if (Directory .Exists (folderBrowserDialog1 .SelectedPath ))
26 | {
27 | textBox1.Text = folderBrowserDialog1.SelectedPath;
28 | }
29 | }
30 |
31 | private void button3_Click(object sender, EventArgs e)
32 | {
33 | if (textBox1.Text.EndsWith("\\"))
34 | {
35 | temppath = textBox1.Text.Substring(0, textBox1.Text.Length - 1);
36 |
37 | }
38 | else { temppath = textBox1.Text; }
39 | IniFile.WriteVal("Main", "TempPath", temppath, Application.StartupPath + "\\files\\settings.ini");
40 | this.Close();
41 |
42 | }
43 |
44 | private void SetTempPath_Load(object sender, EventArgs e)
45 | {
46 | textBox1.Text = temppath;
47 | }
48 |
49 | private void button2_Click(object sender, EventArgs e)
50 | {
51 | this.Close();
52 | }
53 |
54 | private void label2_Click(object sender, EventArgs e)
55 | {
56 | temppath = System.Environment.GetEnvironmentVariable("TEMP");
57 | textBox1.Text = temppath;
58 |
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/wintogo/Forms/UdiskBenchmark.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo.Forms
2 | {
3 | partial class UdiskBenchmark
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UdiskBenchmark));
32 | this.labelLevel = new System.Windows.Forms.Label();
33 | this.label4 = new System.Windows.Forms.Label();
34 | this.button1 = new System.Windows.Forms.Button();
35 | this.SuspendLayout();
36 | //
37 | // labelLevel
38 | //
39 | resources.ApplyResources(this.labelLevel, "labelLevel");
40 | this.labelLevel.BackColor = System.Drawing.Color.Black;
41 | this.labelLevel.ForeColor = System.Drawing.Color.White;
42 | this.labelLevel.Name = "labelLevel";
43 | //
44 | // label4
45 | //
46 | resources.ApplyResources(this.label4, "label4");
47 | this.label4.Name = "label4";
48 | //
49 | // button1
50 | //
51 | resources.ApplyResources(this.button1, "button1");
52 | this.button1.Name = "button1";
53 | this.button1.UseVisualStyleBackColor = true;
54 | this.button1.Click += new System.EventHandler(this.button1_Click);
55 | //
56 | // UdiskBenchmark
57 | //
58 | resources.ApplyResources(this, "$this");
59 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
60 | this.Controls.Add(this.button1);
61 | this.Controls.Add(this.label4);
62 | this.Controls.Add(this.labelLevel);
63 | this.Icon = global::wintogo.Properties.Resources.WTGA;
64 | this.MaximizeBox = false;
65 | this.MinimizeBox = false;
66 | this.Name = "UdiskBenchmark";
67 | this.Load += new System.EventHandler(this.UdiskBenchmark_Load);
68 | this.ResumeLayout(false);
69 | this.PerformLayout();
70 |
71 | }
72 |
73 | #endregion
74 |
75 | private System.Windows.Forms.Label labelLevel;
76 | private System.Windows.Forms.Label label4;
77 | private System.Windows.Forms.Button button1;
78 | }
79 | }
--------------------------------------------------------------------------------
/wintogo/Forms/UdiskBenchmark.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Threading;
4 | using System.Windows.Forms;
5 |
6 | namespace wintogo.Forms
7 | {
8 | public partial class UdiskBenchmark : Form
9 | {
10 | private int lev = 0;
11 | private string udString = string.Empty;
12 | public UdiskBenchmark(string ud,int level)
13 | {
14 | Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
15 | InitializeComponent();
16 | Text = ud;
17 | lev = level;
18 | }
19 |
20 | private void UdiskBenchmark_Load(object sender, EventArgs e)
21 | {
22 | string ln = "Error";
23 | Color lc = Color.Yellow;
24 | if (lev == 1)
25 | {
26 | ln = "Steel";
27 | lc = Color.SteelBlue;
28 | }
29 | else if(lev == 2)
30 | {
31 | ln = "Bronze";
32 | lc = Color.Crimson;
33 | }else if(lev == 3)
34 | {
35 | ln = "Silver";
36 | lc = Color.Silver;
37 | }else if (lev == 4)
38 | {
39 | ln = "Gold";
40 | lc = Color.Gold;
41 | }
42 | else if (lev == 5)
43 | {
44 | ln = "Platinum";
45 | lc = Color.White;
46 | }
47 | labelLevel.Text = ln;
48 | labelLevel.ForeColor = lc;
49 | //labelLevel.Location.X = Width / 2 - labelLevel.Width / 2;
50 | labelLevel.Location = new Point(Width / 2 - labelLevel.Width / 2, labelLevel.Location.Y);
51 | button1.Location = new Point(Width / 2 - button1.Width / 2, button1.Location.Y);
52 | }
53 |
54 | private void button1_Click(object sender, EventArgs e)
55 | {
56 | Close();
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/wintogo/Forms/Update.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | //using Microsoft.Win32;
4 | namespace wintogo
5 |
6 | {
7 | public partial class Update : Form
8 | {
9 | string args = null;
10 | public Update(string args)
11 | {
12 | System.Threading.Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
13 |
14 | InitializeComponent();
15 | this.args = args;
16 | }
17 |
18 | private void checkBox1_CheckedChanged(object sender, EventArgs e)
19 | {
20 | if (checkBox1.Checked == true) { button1.Enabled = false; }
21 | if (checkBox1.Checked == false) { button1.Enabled = true; }
22 | }
23 |
24 | private void button2_Click(object sender, EventArgs e)
25 | {
26 | if (checkBox1.Checked == true)
27 | {
28 | IniFile.WriteVal("Main", "AutoUpdate", "0", Application.StartupPath + "\\files\\settings.ini");
29 | //WTRegedit("nevercheckupdate", "1");
30 | }
31 | this.Close();
32 | }
33 | //private void WTRegedit(string name, string tovalue)
34 | //{
35 | // RegistryKey hklm = Registry.CurrentUser ;
36 | // RegistryKey software = hklm.OpenSubKey("SOFTWARE", true);
37 | // RegistryKey aimdir = software.CreateSubKey(Application.ProductName);
38 | // aimdir.SetValue(name, tovalue);
39 | //}
40 |
41 | private void update_Load(object sender, EventArgs e)
42 | {
43 | label1.Text += args;
44 | }
45 |
46 | private void button1_Click(object sender, EventArgs e)
47 | {
48 | WebUtility.VisitWeb("http://bbs.luobotou.org/thread-761-1-1.html");
49 | this.Close();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/wintogo/Forms/Update.designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class Update
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Update));
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.label2 = new System.Windows.Forms.Label();
34 | this.button1 = new System.Windows.Forms.Button();
35 | this.button2 = new System.Windows.Forms.Button();
36 | this.checkBox1 = new System.Windows.Forms.CheckBox();
37 | this.SuspendLayout();
38 | //
39 | // label1
40 | //
41 | resources.ApplyResources(this.label1, "label1");
42 | this.label1.Name = "label1";
43 | //
44 | // label2
45 | //
46 | resources.ApplyResources(this.label2, "label2");
47 | this.label2.Name = "label2";
48 | //
49 | // button1
50 | //
51 | resources.ApplyResources(this.button1, "button1");
52 | this.button1.Name = "button1";
53 | this.button1.UseVisualStyleBackColor = true;
54 | this.button1.Click += new System.EventHandler(this.button1_Click);
55 | //
56 | // button2
57 | //
58 | resources.ApplyResources(this.button2, "button2");
59 | this.button2.Name = "button2";
60 | this.button2.UseVisualStyleBackColor = true;
61 | this.button2.Click += new System.EventHandler(this.button2_Click);
62 | //
63 | // checkBox1
64 | //
65 | resources.ApplyResources(this.checkBox1, "checkBox1");
66 | this.checkBox1.Name = "checkBox1";
67 | this.checkBox1.UseVisualStyleBackColor = true;
68 | this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
69 | //
70 | // Update
71 | //
72 | resources.ApplyResources(this, "$this");
73 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
74 | this.Controls.Add(this.checkBox1);
75 | this.Controls.Add(this.button2);
76 | this.Controls.Add(this.button1);
77 | this.Controls.Add(this.label2);
78 | this.Controls.Add(this.label1);
79 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
80 | this.Icon = global::wintogo.Properties.Resources.WTGA;
81 | this.MaximizeBox = false;
82 | this.MinimizeBox = false;
83 | this.Name = "Update";
84 | this.Load += new System.EventHandler(this.update_Load);
85 | this.ResumeLayout(false);
86 | this.PerformLayout();
87 |
88 | }
89 |
90 | #endregion
91 |
92 | private System.Windows.Forms.Label label1;
93 | private System.Windows.Forms.Label label2;
94 | private System.Windows.Forms.Button button1;
95 | private System.Windows.Forms.Button button2;
96 | private System.Windows.Forms.CheckBox checkBox1;
97 | }
98 | }
--------------------------------------------------------------------------------
/wintogo/Forms/WriteProgress.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class WriteProgress
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WriteProgress));
32 | this.textBox1 = new System.Windows.Forms.TextBox();
33 | this.groupBox1 = new System.Windows.Forms.GroupBox();
34 | this.label1 = new System.Windows.Forms.Label();
35 | this.linkLabel1 = new System.Windows.Forms.LinkLabel();
36 | this.labelProgress = new System.Windows.Forms.Label();
37 | this.win8PB2 = new wintogo.Win8PB();
38 | this.groupBox1.SuspendLayout();
39 | this.SuspendLayout();
40 | //
41 | // textBox1
42 | //
43 | resources.ApplyResources(this.textBox1, "textBox1");
44 | this.textBox1.Name = "textBox1";
45 | this.textBox1.ReadOnly = true;
46 | this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
47 | //
48 | // groupBox1
49 | //
50 | this.groupBox1.Controls.Add(this.textBox1);
51 | resources.ApplyResources(this.groupBox1, "groupBox1");
52 | this.groupBox1.Name = "groupBox1";
53 | this.groupBox1.TabStop = false;
54 | //
55 | // label1
56 | //
57 | resources.ApplyResources(this.label1, "label1");
58 | this.label1.Name = "label1";
59 | this.label1.Click += new System.EventHandler(this.label1_Click);
60 | //
61 | // linkLabel1
62 | //
63 | resources.ApplyResources(this.linkLabel1, "linkLabel1");
64 | this.linkLabel1.Name = "linkLabel1";
65 | this.linkLabel1.TabStop = true;
66 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
67 | //
68 | // labelProgress
69 | //
70 | resources.ApplyResources(this.labelProgress, "labelProgress");
71 | this.labelProgress.Name = "labelProgress";
72 | //
73 | // win8PB2
74 | //
75 | this.win8PB2.BackColor = System.Drawing.Color.Transparent;
76 | resources.ApplyResources(this.win8PB2, "win8PB2");
77 | this.win8PB2.Name = "win8PB2";
78 | //
79 | // WriteProgress
80 | //
81 | resources.ApplyResources(this, "$this");
82 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
83 | this.Controls.Add(this.win8PB2);
84 | this.Controls.Add(this.labelProgress);
85 | this.Controls.Add(this.linkLabel1);
86 | this.Controls.Add(this.label1);
87 | this.Controls.Add(this.groupBox1);
88 | this.DoubleBuffered = true;
89 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
90 | this.Icon = global::wintogo.Properties.Resources.WTGA;
91 | this.MaximizeBox = false;
92 | this.Name = "WriteProgress";
93 | this.TopMost = true;
94 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.writeprogress_FormClosing);
95 | this.Load += new System.EventHandler(this.writeprogress_Load);
96 | this.groupBox1.ResumeLayout(false);
97 | this.groupBox1.PerformLayout();
98 | this.ResumeLayout(false);
99 | this.PerformLayout();
100 |
101 | }
102 |
103 | #endregion
104 |
105 | public System.Windows.Forms.TextBox textBox1;
106 | private System.Windows.Forms.GroupBox groupBox1;
107 | private System.Windows.Forms.Label label1;
108 | public System.Windows.Forms.LinkLabel linkLabel1;
109 | private System.Windows.Forms.Label labelProgress;
110 | private Win8PB win8PB2;
111 | }
112 | }
--------------------------------------------------------------------------------
/wintogo/Forms/WriteProgress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 | using System.Threading;
5 | using System.Windows.Forms;
6 |
7 | namespace wintogo
8 | {
9 | public partial class WriteProgress : Form
10 | {
11 | public static string[] topicName = new string[10];
12 | public static string[] topicLink = new string[10];
13 |
14 | public bool IsUserClosing { get; set; }
15 |
16 | public Exception OnClosingException { get; protected set; }
17 | public WriteProgress()
18 | {
19 | //CultureInfo ca = new System.Globalization.CultureInfo("en");
20 | //MessageBox.Show(Form1.ci.DisplayName);
21 | System.Threading.Thread.CurrentThread.CurrentUICulture = MsgManager.ci;
22 |
23 | InitializeComponent();
24 | }
25 | int num = 0;
26 | private void writeprogress_FormClosing(object sender, FormClosingEventArgs e)
27 | {
28 | if (IsUserClosing)
29 | {
30 | DialogResult dResult = MessageBox.Show(MsgManager.GetResString("Msg_WritingAbort"), MsgManager.GetResString("Msg_Tip"), MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
31 | if (dResult == DialogResult.Yes)
32 | {
33 | IsUserClosing = false;
34 | OnClosingException = new UserCancelException();
35 | }
36 | else
37 | {
38 | e.Cancel = true;
39 | }
40 | }
41 | try
42 | {
43 | WTGModel.wp = null;
44 |
45 | //Log.WriteLog("Output", textBox1.Text);
46 | ////if (System.IO.Directory .Exists ())
47 | //FileStream fs = new FileStream(WTGModel.logPath + "\\" + DateTime.Now.ToFileTime() + ".log", FileMode.Create, FileAccess.Write);
48 | //fs.SetLength(0);
49 | //StreamWriter sw = new StreamWriter(fs, Encoding.Default);
50 | //string ws = "";
51 | //ws = Application.StartupPath + "\r\n程序版本:" + Application.ProductVersion + "\r\n" + System.DateTime.Now;
52 | //sw.WriteLine(ws);
53 | //ws = textBox1.Text;
54 | //sw.WriteLine(ws);
55 | //sw.Close();
56 | textBox1.Text=string.Empty;
57 | }
58 | catch (Exception ex)
59 | {
60 | Log.WriteLog("Err_WriteProgressFormClosing", ex.ToString());
61 | }
62 |
63 | }
64 |
65 | private void writeprogress_Load(object sender, EventArgs e)
66 | {
67 | //IsUserClosing = true/*/*;*/*/
68 | Random ra = new Random();
69 | num = ra.Next(0, 9);
70 | try
71 | {
72 | linkLabel1.Text = topicName[num];
73 | textBox1.Focus();
74 | //设置光标的位置到文本尾
75 | textBox1.Select(textBox1.TextLength, 0);
76 | //滚动到控件光标处
77 | textBox1.ScrollToCaret();
78 | }
79 | catch (Exception ex)
80 | {
81 | MessageBox.Show(ex.Message);
82 | Log.WriteLog("Err_WriteProgressLoad", ex.ToString());
83 | }
84 |
85 |
86 | }
87 |
88 | private void label1_Click(object sender, EventArgs e)
89 | {
90 |
91 | }
92 |
93 | private void win8PB1_Load(object sender, EventArgs e)
94 | {
95 |
96 | }
97 |
98 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
99 | {
100 | WebUtility.VisitWeb(topicLink[num]);
101 | }
102 |
103 | private void textBox1_TextChanged(object sender, EventArgs e)
104 | {
105 |
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/wintogo/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/wintogo/LanguageDefault.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ZH-HANS
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/wintogo/MultiLanguage/MsgManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Threading;
4 | //using System.Threading.Tasks;
5 | using wintogo.MultiLanguage;
6 |
7 | namespace wintogo
8 | {
9 |
10 | public static class MsgManager
11 | {
12 | public static CultureInfo ci = Thread.CurrentThread.CurrentCulture;
13 | public static System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ResourceLang));
14 | public static string GetResString(string rname, CultureInfo culi)
15 | {
16 | return resources.GetString(rname, culi).Replace("\\n", Environment.NewLine);
17 | }
18 | public static string GetResString(string rescourceName)
19 | {
20 | return resources.GetString(rescourceName, ci).Replace("\\n", Environment.NewLine);
21 |
22 | }
23 |
24 | }
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/wintogo/MultiLanguage/ResourceLang.en.Designer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nkc3g4/wtg-assistant/b8877edf86b73886d5413b20fc0b3b5fdaa0d449/wintogo/MultiLanguage/ResourceLang.en.Designer.cs
--------------------------------------------------------------------------------
/wintogo/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace wintogo
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// 应用程序的主入口点。
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware();
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | [System.Runtime.InteropServices.DllImport("user32.dll")]
22 | private static extern bool SetProcessDPIAware();
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/wintogo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using System.Resources;
5 |
6 | // 有关程序集的常规信息通过以下
7 | // 特性集控制。更改这些特性值可修改
8 | // 与程序集关联的信息。
9 | [assembly: AssemblyTitle("Windows To Go Assistant")]
10 | [assembly: AssemblyDescription("制作在U盘上运行的 Windows")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("bbs.luobotou.org")]
13 | [assembly: AssemblyProduct("WTG辅助工具")]
14 | [assembly: AssemblyCopyright("Copyright © 2012-2024 nkc3g4")]
15 | [assembly: AssemblyTrademark("萝卜头IT论坛")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // 将 ComVisible 设置为 false 使此程序集中的类型
19 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
20 | // 则将该类型上的 ComVisible 特性设置为 true。
21 | [assembly: ComVisible(false)]
22 |
23 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
24 | [assembly: Guid("120b181e-48b6-4ce5-b447-c598c6dfcbb0")]
25 |
26 | // 程序集的版本信息由下面四个值组成:
27 | //
28 | // 主版本
29 | // 次版本
30 | // 内部版本号
31 | // 修订号
32 | //
33 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
34 | // 方法是按如下所示使用“*”:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("5.6.2.0")]
37 | [assembly: AssemblyFileVersion("5.6.2.0")]
38 | [assembly: NeutralResourcesLanguageAttribute("")]
39 |
--------------------------------------------------------------------------------
/wintogo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace wintogo.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("wintogo.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
65 | ///
66 | internal static System.Drawing.Icon WTGA {
67 | get {
68 | object obj = ResourceManager.GetObject("WTGA", resourceCulture);
69 | return ((System.Drawing.Icon)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/wintogo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace wintogo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/wintogo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/wintogo/Resources/WTGA.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nkc3g4/wtg-assistant/b8877edf86b73886d5413b20fc0b3b5fdaa0d449/wintogo/Resources/WTGA.ico
--------------------------------------------------------------------------------
/wintogo/Utility/FileNameConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Globalization;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | namespace wintogo
9 | {
10 | public class ImagePartNameConverter : StringConverter
11 | {
12 |
13 | public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
14 | {
15 | return true;
16 | }
17 | public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
18 | {
19 |
20 | return new StandardValuesCollection(WTGModel.imagePartNames);
21 | }
22 | public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
23 | {
24 | return true;
25 | //return base.GetStandardValuesExclusive(context);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/wintogo/Utility/FormHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace wintogo.Utility
8 | {
9 | public static class FormHelper
10 | {
11 | public static void Closewp()
12 | {
13 | if (WTGModel.wp != null)
14 | {
15 | try
16 | {
17 | WTGModel.wp.Invoke(new Action(() =>
18 | {
19 | WTGModel.wp.IsUserClosing = false;
20 | WTGModel.wp.Close();
21 | }));
22 |
23 | }
24 | catch (Exception ex) {
25 | Console.WriteLine(ex.ToString());
26 | }
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/wintogo/Utility/GetDotNetVersion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Win32;
3 |
4 |
5 | namespace wintogo.Utility
6 | {
7 | public static class GetDotNetVersion
8 | {
9 | public static bool IsCorrectVersion()
10 | {
11 | try
12 | {
13 | const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
14 |
15 | using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey))
16 | {
17 | if (ndpKey != null && ndpKey.GetValue("Release") != null)
18 | {
19 | int releaseKey = (int)ndpKey.GetValue("Release");
20 | return releaseKey >= 394254;
21 | //Console.WriteLine($".NET Framework Version: {CheckFor45PlusVersion((int)ndpKey.GetValue("Release"))}");
22 | }
23 | else
24 | {
25 | return false;
26 | //Console.WriteLine(".NET Framework Version 4.5 or later is not detected.");
27 | }
28 | }
29 | }
30 | catch(Exception ex)
31 | {
32 | Console.WriteLine(ex.ToString());
33 | return true;
34 | }
35 | /*
36 | // Checking the version using >= enables forward compatibility.
37 | string CheckFor45PlusVersion(int releaseKey)
38 | {
39 | if (releaseKey >= 528040)
40 | return "4.8 or later";
41 | if (releaseKey >= 461808)
42 | return "4.7.2";
43 | if (releaseKey >= 461308)
44 | return "4.7.1";
45 | if (releaseKey >= 460798)
46 | return "4.7";
47 | if (releaseKey >= 394802)
48 | return "4.6.2";
49 | if (releaseKey >= 394254)
50 | return "4.6.1";
51 | if (releaseKey >= 393295)
52 | return "4.6";
53 | if (releaseKey >= 379893)
54 | return "4.5.2";
55 | if (releaseKey >= 378675)
56 | return "4.5.1";
57 | if (releaseKey >= 378389)
58 | return "4.5";
59 | // This code should never execute. A non-null release key should mean
60 | // that 4.5 or later is installed.
61 | return "No 4.5 or later version detected";
62 | }*/
63 | }
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/wintogo/Utility/HttpPost.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Net;
6 | using System.Text;
7 | using System.Web;
8 | using System.Windows.Forms;
9 |
10 | namespace wintogo.Utility
11 | {
12 | public class HttpPost
13 | {
14 | public static string HttpUploadFile(string url, string path)
15 | {
16 | // 设置参数
17 | HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
18 | CookieContainer cookieContainer = new CookieContainer();
19 | request.CookieContainer = cookieContainer;
20 | request.AllowAutoRedirect = true;
21 | request.Method = "POST";
22 | string boundary = DateTime.Now.Ticks.ToString("X"); // 随机分隔线
23 | request.ContentType = "multipart/form-data;charset=utf-8;boundary=" + boundary+";version="+Application.ProductVersion;
24 | byte[] itemBoundaryBytes = Encoding.UTF8.GetBytes("\r\n--" + boundary + "\r\n");
25 | byte[] endBoundaryBytes = Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n");
26 | int pos = path.LastIndexOf("\\");
27 | string fileName = path.Substring(pos + 1);
28 | //请求头部信息
29 | StringBuilder sbHeader = new StringBuilder(string.Format("Content-Disposition:form-data;name=\"file\";filename=\"{0}\"\r\nContent-Type:application/octet-stream\r\n\r\n", fileName));
30 | byte[] postHeaderBytes = Encoding.UTF8.GetBytes(sbHeader.ToString());
31 | FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
32 | byte[] bArr = new byte[fs.Length];
33 | fs.Read(bArr, 0, bArr.Length);
34 | fs.Close();
35 | Stream postStream = request.GetRequestStream();
36 | postStream.Write(itemBoundaryBytes, 0, itemBoundaryBytes.Length);
37 | postStream.Write(postHeaderBytes, 0, postHeaderBytes.Length);
38 | postStream.Write(bArr, 0, bArr.Length);
39 | postStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
40 | postStream.Close();
41 | //发送请求并获取相应回应数据
42 | HttpWebResponse response = request.GetResponse() as HttpWebResponse;
43 | //直到request.GetResponse()程序才开始向目标网页发送Post请求
44 | Stream instream = response.GetResponseStream();
45 | StreamReader sr = new StreamReader(instream, Encoding.UTF8);
46 | //返回结果网页(html)代码
47 | string content = sr.ReadToEnd();
48 | return content;
49 | }
50 | public static string Post(string url, Dictionary paras)
51 | {
52 | // 设置参数
53 | HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
54 |
55 | request.AllowAutoRedirect = true;
56 | request.Method = "POST";
57 | request.ContentType = "application/x-www-form-urlencoded";
58 | StringBuilder paraBuilder = new StringBuilder();
59 |
60 | foreach (var item in paras)
61 | {
62 | paraBuilder.Append(HttpUtility.UrlEncode(item.Key.Trim()));
63 | paraBuilder.Append("=");
64 | paraBuilder.Append(HttpUtility.UrlEncode(item.Value.Trim()));
65 | paraBuilder.Append("&");
66 | }
67 |
68 | string paraUrlCoded = paraBuilder.ToString(0, paraBuilder.Length - 1);
69 |
70 | byte[] payload;
71 | //将URL编码后的字符串转化为字节
72 | payload = Encoding.UTF8.GetBytes(paraUrlCoded);
73 | //设置请求的ContentLength
74 | request.ContentLength = payload.Length;
75 |
76 | Stream postStream = request.GetRequestStream();
77 | postStream.Write(payload, 0, payload.Length);
78 | postStream.Close();
79 | //发送请求并获取相应回应数据
80 | HttpWebResponse response = request.GetResponse() as HttpWebResponse;
81 | //直到request.GetResponse()程序才开始向目标网页发送Post请求
82 | Stream instream = response.GetResponseStream();
83 | StreamReader sr = new StreamReader(instream, Encoding.UTF8);
84 | //返回结果网页(html)代码
85 | string content = sr.ReadToEnd();
86 | return content;
87 | }
88 |
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/wintogo/Utility/ISOHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Management.Automation;
2 |
3 | namespace wintogo.Utility
4 | {
5 | public class ISOHelper
6 | {
7 | public static void MountISO(string path)
8 | {
9 | using (PowerShell PowerShellInstance = PowerShell.Create())
10 | {
11 | // use "AddScript" to add the contents of a script file to the end of the execution pipeline.
12 | // use "AddCommand" to add individual commands/cmdlets to the end of the execution pipeline.
13 | PowerShellInstance.AddScript("param($path) Mount-DiskImage -ImagePath $path");
14 |
15 | // use "AddParameter" to add a single parameter to the last command/script on the pipeline.
16 | PowerShellInstance.AddParameter("path", path);
17 | PowerShellInstance.Invoke();
18 |
19 | }
20 | }
21 | public static void DismountISO(string path)
22 | {
23 | using (PowerShell PowerShellInstance = PowerShell.Create())
24 | {
25 | // use "AddScript" to add the contents of a script file to the end of the execution pipeline.
26 | // use "AddCommand" to add individual commands/cmdlets to the end of the execution pipeline.
27 | PowerShellInstance.AddScript("param($path) Dismount-DiskImage -ImagePath $path");
28 |
29 | // use "AddParameter" to add a single parameter to the last command/script on the pipeline.
30 | PowerShellInstance.AddParameter("path", path);
31 | PowerShellInstance.Invoke();
32 |
33 | }
34 |
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/wintogo/Utility/IniOperation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Text;
4 | using System.Windows.Forms;
5 |
6 | namespace wintogo
7 | {
8 | class IniFile
9 | {
10 | //绝对路径(默认执行程序目录)
11 | public string FilePath { get; set; }
12 |
13 | ///
14 | /// 读取ini文件
15 | ///
16 | /// 段落名
17 | /// 键
18 | /// 缺省值
19 | /// 所对应的值,如果该key不存在则返回空值
20 | /// 值允许的大小
21 | /// INI文件的完整路径和文件名
22 | ///
23 | [DllImport("kernel32")]
24 | private static extern int GetPrivateProfileString(
25 | string section, string key, string defVal,
26 | StringBuilder retVal, int size, string filePath);
27 |
28 | ///
29 | /// 写入ini文件
30 | ///
31 | /// 段落名
32 | /// 键
33 | /// 值
34 | /// INI文件的完整路径和文件名
35 | ///
36 | [DllImport("kernel32")]
37 | private static extern long WritePrivateProfileString(
38 | string section, string key, string val, string filePath);
39 |
40 | #region 静态方法
41 |
42 | public static string ReadVal(string section, string key, string filePath)
43 | {
44 | string defVal = string.Empty;
45 | StringBuilder retVal = new StringBuilder(260);
46 | int size = 102400;
47 | string rt = string.Empty;
48 | try
49 | {
50 | GetPrivateProfileString(section, key, defVal, retVal, size, filePath);
51 | rt = retVal.ToString();
52 | }
53 | catch (Exception ex)
54 | {
55 | MessageBox.Show(ex.ToString());
56 |
57 | rt = string.Empty;
58 | }
59 | return rt;
60 | }
61 |
62 | public static bool WriteVal(string section, string key, string val, string filePath)
63 | {
64 | try
65 | {
66 | if (WritePrivateProfileString(section, key, val, filePath) == 0)
67 | return false;
68 | else
69 | return true;
70 | }
71 | catch
72 | {
73 | return false;
74 | }
75 | }
76 |
77 | #endregion
78 |
79 | #region 对象方法
80 |
81 | public string ReadVal(string section, string key)
82 | {
83 | string defVal = string.Empty;
84 | StringBuilder retVal = new StringBuilder();
85 | int size = 10240;
86 | string rt = string.Empty;
87 | try
88 | {
89 | GetPrivateProfileString(section, key,
90 | defVal, retVal, size, this.FilePath);
91 | rt = retVal.ToString();
92 | }
93 | catch
94 | {
95 | rt = string.Empty;
96 | }
97 | return rt;
98 | }
99 |
100 | public bool WriteVal(string section, string key, string val)
101 | {
102 | try
103 | {
104 | WritePrivateProfileString(section, key, val, this.FilePath);
105 | return true;
106 | }
107 | catch
108 | {
109 | return false;
110 | }
111 | }
112 |
113 | #endregion
114 | }
115 | }
--------------------------------------------------------------------------------
/wintogo/Utility/StringOperation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | //using System.Threading.Tasks;
6 |
7 | namespace wintogo
8 | {
9 | public static class StringUtility
10 | {
11 | public static bool IsChina(string CString)
12 | {
13 | bool BoolValue = false;
14 | //if (CString.IndexOf(' ') >= 0)
15 | //{
16 | // return true;
17 | //}
18 | for (int i = 0; i < CString.Length; i++)
19 | {
20 | if (Convert.ToInt32(Convert.ToChar(CString.Substring(i, 1))) > Convert.ToInt32(Convert.ToChar(128)))
21 | {
22 | BoolValue = true;
23 | }
24 |
25 | }
26 | return BoolValue;
27 | }
28 | public static bool IsChinaOrContainSpace(string CString)
29 | {
30 | bool BoolValue = false;
31 | if (CString.IndexOf(' ') >= 0)
32 | {
33 | return true;
34 | }
35 | for (int i = 0; i < CString.Length; i++)
36 | {
37 | if (Convert.ToInt32(Convert.ToChar(CString.Substring(i, 1))) > Convert.ToInt32(Convert.ToChar(128)))
38 | {
39 | BoolValue = true;
40 | }
41 |
42 | }
43 | return BoolValue;
44 | }
45 |
46 | public static string Combine(params string[] paths)
47 | {
48 | if (paths.Length == 0)
49 | {
50 | throw new ArgumentException("please input path");
51 | }
52 | else
53 | {
54 | StringBuilder builder = new StringBuilder();
55 | string spliter = "\\";
56 |
57 | string firstPath = paths[0];
58 |
59 | if (firstPath.StartsWith("HTTP", StringComparison.OrdinalIgnoreCase))
60 | {
61 | spliter = "/";
62 | }
63 |
64 | if (!firstPath.EndsWith(spliter))
65 | {
66 | firstPath = firstPath + spliter;
67 | }
68 | builder.Append(firstPath);
69 |
70 | for (int i = 1; i < paths.Length; i++)
71 | {
72 | string nextPath = paths[i];
73 | if (nextPath.StartsWith("/") || nextPath.StartsWith("\\"))
74 | {
75 | nextPath = nextPath.Substring(1);
76 | }
77 |
78 | if (i != paths.Length - 1)//not the last one
79 | {
80 | if (nextPath.EndsWith("/") || nextPath.EndsWith("\\"))
81 | {
82 | nextPath = nextPath.Substring(0, nextPath.Length - 1) + spliter;
83 | }
84 | else
85 | {
86 | nextPath = nextPath + spliter;
87 | }
88 | }
89 |
90 | builder.Append(nextPath);
91 | }
92 |
93 | return builder.ToString();
94 | }
95 | }
96 | ///
97 | /// // 0xae00cf => "AE00CF "
98 | ///
99 | ///
100 | ///
101 | public static string ToHexString(byte[] bytes)
102 | {
103 | string hexString = string.Empty;
104 | if (bytes != null)
105 | {
106 | StringBuilder strB = new StringBuilder();
107 |
108 | for (int i = 0; i < bytes.Length; i++)
109 | {
110 | strB.Append(bytes[i].ToString("X2"));
111 | }
112 | hexString = strB.ToString();
113 | }
114 | return hexString;
115 | }
116 |
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/wintogo/Utility/TakeOwn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Security.AccessControl;
6 | using System.Text;
7 |
8 | namespace wintogo.Forms
9 | {
10 | public static class TakeOwnTools
11 | {
12 | public static void TakeOwn(string sSourcePath)
13 | {
14 | //在指定目录及子目录下查找文件,在list中列出子目录及文件
15 | DirectoryInfo Dir = new DirectoryInfo(sSourcePath);
16 | DirectoryInfo[] DirSub = Dir.GetDirectories();
17 | if (DirSub.Length <= 0)
18 | {
19 | foreach (FileInfo f in Dir.GetFiles("*.*", SearchOption.TopDirectoryOnly)) //查找文件
20 | {
21 | TakeOwn(f);
22 |
23 | }
24 | }
25 | int t = 1;
26 | foreach (DirectoryInfo d in DirSub)//查找子目录
27 | {
28 | TakeOwn(Dir + @"\" + d.ToString());
29 | TakeOwn(d);
30 | if (t == 1)
31 | {
32 | foreach (FileInfo f in Dir.GetFiles("*.*", SearchOption.TopDirectoryOnly)) //查找文件
33 | {
34 | TakeOwn(f);
35 | }
36 | t = t + 1;
37 | }
38 | }
39 | }
40 | public static void TakeOwn(DirectoryInfo di)
41 | {
42 | DirectorySecurity dirSecurity = di.GetAccessControl();
43 | dirSecurity.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow));
44 | dirSecurity.AddAccessRule(new FileSystemAccessRule("Users", FileSystemRights.FullControl, AccessControlType.Allow));
45 | di.SetAccessControl(dirSecurity);
46 | }
47 | public static void TakeOwn(FileInfo fi)
48 | {
49 | FileSecurity fileSecurity = fi.GetAccessControl();
50 | fileSecurity.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow));
51 | fileSecurity.AddAccessRule(new FileSystemAccessRule("Users", FileSystemRights.FullControl, AccessControlType.Allow));
52 | fi.SetAccessControl(fileSecurity);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/wintogo/Utility/WebUtility.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using System.Diagnostics;
4 | using System.Text.RegularExpressions;
5 | using System.Windows.Forms;
6 |
7 | namespace wintogo
8 | {
9 | public static class WebUtility
10 | {
11 | public static void VisitWeb(string url)
12 | {
13 | try
14 | {
15 | Process.Start(url);
16 | }
17 | catch
18 | {
19 | try
20 | {
21 | RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
22 | string s = key.GetValue("").ToString();
23 |
24 | Regex reg = new Regex("\"([^\"]+)\"");
25 | MatchCollection matchs = reg.Matches(s);
26 |
27 | string filename = "";
28 | if (matchs.Count > 0)
29 | {
30 | filename = matchs[0].Groups[1].Value;
31 | Process.Start(filename, url);
32 | }
33 | }
34 | catch (Exception ex)
35 | {
36 | //MsgManager.getResString("Msg_FatalError")
37 | //程序遇到严重错误\n官方支持论坛:bbs.luobotou.org\n
38 | MessageBox.Show("程序遇到严重错误\nFATAL ERROR!官方支持论坛:bbs.luobotou.org\n" + ex.ToString());
39 |
40 | }
41 | }
42 |
43 |
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/wintogo/WTGA.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nkc3g4/wtg-assistant/b8877edf86b73886d5413b20fc0b3b5fdaa0d449/wintogo/WTGA.ico
--------------------------------------------------------------------------------
/wintogo/WTGA.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nkc3g4/wtg-assistant/b8877edf86b73886d5413b20fc0b3b5fdaa0d449/wintogo/WTGA.png
--------------------------------------------------------------------------------
/wintogo/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
47 |
--------------------------------------------------------------------------------
/wintogo/copy.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace wintogo
2 | {
3 | partial class copy
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.win8PB1 = new wintogo.Win8PB();
34 | this.SuspendLayout();
35 | //
36 | // label1
37 | //
38 | this.label1.AutoSize = true;
39 | this.label1.Font = new System.Drawing.Font("Microsoft YaHei", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
40 | this.label1.Location = new System.Drawing.Point(19, 9);
41 | this.label1.Name = "label1";
42 | this.label1.Size = new System.Drawing.Size(269, 42);
43 | this.label1.TabIndex = 0;
44 | this.label1.Text = "复制文件中...大约需要10分钟~1小时\r\n 请耐心等待!";
45 | this.label1.Click += new System.EventHandler(this.label1_Click);
46 | //
47 | // button1
48 | //
49 | this.button1.Location = new System.Drawing.Point(106, 101);
50 | this.button1.Name = "button1";
51 | this.button1.Size = new System.Drawing.Size(75, 21);
52 | this.button1.TabIndex = 2;
53 | this.button1.Text = "取消";
54 | this.button1.UseVisualStyleBackColor = true;
55 | this.button1.Click += new System.EventHandler(this.button1_Click);
56 | //
57 | // win8PB1
58 | //
59 | this.win8PB1.Location = new System.Drawing.Point(-1, 67);
60 | this.win8PB1.Name = "win8PB1";
61 | this.win8PB1.Size = new System.Drawing.Size(300, 10);
62 | this.win8PB1.TabIndex = 3;
63 | this.win8PB1.Load += new System.EventHandler(this.win8PB1_Load);
64 | //
65 | // copy
66 | //
67 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
68 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
69 | this.ClientSize = new System.Drawing.Size(300, 135);
70 | this.Controls.Add(this.win8PB1);
71 | this.Controls.Add(this.label1);
72 | this.Controls.Add(this.button1);
73 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
74 | this.Icon = global::wintogo.Properties.Resources._2001;
75 | this.MaximizeBox = false;
76 | this.Name = "copy";
77 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
78 | this.Text = "复制文件...";
79 | this.Load += new System.EventHandler(this.copy_Load);
80 | this.ResumeLayout(false);
81 | this.PerformLayout();
82 |
83 | }
84 |
85 | #endregion
86 |
87 | private System.Windows.Forms.Label label1;
88 | private System.Windows.Forms.Button button1;
89 | private Win8PB win8PB1;
90 | }
91 | }
--------------------------------------------------------------------------------
/wintogo/copy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Windows.Forms;
4 | using System.IO;
5 | namespace wintogo
6 | {
7 | public partial class copy : Form
8 | {
9 | Thread copyfile;
10 | String udisk;
11 | public copy(string ud)
12 | {
13 | InitializeComponent();
14 | udisk = ud;
15 | }
16 |
17 | private void copy_Load(object sender, EventArgs e)
18 | {
19 | copyfile = new Thread(new ThreadStart(copyfiles));
20 | copyfile.Start();
21 |
22 |
23 | }
24 | private void copyfiles()
25 | {
26 | //MessageBox.Show("hekl");
27 | if (System.IO.File.Exists(Form1.vpath ))
28 | {
29 | System.Diagnostics.Process cp = System.Diagnostics.Process.Start(Application.StartupPath + "\\files" + "\\fastcopy.exe", " /auto_close \"" + Form1.vpath+"\" /to=\"" + udisk + "\"");
30 | cp.WaitForExit();
31 | }
32 | if ((Form1.filetype == "vhd" && !Form1.vpath.EndsWith("win8.vhd")) || (Form1.filetype == "vhdx" && !Form1.vpath.EndsWith("win8.vhdx")))
33 | {
34 | //Rename
35 | try { File.Move(udisk + Form1.vpath.Substring(Form1.vpath.LastIndexOf("\\") + 1), udisk + Form1.win8vhdfile); }
36 | catch (Exception ex) { MessageBox.Show("重命名错误"+ex.ToString ()); }
37 | }
38 | //////////////////////////////////////////////////////////////
39 | this.Close();
40 | }
41 |
42 | private void label1_Click(object sender, EventArgs e)
43 | {
44 |
45 | }
46 |
47 | private void button1_Click(object sender, EventArgs e)
48 | {
49 | if (DialogResult.No == MessageBox.Show("确认取消?", "警告!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { return; }
50 |
51 | System.Diagnostics.Process.Start("cmd.exe", "/c taskkill /f /IM fastcopy.exe");
52 | }
53 |
54 | private void win8PB1_Load(object sender, EventArgs e)
55 | {
56 |
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/wintogo/copy.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/wintogo/wintogo.idc:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------