├── .gitattributes
├── .gitignore
├── Controls
├── ConfirmMessage.cs
├── Controls.csproj
├── DirectorySelector.xaml
├── DirectorySelector.xaml.cs
├── DropDownButton.cs
├── ErrorReminder.xaml
├── ErrorReminder.xaml.cs
├── FieldTitle.xaml
├── FieldTitle.xaml.cs
├── FodyWeavers.xml
├── GetDictionaryValue.xaml
├── GetDictionaryValue.xaml.cs
├── IconButton.xaml
├── IconButton.xaml.cs
├── ImageViewer.xaml
├── ImageViewer.xaml.cs
├── OpenFileSplitButton.cs
├── Properties
│ └── AssemblyInfo.cs
├── SaveFileButton.cs
├── SaveFileHelper.cs
├── SaveFileMenuItem.cs
├── SaveFileSelector.xaml
├── SaveFileSelector.xaml.cs
├── SaveFileSplitButton.cs
├── TabControl.cs
├── ThemeSetter.cs
├── Themes
│ └── Generic.xaml
├── ToggleBoolean.xaml
├── ToggleBoolean.xaml.cs
├── Window.xaml
├── Window.xaml.cs
├── app.config
└── packages.config
├── Documents
├── Demo.json
├── README.md
└── Transfer.ico
├── Handlers
├── Ftp.cs
├── Handlers.csproj
├── Local.cs
├── Properties
│ └── AssemblyInfo.cs
├── SFtp.cs
└── packages.config
├── LICENSE.txt
├── Models
├── Codes
│ ├── BaseTemplate.cs
│ ├── CSharp.cs
│ ├── CSharp.tt
│ ├── Java.cs
│ ├── Java.tt
│ ├── JavaScript.cs
│ ├── JavaScript.tt
│ ├── Python.cs
│ └── Python.tt
├── Converters
│ └── HttpMethodConverter.cs
├── DataErrorInfos
│ └── Task.cs
├── Global.cs
├── ItemsEditMode.cs
├── Localization.cs
├── Models.csproj
├── Properties
│ └── AssemblyInfo.cs
├── RequestContentType.cs
├── RequestItem.cs
├── RequestItemType.cs
├── Response.cs
├── ResponseContentType.cs
├── Setting.cs
├── Task.cs
├── TaskStatus.cs
├── Theme.cs
├── ValidationError.cs
├── app.config
└── packages.config
├── PostEmulator.sln
├── README.md
├── Setup
└── Setup.vdproj
├── ViewModels
├── About.cs
├── Bootstrapper.cs
├── Code.cs
├── Main.cs
├── Properties
│ └── AssemblyInfo.cs
├── Runner.cs
├── Screen.cs
├── ViewModels.csproj
├── app.config
└── packages.config
├── Views
├── About.xaml
├── About.xaml.cs
├── App.config
├── App.xaml
├── App.xaml.cs
├── Code.xaml
├── Code.xaml.cs
├── FodyWeavers.xml
├── Localization
│ ├── en.json
│ └── zh-CN.json
├── Main.xaml
├── Main.xaml.cs
├── Properties
│ └── AssemblyInfo.cs
├── Runner.xaml
├── Runner.xaml.cs
├── Transfer.ico
├── Views.csproj
└── packages.config
└── Widgets
├── FodyWeavers.xml
├── Properties
└── AssemblyInfo.cs
├── RequestItemEditor.xaml
├── RequestItemEditor.xaml.cs
├── TextEditor.xaml
├── TextEditor.xaml.cs
├── Themes
└── Generic.xaml
├── Widgets.csproj
├── app.config
└── packages.config
/.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 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/Controls/ConfirmMessage.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 ColdShineSoft.PostEmulator.Controls
8 | {
9 | public class ConfirmMessage:System.Windows.FrameworkElement
10 | {
11 | [Bindables.DependencyProperty]
12 | public string Title { get; set; } = "Confirm";
13 |
14 | [Bindables.DependencyProperty]
15 | public string Message { get; set; }
16 |
17 | [Bindables.DependencyProperty]
18 | public string OkText { get; set; }
19 |
20 | [Bindables.DependencyProperty]
21 | public string CancelText { get; set; }
22 |
23 | [Bindables.DependencyProperty(OnPropertyChanged = nameof(OnShowChanged), Options = System.Windows.FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
24 | public bool Show { get; set; }
25 |
26 | [Bindables.DependencyProperty(Options = System.Windows.FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
27 | public bool Result { get; set; }
28 |
29 | protected static void OnShowChanged(System.Windows.DependencyObject dependencyObject, System.Windows.DependencyPropertyChangedEventArgs eventArgs)
30 | {
31 | ConfirmMessage confirmMessage = (ConfirmMessage)dependencyObject;
32 | if (!confirmMessage.Show)
33 | return;
34 |
35 | confirmMessage.Result = MahApps.Metro.Controls.Dialogs.DialogManager.ShowModalMessageExternal((MahApps.Metro.Controls.MetroWindow)System.Windows.Window.GetWindow(confirmMessage), confirmMessage.Title, confirmMessage.Message, MahApps.Metro.Controls.Dialogs.MessageDialogStyle.AffirmativeAndNegative, new MahApps.Metro.Controls.Dialogs.MetroDialogSettings { AffirmativeButtonText = confirmMessage.OkText, NegativeButtonText = confirmMessage.CancelText }) == MahApps.Metro.Controls.Dialogs.MessageDialogResult.Affirmative;
36 | confirmMessage.Show = false;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Controls/DirectorySelector.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Controls/DirectorySelector.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// DirectorySelector.xaml 的交互逻辑
20 | ///
21 | public partial class DirectorySelector : Control
22 | {
23 | private Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog _FolderDialog;
24 | protected Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog FolderDialog
25 | {
26 | get
27 | {
28 | if(_FolderDialog==null)
29 | {
30 | _FolderDialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog();
31 | _FolderDialog.IsFolderPicker = true;
32 | }
33 | return _FolderDialog;
34 | }
35 | }
36 |
37 | public bool IsFolderPicker
38 | {
39 | get
40 | {
41 | return this.FolderDialog.IsFolderPicker;
42 | }
43 | set
44 | {
45 | this.FolderDialog.IsFolderPicker = value;
46 | }
47 | }
48 |
49 | [Bindables.DependencyProperty]
50 | public string OpenButtonText { get; set; } = "选择...";
51 |
52 | [Bindables.DependencyProperty(Options =FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
53 | public string Path { get; set; }
54 |
55 | public static readonly RoutedEvent PathChangedEvent = EventManager.RegisterRoutedEvent("PathChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(DirectorySelector));
56 |
57 | public event RoutedPropertyChangedEventHandler PathChanged
58 | {
59 | add
60 | {
61 | this.AddHandler(PathChangedEvent, value);
62 | }
63 | remove
64 | {
65 | this.RemoveHandler(PathChangedEvent, value);
66 | }
67 | }
68 |
69 | protected virtual void OnPathChanged(string oldPath,string newPath)
70 | {
71 | RoutedPropertyChangedEventArgs args = new RoutedPropertyChangedEventArgs(oldPath, newPath);
72 | //this.Path = path;
73 | args.RoutedEvent = PathChangedEvent;
74 | this.RaiseEvent(args);
75 | //System.Threading.Tasks.Task.Run(() =>
76 | //{
77 | // System.Threading.Thread.Sleep(100);
78 | // System.Windows.Application.Current.Dispatcher.Invoke(() => this.RaiseEvent(args));
79 | //});
80 | }
81 |
82 | public DirectorySelector()
83 | {
84 | InitializeComponent();
85 | }
86 |
87 | private void Button_Click(object sender, RoutedEventArgs e)
88 | {
89 | if (this.FolderDialog.ShowDialog() == Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
90 | this.Path = this.FolderDialog.FileName;
91 | }
92 |
93 | protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
94 | {
95 | base.OnPropertyChanged(e);
96 | if(e.Property.Name==nameof(this.Path))
97 | this.OnPathChanged((string)e.OldValue, (string)e.NewValue);
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/Controls/DropDownButton.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 |
9 | namespace ColdShineSoft.PostEmulator.Controls
10 | {
11 | public class DropDownButton : MahApps.Metro.Controls.SplitButton
12 | {
13 | private System.Windows.Controls.ContentControl _InnerButton;
14 | protected System.Windows.Controls.ContentControl InnerButton
15 | {
16 | get
17 | {
18 | if (this._InnerButton == null)
19 | {
20 | this._InnerButton = (System.Windows.Controls.ContentControl)this.Template.FindName("PART_ButtonContent", this);
21 | this._InnerButton.VerticalAlignment = System.Windows.VerticalAlignment.Center;
22 | }
23 | return this._InnerButton;
24 | }
25 | }
26 |
27 | private MahApps.Metro.IconPacks.PackIconCodicons _IconControl;
28 | protected MahApps.Metro.IconPacks.PackIconCodicons IconControl
29 | {
30 | get
31 | {
32 | if(this._IconControl==null)
33 | {
34 | this._IconControl = new MahApps.Metro.IconPacks.PackIconCodicons();
35 | this._IconControl.Margin = new Thickness(5, 0, 3, 0);
36 | this._IconControl.VerticalAlignment = System.Windows.VerticalAlignment.Center;
37 |
38 | System.Windows.Data.Binding binding = new System.Windows.Data.Binding("FontSize");
39 | binding.Source = this;
40 | this._IconControl.SetBinding(MahApps.Metro.IconPacks.PackIconCodicons.WidthProperty, binding);
41 | this._IconControl.SetBinding(MahApps.Metro.IconPacks.PackIconCodicons.HeightProperty, binding);
42 | }
43 | return this._IconControl;
44 | }
45 | }
46 |
47 | public MahApps.Metro.IconPacks.PackIconCodiconsKind Kind
48 | {
49 | get
50 | {
51 | return this.IconControl.Kind;
52 | }
53 | set
54 | {
55 | this.IconControl.Kind = value;
56 | }
57 | }
58 |
59 | public DropDownButton()
60 | {
61 | this.FontFamily = new System.Windows.Media.FontFamily("微软雅黑");
62 | this.Icon = this.IconControl;
63 | }
64 |
65 | protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
66 | {
67 | base.OnPropertyChanged(e);
68 |
69 | //if (e.Property == TextProperty)
70 | // if (this.InnerButton != null)
71 | // this.InnerButton.Content = e.NewValue;
72 | }
73 |
74 | public override void OnApplyTemplate()
75 | {
76 | base.OnApplyTemplate();
77 |
78 | //this.InnerButton.Content = this.Text;
79 | System.Windows.Data.Binding binding = new System.Windows.Data.Binding("Text");
80 | binding.Source = this;
81 | this.InnerButton.SetBinding(System.Windows.Controls.ContentControl.ContentProperty, binding);
82 | }
83 |
84 | protected override void OnInitialized(EventArgs e)
85 | {
86 | base.OnInitialized(e);
87 | }
88 |
89 | protected override void OnSelectionChanged(SelectionChangedEventArgs e)
90 | {
91 | e.Handled = true;
92 | //base.OnSelectionChanged(e);
93 | }
94 | }
95 | }
--------------------------------------------------------------------------------
/Controls/ErrorReminder.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Controls/ErrorReminder.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// ErrorReminder.xaml 的交互逻辑
20 | ///
21 | public partial class ErrorReminder : Control
22 | {
23 | [Bindables.DependencyProperty]
24 | public string Text { get; set; }
25 |
26 | public ErrorReminder()
27 | {
28 | InitializeComponent();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Controls/FieldTitle.xaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Controls/FieldTitle.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// FieldTitle.xaml 的交互逻辑
20 | ///
21 | public partial class FieldTitle : Label
22 | {
23 | public FieldTitle()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Controls/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Controls/GetDictionaryValue.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
32 |
--------------------------------------------------------------------------------
/Controls/GetDictionaryValue.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// GetDictionaryValue.xaml 的交互逻辑
20 | ///
21 | public partial class GetDictionaryValue : Control
22 | {
23 | [Bindables.DependencyProperty]
24 | public System.Collections.IDictionary Dictionary { get; set; }
25 |
26 | [Bindables.DependencyProperty]
27 | public object Key { get; set; }
28 |
29 | [Bindables.DependencyProperty]
30 | public object Text { get; set; }
31 |
32 | public GetDictionaryValue()
33 | {
34 | InitializeComponent();
35 | }
36 |
37 | protected static readonly string[] Properties = new string[] { nameof(Dictionary), nameof(Key) };
38 |
39 | protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
40 | {
41 | base.OnPropertyChanged(e);
42 | if (Properties.Contains(e.Property.Name))
43 | this.SetText();
44 | }
45 |
46 | protected void SetText()
47 | {
48 | if (this.Dictionary == null || this.Key == null)
49 | this.Text = "";
50 | else if (this.Dictionary.Contains(this.Key))
51 | this.Text = System.Convert.ToString(this.Dictionary[this.Key]);
52 | else this.Text = this.Key;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Controls/IconButton.xaml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Controls/IconButton.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// IconButton.xaml 的交互逻辑
20 | ///
21 | public partial class IconButton : Button
22 | {
23 | //[Bindables.DependencyProperty]
24 | public MahApps.Metro.IconPacks.PackIconCodiconsKind Icon { get; set; }
25 |
26 | //static IconButton()
27 | //{
28 | // DefaultStyleKeyProperty.OverrideMetadata(typeof(IconButton), new FrameworkPropertyMetadata(typeof(IconButton)));
29 | //}
30 |
31 | public IconButton()
32 | {
33 | InitializeComponent();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Controls/ImageViewer.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Controls/ImageViewer.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// ImageViewer.xaml 的交互逻辑
20 | ///
21 | public partial class ImageViewer : DockPanel
22 | {
23 | [Bindables.DependencyProperty]
24 | public ImageSource Source { get; set; }
25 |
26 | public ImageViewer()
27 | {
28 | InitializeComponent();
29 | }
30 |
31 | private void Full_Click(object sender, RoutedEventArgs e)
32 | {
33 | this.Image.Stretch = Stretch.None;
34 | }
35 |
36 | private void Horizontal_Click(object sender, RoutedEventArgs e)
37 | {
38 | this.Image.Stretch = Stretch.Uniform;
39 | this.Image.Width = this.ActualWidth - SystemParameters.VerticalScrollBarWidth;
40 | this.Image.Height = double.NaN;
41 | }
42 |
43 | private void Vertical_Click(object sender, RoutedEventArgs e)
44 | {
45 | this.Image.Stretch = Stretch.Uniform;
46 | this.Image.Width = double.NaN;
47 | this.Image.Height = this.ActualHeight - SystemParameters.HorizontalScrollBarHeight;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Controls/OpenFileSplitButton.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// OpenFileButton.xaml 的交互逻辑
20 | ///
21 | public partial class OpenFileSplitButton : DropDownButton
22 | {
23 | private static Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog _OpenFileDialog;
24 | protected Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog OpenFileDialog
25 | {
26 | get
27 | {
28 | if (_OpenFileDialog == null)
29 | {
30 | _OpenFileDialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog();
31 | _OpenFileDialog.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("*.json", "*.json"));
32 | }
33 | return _OpenFileDialog;
34 | }
35 | }
36 |
37 | [Bindables.DependencyProperty]
38 | public string SelectedFilePath { get; set; }
39 |
40 | public static readonly RoutedEvent OpenFileEvent = EventManager.RegisterRoutedEvent("OpenFile", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler), typeof(OpenFileSplitButton));
41 |
42 | public event RoutedPropertyChangedEventHandler OpenFile
43 | {
44 | add
45 | {
46 | this.AddHandler(OpenFileEvent, value);
47 | }
48 | remove
49 | {
50 | this.RemoveHandler(OpenFileEvent, value);
51 | }
52 | }
53 |
54 | public OpenFileSplitButton()
55 | {
56 | //this.Style = new Style(typeof(OpenFileSplitButton), (System.Windows.Style)Application.Current.TryFindResource(typeof(HandyControl.Controls.SplitButton)));
57 | this.Click += OpenFileSplitButton_Click;
58 | }
59 |
60 | protected virtual void OnOpenFile(string path)
61 | {
62 | RoutedPropertyChangedEventArgs args = new RoutedPropertyChangedEventArgs(this.SelectedFilePath, path);
63 | this.SelectedFilePath = path;
64 | args.RoutedEvent = OpenFileEvent;
65 | RaiseEvent(args);
66 | }
67 |
68 | private void OpenFileSplitButton_Click(object sender, RoutedEventArgs e)
69 | {
70 | if (this.OpenFileDialog.ShowDialog() == Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
71 | this.OnOpenFile(this.OpenFileDialog.FileName);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Controls/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("Controls")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Controls")]
15 | [assembly: AssemblyCopyright("Copyright © 2021")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly:ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
52 | //通过使用 "*",如下所示:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Controls/SaveFileButton.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 ColdShineSoft.PostEmulator.Controls
8 | {
9 | public class SaveFileButton : IconButton
10 | {
11 | private Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog _SaveFileDialog;
12 | protected Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog SaveFileDialog
13 | {
14 | get
15 | {
16 | if (_SaveFileDialog == null)
17 | _SaveFileDialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog();
18 | return _SaveFileDialog;
19 | }
20 | }
21 |
22 | [Bindables.DependencyProperty(Options = System.Windows.FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
23 | public string SelectedFilePath { get; set; }
24 |
25 | [Bindables.DependencyProperty]
26 | public string DefaultFileName { get; set; }
27 |
28 | public static readonly System.Windows.RoutedEvent SaveFileEvent = System.Windows.EventManager.RegisterRoutedEvent("SaveFile", System.Windows.RoutingStrategy.Bubble, typeof(System.Windows.RoutedPropertyChangedEventHandler), typeof(SaveFileButton));
29 |
30 | public event System.Windows.RoutedPropertyChangedEventHandler SaveFile
31 | {
32 | add
33 | {
34 | this.AddHandler(SaveFileEvent, value);
35 | }
36 | remove
37 | {
38 | this.RemoveHandler(SaveFileEvent, value);
39 | }
40 | }
41 | public SaveFileButton()
42 | {
43 | this.Icon = MahApps.Metro.IconPacks.PackIconCodiconsKind.Save;
44 | this.Click += SaveFileButton_Click;
45 | }
46 |
47 | private void SaveFileButton_Click(object sender, System.Windows.RoutedEventArgs e)
48 | {
49 | this.SaveFileDialog.DefaultFileName = this.DefaultFileName;
50 | if (this.SelectedFilePath == null)
51 | {
52 | if (this.SaveFileDialog.ShowDialog() == Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
53 | this.OnSaveFile(this.SaveFileDialog.FileName);
54 | this._SaveFileDialog = null;
55 | }
56 | else this.OnSaveFile(this.SelectedFilePath);
57 | }
58 |
59 | protected virtual void OnSaveFile(string path)
60 | {
61 | System.Windows.RoutedPropertyChangedEventArgs args = new System.Windows.RoutedPropertyChangedEventArgs(this.SelectedFilePath, path);
62 | this.SelectedFilePath = path;
63 | args.RoutedEvent = SaveFileEvent;
64 | RaiseEvent(args);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/Controls/SaveFileHelper.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 ColdShineSoft.PostEmulator.Controls
8 | //{
9 | // public class SaveFileHelper: System.Windows.DependencyObject
10 | // {
11 | // private static Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog _SaveFileDialog;
12 | // private static Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog SaveFileDialog
13 | // {
14 | // get
15 | // {
16 | // if (_SaveFileDialog == null)
17 | // {
18 | // _SaveFileDialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog();
19 | // _SaveFileDialog.DefaultExtension = "json";
20 | // _SaveFileDialog.AlwaysAppendDefaultExtension = true;
21 | // _SaveFileDialog.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("*.json", "*.json"));
22 | // }
23 | // return _SaveFileDialog;
24 | // }
25 | // }
26 |
27 |
28 | // public static readonly System.Windows.RoutedEvent SaveFileEvent = System.Windows.EventManager.RegisterRoutedEvent("SaveFile", System.Windows.RoutingStrategy.Bubble, typeof(System.Windows.RoutedPropertyChangedEventHandler), typeof(SaveFileHelper));
29 |
30 | // private static void OnSaveFile(System.Windows.UIElement element, string path)
31 | // {
32 | // System.Windows.RoutedPropertyChangedEventArgs args = new System.Windows.RoutedPropertyChangedEventArgs(GetSelectedFilePath(element), path);
33 | // SetSelectedFilePath(element, path);
34 | // args.RoutedEvent = SaveFileEvent;
35 | // element.RaiseEvent(args);
36 | // }
37 |
38 | // private static void OnSaveFileClick(System.Windows.UIElement element)
39 | // {
40 | // if (SaveFileDialog.ShowDialog() == Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
41 | // OnSaveFile(element, SaveFileDialog.FileName);
42 | // }
43 |
44 | // public static void AddSaveFileHandler(System.Windows.DependencyObject d, System.Windows.RoutedPropertyChangedEventHandler handler)
45 | // {
46 | // ((System.Windows.UIElement)d).AddHandler(SaveFileEvent, handler);
47 | // }
48 |
49 | // public static void RemoveSaveFileHandler(System.Windows.DependencyObject d, System.Windows.RoutedPropertyChangedEventHandler handler)
50 | // {
51 | // ((System.Windows.UIElement)d).RemoveHandler(SaveFileEvent, handler);
52 | // }
53 |
54 | // [Bindables.AttachedProperty(Options =System.Windows.FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
55 | // public static string SelectedFilePath { get; set; }
56 |
57 | // public static string GetSelectedFilePath(System.Windows.DependencyObject obj)
58 | // {
59 | // // This method has to have the only line below.
60 | // throw new Bindables.WillBeImplementedByBindablesException();
61 | // }
62 | // public static void SetSelectedFilePath(System.Windows.DependencyObject obj, string value)
63 | // {
64 | // // This method has to be empty.
65 | // }
66 |
67 | // [Bindables.AttachedProperty(OnPropertyChanged = nameof(EnabledChanged))]
68 | // public static bool Enabled { get; set; }
69 |
70 | // public static bool GetEnabled(System.Windows.DependencyObject obj)
71 | // {
72 | // // This method has to have the only line below.
73 | // throw new Bindables.WillBeImplementedByBindablesException();
74 | // }
75 | // public static void SetEnabled(System.Windows.DependencyObject obj, bool value)
76 | // {
77 | // // This method has to be empty.
78 | // }
79 |
80 | // private static void EnabledChanged(System.Windows.DependencyObject target, System.Windows.DependencyPropertyChangedEventArgs e)
81 | // {
82 | // if((bool)e.NewValue)
83 | // {
84 | // if (target is System.Windows.Controls.Primitives.ButtonBase)
85 | // {
86 | // System.Windows.Controls.Primitives.ButtonBase button = (System.Windows.Controls.Primitives.ButtonBase)target;
87 | // button.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, ClickHandler);
88 | // return;
89 | // }
90 | // if (target is System.Windows.Controls.MenuItem)
91 | // {
92 | // System.Windows.Controls.MenuItem menuItem = (System.Windows.Controls.MenuItem)target;
93 | // menuItem.AddHandler(System.Windows.Controls.MenuItem.ClickEvent, ClickHandler);
94 | // return;
95 | // }
96 | // }
97 | // else
98 | // {
99 | // if (target is System.Windows.Controls.Primitives.ButtonBase)
100 | // {
101 | // System.Windows.Controls.Primitives.ButtonBase button = (System.Windows.Controls.Primitives.ButtonBase)target;
102 | // button.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, ClickHandler);
103 | // return;
104 | // }
105 | // if (target is System.Windows.Controls.MenuItem)
106 | // {
107 | // System.Windows.Controls.MenuItem menuItem = (System.Windows.Controls.MenuItem)target;
108 | // menuItem.AddHandler(System.Windows.Controls.MenuItem.ClickEvent, ClickHandler);
109 | // return;
110 | // }
111 | // }
112 | // }
113 |
114 | // private static System.Windows.RoutedEventHandler ClickHandler = (sender,args)=> OnSaveFileClick((System.Windows.UIElement)sender);
115 | // }
116 | //}
--------------------------------------------------------------------------------
/Controls/SaveFileMenuItem.cs:
--------------------------------------------------------------------------------
1 | namespace ColdShineSoft.PostEmulator.Controls
2 | {
3 | public partial class SaveFileMenuItem : System.Windows.Controls.MenuItem
4 | {
5 | private static Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog _SaveFileDialog;
6 | protected Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog SaveFileDialog
7 | {
8 | get
9 | {
10 | if (_SaveFileDialog == null)
11 | {
12 | _SaveFileDialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog();
13 | _SaveFileDialog.DefaultExtension = "json";
14 | _SaveFileDialog.AlwaysAppendDefaultExtension = true;
15 | _SaveFileDialog.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("*.json", "*.json"));
16 | }
17 | return _SaveFileDialog;
18 | }
19 | }
20 |
21 | [Bindables.DependencyProperty]
22 | public string SelectedFilePath { get; set; }
23 |
24 | public static readonly System.Windows.RoutedEvent SaveFileEvent = System.Windows.EventManager.RegisterRoutedEvent("SaveFile", System.Windows.RoutingStrategy.Bubble, typeof(System.Windows.RoutedPropertyChangedEventHandler), typeof(SaveFileMenuItem));
25 |
26 | public event System.Windows.RoutedPropertyChangedEventHandler SaveFile
27 | {
28 | add
29 | {
30 | this.AddHandler(SaveFileEvent, value);
31 | }
32 | remove
33 | {
34 | this.RemoveHandler(SaveFileEvent, value);
35 | }
36 | }
37 |
38 | public SaveFileMenuItem()
39 | {
40 | this.Style = new System.Windows.Style(typeof(SaveFileMenuItem), (System.Windows.Style)System.Windows.Application.Current.TryFindResource(typeof(System.Windows.Controls.MenuItem)));
41 | }
42 |
43 | protected virtual void OnSaveFile(string path)
44 | {
45 | System.Windows.RoutedPropertyChangedEventArgs args = new System.Windows.RoutedPropertyChangedEventArgs(this.SelectedFilePath, path);
46 | this.SelectedFilePath = path;
47 | args.RoutedEvent = SaveFileEvent;
48 | RaiseEvent(args);
49 | }
50 |
51 | protected override void OnClick()
52 | {
53 | if (this.SaveFileDialog.ShowDialog() == Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
54 | this.OnSaveFile(this.SaveFileDialog.FileName);
55 |
56 | base.OnClick();
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/Controls/SaveFileSelector.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Controls/SaveFileSelector.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// FileSelector.xaml 的交互逻辑
20 | ///
21 | public partial class SaveFileSelector : Control
22 | {
23 | private Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog _SaveFileDialog;
24 | protected Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog SaveFileDialog
25 | {
26 | get
27 | {
28 | if (_SaveFileDialog == null)
29 | {
30 | _SaveFileDialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog();
31 | _SaveFileDialog.DefaultExtension = "zip";
32 | _SaveFileDialog.AlwaysAppendDefaultExtension = true;
33 | _SaveFileDialog.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("*.zip", "*.zip"));
34 | }
35 | return _SaveFileDialog;
36 | }
37 | }
38 |
39 | [Bindables.DependencyProperty]
40 | public string OpenButtonText { get; set; } = "选择...";
41 |
42 | [Bindables.DependencyProperty(Options = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
43 | public string Path { get; set; }
44 |
45 | public SaveFileSelector()
46 | {
47 | InitializeComponent();
48 | }
49 |
50 | private void Button_Click(object sender, RoutedEventArgs e)
51 | {
52 | if(!string.IsNullOrWhiteSpace(this.Path))
53 | this.SaveFileDialog.DefaultFileName = System.IO.Path.GetFileName(this.Path);
54 | if (this.SaveFileDialog.ShowDialog() == Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
55 | this.Path = this.SaveFileDialog.FileName;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Controls/SaveFileSplitButton.cs:
--------------------------------------------------------------------------------
1 | namespace ColdShineSoft.PostEmulator.Controls
2 | {
3 | public partial class SaveFileSplitButton : DropDownButton
4 | {
5 | private static Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog _SaveFileDialog;
6 | protected Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog SaveFileDialog
7 | {
8 | get
9 | {
10 | if (_SaveFileDialog == null)
11 | {
12 | _SaveFileDialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog();
13 | _SaveFileDialog.DefaultExtension = "json";
14 | _SaveFileDialog.AlwaysAppendDefaultExtension = true;
15 | _SaveFileDialog.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("*.json", "*.json"));
16 | }
17 | return _SaveFileDialog;
18 | }
19 | }
20 |
21 | [Bindables.DependencyProperty(Options =System.Windows.FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
22 | public string SelectedFilePath { get; set; }
23 |
24 | public static readonly System.Windows.RoutedEvent SaveFileEvent = System.Windows.EventManager.RegisterRoutedEvent("SaveFile", System.Windows.RoutingStrategy.Bubble, typeof(System.Windows.RoutedPropertyChangedEventHandler), typeof(SaveFileSplitButton));
25 |
26 | public event System.Windows.RoutedPropertyChangedEventHandler SaveFile
27 | {
28 | add
29 | {
30 | this.AddHandler(SaveFileEvent, value);
31 | }
32 | remove
33 | {
34 | this.RemoveHandler(SaveFileEvent, value);
35 | }
36 | }
37 |
38 | public SaveFileSplitButton()
39 | {
40 | //this.Style = new System.Windows.Style(typeof(SaveFileSplitButton), (System.Windows.Style)System.Windows.Application.Current.TryFindResource(typeof(HandyControl.Controls.SplitButton)));
41 | this.Click += SaveFileSplitButton_Click;
42 | }
43 |
44 | protected virtual void OnSaveFile(string path)
45 | {
46 | System.Windows.RoutedPropertyChangedEventArgs args = new System.Windows.RoutedPropertyChangedEventArgs(this.SelectedFilePath, path);
47 | this.SelectedFilePath = path;
48 | args.RoutedEvent = SaveFileEvent;
49 | RaiseEvent(args);
50 | }
51 |
52 | private void SaveFileSplitButton_Click(object sender, System.Windows.RoutedEventArgs e)
53 | {
54 | if (this.SelectedFilePath == null)
55 | {
56 | if (this.SaveFileDialog.ShowDialog() == Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
57 | this.OnSaveFile(this.SaveFileDialog.FileName);
58 | }
59 | else this.OnSaveFile(this.SelectedFilePath);
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/Controls/TabControl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Controls;
7 |
8 | namespace ColdShineSoft.PostEmulator.Controls
9 | {
10 | public class TabControl : MahApps.Metro.Controls.MetroTabControl
11 | {
12 | [Bindables.DependencyProperty(OnPropertyChanged =nameof(OnIsFocusChanged),Options =System.Windows.FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
13 | public bool IsFocus { get; set; }
14 |
15 | protected static void OnIsFocusChanged(System.Windows.DependencyObject dependencyObject,System.Windows.DependencyPropertyChangedEventArgs eventArgs)
16 | {
17 | if (!(bool)eventArgs.NewValue)
18 | return;
19 |
20 | TabControl tab=(TabControl)dependencyObject;
21 | tab.Focus();
22 | tab.IsFocus = false;
23 | }
24 |
25 | public TabControl()
26 | {
27 | //this.Style = new System.Windows.Style(typeof(HandyControl.Controls.TabControl), (System.Windows.Style)System.Windows.Application.Current.TryFindResource(typeof(HandyControl.Controls.TabControl)));
28 | }
29 |
30 | protected override void OnSelectionChanged(SelectionChangedEventArgs e)
31 | {
32 | this.Focus();
33 | base.OnSelectionChanged(e);
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/Controls/ThemeSetter.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 ColdShineSoft.PostEmulator.Controls
8 | {
9 | public class ThemeSetter:System.Windows.FrameworkElement
10 | {
11 | [Bindables.DependencyProperty(OnPropertyChanged = nameof(OnThemeChanged))]
12 | public string Theme { get; set; }
13 |
14 |
15 | protected static void OnThemeChanged(System.Windows.DependencyObject dependencyObject, System.Windows.DependencyPropertyChangedEventArgs eventArgs)
16 | {
17 | if (eventArgs.NewValue != null)
18 | ControlzEx.Theming.ThemeManager.Current.ChangeTheme(System.Windows.Application.Current, eventArgs.NewValue.ToString());
19 | }
20 |
21 | }
22 | }
--------------------------------------------------------------------------------
/Controls/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/Controls/ToggleBoolean.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Controls/ToggleBoolean.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Controls
17 | {
18 | ///
19 | /// ToggleBoolean.xaml 的交互逻辑
20 | ///
21 | public partial class ToggleBoolean : Control
22 | {
23 | [Bindables.DependencyProperty]
24 | public object TrueContent { get; set; } = " ";
25 |
26 | [Bindables.DependencyProperty]
27 | public object FalseContent { get; set; } = " ";
28 |
29 | [Bindables.DependencyProperty(Options = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]
30 | public bool Value { get; set; }
31 |
32 | public ToggleBoolean()
33 | {
34 | InitializeComponent();
35 | }
36 |
37 | private void Button_Click(object sender, RoutedEventArgs e)
38 | {
39 | this.Value = !this.Value;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Controls/Window.xaml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/Controls/Window.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace ColdShineSoft.PostEmulator.Controls
16 | {
17 | ///
18 | /// Window.xaml 的交互逻辑
19 | ///
20 | public partial class Window : MahApps.Metro.Controls.MetroWindow
21 | {
22 | public Window()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Controls/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Controls/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Documents/Demo.json:
--------------------------------------------------------------------------------
1 | {"Jobs":[{"Name":"New Job 1","SourceDirectoryPath":"G:\\WindowsApplications\\CustomFileCopier","ResultHandlerTypeName":"ColdShineSoft.CustomFileCopier.Handlers.Local,ColdShineSoft.CustomFileCopier.Handlers","TargetDirectoryPath":"C:\\Users\\Administrator\\Desktop\\新建文件夹\\Test","TargetServer":null,"TargetPort":0,"TargetUserName":null,"TargetPassword":"","ConditionMode":1,"CustomExpression":"using System.Linq;\r\nusing System.IO;\r\n\r\npublic class CustomFileFilter:ColdShineSoft.CustomFileCopier.Models.FileFilter\r\n{\r\n\tpublic override System.Collections.Generic.IEnumerable GetFiles(string sourceDirectoryPath)\r\n\t{\r\n\t\treturn Directory.EnumerateFiles(sourceDirectoryPath, \"*\", SearchOption.AllDirectories).Select(f => new System.IO.FileInfo(f)).Where(f=>new string[]{\".xaml\",\".cs\"}.Contains(f.Extension.ToLower()) && f.LastWriteTime>=System.DateTime.Today.AddDays(-1000));\r\n\t}\r\n}","Conditions":[{"PropertyId":105,"OperatorId":103,"LeftBracket":true,"RightBracket":false,"Connective":0,"StringValue":".xaml","LongValue":0,"DateTimeValue":"2022-02-07T00:00:00+08:00"},{"PropertyId":105,"OperatorId":103,"LeftBracket":false,"RightBracket":true,"Connective":1,"StringValue":".cs","LongValue":0,"DateTimeValue":"2022-02-07T00:00:00+08:00"},{"PropertyId":106,"OperatorId":202,"LeftBracket":false,"RightBracket":false,"Connective":0,"StringValue":null,"LongValue":0,"DateTimeValue":"2022-02-01T00:00:00"}]}],"CompressToZipFile":false,"CompressFilePath":"C:\\Users\\Administrator\\Desktop\\Demo.zip","AddNowToCompressFileName":true,"NowFormatString":"(yyyyMMddHHmm)","AutoRunWhenFilesFiltered":false}
--------------------------------------------------------------------------------
/Documents/README.md:
--------------------------------------------------------------------------------
1 | # CustomFileCopier
2 |
3 | CustomFileCopier is a windows tool that copy the files which are match the custom condition(s) from the souce directory to the target directory or zip file.
4 |
5 | For example, if you want to compress the source codes which have been modified from this project, you can add a job similar to below:
6 |
7 | Another way if you are familiar with C#, you can add the job similar to below:
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Documents/Transfer.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveIsLive/PostEmulator/710a3456df0f0b8544c665344fa2f8c3941042e1/Documents/Transfer.ico
--------------------------------------------------------------------------------
/Handlers/Ftp.cs:
--------------------------------------------------------------------------------
1 | using ColdShineSoft.CustomFileCopier.Models;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ColdShineSoft.CustomFileCopier.Handlers
9 | {
10 | public class Ftp : Models.ResultHandler
11 | {
12 | public override string Name { get; }= "FTP";
13 |
14 | public override bool Remote => true;
15 |
16 | public override string CheckTargetDirectoryValid(Job job)
17 | {
18 | FluentFTP.FtpClient ftpClient = new FluentFTP.FtpClient(job.TargetServer, job.TargetPort, job.TargetUserName, job.TargetPassword);
19 | //ftpClient.EncryptionMode = FluentFTP.FtpEncryptionMode.Auto;
20 | try
21 | {
22 | ftpClient.Connect();
23 | if (ftpClient.DirectoryExists(job.TargetDirectoryPath))
24 | return null;
25 | ftpClient.CreateDirectory(job.TargetDirectoryPath);
26 | return null;
27 | }
28 | catch (System.Exception exception)
29 | {
30 | return exception.Message;
31 | }
32 | finally
33 | {
34 | ftpClient.Disconnect();
35 | }
36 | }
37 |
38 | public override bool TargetDirectoryEmpty(Job job)
39 | {
40 | FluentFTP.FtpClient ftpClient = new FluentFTP.FtpClient(job.TargetServer, job.TargetPort, job.TargetUserName, job.TargetPassword);
41 | try
42 | {
43 | ftpClient.Connect();
44 | return ftpClient.GetNameListing(job.TargetDirectoryPath).Length == 0;
45 | }
46 | finally
47 | {
48 | ftpClient.Disconnect();
49 | }
50 | }
51 |
52 | public override void Execute(Models.Job job)
53 | {
54 | FluentFTP.FtpClient ftpClient = new FluentFTP.FtpClient(job.TargetServer, job.TargetPort, job.TargetUserName, job.TargetPassword);
55 | try
56 | {
57 | ftpClient.Connect();
58 | foreach (Models.File sourceFile in job.SourceFiles)
59 | {
60 | sourceFile.Result = Models.CopyResult.Copying;
61 | string targetFilePath = job.GetTargetAbsoluteFilePath(sourceFile.Path);
62 | string targetDirectory = System.IO.Path.GetDirectoryName(targetFilePath).Replace('\\', '/');
63 | //if (!ftpClient.FileExists(targetDirectory))
64 | // try
65 | // {
66 | // ftpClient.CreateDirectory(targetDirectory);
67 | // }
68 | // catch (System.Exception exception)
69 | // {
70 | // sourceFile.Result = Models.CopyResult.Failure;
71 | // sourceFile.Error = exception.Message;
72 | // continue;
73 | // }
74 | try
75 | {
76 | ftpClient.UploadFile(sourceFile.Path, targetFilePath, createRemoteDir: true);
77 | }
78 | catch (System.Exception exception)
79 | {
80 | sourceFile.Result = Models.CopyResult.Failure;
81 | sourceFile.Error = exception.Message;
82 | continue;
83 | }
84 | sourceFile.Result = Models.CopyResult.Success;
85 | job.Task.CopiedFileCount++;
86 | job.Task.CopiedFileSize += sourceFile.FileInfo.Length;
87 | }
88 | }
89 | finally
90 | {
91 | ftpClient.DisconnectAsync();
92 | }
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/Handlers/Handlers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {ED36B783-B15F-4111-B026-4DEBD9625B46}
8 | Library
9 | Properties
10 | ColdShineSoft.CustomFileCopier.Handlers
11 | ColdShineSoft.CustomFileCopier.Handlers
12 | v4.6.2
13 | 512
14 | true
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | ..\packages\Caliburn.Micro.Core.4.0.210\lib\netstandard2.0\Caliburn.Micro.Core.dll
36 |
37 |
38 | ..\packages\FluentFTP.39.3.0\lib\net45\FluentFTP.dll
39 |
40 |
41 | ..\packages\SSH.NET.2020.0.2\lib\net40\Renci.SshNet.dll
42 |
43 |
44 |
45 |
46 |
47 | ..\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | {f17beaa9-f77b-438f-9a04-350885926cd8}
66 | Models
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/Handlers/Local.cs:
--------------------------------------------------------------------------------
1 | using ColdShineSoft.CustomFileCopier.Models;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ColdShineSoft.CustomFileCopier.Handlers
9 | {
10 | public class Local : Models.ResultHandler
11 | {
12 | public override string Name
13 | {
14 | get
15 | {
16 | if (System.Threading.Thread.CurrentThread.CurrentUICulture.LCID == ChineseCulture?.LCID)
17 | return "本地目录";
18 | else return "Local Directory";
19 | }
20 | }
21 |
22 | public override bool Remote => false;
23 |
24 | public override string CheckTargetDirectoryValid(Job job)
25 | {
26 | try
27 | {
28 | if (System.IO.Directory.Exists(job.TargetDirectoryPath))
29 | return null;
30 | System.IO.Directory.CreateDirectory(job.TargetDirectoryPath);
31 | return null;
32 | }
33 | catch(System.Exception exception)
34 | {
35 | return exception.Message;
36 | }
37 | }
38 |
39 | public override bool TargetDirectoryEmpty(Job job)
40 | {
41 | return System.IO.Directory.EnumerateFileSystemEntries(job.TargetDirectoryPath).FirstOrDefault() == null;
42 | }
43 |
44 | public override void Execute(Models.Job job)
45 | {
46 | foreach (Models.File sourceFile in job.SourceFiles)
47 | {
48 | //if (sourceFile.Result != Models.CopyResult.Success)
49 | //{
50 | sourceFile.Result = Models.CopyResult.Copying;
51 | string targetFilePath = job.GetTargetAbsoluteFilePath(sourceFile.Path);
52 | string targetDirectory = System.IO.Path.GetDirectoryName(targetFilePath);
53 | if (!System.IO.Directory.Exists(targetDirectory))
54 | try
55 | {
56 | System.IO.Directory.CreateDirectory(targetDirectory);
57 | }
58 | catch (System.Exception exception)
59 | {
60 | sourceFile.Result = Models.CopyResult.Failure;
61 | sourceFile.Error = exception.Message;
62 | //return exception.Message;
63 | continue;
64 | }
65 | try
66 | {
67 | System.IO.File.Copy(sourceFile.Path, targetFilePath, true);
68 | }
69 | catch (System.Exception exception)
70 | {
71 | sourceFile.Result = Models.CopyResult.Failure;
72 | sourceFile.Error = exception.Message;
73 | //return exception.Message;
74 | continue;
75 | }
76 | //}
77 | sourceFile.Result = Models.CopyResult.Success;
78 | job.Task.CopiedFileCount++;
79 | job.Task.CopiedFileSize += sourceFile.FileInfo.Length;
80 | }
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/Handlers/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Handlers")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Handlers")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("ed36b783-b15f-4111-b026-4debd9625b46")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Handlers/SFtp.cs:
--------------------------------------------------------------------------------
1 | using ColdShineSoft.CustomFileCopier.Models;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ColdShineSoft.CustomFileCopier.Handlers
9 | {
10 | public class Sftp : Models.ResultHandler
11 | {
12 | public override string Name { get; } = "SFTP";
13 |
14 | public override bool Remote => true;
15 |
16 | public override string CheckTargetDirectoryValid(Job job)
17 | {
18 | Renci.SshNet.SftpClient sftpClient = new Renci.SshNet.SftpClient(job.TargetServer, job.TargetPort, job.TargetUserName, job.TargetPassword);
19 | try
20 | {
21 | sftpClient.Connect();
22 | if (sftpClient.Exists(job.TargetDirectoryPath))
23 | return null;
24 | sftpClient.CreateDirectory(job.TargetDirectoryPath);
25 | return null;
26 | }
27 | catch(System.Exception exception)
28 | {
29 | return exception.Message;
30 | }
31 | finally
32 | {
33 | sftpClient.Disconnect();
34 | }
35 | }
36 |
37 | public override bool TargetDirectoryEmpty(Job job)
38 | {
39 | Renci.SshNet.SftpClient sftpClient = new Renci.SshNet.SftpClient(job.TargetServer, job.TargetPort, job.TargetUserName, job.TargetPassword);
40 | try
41 | {
42 | sftpClient.Connect();
43 | return sftpClient.ListDirectory(job.TargetDirectoryPath).All(d => d.Name.Trim('.') == "");
44 | }
45 | finally
46 | {
47 | sftpClient.Disconnect();
48 | }
49 | }
50 |
51 | public override void Execute(Models.Job job)
52 | {
53 | Renci.SshNet.SftpClient sftpClient = new Renci.SshNet.SftpClient(job.TargetServer, job.TargetPort, job.TargetUserName, job.TargetPassword);
54 | try
55 | {
56 | sftpClient.Connect();
57 | foreach (Models.File sourceFile in job.SourceFiles)
58 | {
59 | sourceFile.Result = Models.CopyResult.Copying;
60 | string targetFilePath = job.GetTargetAbsoluteFilePath(sourceFile.Path);
61 | string targetDirectory = System.IO.Path.GetDirectoryName(targetFilePath).Replace('\\', '/');
62 | if (!sftpClient.Exists(targetDirectory))
63 | try
64 | {
65 | this.CreateServerDirectoryIfItDoesntExist(sftpClient, targetDirectory);
66 | }
67 | catch (System.Exception exception)
68 | {
69 | sourceFile.Result = Models.CopyResult.Failure;
70 | sourceFile.Error = exception.Message;
71 | continue;
72 | }
73 | try
74 | {
75 | this.CopyFile(sftpClient, sourceFile.Path, targetFilePath);
76 | }
77 | catch (System.Exception exception)
78 | {
79 | sourceFile.Result = Models.CopyResult.Failure;
80 | sourceFile.Error = exception.Message;
81 | continue;
82 | }
83 | sourceFile.Result = Models.CopyResult.Success;
84 | job.Task.CopiedFileCount++;
85 | job.Task.CopiedFileSize += sourceFile.FileInfo.Length;
86 | }
87 | }
88 | finally
89 | {
90 | sftpClient.Disconnect();
91 | }
92 | }
93 |
94 | protected readonly char[] DirectorySeparators = new char[] { '/', '\\' };
95 |
96 | protected void CreateServerDirectoryIfItDoesntExist(Renci.SshNet.SftpClient sftpClient, string serverDestinationPath)
97 | {
98 | string directory = null;
99 |
100 | foreach(char c in serverDestinationPath)
101 | {
102 | if (directory != null && this.DirectorySeparators.Contains(c))
103 | if (!sftpClient.Exists(directory))
104 | sftpClient.CreateDirectory(directory);
105 |
106 | directory += c;
107 | }
108 | if(!this.DirectorySeparators.Contains(serverDestinationPath.Last()))
109 | if (!sftpClient.Exists(serverDestinationPath))
110 | sftpClient.CreateDirectory(serverDestinationPath);
111 |
112 | //if (serverDestinationPath[0] == '/')
113 | // serverDestinationPath = serverDestinationPath.Substring(1);
114 |
115 | //string[] directories = serverDestinationPath.Split('/');
116 | //for (int i = 0; i < directories.Length; i++)
117 | //{
118 | // string dirName = string.Join("/", directories, 0, i + 1);
119 | // if (!sftpClient.Exists(dirName))
120 | // sftpClient.CreateDirectory(dirName);
121 | //}
122 | }
123 |
124 |
125 | public void CopyFile(Renci.SshNet.SftpClient sftpClient, string localFilePath, string remoteFilePath)
126 | {
127 | System.IO.Stream stream = System.IO.File.OpenRead(localFilePath);
128 | sftpClient.UploadFile(stream, remoteFilePath, true);
129 | stream.Close();
130 | }
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/Handlers/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) [year] [fullname]
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 |
--------------------------------------------------------------------------------
/Models/Codes/CSharp.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 17.0.0.0
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | // ------------------------------------------------------------------------------
10 | namespace ColdShineSoft.PostEmulator.Models.Codes
11 | {
12 | using System.Linq;
13 | using System.Text;
14 | using System.Collections.Generic;
15 | using System;
16 |
17 | ///
18 | /// Class to produce the template output
19 | ///
20 |
21 | #line 1 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
23 | public partial class CSharp : BaseTemplate
24 | {
25 | #line hidden
26 | ///
27 | /// Create the template output
28 | ///
29 | public override string TransformText()
30 | {
31 | this.Write("\r\n");
32 |
33 | #line 7 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
34 |
35 | RequestItem[] cookies=this.Task.CookieItems.Where(c=>c.Selected).ToArray();
36 | if(cookies.Length==0)
37 |
38 |
39 | #line default
40 | #line hidden
41 | this.Write("var httpClient=new HttpClient();\r\n");
42 |
43 | #line 12 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
44 |
45 | else
46 | {
47 |
48 |
49 | #line default
50 | #line hidden
51 | this.Write("var cookieContainer = new System.Net.CookieContainer();\r\n");
52 |
53 | #line 17 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
54 |
55 | foreach(RequestItem cookie in cookies)
56 | {
57 |
58 |
59 | #line default
60 | #line hidden
61 | this.Write("cookieContainer.Add(new Cookie(\"");
62 |
63 | #line 21 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
64 | this.Write(this.ToStringHelper.ToStringWithCulture(cookie.Name));
65 |
66 | #line default
67 | #line hidden
68 | this.Write("\", \"");
69 |
70 | #line 21 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
71 | this.Write(this.ToStringHelper.ToStringWithCulture(cookie.Value));
72 |
73 | #line default
74 | #line hidden
75 | this.Write("\") { Domain = \"");
76 |
77 | #line 21 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
78 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.Uri.Host));
79 |
80 | #line default
81 | #line hidden
82 | this.Write("\" });\r\n");
83 |
84 | #line 22 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
85 |
86 | }
87 |
88 |
89 | #line default
90 | #line hidden
91 | this.Write("var httpClient = new HttpClient(new Http.HttpClientHandler\r\n{\r\n\tCookieContainer =" +
92 | " cookieContainer,\r\n\tUseCookies = true\r\n});\r\n");
93 |
94 | #line 30 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
95 |
96 | }
97 |
98 |
99 | #line default
100 | #line hidden
101 | this.Write("var httpRequestMessage = new HttpRequestMessage(HttpMethod.");
102 |
103 | #line 33 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
104 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.HttpMethod.Method[0]));
105 |
106 | #line default
107 | #line hidden
108 |
109 | #line 33 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
110 | this.Write(this.ToStringHelper.ToStringWithCulture(new string(this.Task.HttpMethod.Method.Skip(1).ToArray()).ToLower()));
111 |
112 | #line default
113 | #line hidden
114 | this.Write(", \"");
115 |
116 | #line 33 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
117 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.Url));
118 |
119 | #line default
120 | #line hidden
121 | this.Write("\");\r\n");
122 |
123 | #line 34 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
124 |
125 | foreach(RequestItem header in this.Task.HeaderItems.Where(h=>h.Selected&&h.Type==RequestItemType.Common))
126 | {
127 |
128 |
129 | #line default
130 | #line hidden
131 | this.Write("httpRequestMessage.Headers.Add(\"");
132 |
133 | #line 38 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
134 | this.Write(this.ToStringHelper.ToStringWithCulture(header.Name));
135 |
136 | #line default
137 | #line hidden
138 | this.Write("\", \"");
139 |
140 | #line 38 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
141 | this.Write(this.ToStringHelper.ToStringWithCulture(header.Value));
142 |
143 | #line default
144 | #line hidden
145 | this.Write("\")\r\n");
146 |
147 | #line 39 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
148 |
149 | }
150 |
151 |
152 | #line default
153 | #line hidden
154 |
155 | #line 42 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
156 |
157 | if(this.Task.AcceptsRequestBody)
158 | {
159 | if (this.Task.ContentType == RequestContentType.FormUrlencoded)
160 | {
161 |
162 |
163 | #line default
164 | #line hidden
165 | this.Write("httpRequestMessage.Content = new FormUrlEncodedContent(new Dictionary(){");
167 |
168 | #line 48 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
169 | this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(",",this.Task.FormParameters.Where(p => p.Selected).Select(p=>$"{{\"{p.Name}\",\"{p.Value}\"}}"))));
170 |
171 | #line default
172 | #line hidden
173 | this.Write(")};\r\n");
174 |
175 | #line 49 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
176 |
177 | }
178 | else
179 | {
180 |
181 |
182 | #line default
183 | #line hidden
184 | this.Write("httpRequestMessage.Content = new StringContent(@\"");
185 |
186 | #line 54 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
187 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.PostStringContent.Replace("\"","\"\"")));
188 |
189 | #line default
190 | #line hidden
191 | this.Write("\");\r\n");
192 |
193 | #line 55 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
194 |
195 | }
196 | }
197 |
198 |
199 | #line default
200 | #line hidden
201 |
202 | #line 59 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
203 |
204 | if (this.Task.AcceptsRequestBody)
205 | {
206 |
207 |
208 | #line default
209 | #line hidden
210 | this.Write("httpRequestMessage.Content.Headers.ContentType.MediaType = \"");
211 |
212 | #line 63 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
213 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.Content_Type));
214 |
215 | #line default
216 | #line hidden
217 | this.Write("\";\r\n\t");
218 |
219 | #line 64 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
220 |
221 | if(!string.IsNullOrWhiteSpace(this.Task.CharSet))
222 | {
223 |
224 |
225 | #line default
226 | #line hidden
227 | this.Write("httpRequestMessage.Content.Headers.ContentType.CharSet = \"");
228 |
229 | #line 68 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
230 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.CharSet));
231 |
232 | #line default
233 | #line hidden
234 | this.Write("\";\r\n\t");
235 |
236 | #line 69 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
237 |
238 | }
239 |
240 |
241 | #line default
242 | #line hidden
243 |
244 | #line 72 "G:\WindowsApplications\PostEmulator\Models\Codes\CSharp.tt"
245 |
246 | }
247 |
248 |
249 | #line default
250 | #line hidden
251 | this.Write("var httpResponseMessage = await this.HttpClient.SendAsync(httpRequestMessage);");
252 | return this.GenerationEnvironment.ToString();
253 | }
254 | }
255 |
256 | #line default
257 | #line hidden
258 | }
259 |
--------------------------------------------------------------------------------
/Models/Codes/CSharp.tt:
--------------------------------------------------------------------------------
1 | <#@ template language="C#" inherits="BaseTemplate" #>
2 | <#@ assembly name="System.Core" #>
3 | <#@ import namespace="System.Linq" #>
4 | <#@ import namespace="System.Text" #>
5 | <#@ import namespace="System.Collections.Generic" #>
6 |
7 | <#
8 | RequestItem[] cookies=this.Task.CookieItems.Where(c=>c.Selected).ToArray();
9 | if(cookies.Length==0)
10 | #>
11 | var httpClient=new HttpClient();
12 | <#
13 | else
14 | {
15 | #>
16 | var cookieContainer = new System.Net.CookieContainer();
17 | <#
18 | foreach(RequestItem cookie in cookies)
19 | {
20 | #>
21 | cookieContainer.Add(new Cookie("<#= cookie.Name #>", "<#= cookie.Value #>") { Domain = "<#= this.Task.Uri.Host #>" });
22 | <#
23 | }
24 | #>
25 | var httpClient = new HttpClient(new Http.HttpClientHandler
26 | {
27 | CookieContainer = cookieContainer,
28 | UseCookies = true
29 | });
30 | <#
31 | }
32 | #>
33 | var httpRequestMessage = new HttpRequestMessage(HttpMethod.<#= this.Task.HttpMethod.Method[0] #><#= new string(this.Task.HttpMethod.Method.Skip(1).ToArray()).ToLower() #>, "<#= this.Task.Url #>");
34 | <#
35 | foreach(RequestItem header in this.Task.HeaderItems.Where(h=>h.Selected&&h.Type==RequestItemType.Common))
36 | {
37 | #>
38 | httpRequestMessage.Headers.Add("<#= header.Name #>", "<#= header.Value #>")
39 | <#
40 | }
41 | #>
42 | <#
43 | if(this.Task.AcceptsRequestBody)
44 | {
45 | if (this.Task.ContentType == RequestContentType.FormUrlencoded)
46 | {
47 | #>
48 | httpRequestMessage.Content = new FormUrlEncodedContent(new Dictionary(){<#= string.Join(",",this.Task.FormParameters.Where(p => p.Selected).Select(p=>$"{{\"{p.Name}\",\"{p.Value}\"}}")) #>)};
49 | <#
50 | }
51 | else
52 | {
53 | #>
54 | httpRequestMessage.Content = new StringContent(@"<#= this.Task.PostStringContent.Replace("\"","\"\"") #>");
55 | <#
56 | }
57 | }
58 | #>
59 | <#
60 | if (this.Task.AcceptsRequestBody)
61 | {
62 | #>
63 | httpRequestMessage.Content.Headers.ContentType.MediaType = "<#= this.Task.Content_Type #>";
64 | <#
65 | if(!string.IsNullOrWhiteSpace(this.Task.CharSet))
66 | {
67 | #>
68 | httpRequestMessage.Content.Headers.ContentType.CharSet = "<#= this.Task.CharSet #>";
69 | <#
70 | }
71 | #>
72 | <#
73 | }
74 | #>
75 | var httpResponseMessage = await this.HttpClient.SendAsync(httpRequestMessage);
--------------------------------------------------------------------------------
/Models/Codes/Java.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 17.0.0.0
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | // ------------------------------------------------------------------------------
10 | namespace ColdShineSoft.PostEmulator.Models.Codes
11 | {
12 | using System.Linq;
13 | using System.Text;
14 | using System.Collections.Generic;
15 | using System;
16 |
17 | ///
18 | /// Class to produce the template output
19 | ///
20 |
21 | #line 1 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
23 | public partial class Java : BaseTemplate
24 | {
25 | #line hidden
26 | ///
27 | /// Create the template output
28 | ///
29 | public override string TransformText()
30 | {
31 | this.Write("\r\nURL url = new URL(\"");
32 |
33 | #line 7 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
34 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.Url));
35 |
36 | #line default
37 | #line hidden
38 | this.Write("\");\r\nHttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection" +
39 | "();\r\nhttpURLConnection.setRequestMethod(\"");
40 |
41 | #line 9 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
42 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.HttpMethod.Method));
43 |
44 | #line default
45 | #line hidden
46 | this.Write("\");\r\n");
47 |
48 | #line 10 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
49 |
50 | foreach(RequestItem header in this.Task.HeaderItems.Where(h=>h.Selected))
51 | {
52 |
53 |
54 | #line default
55 | #line hidden
56 | this.Write("httpURLConnection.setRequestProperty(\"");
57 |
58 | #line 14 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
59 | this.Write(this.ToStringHelper.ToStringWithCulture(header.Name));
60 |
61 | #line default
62 | #line hidden
63 | this.Write("\", \"");
64 |
65 | #line 14 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
66 | this.Write(this.ToStringHelper.ToStringWithCulture(header.Value));
67 |
68 | #line default
69 | #line hidden
70 | this.Write("\")\r\n");
71 |
72 | #line 15 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
73 |
74 | }
75 |
76 |
77 | #line default
78 | #line hidden
79 | this.Write("\r\n");
80 |
81 | #line 19 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
82 |
83 | if (this.Task.AcceptsRequestBody)
84 | {
85 |
86 |
87 | #line default
88 | #line hidden
89 | this.Write("httpURLConnection.setDoOutput(true);\r\nDataOutputStream dataOutputStream = new Dat" +
90 | "aOutputStream(httpURLConnection.getOutputStream());\r\ndataOutputStream.writeBytes" +
91 | "(`");
92 |
93 | #line 25 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
94 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.PostStringContent));
95 |
96 | #line default
97 | #line hidden
98 | this.Write("`);\r\ndataOutputStream.flush();\r\ndataOutputStream.close();\r\n");
99 |
100 | #line 28 "G:\WindowsApplications\PostEmulator\Models\Codes\Java.tt"
101 |
102 | }
103 |
104 |
105 | #line default
106 | #line hidden
107 | this.Write("\r\nInputStream result=httpURLConnection.getInputStream();");
108 | return this.GenerationEnvironment.ToString();
109 | }
110 | }
111 |
112 | #line default
113 | #line hidden
114 | }
115 |
--------------------------------------------------------------------------------
/Models/Codes/Java.tt:
--------------------------------------------------------------------------------
1 | <#@ template language="C#" inherits="BaseTemplate" #>
2 | <#@ assembly name="System.Core" #>
3 | <#@ import namespace="System.Linq" #>
4 | <#@ import namespace="System.Text" #>
5 | <#@ import namespace="System.Collections.Generic" #>
6 |
7 | URL url = new URL("<#= this.Task.Url #>");
8 | HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
9 | httpURLConnection.setRequestMethod("<#= this.Task.HttpMethod.Method #>");
10 | <#
11 | foreach(RequestItem header in this.Task.HeaderItems.Where(h=>h.Selected))
12 | {
13 | #>
14 | httpURLConnection.setRequestProperty("<#= header.Name #>", "<#= header.Value #>")
15 | <#
16 | }
17 | #>
18 |
19 | <#
20 | if (this.Task.AcceptsRequestBody)
21 | {
22 | #>
23 | httpURLConnection.setDoOutput(true);
24 | DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
25 | dataOutputStream.writeBytes(`<#= this.Task.PostStringContent #>`);
26 | dataOutputStream.flush();
27 | dataOutputStream.close();
28 | <#
29 | }
30 | #>
31 |
32 | InputStream result=httpURLConnection.getInputStream();
--------------------------------------------------------------------------------
/Models/Codes/JavaScript.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 17.0.0.0
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | // ------------------------------------------------------------------------------
10 | namespace ColdShineSoft.PostEmulator.Models.Codes
11 | {
12 | using System.Linq;
13 | using System.Text;
14 | using System.Collections.Generic;
15 | using System;
16 |
17 | ///
18 | /// Class to produce the template output
19 | ///
20 |
21 | #line 1 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
23 | public partial class JavaScript : BaseTemplate
24 | {
25 | #line hidden
26 | ///
27 | /// Create the template output
28 | ///
29 | public override string TransformText()
30 | {
31 | this.Write("\r\nconst axios = require(\'axios\');\r\nawait response=axios({\r\n\tmethod:\"");
32 |
33 | #line 9 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
34 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.HttpMethod.Method));
35 |
36 | #line default
37 | #line hidden
38 | this.Write("\",\r\n\turl:\"");
39 |
40 | #line 10 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
41 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.Url));
42 |
43 | #line default
44 | #line hidden
45 | this.Write("\",\r\n\theaders:{");
46 |
47 | #line 11 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
48 | this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(",",this.Task.HeaderItems.Where(h => h.Selected).Select(h=>$"'{h.Name}':'{h.Value}'"))));
49 |
50 | #line default
51 | #line hidden
52 | this.Write("},\r\n");
53 |
54 | #line 12 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
55 |
56 | if (this.Task.AcceptsRequestBody)
57 | {
58 |
59 |
60 | #line default
61 | #line hidden
62 | this.Write("\t");
63 |
64 | #line 16 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
65 |
66 | switch(this.Task.ContentType)
67 | {
68 | case RequestContentType.FormUrlencoded:
69 |
70 |
71 | #line default
72 | #line hidden
73 | this.Write("\tdata:{");
74 |
75 | #line 21 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
76 | this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(",",this.Task.FormParameters.Where(p => p.Selected).Select(p=>$"'{p.Name}':'{p.Value}'"))));
77 |
78 | #line default
79 | #line hidden
80 | this.Write("}\r\n\t");
81 |
82 | #line 22 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
83 |
84 | break;
85 | case RequestContentType.Json:
86 |
87 |
88 | #line default
89 | #line hidden
90 | this.Write("\tdata:");
91 |
92 | #line 26 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
93 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.JsonContent));
94 |
95 | #line default
96 | #line hidden
97 | this.Write("\r\n\t");
98 |
99 | #line 27 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
100 |
101 | break;
102 | default:
103 |
104 |
105 | #line default
106 | #line hidden
107 | this.Write("\tdata:`");
108 |
109 | #line 31 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
110 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.PostStringContent));
111 |
112 | #line default
113 | #line hidden
114 | this.Write("`\r\n\t");
115 |
116 | #line 32 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
117 |
118 | break;
119 |
120 |
121 | #line default
122 | #line hidden
123 |
124 | #line 35 "G:\WindowsApplications\PostEmulator\Models\Codes\JavaScript.tt"
125 |
126 | }
127 | }
128 |
129 |
130 | #line default
131 | #line hidden
132 | this.Write("});");
133 | return this.GenerationEnvironment.ToString();
134 | }
135 | }
136 |
137 | #line default
138 | #line hidden
139 | }
140 |
--------------------------------------------------------------------------------
/Models/Codes/JavaScript.tt:
--------------------------------------------------------------------------------
1 | <#@ template language="C#" inherits="BaseTemplate" #>
2 | <#@ assembly name="System.Core" #>
3 | <#@ import namespace="System.Linq" #>
4 | <#@ import namespace="System.Text" #>
5 | <#@ import namespace="System.Collections.Generic" #>
6 |
7 | const axios = require('axios');
8 | await response=axios({
9 | method:"<#= this.Task.HttpMethod.Method #>",
10 | url:"<#= this.Task.Url #>",
11 | headers:{<#= string.Join(",",this.Task.HeaderItems.Where(h => h.Selected).Select(h=>$"'{h.Name}':'{h.Value}'")) #>},
12 | <#
13 | if (this.Task.AcceptsRequestBody)
14 | {
15 | #>
16 | <#
17 | switch(this.Task.ContentType)
18 | {
19 | case RequestContentType.FormUrlencoded:
20 | #>
21 | data:{<#= string.Join(",",this.Task.FormParameters.Where(p => p.Selected).Select(p=>$"'{p.Name}':'{p.Value}'")) #>}
22 | <#
23 | break;
24 | case RequestContentType.Json:
25 | #>
26 | data:<#= this.Task.JsonContent #>
27 | <#
28 | break;
29 | default:
30 | #>
31 | data:`<#= this.Task.PostStringContent #>`
32 | <#
33 | break;
34 | #>
35 | <#
36 | }
37 | }
38 | #>
39 | });
--------------------------------------------------------------------------------
/Models/Codes/Python.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 17.0.0.0
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | // ------------------------------------------------------------------------------
10 | namespace ColdShineSoft.PostEmulator.Models.Codes
11 | {
12 | using System.Linq;
13 | using System.Text;
14 | using System.Collections.Generic;
15 | using System;
16 |
17 | ///
18 | /// Class to produce the template output
19 | ///
20 |
21 | #line 1 "G:\WindowsApplications\PostEmulator\Models\Codes\Python.tt"
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
23 | public partial class Python : BaseTemplate
24 | {
25 | #line hidden
26 | ///
27 | /// Create the template output
28 | ///
29 | public override string TransformText()
30 | {
31 | this.Write("\r\nimport urllib.request\r\nimport urllib.parse\r\n\r\nurl = \'");
32 |
33 | #line 10 "G:\WindowsApplications\PostEmulator\Models\Codes\Python.tt"
34 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.Url));
35 |
36 | #line default
37 | #line hidden
38 | this.Write("\'\r\nheaders = {");
39 |
40 | #line 11 "G:\WindowsApplications\PostEmulator\Models\Codes\Python.tt"
41 | this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(",",this.Task.HeaderItems.Where(h => h.Selected).Select(h=>$"'{h.Name}':'{h.Value}'"))));
42 |
43 | #line default
44 | #line hidden
45 | this.Write("}\r\nrequest = urllib.request.Request(url, method=\'");
46 |
47 | #line 12 "G:\WindowsApplications\PostEmulator\Models\Codes\Python.tt"
48 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.HttpMethod.Method));
49 |
50 | #line default
51 | #line hidden
52 | this.Write("\', headers=headers");
53 |
54 | #line 12 "G:\WindowsApplications\PostEmulator\Models\Codes\Python.tt"
55 | this.Write(this.ToStringHelper.ToStringWithCulture(this.Task.AcceptsRequestBody?$",data='''{this.Task.PostStringContent}'''":""));
56 |
57 | #line default
58 | #line hidden
59 | this.Write(")\r\nresponse = urllib.request.urlopen(request)");
60 | return this.GenerationEnvironment.ToString();
61 | }
62 | }
63 |
64 | #line default
65 | #line hidden
66 | }
67 |
--------------------------------------------------------------------------------
/Models/Codes/Python.tt:
--------------------------------------------------------------------------------
1 | <#@ template language="C#" inherits="BaseTemplate" #>
2 | <#@ assembly name="System.Core" #>
3 | <#@ import namespace="System.Linq" #>
4 | <#@ import namespace="System.Text" #>
5 | <#@ import namespace="System.Collections.Generic" #>
6 |
7 | import urllib.request
8 | import urllib.parse
9 |
10 | url = '<#= this.Task.Url #>'
11 | headers = {<#= string.Join(",",this.Task.HeaderItems.Where(h => h.Selected).Select(h=>$"'{h.Name}':'{h.Value}'")) #>}
12 | request = urllib.request.Request(url, method='<#= this.Task.HttpMethod.Method #>', headers=headers<#= this.Task.AcceptsRequestBody?$",data='''{this.Task.PostStringContent}'''":"" #>)
13 | response = urllib.request.urlopen(request)
--------------------------------------------------------------------------------
/Models/Converters/HttpMethodConverter.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ColdShineSoft.PostEmulator.Models.Converters
9 | {
10 | public class HttpMethodConverter : Newtonsoft.Json.JsonConverter
11 | {
12 | protected static readonly System.Type ObjectType = typeof(System.Net.Http.HttpMethod);
13 |
14 | public override bool CanConvert(Type objectType)
15 | {
16 | return objectType == ObjectType;
17 | }
18 |
19 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
20 | {
21 | return new System.Net.Http.HttpMethod(reader.Value.ToString());
22 | }
23 |
24 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
25 | {
26 | writer.WriteValue(value.ToString());
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Models/DataErrorInfos/Task.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 ColdShineSoft.PostEmulator.Models.DataErrorInfos
8 | {
9 | public class Task : Models.Task
10 | {
11 | private string _Url;
12 | public override string Url
13 | {
14 | get
15 | {
16 | return this._Url;
17 | }
18 | set
19 | {
20 | this._Url = value;
21 | this.NotifyOfPropertyChange(() => this.Url);
22 | }
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Models/Global.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public class Global : Caliburn.Micro.PropertyChangedBase
10 | {
11 | private Localization _Localization;
12 | public Localization Localization
13 | {
14 | get
15 | {
16 | return this._Localization;
17 | }
18 | set
19 | {
20 | this._Localization = value;
21 | this.NotifyOfPropertyChange(() => this.Localization);
22 | }
23 | }
24 |
25 | public static readonly Global Instance = new Global();
26 | }
27 | }
--------------------------------------------------------------------------------
/Models/ItemsEditMode.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public enum ItemsEditMode
10 | {
11 | Editor,
12 | RawText
13 | }
14 | }
--------------------------------------------------------------------------------
/Models/Localization.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public class Localization
10 | {
11 | public string Add { get; set; }
12 | public string Save { get; set; }
13 | public string SaveAs { get; set; }
14 | public string Open { get; set; }
15 | public string RecentFiles { get; set; }
16 | public string Language { get; set; }
17 | public string Help { get; set; }
18 | public string Tutorial { get; set; }
19 | public string About { get; set; }
20 | public string Theme { get; set; }
21 |
22 | public string Run { get; set; }
23 | public string Stop { get; set; }
24 | public string RunTask { get; set; }
25 | public string Status { get; set; }
26 | public string ExportCode { get; set; }
27 |
28 | public string Url { get; set; }
29 | public string UrlParameters { get; set; }
30 |
31 | public string RequestHeaders { get; set; }
32 | public string HeadersRaw { get; set; }
33 | public string HeadersEditor { get; set; }
34 | public string CookiesEditor { get; set; }
35 |
36 | public string RequestBody { get; set; }
37 | public string ContentType { get; set; }
38 | public string Editor { get; set; }
39 |
40 | public string Name { get; set; }
41 | public string Value { get; set; }
42 | public string OpenFileDialog { get; set; }
43 | public string Result { get; set; }
44 | public string Error { get; set; }
45 |
46 | public string GetCookiesFromResponse { get; set; }
47 | public string SaveResponseBody { get; set; }
48 | public string ResponseBody { get; set; }
49 | public string PlainText { get; set; }
50 | public string CodeView { get; set; }
51 | public string Image { get; set; }
52 | public string Binary { get; set; }
53 | public string MissedHeaders { get; set; }
54 |
55 | public string Confirm { get; set; }
56 | public string OK { get; set; }
57 | public string Cancel { get; set; }
58 |
59 | public System.Collections.Generic.Dictionary TaskStatus { get; set; }
60 |
61 | public System.Collections.Generic.Dictionary ValidationError { get; set; }
62 |
63 | public static readonly string InstallationDirectory = System.AppDomain.CurrentDomain.BaseDirectory + @"Localization\";
64 |
65 | }
66 | }
--------------------------------------------------------------------------------
/Models/Models.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F17BEAA9-F77B-438F-9A04-350885926CD8}
8 | Library
9 | Properties
10 | ColdShineSoft.HttpClientPerformer.Models
11 | ColdShineSoft.PostEmulator.Models
12 | v4.6.2
13 | 512
14 | true
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\packages\AngleSharp.1.0.2\lib\net461\AngleSharp.dll
37 |
38 |
39 | ..\packages\BrotliSharpLib.0.3.3\lib\net451\BrotliSharpLib.dll
40 |
41 |
42 | ..\packages\Caliburn.Micro.Core.4.0.210\lib\netstandard2.0\Caliburn.Micro.Core.dll
43 |
44 |
45 | ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
46 |
47 |
48 |
49 | ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
50 |
51 |
52 |
53 |
54 |
55 | ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll
56 |
57 |
58 |
59 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
60 |
61 |
62 | ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
63 |
64 |
65 |
66 | ..\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll
67 |
68 |
69 | ..\packages\System.Text.Encoding.CodePages.6.0.0\lib\net461\System.Text.Encoding.CodePages.dll
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | True
82 | True
83 | CSharp.tt
84 |
85 |
86 | True
87 | True
88 | Java.tt
89 |
90 |
91 | True
92 | True
93 | JavaScript.tt
94 |
95 |
96 | True
97 | True
98 | Python.tt
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | TextTemplatingFilePreprocessor
128 | CSharp.cs
129 |
130 |
131 | TextTemplatingFilePreprocessor
132 | Java.cs
133 |
134 |
135 | TextTemplatingFilePreprocessor
136 | JavaScript.cs
137 |
138 |
139 | TextTemplatingFilePreprocessor
140 | Python.cs
141 |
142 |
143 |
144 |
--------------------------------------------------------------------------------
/Models/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("Models")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Models")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("f17beaa9-f77b-438f-9a04-350885926cd8")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Models/RequestContentType.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public enum RequestContentType
10 | {
11 | PlainText,
12 | FormUrlencoded,
13 | Json,
14 | XML
15 | }
16 | }
--------------------------------------------------------------------------------
/Models/RequestItem.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public class RequestItem : Caliburn.Micro.PropertyChangedBase
10 | {
11 | private bool _Selected = true;
12 | [Newtonsoft.Json.JsonProperty]
13 | public bool Selected
14 | {
15 | get
16 | {
17 | return this._Selected;
18 | }
19 | set
20 | {
21 | this._Selected = value;
22 | this._ShowInRaw = null;
23 | this.NotifyOfPropertyChange(() => this.Selected);
24 | //this.NotifyOfPropertyChange(() => this.ShowInRaw);
25 | }
26 | }
27 |
28 | [Newtonsoft.Json.JsonProperty]
29 | private string _Key;
30 | public string Name
31 | {
32 | get
33 | {
34 | return this._Key;
35 | }
36 | set
37 | {
38 | this._Key = value;
39 | this._Type = null;
40 | this._ShowInRaw = null;
41 | //this._ShowInEditor = null;
42 | this.NotifyOfPropertyChange(() => this.Name);
43 | //this.NotifyOfPropertyChange(() => this.ShowInRaw);
44 | //this.NotifyOfPropertyChange(() => this.ShowInEditor);
45 | }
46 | }
47 |
48 | private string _Value;
49 | [Newtonsoft.Json.JsonProperty]
50 | public string Value
51 | {
52 | get
53 | {
54 | return this._Value;
55 | }
56 | set
57 | {
58 | this._Value = value;
59 | this._ShowInRaw = null;
60 | //this._ShowInEditor = null;
61 | this.NotifyOfPropertyChange(() => this.Value);
62 | //this.NotifyOfPropertyChange(() => this.ShowInRaw);
63 | //this.NotifyOfPropertyChange(() => this.ShowInEditor);
64 | //this.OnValueChanged();
65 | }
66 | }
67 |
68 | public void SetValueWithoutNotify(string value)
69 | {
70 | this._Value = value;
71 | this._ShowInRaw = null;
72 | //this._ShowInEditor = null;
73 | }
74 |
75 | //public event System.Action ValueChanged;
76 | //protected void OnValueChanged()
77 | //{
78 | // if (this.ValueChanged != null)
79 | // this.ValueChanged(this.Value);
80 | //}
81 |
82 | //private bool? _IsCookieItem;
83 | //public bool IsCookieItem
84 | //{
85 | // get
86 | // {
87 | // if (this._IsCookieItem == null)
88 | // this._IsCookieItem = string.Equals(this.Name, "Cookie", StringComparison.OrdinalIgnoreCase);
89 | // return this._IsCookieItem.Value;
90 | // }
91 | //}
92 |
93 | private RequestItemType? _Type;
94 | public RequestItemType Type
95 | {
96 | get
97 | {
98 | if (this._Type == null)
99 | if (string.Equals(this.Name, "Cookie", StringComparison.OrdinalIgnoreCase))
100 | this._Type = RequestItemType.Cookie;
101 | else if (string.Equals(this.Name, "Content-Type", StringComparison.OrdinalIgnoreCase))
102 | this._Type = RequestItemType.ContentType;
103 | else this._Type = RequestItemType.Common;
104 | return this._Type.Value;
105 | }
106 | }
107 |
108 | private bool? _ShowInRaw;
109 | public bool ShowInRaw
110 | {
111 | get
112 | {
113 | if(this._ShowInRaw==null)
114 | if (this.Selected)
115 | {
116 | bool noValue = string.IsNullOrWhiteSpace(this.Value);
117 | if (this.Type == RequestItemType.Cookie && noValue)
118 | this._ShowInRaw = false;
119 | else if (string.IsNullOrWhiteSpace(this.Name) && noValue)
120 | this._ShowInRaw = false;
121 | else this._ShowInRaw = true;
122 | }
123 | else this._ShowInRaw = false;
124 | return this._ShowInRaw.Value;
125 | }
126 | }
127 |
128 | //private bool? _ShowInEditor;
129 | //public bool ShowInEditor
130 | //{
131 | // get
132 | // {
133 | // if (this._ShowInEditor == null)
134 | // if (this.IsCookieItem && string.IsNullOrWhiteSpace(this.Value))
135 | // this._ShowInEditor = false;
136 | // else this._ShowInEditor = true;
137 | // return this._ShowInEditor.Value;
138 | // }
139 | //}
140 |
141 | public RequestItem()
142 | {
143 |
144 | }
145 |
146 | public RequestItem(string name)
147 | {
148 | this._Key = name;
149 | }
150 |
151 | public RequestItem(string name, string value)
152 | {
153 | this._Key = name;
154 | this._Value = value;
155 | }
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/Models/RequestItemType.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public enum RequestItemType
10 | {
11 | Common,
12 | Cookie,
13 | ContentType
14 | }
15 | }
--------------------------------------------------------------------------------
/Models/Response.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public class Response : Caliburn.Micro.PropertyChangedBase
10 | {
11 | public string Headers { get; protected set; }
12 |
13 | public byte[] Content { get; protected set; }
14 |
15 | public readonly string MediaType;
16 |
17 | protected readonly string CharSet;
18 |
19 | public readonly string FileName;
20 |
21 | public System.Collections.Generic.IList MissedHeaders { get; protected set; }
22 |
23 | public string Error { get; protected set; }
24 |
25 | private System.Text.Encoding _Encoding;
26 | public System.Text.Encoding Encoding
27 | {
28 | get
29 | {
30 | if(this._Encoding==null)
31 | try
32 | {
33 | this._Encoding = System.Text.Encoding.GetEncoding(this.CharSet);
34 | }
35 | catch
36 | {
37 | this._Encoding = System.Text.Encoding.UTF8;
38 | }
39 | return this._Encoding;
40 | }
41 | }
42 |
43 | private string _TextContent;
44 | public string TextContent
45 | {
46 | get
47 | {
48 | if (this._TextContent == null)
49 | this._TextContent = this.Encoding.GetString(this.Content);
50 | return this._TextContent;
51 | }
52 | }
53 |
54 | private string _FormattedContentCode;
55 | public string FormattedContentCode
56 | {
57 | get
58 | {
59 | if (this._FormattedContentCode == null)
60 | switch (this.ContentType)
61 | {
62 | case ResponseContentType.HTML:
63 | {
64 | AngleSharp.Html.Parser.HtmlParser parser = new AngleSharp.Html.Parser.HtmlParser();
65 | AngleSharp.Html.Dom.IHtmlDocument document = parser.ParseDocument(this.TextContent);
66 | System.IO.StringWriter writer = new System.IO.StringWriter();
67 | document.ToHtml(writer, new AngleSharp.Html.PrettyMarkupFormatter());
68 | this._FormattedContentCode = writer.ToString();
69 | break;
70 | }
71 | case ResponseContentType.Json:
72 | {
73 | this._FormattedContentCode = Newtonsoft.Json.JsonConvert.DeserializeObject(this.TextContent).ToString();
74 | break;
75 | }
76 | case ResponseContentType.XML:
77 | {
78 | //System.Xml.Linq.XDocument document = System.Xml.Linq.XDocument.Parse(this.TextContent);
79 | //System.IO.StringWriter writer = new System.IO.StringWriter();
80 | //document.Save(writer);
81 | //this._FormattedContentCode = writer.ToString();
82 | this._FormattedContentCode = System.Xml.Linq.XDocument.Parse(this.TextContent).ToString();
83 | break;
84 | }
85 | default:
86 | this._FormattedContentCode = this.TextContent;
87 | break;
88 | }
89 | return this._FormattedContentCode;
90 | }
91 | }
92 |
93 | private System.IO.MemoryStream _ContentStream;
94 | public System.IO.MemoryStream ContentStream
95 | {
96 | get
97 | {
98 | if (this._ContentStream == null)
99 | this._ContentStream = new System.IO.MemoryStream(this.Content);
100 | return this._ContentStream;
101 | }
102 | }
103 |
104 | private ResponseContentType? _ContentType;
105 | public ResponseContentType ContentType
106 | {
107 | get
108 | {
109 | if (this._ContentType == null)
110 | if (this.MediaType == null)
111 | this._ContentType = Models.ResponseContentType.Binary;
112 | else if (this.MediaType.Contains("html"))
113 | this._ContentType = Models.ResponseContentType.HTML;
114 | else if (this.MediaType.Contains("json"))
115 | this._ContentType = Models.ResponseContentType.Json;
116 | else if (this.MediaType.Contains("javascript"))
117 | this._ContentType = Models.ResponseContentType.JavaScript;
118 | else if(this.MediaType.Contains("xml"))
119 | this._ContentType = Models.ResponseContentType.XML;
120 | else if(this.MediaType.Contains("image"))
121 | this._ContentType = Models.ResponseContentType.Image;
122 | else if(this.MediaType.Contains("text"))
123 | this._ContentType = Models.ResponseContentType.PlainText;
124 | else this._ContentType = Models.ResponseContentType.Binary;
125 | return this._ContentType.Value;
126 | }
127 | }
128 |
129 | private bool? _IsCodeContent;
130 | public bool IsCodeContent
131 | {
132 | get
133 | {
134 | if(this._IsCodeContent==null)
135 | switch(this.ContentType)
136 | {
137 | case ResponseContentType.HTML:
138 | case ResponseContentType.CSS:
139 | case ResponseContentType.JavaScript:
140 | case ResponseContentType.XML:
141 | case ResponseContentType.Json:
142 | this._IsCodeContent = true;
143 | break;
144 | default:
145 | this._IsCodeContent = false;
146 | break;
147 | }
148 | return this._IsCodeContent.Value;
149 | }
150 | }
151 |
152 | public Response(string headers, byte[] content,string mediaType,string charSet,string fileName, IList missedHeaders, string error)
153 | {
154 | this.Headers = headers;
155 | this.Content = content;
156 | this.MediaType = mediaType?.ToLower();
157 | this.CharSet = charSet;
158 | this.FileName = fileName;
159 | this.MissedHeaders = missedHeaders;
160 | this.Error = error;
161 | }
162 | }
163 | }
--------------------------------------------------------------------------------
/Models/ResponseContentType.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public enum ResponseContentType
10 | {
11 | Binary,
12 | PlainText,
13 | HTML,
14 | CSS,
15 | JavaScript,
16 | Json,
17 | XML,
18 | Image
19 | }
20 | }
--------------------------------------------------------------------------------
/Models/Setting.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public class Setting:Caliburn.Micro.PropertyChangedBase
10 | {
11 | private string _SelectedCultureName;
12 | [Newtonsoft.Json.JsonProperty]
13 | public string SelectedCultureName
14 | {
15 | get
16 | {
17 | return this._SelectedCultureName;
18 | }
19 | set
20 | {
21 | this._SelectedCultureName = value;
22 | this._SelectedCulture = null;
23 | }
24 | }
25 |
26 | private System.Globalization.CultureInfo _SelectedCulture;
27 | public System.Globalization.CultureInfo SelectedCulture
28 | {
29 | get
30 | {
31 | if(this._SelectedCulture==null)
32 | {
33 | string cultureName = this.SelectedCultureName;
34 | if (string.IsNullOrWhiteSpace(this.SelectedCultureName))
35 | {
36 | string baseDirectory = Localization.InstallationDirectory;
37 | string filePath = baseDirectory + System.Globalization.CultureInfo.CurrentUICulture.Name + ".json";
38 | if (System.IO.File.Exists(filePath))
39 | cultureName = System.Globalization.CultureInfo.CurrentUICulture.Name;
40 | else cultureName = "en";
41 | }
42 | this._SelectedCulture = (System.Globalization.CultureInfo)System.Globalization.CultureInfo.GetCultureInfo(cultureName).Clone();
43 | }
44 | return this._SelectedCulture;
45 | }
46 | }
47 |
48 | [Newtonsoft.Json.JsonProperty]
49 | public byte MaxRecentFileCount { get; set; } = 50;
50 |
51 | private int _ThemeId;
52 | [Newtonsoft.Json.JsonProperty]
53 | public int ThemeId
54 | {
55 | get
56 | {
57 | if (this._ThemeId == 0)
58 | this._ThemeId = Theme.Default.ThemeId;
59 | return this._ThemeId;
60 | }
61 | set
62 | {
63 | this._ThemeId = value;
64 | this._Theme = null;
65 | this.NotifyOfPropertyChange(() => this.Theme);
66 | }
67 | }
68 |
69 | private Theme _Theme;
70 | public Theme Theme
71 | {
72 | get
73 | {
74 | if (this._Theme == null)
75 | this._Theme = Theme.FromId(this.ThemeId);
76 | return this._Theme;
77 | }
78 | }
79 |
80 | private System.Collections.ObjectModel.ObservableCollection _RecentFiles;
81 | [Newtonsoft.Json.JsonProperty]
82 | public System.Collections.ObjectModel.ObservableCollection RecentFiles
83 | {
84 | get
85 | {
86 | if (this._RecentFiles == null)
87 | this._RecentFiles = new System.Collections.ObjectModel.ObservableCollection();
88 | return this._RecentFiles;
89 | }
90 | set
91 | {
92 | this._RecentFiles = value;
93 | }
94 | }
95 |
96 | protected static readonly string SavePath = System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Cold-Shine-Soft.Com" , "Post Emulator", "Setting.json");
97 |
98 | private static Setting _Instance;
99 | public static Setting Instance
100 | {
101 | get
102 | {
103 | if (_Instance == null)
104 | if (System.IO.File.Exists(SavePath))
105 | {
106 | System.IO.StreamReader reader = new System.IO.StreamReader(SavePath);
107 | //_Instance = NetJSON.NetJSON.Deserialize(reader);
108 | _Instance = new Newtonsoft.Json.JsonSerializer().Deserialize(new Newtonsoft.Json.JsonTextReader(reader));
109 | if (_Instance == null)
110 | _Instance = new Setting();
111 | reader.Close();
112 | }
113 | else _Instance = new Setting();
114 | return _Instance;
115 | }
116 | }
117 |
118 | public void AddRecentFile(string path)
119 | {
120 | int index = this.RecentFiles.IndexOf(path);
121 | if (index >= 0)
122 | this.RecentFiles.Move(index, 0);
123 | else this.RecentFiles.Insert(0, path);
124 | if (this.RecentFiles.Count > this.MaxRecentFileCount)
125 | this.RecentFiles.RemoveAt(this.RecentFiles.Count - 1);
126 | this.Save();
127 | }
128 |
129 | public void Save()
130 | {
131 | string directory = System.IO.Path.GetDirectoryName(SavePath);
132 | if (!System.IO.Directory.Exists(directory))
133 | System.IO.Directory.CreateDirectory(directory);
134 |
135 | System.IO.StreamWriter writer = new System.IO.StreamWriter(SavePath);
136 | //NetJSON.NetJSON.Serialize(this, writer);
137 | new Newtonsoft.Json.JsonSerializer().Serialize(writer, this);
138 | writer.Close();
139 | }
140 | }
141 | }
--------------------------------------------------------------------------------
/Models/TaskStatus.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public enum TaskStatus
10 | {
11 | Standby,
12 | Performing,
13 | Done
14 | }
15 | }
--------------------------------------------------------------------------------
/Models/Theme.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public enum Themes : byte
10 | {
11 | Light,
12 | Dark,
13 | Red,
14 | Green,
15 | Blue,
16 | Purple,
17 | Orange,
18 | Lime,
19 | Emerald,
20 | Teal,
21 | Cyan,
22 | Cobalt,
23 | Indigo,
24 | Violet,
25 | Pink,
26 | Magenta,
27 | Crimson,
28 | Amber,
29 | Yellow,
30 | Brown,
31 | Olive,
32 | Steel,
33 | Mauve,
34 | Taupe,
35 | Sienna
36 | }
37 |
38 | public class Theme
39 | {
40 | protected static readonly Themes[] BaseThemes = new Themes[] { Themes.Light, Themes.Dark };
41 |
42 | protected static readonly Themes[] ColorSchemes = System.Enum.GetValues(typeof(Themes)).OfType().Where(t => !BaseThemes.Contains(t)).ToArray();
43 |
44 | private static Theme[] _All;
45 | public static Theme[] All
46 | {
47 | get
48 | {
49 | if(_All==null)
50 | {
51 | System.Collections.Generic.List all = new List();
52 | foreach(Themes baseTheme in BaseThemes)
53 | {
54 | Theme theme = new Theme();
55 | theme.Value = baseTheme;
56 | theme.Children = ColorSchemes.Select(colorScheme => new Theme { Parent = theme, Value = colorScheme }).ToArray();
57 | all.Add(theme);
58 | }
59 | _All = all.ToArray();
60 | }
61 | return _All;
62 | }
63 | }
64 |
65 | private static Theme _Default;
66 | public static Theme Default
67 | {
68 | get
69 | {
70 | if (_Default == null)
71 | _Default = All.First(t => t.Value == Themes.Light).Children.First(t => t.Value == Themes.Blue);
72 | return _Default;
73 | }
74 | }
75 |
76 | [Newtonsoft.Json.JsonProperty]
77 | public Theme Parent { get; set; }
78 |
79 | [Newtonsoft.Json.JsonProperty]
80 | public Themes Value { get; set; }
81 |
82 | public Theme[] Children { get; set; }
83 |
84 | private int _ThemeId;
85 | public int ThemeId
86 | {
87 | get
88 | {
89 | if (this._ThemeId == 0)
90 | this._ThemeId = (byte)(this.Parent?.Value ?? 0) * 100 + (byte)this.Value;
91 | return this._ThemeId;
92 | }
93 | }
94 |
95 | private string _Name;
96 | public string Name
97 | {
98 | get
99 | {
100 | if (this._Name == null)
101 | this._Name = this.Parent?.Value + "." + this.Value;
102 | return this._Name;
103 | }
104 | }
105 |
106 | public static Theme FromId(int themeId)
107 | {
108 | foreach (Theme baseTheme in All)
109 | foreach (Theme colorScheme in baseTheme.Children)
110 | if (colorScheme.ThemeId == themeId)
111 | return colorScheme;
112 | return Default;
113 | }
114 |
115 | public override string ToString()
116 | {
117 | return this.Name;
118 | }
119 |
120 | //public int CompareTo(Theme other)
121 | //{
122 | // return this.CompareValue.CompareTo(other.CompareValue);
123 | //}
124 |
125 | public override int GetHashCode()
126 | {
127 | return this.ThemeId;
128 | }
129 |
130 | public override bool Equals(object obj)
131 | {
132 | return this.ThemeId == ((Theme)obj).ThemeId;
133 | }
134 | }
135 | }
--------------------------------------------------------------------------------
/Models/ValidationError.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 ColdShineSoft.PostEmulator.Models
8 | {
9 | public enum ValidationError
10 | {
11 | Required,
12 | InvalidFormat
13 | }
14 | }
--------------------------------------------------------------------------------
/Models/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Models/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/PostEmulator.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.32112.339
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViewModels", "ViewModels\ViewModels.csproj", "{0C7296AA-3D93-40C4-A791-F70B367DC0E9}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models", "Models\Models.csproj", "{F17BEAA9-F77B-438F-9A04-350885926CD8}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Views", "Views\Views.csproj", "{C20282E0-30A5-4967-8648-26C3A65E9968}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls", "Controls\Controls.csproj", "{1333E27F-A5C0-4532-8F47-0E85BF32AEEC}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Widgets", "Widgets\Widgets.csproj", "{D30945D8-CF5A-4059-A234-FA786A65E6AD}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Release|Any CPU = Release|Any CPU
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {0C7296AA-3D93-40C4-A791-F70B367DC0E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {0C7296AA-3D93-40C4-A791-F70B367DC0E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {0C7296AA-3D93-40C4-A791-F70B367DC0E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {0C7296AA-3D93-40C4-A791-F70B367DC0E9}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {F17BEAA9-F77B-438F-9A04-350885926CD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {F17BEAA9-F77B-438F-9A04-350885926CD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {F17BEAA9-F77B-438F-9A04-350885926CD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {F17BEAA9-F77B-438F-9A04-350885926CD8}.Release|Any CPU.Build.0 = Release|Any CPU
30 | {C20282E0-30A5-4967-8648-26C3A65E9968}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {C20282E0-30A5-4967-8648-26C3A65E9968}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {C20282E0-30A5-4967-8648-26C3A65E9968}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {C20282E0-30A5-4967-8648-26C3A65E9968}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {1333E27F-A5C0-4532-8F47-0E85BF32AEEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 | {1333E27F-A5C0-4532-8F47-0E85BF32AEEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 | {1333E27F-A5C0-4532-8F47-0E85BF32AEEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {1333E27F-A5C0-4532-8F47-0E85BF32AEEC}.Release|Any CPU.Build.0 = Release|Any CPU
38 | {D30945D8-CF5A-4059-A234-FA786A65E6AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {D30945D8-CF5A-4059-A234-FA786A65E6AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {D30945D8-CF5A-4059-A234-FA786A65E6AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 | {D30945D8-CF5A-4059-A234-FA786A65E6AD}.Release|Any CPU.Build.0 = Release|Any CPU
42 | EndGlobalSection
43 | GlobalSection(SolutionProperties) = preSolution
44 | HideSolutionNode = FALSE
45 | EndGlobalSection
46 | GlobalSection(ExtensibilityGlobals) = postSolution
47 | SolutionGuid = {7D0C187A-7D44-4CA4-909F-C1F00EB02208}
48 | EndGlobalSection
49 | EndGlobal
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Post Emulator
2 | Post Emulator is a lightweight windows tool for generating HTTP requests to test the response from server.
3 | # Key Features
4 | ## Convert raw headers to editors
5 | 
6 | 
7 | 
8 | ## Export the request task to programming code
9 | 
10 | 
11 | ## Take the coookies to the the request from response
12 | 
13 | 
14 | # Usage
15 | 1. Download the PostEmulator-Portable.zip(just 6m size) from the releases page:https://github.com/LiveIsLive/PostEmulator/releases
16 | 1. Extract the PostEmulator-Portable.zip
17 | 2. Open ColdShineSoft.PostEmulator.Views.exe
18 |
--------------------------------------------------------------------------------
/ViewModels/About.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 ColdShineSoft.PostEmulator.ViewModels
8 | {
9 | public class About : Screen
10 | {
11 | private static string _Version;
12 | public string Version
13 | {
14 | get
15 | {
16 | if (_Version == null)
17 | _Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
18 | return _Version;
19 | }
20 | }
21 |
22 | public int Year { get; } = System.DateTime.Now.Year;
23 |
24 | public void ShowHomePage()
25 | {
26 | System.Diagnostics.Process.Start("https://cold-shine-soft.com/");
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/ViewModels/Bootstrapper.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | using Caliburn.Micro;
4 | using System.ComponentModel.Composition;
5 | using System.ComponentModel.Composition.Hosting;
6 | using System.ComponentModel.Composition.Primitives;
7 |
8 | namespace ColdShineSoft.PostEmulator.ViewModels
9 | {
10 | public class Bootstrapper: Caliburn.Micro.BootstrapperBase
11 | {
12 | public Bootstrapper()
13 | {
14 | this.Initialize();
15 | }
16 |
17 | protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
18 | {
19 | System.Threading.Thread.CurrentThread.CurrentCulture = Models.Setting.Instance.SelectedCulture;
20 | System.Threading.Thread.CurrentThread.CurrentUICulture = Models.Setting.Instance.SelectedCulture;
21 |
22 |
23 | if (e.Args.Length == 1)
24 | Main.SetOpeningFilePath(e.Args[0]);
25 |
26 | var config = new Caliburn.Micro.TypeMappingConfiguration
27 | {
28 | UseNameSuffixesInMappings = false,
29 | DefaultSubNamespaceForViewModels = typeof(Main).Namespace,
30 | DefaultSubNamespaceForViews = "ColdShineSoft.PostEmulator.Views"
31 | };
32 |
33 | Caliburn.Micro.ViewLocator.ConfigureTypeMappings(config);
34 | Caliburn.Micro.ViewModelLocator.ConfigureTypeMappings(config);
35 | base.OnStartup(sender, e);
36 |
37 | this.DisplayRootViewForAsync();
38 | }
39 |
40 | protected override System.Collections.Generic.IEnumerable SelectAssemblies()
41 | {
42 | return new[] { System.Reflection.Assembly.GetExecutingAssembly(),System.Reflection.Assembly.GetEntryAssembly() };
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/ViewModels/Code.cs:
--------------------------------------------------------------------------------
1 | using ColdShineSoft.PostEmulator.Models.Codes;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ColdShineSoft.PostEmulator.ViewModels
9 | {
10 | public class Code : Screen
11 | {
12 | public Code(BaseTemplate template)
13 | {
14 | Template = template;
15 | }
16 |
17 | public Models.Codes.BaseTemplate Template { get; protected set; }
18 |
19 |
20 | }
21 | }
--------------------------------------------------------------------------------
/ViewModels/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ViewModels")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ViewModels")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("0c7296aa-3d93-40c4-a791-f70b367dc0e9")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ViewModels/Runner.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 ColdShineSoft.PostEmulator.ViewModels
8 | {
9 | public class Runner:Screen
10 | {
11 | //不知道为什么在xaml里面c:Binding使用models:TaskStatus会报错
12 | public object TaskStatus { get; } = new { Models.TaskStatus.Done };
13 |
14 | public Models.Task Task { get; protected set; }
15 |
16 | public string Title { get; protected set; }
17 |
18 | private Models.Response _Response;
19 | public Models.Response Response
20 | {
21 | get
22 | {
23 | return this._Response;
24 | }
25 | set
26 | {
27 | this._Response = value;
28 | this.NotifyOfPropertyChange(() => this.Response);
29 | //this._TextDocument = null;
30 | //this.NotifyOfPropertyChange(() => this.TextDocument);
31 | this._DeaultSaveFileName = null;
32 | this.NotifyOfPropertyChange(() => this.DeaultSaveFileName);
33 | }
34 | }
35 |
36 | //private ICSharpCode.AvalonEdit.Document.TextDocument _TextDocument;
37 | //public ICSharpCode.AvalonEdit.Document.TextDocument TextDocument
38 | //{
39 | // get
40 | // {
41 | // if (this._TextDocument == null)
42 | // {
43 | // if (this.Response == null)
44 | // return null;
45 | // this._TextDocument = new ICSharpCode.AvalonEdit.Document.TextDocument(this.Response.FormattedContentCode);
46 | // }
47 | // return this._TextDocument;
48 | // }
49 | //}
50 |
51 | //private ICSharpCode.AvalonEdit.Highlighting.IHighlightingDefinition _Highlighting;
52 | //public ICSharpCode.AvalonEdit.Highlighting.IHighlightingDefinition Highlighting
53 | //{
54 | // get
55 | // {
56 | // if(this._Highlighting==null)
57 | // this._Highlighting= ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition(this.Response.ContentType.ToString());
58 | // return this._Highlighting;
59 | // }
60 | //}
61 |
62 | private string _DeaultSaveFileName;
63 | public string DeaultSaveFileName
64 | {
65 | get
66 | {
67 | if (this._DeaultSaveFileName == null)
68 | {
69 | if (this.Response == null)
70 | return null;
71 | if (string.IsNullOrWhiteSpace(this.Response.FileName))
72 | switch (this.Response.ContentType)
73 | {
74 | case Models.ResponseContentType.PlainText:
75 | this._DeaultSaveFileName = ".text";
76 | break;
77 | case Models.ResponseContentType.HTML:
78 | this._DeaultSaveFileName = ".html";
79 | break;
80 | case Models.ResponseContentType.Json:
81 | this._DeaultSaveFileName = ".json";
82 | break;
83 | case Models.ResponseContentType.JavaScript:
84 | this._DeaultSaveFileName = ".js";
85 | break;
86 | case Models.ResponseContentType.CSS:
87 | this._DeaultSaveFileName = ".css";
88 | break;
89 | case Models.ResponseContentType.XML:
90 | this._DeaultSaveFileName = ".xml";
91 | break;
92 | case Models.ResponseContentType.Image:
93 | if (this.Response.MediaType != null)
94 | this._DeaultSaveFileName = "." + this.Response.MediaType.Split('/').Last();
95 | break;
96 | default:
97 | this._DeaultSaveFileName = "";
98 | break;
99 | }
100 | else this._DeaultSaveFileName = this.Response.FileName;
101 | }
102 | return this._DeaultSaveFileName;
103 | }
104 | }
105 |
106 | public Runner(Models.Task task, string fileName)
107 | {
108 | this.Task = task;
109 | this.Title = $"{this.Localization.RunTask} - {fileName}";
110 |
111 | //this.Thread = new System.Threading.Thread(this.Task.Run);
112 | //this.Thread.IsBackground = true;
113 | }
114 |
115 | public async Task Run()
116 | {
117 | this.Response = await this.Task.Run();
118 | this.Response.NotifyOfPropertyChange(() => this.Response.FormattedContentCode);
119 | //this.Thread.Start();
120 | }
121 |
122 | public void Stop()
123 | {
124 | //this.Thread.Abort();
125 | this.Task.CancelPendingRequests();
126 | //this.CancellationTokenSource.Cancel();
127 | //this.Task.Status = Models.TaskStatus.Standby;
128 | this.TryCloseAsync();
129 | }
130 |
131 |
132 | public void CopyCookiesToNewTask()
133 | {
134 | Models.Task task = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(this.Task));
135 | task.ReplaceSelectedOldItems(task.CookieItems, this.Task.CookieContainer.GetCookies(task.Uri).Cast().Select(c => new Models.RequestItem(c.Name, c.Value)).ToList());
136 | this.WindowManager.ShowWindowAsync(new Main { Task = task });
137 | }
138 |
139 | public void SaveFile(string path)
140 | {
141 | System.IO.File.WriteAllBytes(path, this.Response.Content);
142 | }
143 | }
144 | }
--------------------------------------------------------------------------------
/ViewModels/Screen.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 ColdShineSoft.PostEmulator.ViewModels
8 | {
9 | public class Screen : Caliburn.Micro.Screen
10 | {
11 | protected readonly System.Threading.CancellationTokenSource CancellationTokenSource = new System.Threading.CancellationTokenSource();
12 |
13 | protected static readonly string LocalizationDirectory = Models.Localization.InstallationDirectory;
14 |
15 | private Models.Setting _Setting;
16 | public Models.Setting Setting
17 | {
18 | get
19 | {
20 | if (this._Setting == null)
21 | {
22 | this._Setting = Models.Setting.Instance;
23 | //if(string.IsNullOrWhiteSpace(this._Setting.SelectedCultureName))
24 | //{
25 | // string baseDirectory = LocalizationDirectory;
26 | // string filePath = baseDirectory + System.Globalization.CultureInfo.CurrentUICulture.Name + ".json";
27 | // if (System.IO.File.Exists(filePath))
28 | // this._Setting.SelectedCultureName = System.Globalization.CultureInfo.CurrentUICulture.Name;
29 | // else
30 | // {
31 | // filePath = baseDirectory + System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName + ".json";
32 | // if (System.IO.File.Exists(filePath))
33 | // this._Setting.SelectedCultureName = System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
34 | // else this._Setting.SelectedCultureName = "en";
35 | // }
36 | //}
37 | //System.Globalization.CultureInfo culture = (System.Globalization.CultureInfo)System.Globalization.CultureInfo.GetCultureInfo(this._Setting.SelectedCultureName).Clone();
38 |
39 | //System.Windows.Application.Current.Dispatcher.Invoke(() =>
40 | //{
41 | // System.Threading.Thread.CurrentThread.CurrentCulture= culture;
42 | // System.Threading.Thread.CurrentThread.CurrentUICulture= culture;
43 | //});
44 | //this.SetUiLang(this.Setting.SelectedCultureName);
45 | }
46 | return this._Setting;
47 | }
48 | }
49 |
50 | private Models.Localization _Localization;
51 | public Models.Localization Localization
52 | {
53 | get
54 | {
55 | if (this._Localization == null)
56 | //if (Caliburn.Micro.Execute.InDesignMode)
57 | //{
58 | // System.IO.StreamReader reader = new System.IO.StreamReader(System.Windows.Application.GetResourceStream(new Uri("/ColdShineSoft.PostEmulator.Views;component/Localization/zh-CN.json", System.UriKind.Relative)).Stream);
59 | // this._Localization = NetJSON.NetJSON.Deserialize(reader);
60 | // reader.Close();
61 | //}
62 | //else
63 | {
64 | System.IO.StreamReader reader = new System.IO.StreamReader(LocalizationDirectory + this.Setting.SelectedCulture.Name + ".json");
65 | //this._Localization = NetJSON.NetJSON.Deserialize(reader);
66 | this._Localization = new Newtonsoft.Json.JsonSerializer().Deserialize(new Newtonsoft.Json.JsonTextReader(reader));
67 | Models.Global.Instance.Localization = this._Localization;
68 | reader.Close();
69 | }
70 | return this._Localization;
71 | }
72 | set
73 | {
74 | this._Localization = value;
75 | this.NotifyOfPropertyChange(() => this.Localization);
76 | }
77 | }
78 |
79 | private Caliburn.Micro.IWindowManager _WindowManager;
80 | public Caliburn.Micro.IWindowManager WindowManager
81 | {
82 | get
83 | {
84 | if (this._WindowManager == null)
85 | this._WindowManager = new Caliburn.Micro.WindowManager();
86 | return this._WindowManager;
87 | }
88 | }
89 |
90 | //private MvvmDialogs.IDialogService _DialogService;
91 | //public MvvmDialogs.IDialogService DialogService
92 | //{
93 | // get
94 | // {
95 | // if (this._DialogService == null)
96 | // this._DialogService = new MvvmDialogs.DialogService();
97 | // return this._DialogService;
98 | // }
99 | //}
100 |
101 | //protected static readonly System.Type UiConfigHelperType = System.Type.GetType("HandyControl.Tools.ConfigHelper,HandyControl");
102 |
103 | //protected static readonly object UiConfigHelper = UiConfigHelperType.GetField("Instance").GetValue(null);
104 |
105 | //protected static System.Reflection.MethodInfo SetUiLangMethod = UiConfigHelperType.GetMethod("SetLang");
106 |
107 | //protected void SetUiLang(string name)
108 | //{
109 | // try
110 | // {
111 | // SetUiLangMethod.Invoke(UiConfigHelper, new object[] { name });
112 | // }
113 | // catch
114 | // {
115 | // try
116 | // {
117 | // SetUiLangMethod.Invoke(UiConfigHelper, new object[] { name.Split('-')[0] });
118 | // }
119 | // catch
120 | // {
121 | // SetUiLangMethod.Invoke(UiConfigHelper, new object[] { "en" });
122 | // }
123 | // }
124 | //}
125 |
126 | //public void CloseWindow()
127 | //{
128 | // this.TryCloseAsync();
129 | //}
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/ViewModels/ViewModels.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {0C7296AA-3D93-40C4-A791-F70B367DC0E9}
8 | Library
9 | Properties
10 | ColdShineSoft.PostEmulator.ViewModels
11 | ColdShineSoft.PostEmulator.ViewModels
12 | v4.6.2
13 | 512
14 | true
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\packages\Caliburn.Micro.Core.4.0.210\lib\netstandard2.0\Caliburn.Micro.Core.dll
37 |
38 |
39 | ..\packages\Caliburn.Micro.4.0.210\lib\net462\Caliburn.Micro.Platform.dll
40 |
41 |
42 | ..\packages\Caliburn.Micro.4.0.210\lib\net462\Caliburn.Micro.Platform.Core.dll
43 |
44 |
45 | ..\packages\gong-wpf-dragdrop.3.1.1\lib\net462\GongSolutions.WPF.DragDrop.dll
46 |
47 |
48 | ..\packages\AvalonEdit.6.3.0.90\lib\net462\ICSharpCode.AvalonEdit.dll
49 |
50 |
51 | ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll
52 |
53 |
54 | ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | ..\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll
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 | {f17beaa9-f77b-438f-9a04-350885926cd8}
91 | Models
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/ViewModels/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ViewModels/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Views/About.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 | Custom File Copier
14 |
15 |
16 |
17 |
18 |
19 |
22 |
23 | Copyright ©
24 |
25 |
26 |
29 | All rights reserved
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Views/About.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace ColdShineSoft.PostEmulator.Views
16 | {
17 | ///
18 | /// About.xaml 的交互逻辑
19 | ///
20 | public partial class About : MahApps.Metro.Controls.MetroWindow
21 | {
22 | public About()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Views/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Views/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Views/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace ColdShineSoft.PostEmulator.Views
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | public App()
17 | {
18 | //HandyControl.Tools.ConfigHelper.Instance.SetNavigationWindowDefaultStyle();
19 | System.AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
20 | }
21 |
22 | private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
23 | {
24 | System.IO.File.AppendAllText(System.AppContext.BaseDirectory + "Error.txt", e.ExceptionObject.ToString());
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Views/Code.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
--------------------------------------------------------------------------------
/Views/Code.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace ColdShineSoft.PostEmulator.Views
16 | {
17 | ///
18 | /// Code.xaml 的交互逻辑
19 | ///
20 | public partial class Code : Window
21 | {
22 | public Code()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Views/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Views/Localization/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "Add": "Add",
3 | "Save": "Save",
4 | "SaveAs": "Save As...",
5 | "Open": "Open",
6 | "RecentFiles": "Recent Files",
7 | "Language": "Language",
8 | "FileList": "File List",
9 | "Help": "Help",
10 | "Tutorial": "Tutorial",
11 | "About": "About",
12 | "Theme": "Theme",
13 |
14 | "Run": "Start Runing",
15 | "Stop": "Stop",
16 | "RunTask": "Run Task",
17 | "Status": "Status",
18 | "ExportCode": "Export Code",
19 |
20 | "Url": "URL Address",
21 | "UrlParameters": "Url Parameters",
22 |
23 | "RequestHeaders": "Request Headers",
24 | "HeadersRaw": "Raw",
25 | "HeadersEditor": "Headers Editor",
26 | "CookiesEditor": "Cookies Editor",
27 |
28 | "RequestBody": "Request Body",
29 | "ContentType": "Content Type",
30 | "Editor": "Editor",
31 |
32 | "Name": "Name",
33 | "Value": "Value",
34 | "OpenFileDialog": "Browse...",
35 | "Result": "Result",
36 | "Error": "Error",
37 |
38 | "SaveResponseBody": "Save Response Body",
39 | "GetCookiesFromResponse": "Get Cookies From Response Headers",
40 | "ResponseBody": "Response Body",
41 | "PlainText": "Plain Text",
42 | "CodeView": "Code View",
43 | "Image": "Image",
44 | "Binary": "Binary",
45 | "MissedHeaders": "Can not add the headers to the request headers",
46 |
47 | "Confirm": "Overwrite Confirm",
48 | "OK": "OK",
49 | "Cancel": "Cancel",
50 |
51 | "TaskStatus":
52 | {
53 | "Standby": "Standby",
54 | "Performing": "Performing...",
55 | "Done": "Done"
56 | },
57 | "ValidationError":
58 | {
59 | "Required": "Must input the “{0}”.",
60 | "InvalidFormat": "The “{0}” is incorrectly formatted."
61 | }
62 | }
--------------------------------------------------------------------------------
/Views/Localization/zh-CN.json:
--------------------------------------------------------------------------------
1 | {
2 | "Add": "添加",
3 | "Save": "保存",
4 | "SaveAs": "另存为...",
5 | "Open": "打开",
6 | "RecentFiles": "最近使用过的文件",
7 | "Language": "语言/Languages",
8 | "Help": "帮助",
9 | "Tutorial": "入门",
10 | "About": "关于",
11 | "Theme": "主题",
12 |
13 | "Run": "开始执行",
14 | "Stop": "停止",
15 | "RunTask": "执行任务",
16 | "Status": "状态",
17 | "ExportCode": "导出代码",
18 |
19 | "Url": "网址",
20 | "UrlParameters": "网址参数",
21 |
22 | "RequestHeaders": "请求标头",
23 | "HeadersRaw": "源",
24 | "HeadersEditor": "标头编辑器",
25 | "CookiesEditor": "Cookies编辑器",
26 |
27 | "RequestBody": "请求正文",
28 | "ContentType": "内容类型",
29 | "Editor": "编辑器",
30 |
31 | "Name": "名称",
32 | "Value": "值",
33 | "OpenFileDialog": "浏览...",
34 | "Result": "处理结果",
35 | "Error": "错误",
36 |
37 | "SaveResponseBody": "保存响应正文",
38 | "GetCookiesFromResponse": "从响应标头获取Cookie",
39 | "ResponseBody": "响应正文",
40 | "PlainText": "纯文本",
41 | "CodeView": "代码视图",
42 | "Image": "图片",
43 | "Binary": "二进制",
44 | "MissedHeaders": "无法添加标头到请求标头",
45 |
46 | "Confirm": "覆盖确认",
47 | "OK": "确定",
48 | "Cancel": "取消",
49 |
50 | "TaskStatus":
51 | {
52 | "Standby": "待执行",
53 | "Performing": "执行中...",
54 | "Done": "已完成"
55 | },
56 | "ValidationError":
57 | {
58 | "Required": "必须输入“{0}”",
59 | "InvalidFormat": "“{0}”格式不正确。"
60 | }
61 | }
--------------------------------------------------------------------------------
/Views/Main.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 |
16 |
17 | namespace ColdShineSoft.PostEmulator.Views
18 | {
19 | ///
20 | /// Main.xaml 的交互逻辑
21 | ///
22 | public partial class Main : MahApps.Metro.Controls.MetroWindow
23 | {
24 | public Main()
25 | {
26 | InitializeComponent();
27 | }
28 |
29 | private void DialogTest_Click(object sender, RoutedEventArgs e)
30 | {
31 | MahApps.Metro.Controls.Dialogs.DialogManager.ShowMessageAsync(this,"系统提示","This is a Test!",MahApps.Metro.Controls.Dialogs.MessageDialogStyle.AffirmativeAndNegative,new MahApps.Metro.Controls.Dialogs.MetroDialogSettings { AffirmativeButtonText = "确定", NegativeButtonText = "取消" });
32 | }
33 |
34 | private void DateTimePicker_Loaded(object sender, RoutedEventArgs e)
35 | {
36 |
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Views/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("Presentation")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Presentation")]
15 | [assembly: AssemblyCopyright("Copyright © 2021")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
52 | //通过使用 "*",如下所示:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Views/Runner.xaml:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | :
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
77 |
78 |
79 |
80 |
81 |
92 |
93 |
94 |
95 |
96 |
107 |
108 |
109 |
110 |
111 |
122 |
123 |
124 |
125 |
126 |
137 |
138 |
139 |
140 |
141 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
180 |
181 |
182 |
183 |
184 |
185 |
--------------------------------------------------------------------------------
/Views/Runner.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace ColdShineSoft.PostEmulator.Views
16 | {
17 | ///
18 | /// Runner.xaml 的交互逻辑
19 | ///
20 | public partial class Runner : MahApps.Metro.Controls.MetroWindow
21 | {
22 | public Runner()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Views/Transfer.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveIsLive/PostEmulator/710a3456df0f0b8544c665344fa2f8c3941042e1/Views/Transfer.ico
--------------------------------------------------------------------------------
/Views/Views.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C20282E0-30A5-4967-8648-26C3A65E9968}
8 | WinExe
9 | ColdShineSoft.PostEmulator.Views
10 | ColdShineSoft.PostEmulator.Views
11 | v4.6.2
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 | false
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 |
38 |
39 | Transfer.ico
40 |
41 |
42 | true
43 |
44 |
45 |
46 | ..\packages\CalcBinding.2.5.2\lib\net45\CalcBinding.dll
47 |
48 |
49 | ..\packages\Caliburn.Micro.Core.4.0.210\lib\netstandard2.0\Caliburn.Micro.Core.dll
50 |
51 |
52 | ..\packages\Caliburn.Micro.4.0.210\lib\net462\Caliburn.Micro.Platform.dll
53 |
54 |
55 | ..\packages\Caliburn.Micro.4.0.210\lib\net462\Caliburn.Micro.Platform.Core.dll
56 |
57 |
58 | ..\packages\ControlzEx.5.0.1\lib\net462\ControlzEx.dll
59 |
60 |
61 | ..\packages\DynamicExpresso.Core.2.13.0\lib\netstandard2.0\DynamicExpresso.Core.dll
62 |
63 |
64 | ..\packages\gong-wpf-dragdrop.3.1.1\lib\net462\GongSolutions.WPF.DragDrop.dll
65 |
66 |
67 | ..\packages\AvalonEdit.6.3.0.90\lib\net462\ICSharpCode.AvalonEdit.dll
68 |
69 |
70 | ..\packages\JsonControls.JsonViewer.1.1.2\lib\net40\JsonControls.dll
71 |
72 |
73 | ..\packages\MahApps.Metro.2.4.9\lib\net46\MahApps.Metro.dll
74 |
75 |
76 | ..\packages\MahApps.Metro.IconPacks.Codicons.4.11.0\lib\net46\MahApps.Metro.IconPacks.Codicons.dll
77 |
78 |
79 | ..\packages\MahApps.Metro.IconPacks.Codicons.4.11.0\lib\net46\MahApps.Metro.IconPacks.Core.dll
80 |
81 |
82 | ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll
83 |
84 |
85 | ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | ..\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll
94 |
95 |
96 | ..\packages\WPFHexaEditor.1.9.1\lib\net451\System.ValueTuple.dll
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 | 4.0
109 |
110 |
111 |
112 |
113 |
114 | ..\packages\WPFHexaEditor.1.9.1\lib\net451\WPFHexaEditor.dll
115 |
116 |
117 |
118 |
119 | MSBuild:Compile
120 | Designer
121 |
122 |
123 | About.xaml
124 |
125 |
126 | App.xaml
127 | Code
128 |
129 |
130 | Code.xaml
131 |
132 |
133 | Runner.xaml
134 |
135 |
136 |
137 |
138 | Main.xaml
139 |
140 |
141 | Code
142 |
143 |
144 | PreserveNewest
145 |
146 |
147 | PreserveNewest
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 | {1333e27f-a5c0-4532-8f47-0e85bf32aeec}
157 | Controls
158 |
159 |
160 | {f17beaa9-f77b-438f-9a04-350885926cd8}
161 | Models
162 |
163 |
164 | {0c7296aa-3d93-40c4-a791-f70b367dc0e9}
165 | ViewModels
166 |
167 |
168 | {d30945d8-cf5a-4059-a234-fa786a65e6ad}
169 | Widgets
170 |
171 |
172 |
173 |
174 | Designer
175 | MSBuild:Compile
176 |
177 |
178 | Designer
179 | MSBuild:Compile
180 |
181 |
182 | Designer
183 | MSBuild:Compile
184 |
185 |
186 | Designer
187 | MSBuild:Compile
188 |
189 |
190 |
191 |
192 |
193 |
194 |
--------------------------------------------------------------------------------
/Views/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Widgets/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Widgets/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("Widget")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Widget")]
15 | [assembly: AssemblyCopyright("Copyright © 2023")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly:ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
52 | //通过使用 "*",如下所示:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Widgets/RequestItemEditor.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Widgets/RequestItemEditor.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Widgets
17 | {
18 | ///
19 | /// RequestItemEditor.xaml 的交互逻辑
20 | ///
21 | public partial class RequestItemEditor : Control
22 | {
23 | [Bindables.DependencyProperty]
24 | public object Names { get; set; }
25 |
26 | [Bindables.DependencyProperty]
27 | public System.Collections.ObjectModel.ObservableCollection Items { get; set; }
28 |
29 | [Bindables.DependencyProperty]
30 | public Models.RequestItem FirstItem { get; set; }
31 |
32 | [Bindables.DependencyProperty]
33 | public Models.RequestItem LastItem { get; set; }
34 |
35 | protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
36 | {
37 | if (e.Property.Name == nameof(this.Items) && this.Items != null)
38 | {
39 | this.FirstItem = this.Items?.FirstOrDefault();
40 | this.LastItem = this.Items?.LastOrDefault();
41 | this.Items.CollectionChanged += Items_CollectionChanged;
42 | }
43 |
44 | base.OnPropertyChanged(e);
45 | }
46 |
47 | private void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
48 | {
49 | this.FirstItem = this.Items?.FirstOrDefault();
50 | this.LastItem = this.Items?.LastOrDefault();
51 | }
52 |
53 | public RequestItemEditor()
54 | {
55 | InitializeComponent();
56 | }
57 |
58 | private void Add_Click(object sender, RoutedEventArgs e)
59 | {
60 | this.Items.Add(new Models.RequestItem());
61 | }
62 |
63 | private void MoveUp_Click(object sender, RoutedEventArgs e)
64 | {
65 | Models.RequestItem item = (Models.RequestItem)((Controls.IconButton)sender).DataContext;
66 | int index = this.Items.IndexOf(item);
67 | if (index > 0)
68 | this.Items.Move(index, index - 1);
69 | }
70 |
71 | private void MoveDown_Click(object sender, RoutedEventArgs e)
72 | {
73 | Models.RequestItem item = (Models.RequestItem)((Controls.IconButton)sender).DataContext;
74 | int index = this.Items.IndexOf(item);
75 | if (index < this.Items.Count - 1)
76 | this.Items.Move(index, index + 1);
77 | }
78 |
79 | private void Remove_Click(object sender, RoutedEventArgs e)
80 | {
81 | this.Items.Remove((Models.RequestItem)((Controls.IconButton)sender).DataContext);
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Widgets/TextEditor.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
--------------------------------------------------------------------------------
/Widgets/TextEditor.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace ColdShineSoft.PostEmulator.Widgets
17 | {
18 | ///
19 | /// TextEditor.xaml 的交互逻辑
20 | ///
21 | public partial class TextEditor : UserControl
22 | {
23 | [Bindables.DependencyProperty]
24 | public string Text { get; set; }
25 |
26 | [Bindables.DependencyProperty]
27 | public object Type { get; set; }
28 |
29 | public TextEditor()
30 | {
31 | InitializeComponent();
32 | }
33 |
34 | protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
35 | {
36 | if(e.Property.Name==nameof(this.Text))
37 | this.Editor.Text = this.Text;
38 | else if (e.Property.Name == nameof(this.Type) && this.Type != null)
39 | this.Editor.SyntaxHighlighting= ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition(this.Type.ToString());
40 |
41 | base.OnPropertyChanged(e);
42 | }
43 |
44 | protected override void OnInitialized(EventArgs e)
45 | {
46 | base.OnInitialized(e);
47 | }
48 |
49 | private void Editor_LostFocus(object sender, RoutedEventArgs e)
50 | {
51 | this.Text = this.Editor.Text;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Widgets/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
5 |
18 |
19 |
--------------------------------------------------------------------------------
/Widgets/Widgets.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | AnyCPU
8 | {D30945D8-CF5A-4059-A234-FA786A65E6AD}
9 | library
10 | ColdShineSoft.PostEmulator.Widgets
11 | ColdShineSoft.PostEmulator.Widgets
12 | v4.6.2
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 | true
17 |
18 |
19 |
20 |
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 |
39 | ..\packages\Bindables.Fody.6.3.0\lib\net45\Bindables.dll
40 |
41 |
42 | ..\packages\CalcBinding.2.5.2\lib\net45\CalcBinding.dll
43 |
44 |
45 | ..\packages\ControlzEx.4.4.0\lib\net462\ControlzEx.dll
46 |
47 |
48 | ..\packages\DynamicExpresso.Core.2.3.1\lib\net461\DynamicExpresso.Core.dll
49 |
50 |
51 | ..\packages\AvalonEdit.6.3.0.90\lib\net462\ICSharpCode.AvalonEdit.dll
52 |
53 |
54 | ..\packages\MahApps.Metro.2.4.9\lib\net46\MahApps.Metro.dll
55 |
56 |
57 | ..\packages\MahApps.Metro.IconPacks.Codicons.4.11.0\lib\net46\MahApps.Metro.IconPacks.Codicons.dll
58 |
59 |
60 | ..\packages\MahApps.Metro.IconPacks.Codicons.4.11.0\lib\net46\MahApps.Metro.IconPacks.Core.dll
61 |
62 |
63 | ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.19\lib\net45\Microsoft.Xaml.Behaviors.dll
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 4.0
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | Designer
88 | MSBuild:Compile
89 |
90 |
91 | MSBuild:Compile
92 | Designer
93 |
94 |
95 | MSBuild:Compile
96 | Designer
97 |
98 |
99 |
100 |
101 | Code
102 |
103 |
104 | RequestItemEditor.xaml
105 |
106 |
107 | TextEditor.xaml
108 |
109 |
110 |
111 |
112 | {1333e27f-a5c0-4532-8f47-0e85bf32aeec}
113 | Controls
114 |
115 |
116 | {f17beaa9-f77b-438f-9a04-350885926cd8}
117 | Models
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 | 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/Widgets/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Widgets/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------