├── .gitignore ├── LICENSE ├── README.md ├── release └── Debug │ └── net6.0-windows │ ├── ConvertTools.deps.json │ ├── ConvertTools.dll │ ├── ConvertTools.exe │ ├── ConvertTools.pdb │ ├── ConvertTools.runtimeconfig.json │ └── Newtonsoft.Json.dll ├── src └── ConvertTools │ ├── .vs │ └── ConvertTools │ │ ├── DesignTimeBuild │ │ └── .dtbcache.v2 │ │ └── v17 │ │ ├── .futdcache.v1 │ │ └── .suo │ ├── ConvertTools.sln │ └── ConvertTools │ ├── ConvertTools.csproj │ ├── ConvertTools.csproj.user │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── Program.cs │ └── Utils │ ├── DateTimeUtil.cs │ ├── EncodeUtil.cs │ └── JsonUtil.cs └── ui.png /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | src/ConvertTools/ConvertTools/obj/ 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ConvertTools 2 | 编码转换工具集合,含Json、URL编解码、Unicode编解码、Base64编解码、常用散列算法(MD5、SHA-1、SHA-256)、时间戳转换、时间差计算 3 | 4 | ## 写在前面 5 | 6 | 这应该是迄今为止,我开源的最没什么技术含量的一个工具了(偷笑),花了不到两小时捣鼓出来的。之前是浏览器收藏夹中收藏了一堆各家的工具类网站,想用什么打开什么。你可能会问,不是很多网站有工具合集么?没错,但各家都有各自的问题,比如URL编解码只支持UTF-8,输入框中的回车都按\r\n处理,不符合Linux或编程中用\n换行……所以我之前偷懒的办法就是挑选各家某个做得完善的功能网页进行收藏,虽然收藏夹七八个网页,也就凑活着用了,有些网站为了它几行可怜巴巴毫无技术含量的js代码不被其他网站拿去,做成由它们服务器计算结果然后返回,这样一来还要限制输入内容的字节数,稍微长一点的内容,还得自己手工分拆成多个,转换多次再手工合并,还是因为太懒,以前也忍了。直到断网几小时,工作没法做了,才下定决定,花点时间做个一劳永逸的离线工具,于是有了它 7 | 8 | ## 软件截图 9 | 10 | ![](ui.png) 11 | 12 | ## 开发及运行说明 13 | 14 | 本工具使用C#编程语言,基于.NET 6.0开发
15 | 运行本工具需要在Windows系统中安装.NET 6.0的运行环境,微软官网下载地址为:https://dotnet.microsoft.com/zh-cn/download/dotnet/6.0 ,打开网页后选择下载“.NET 桌面运行时”
16 | 安装完运行环境后,双击打开“ConvertTools.exe”,即可运行本工具 17 | 18 | ## 反馈交流 19 | 20 | QQ群:132108644 21 | -------------------------------------------------------------------------------- /release/Debug/net6.0-windows/ConvertTools.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v6.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v6.0": { 9 | "ConvertTools/1.0.0": { 10 | "dependencies": { 11 | "Newtonsoft.Json": "13.0.1", 12 | "System.Text.Encoding.CodePages": "6.0.0" 13 | }, 14 | "runtime": { 15 | "ConvertTools.dll": {} 16 | } 17 | }, 18 | "Newtonsoft.Json/13.0.1": { 19 | "runtime": { 20 | "lib/netstandard2.0/Newtonsoft.Json.dll": { 21 | "assemblyVersion": "13.0.0.0", 22 | "fileVersion": "13.0.1.25517" 23 | } 24 | } 25 | }, 26 | "System.Runtime.CompilerServices.Unsafe/6.0.0": {}, 27 | "System.Text.Encoding.CodePages/6.0.0": { 28 | "dependencies": { 29 | "System.Runtime.CompilerServices.Unsafe": "6.0.0" 30 | } 31 | } 32 | } 33 | }, 34 | "libraries": { 35 | "ConvertTools/1.0.0": { 36 | "type": "project", 37 | "serviceable": false, 38 | "sha512": "" 39 | }, 40 | "Newtonsoft.Json/13.0.1": { 41 | "type": "package", 42 | "serviceable": true, 43 | "sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==", 44 | "path": "newtonsoft.json/13.0.1", 45 | "hashPath": "newtonsoft.json.13.0.1.nupkg.sha512" 46 | }, 47 | "System.Runtime.CompilerServices.Unsafe/6.0.0": { 48 | "type": "package", 49 | "serviceable": true, 50 | "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", 51 | "path": "system.runtime.compilerservices.unsafe/6.0.0", 52 | "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" 53 | }, 54 | "System.Text.Encoding.CodePages/6.0.0": { 55 | "type": "package", 56 | "serviceable": true, 57 | "sha512": "sha512-ZFCILZuOvtKPauZ/j/swhvw68ZRi9ATCfvGbk1QfydmcXBkIWecWKn/250UH7rahZ5OoDBaiAudJtPvLwzw85A==", 58 | "path": "system.text.encoding.codepages/6.0.0", 59 | "hashPath": "system.text.encoding.codepages.6.0.0.nupkg.sha512" 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /release/Debug/net6.0-windows/ConvertTools.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/release/Debug/net6.0-windows/ConvertTools.dll -------------------------------------------------------------------------------- /release/Debug/net6.0-windows/ConvertTools.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/release/Debug/net6.0-windows/ConvertTools.exe -------------------------------------------------------------------------------- /release/Debug/net6.0-windows/ConvertTools.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/release/Debug/net6.0-windows/ConvertTools.pdb -------------------------------------------------------------------------------- /release/Debug/net6.0-windows/ConvertTools.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "net6.0", 4 | "frameworks": [ 5 | { 6 | "name": "Microsoft.NETCore.App", 7 | "version": "6.0.0" 8 | }, 9 | { 10 | "name": "Microsoft.WindowsDesktop.App", 11 | "version": "6.0.0" 12 | } 13 | ] 14 | } 15 | } -------------------------------------------------------------------------------- /release/Debug/net6.0-windows/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/release/Debug/net6.0-windows/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /src/ConvertTools/.vs/ConvertTools/DesignTimeBuild/.dtbcache.v2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/src/ConvertTools/.vs/ConvertTools/DesignTimeBuild/.dtbcache.v2 -------------------------------------------------------------------------------- /src/ConvertTools/.vs/ConvertTools/v17/.futdcache.v1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/src/ConvertTools/.vs/ConvertTools/v17/.futdcache.v1 -------------------------------------------------------------------------------- /src/ConvertTools/.vs/ConvertTools/v17/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/src/ConvertTools/.vs/ConvertTools/v17/.suo -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32414.318 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConvertTools", "ConvertTools\ConvertTools.csproj", "{FCAC98C7-6B84-4D02-B108-806C37750E41}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FCAC98C7-6B84-4D02-B108-806C37750E41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FCAC98C7-6B84-4D02-B108-806C37750E41}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FCAC98C7-6B84-4D02-B108-806C37750E41}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FCAC98C7-6B84-4D02-B108-806C37750E41}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {C7F4F476-5051-4AA0-86E2-BBB699C1239C} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/ConvertTools.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | enable 7 | true 8 | enable 9 | ..\..\..\release 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/ConvertTools.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Form 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ConvertTools 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.RtxOriginal = new System.Windows.Forms.RichTextBox(); 32 | this.GrpJson = new System.Windows.Forms.GroupBox(); 33 | this.BtnJsonAntiPrettyPrint = new System.Windows.Forms.Button(); 34 | this.BtnJsonToPrettyPrint = new System.Windows.Forms.Button(); 35 | this.GrpUrl = new System.Windows.Forms.GroupBox(); 36 | this.CboChooseEncodingForUrl = new System.Windows.Forms.ComboBox(); 37 | this.BtnUrlDecode = new System.Windows.Forms.Button(); 38 | this.BtnUrlEncode = new System.Windows.Forms.Button(); 39 | this.RtxResult = new System.Windows.Forms.RichTextBox(); 40 | this.label1 = new System.Windows.Forms.Label(); 41 | this.label2 = new System.Windows.Forms.Label(); 42 | this.GrpUnicode = new System.Windows.Forms.GroupBox(); 43 | this.BtnUnicodeDecode = new System.Windows.Forms.Button(); 44 | this.BtnUnicodeEncode = new System.Windows.Forms.Button(); 45 | this.GrpBase64 = new System.Windows.Forms.GroupBox(); 46 | this.CboChooseEncodingForBase64 = new System.Windows.Forms.ComboBox(); 47 | this.BtnBase64Decode = new System.Windows.Forms.Button(); 48 | this.BtnBase64Encode = new System.Windows.Forms.Button(); 49 | this.BtnCopyToClipboard = new System.Windows.Forms.Button(); 50 | this.GrpHash = new System.Windows.Forms.GroupBox(); 51 | this.BtnSHA256 = new System.Windows.Forms.Button(); 52 | this.CboChooseEncodingForHash = new System.Windows.Forms.ComboBox(); 53 | this.ChkToLower = new System.Windows.Forms.CheckBox(); 54 | this.BtnSHA1 = new System.Windows.Forms.Button(); 55 | this.BtnMD5 = new System.Windows.Forms.Button(); 56 | this.GrpTimestamp = new System.Windows.Forms.GroupBox(); 57 | this.BtnToTimestamp = new System.Windows.Forms.Button(); 58 | this.BtnToSecondTimestamp = new System.Windows.Forms.Button(); 59 | this.CboChooseUnitForToTimestamp = new System.Windows.Forms.ComboBox(); 60 | this.TxtInputTimeString = new System.Windows.Forms.TextBox(); 61 | this.label4 = new System.Windows.Forms.Label(); 62 | this.BtnTimestampToString = new System.Windows.Forms.Button(); 63 | this.TxtInputTimestamp = new System.Windows.Forms.TextBox(); 64 | this.label3 = new System.Windows.Forms.Label(); 65 | this.GrpTimeSpan = new System.Windows.Forms.GroupBox(); 66 | this.BtnCalaulateTimeSpan = new System.Windows.Forms.Button(); 67 | this.label6 = new System.Windows.Forms.Label(); 68 | this.DptEnd = new System.Windows.Forms.DateTimePicker(); 69 | this.label5 = new System.Windows.Forms.Label(); 70 | this.DptStart = new System.Windows.Forms.DateTimePicker(); 71 | this.ChkAutoCopyResultToCipboard = new System.Windows.Forms.CheckBox(); 72 | this.label7 = new System.Windows.Forms.Label(); 73 | this.ChkIsCRLF = new System.Windows.Forms.CheckBox(); 74 | this.label8 = new System.Windows.Forms.Label(); 75 | this.label9 = new System.Windows.Forms.Label(); 76 | this.LblOriginalTextLength = new System.Windows.Forms.Label(); 77 | this.LblResultTextLength = new System.Windows.Forms.Label(); 78 | this.GrpJson.SuspendLayout(); 79 | this.GrpUrl.SuspendLayout(); 80 | this.GrpUnicode.SuspendLayout(); 81 | this.GrpBase64.SuspendLayout(); 82 | this.GrpHash.SuspendLayout(); 83 | this.GrpTimestamp.SuspendLayout(); 84 | this.GrpTimeSpan.SuspendLayout(); 85 | this.SuspendLayout(); 86 | // 87 | // RtxOriginal 88 | // 89 | this.RtxOriginal.Location = new System.Drawing.Point(474, 45); 90 | this.RtxOriginal.Name = "RtxOriginal"; 91 | this.RtxOriginal.Size = new System.Drawing.Size(419, 815); 92 | this.RtxOriginal.TabIndex = 0; 93 | this.RtxOriginal.Text = ""; 94 | this.RtxOriginal.TextChanged += new System.EventHandler(this.RtxOriginal_TextChanged); 95 | // 96 | // GrpJson 97 | // 98 | this.GrpJson.Controls.Add(this.BtnJsonAntiPrettyPrint); 99 | this.GrpJson.Controls.Add(this.BtnJsonToPrettyPrint); 100 | this.GrpJson.Location = new System.Drawing.Point(19, 18); 101 | this.GrpJson.Name = "GrpJson"; 102 | this.GrpJson.Size = new System.Drawing.Size(288, 83); 103 | this.GrpJson.TabIndex = 1; 104 | this.GrpJson.TabStop = false; 105 | this.GrpJson.Text = "Json相关"; 106 | // 107 | // BtnJsonAntiPrettyPrint 108 | // 109 | this.BtnJsonAntiPrettyPrint.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 110 | this.BtnJsonAntiPrettyPrint.Location = new System.Drawing.Point(152, 27); 111 | this.BtnJsonAntiPrettyPrint.Name = "BtnJsonAntiPrettyPrint"; 112 | this.BtnJsonAntiPrettyPrint.Size = new System.Drawing.Size(121, 35); 113 | this.BtnJsonAntiPrettyPrint.TabIndex = 3; 114 | this.BtnJsonAntiPrettyPrint.Text = "Json压缩"; 115 | this.BtnJsonAntiPrettyPrint.UseVisualStyleBackColor = true; 116 | this.BtnJsonAntiPrettyPrint.Click += new System.EventHandler(this.BtnJsonAntiPrettyPrint_Click); 117 | // 118 | // BtnJsonToPrettyPrint 119 | // 120 | this.BtnJsonToPrettyPrint.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 121 | this.BtnJsonToPrettyPrint.Location = new System.Drawing.Point(15, 27); 122 | this.BtnJsonToPrettyPrint.Name = "BtnJsonToPrettyPrint"; 123 | this.BtnJsonToPrettyPrint.Size = new System.Drawing.Size(121, 35); 124 | this.BtnJsonToPrettyPrint.TabIndex = 2; 125 | this.BtnJsonToPrettyPrint.Text = "Json格式化"; 126 | this.BtnJsonToPrettyPrint.UseVisualStyleBackColor = true; 127 | this.BtnJsonToPrettyPrint.Click += new System.EventHandler(this.BtnJsonToPrettyPrint_Click); 128 | // 129 | // GrpUrl 130 | // 131 | this.GrpUrl.Controls.Add(this.CboChooseEncodingForUrl); 132 | this.GrpUrl.Controls.Add(this.BtnUrlDecode); 133 | this.GrpUrl.Controls.Add(this.BtnUrlEncode); 134 | this.GrpUrl.Location = new System.Drawing.Point(19, 109); 135 | this.GrpUrl.Name = "GrpUrl"; 136 | this.GrpUrl.Size = new System.Drawing.Size(435, 83); 137 | this.GrpUrl.TabIndex = 2; 138 | this.GrpUrl.TabStop = false; 139 | this.GrpUrl.Text = "URL编解码"; 140 | // 141 | // CboChooseEncodingForUrl 142 | // 143 | this.CboChooseEncodingForUrl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 144 | this.CboChooseEncodingForUrl.FormattingEnabled = true; 145 | this.CboChooseEncodingForUrl.Items.AddRange(new object[] { 146 | "UTF-8", 147 | "GBK"}); 148 | this.CboChooseEncodingForUrl.Location = new System.Drawing.Point(294, 34); 149 | this.CboChooseEncodingForUrl.Name = "CboChooseEncodingForUrl"; 150 | this.CboChooseEncodingForUrl.Size = new System.Drawing.Size(121, 25); 151 | this.CboChooseEncodingForUrl.TabIndex = 3; 152 | // 153 | // BtnUrlDecode 154 | // 155 | this.BtnUrlDecode.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 156 | this.BtnUrlDecode.Location = new System.Drawing.Point(152, 27); 157 | this.BtnUrlDecode.Name = "BtnUrlDecode"; 158 | this.BtnUrlDecode.Size = new System.Drawing.Size(121, 35); 159 | this.BtnUrlDecode.TabIndex = 5; 160 | this.BtnUrlDecode.Text = "URL解码"; 161 | this.BtnUrlDecode.UseVisualStyleBackColor = true; 162 | this.BtnUrlDecode.Click += new System.EventHandler(this.BtnUrlDecode_Click); 163 | // 164 | // BtnUrlEncode 165 | // 166 | this.BtnUrlEncode.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 167 | this.BtnUrlEncode.Location = new System.Drawing.Point(15, 27); 168 | this.BtnUrlEncode.Name = "BtnUrlEncode"; 169 | this.BtnUrlEncode.Size = new System.Drawing.Size(121, 35); 170 | this.BtnUrlEncode.TabIndex = 4; 171 | this.BtnUrlEncode.Text = "URL编码"; 172 | this.BtnUrlEncode.UseVisualStyleBackColor = true; 173 | this.BtnUrlEncode.Click += new System.EventHandler(this.BtnUrlEncode_Click); 174 | // 175 | // RtxResult 176 | // 177 | this.RtxResult.Location = new System.Drawing.Point(911, 45); 178 | this.RtxResult.Name = "RtxResult"; 179 | this.RtxResult.Size = new System.Drawing.Size(692, 815); 180 | this.RtxResult.TabIndex = 3; 181 | this.RtxResult.Text = ""; 182 | this.RtxResult.TextChanged += new System.EventHandler(this.RtxResult_TextChanged); 183 | // 184 | // label1 185 | // 186 | this.label1.AutoSize = true; 187 | this.label1.Location = new System.Drawing.Point(474, 18); 188 | this.label1.Name = "label1"; 189 | this.label1.Size = new System.Drawing.Size(276, 17); 190 | this.label1.TabIndex = 4; 191 | this.label1.Text = "原始文本: 注意输入框中的回车默认算作\\n"; 192 | // 193 | // label2 194 | // 195 | this.label2.AutoSize = true; 196 | this.label2.Location = new System.Drawing.Point(911, 18); 197 | this.label2.Name = "label2"; 198 | this.label2.Size = new System.Drawing.Size(68, 17); 199 | this.label2.TabIndex = 5; 200 | this.label2.Text = "转换之后:"; 201 | // 202 | // GrpUnicode 203 | // 204 | this.GrpUnicode.Controls.Add(this.BtnUnicodeDecode); 205 | this.GrpUnicode.Controls.Add(this.BtnUnicodeEncode); 206 | this.GrpUnicode.Location = new System.Drawing.Point(19, 200); 207 | this.GrpUnicode.Name = "GrpUnicode"; 208 | this.GrpUnicode.Size = new System.Drawing.Size(288, 83); 209 | this.GrpUnicode.TabIndex = 6; 210 | this.GrpUnicode.TabStop = false; 211 | this.GrpUnicode.Text = "Unicode编解码"; 212 | // 213 | // BtnUnicodeDecode 214 | // 215 | this.BtnUnicodeDecode.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 216 | this.BtnUnicodeDecode.Location = new System.Drawing.Point(152, 31); 217 | this.BtnUnicodeDecode.Name = "BtnUnicodeDecode"; 218 | this.BtnUnicodeDecode.Size = new System.Drawing.Size(121, 35); 219 | this.BtnUnicodeDecode.TabIndex = 7; 220 | this.BtnUnicodeDecode.Text = "Unicode解码"; 221 | this.BtnUnicodeDecode.UseVisualStyleBackColor = true; 222 | this.BtnUnicodeDecode.Click += new System.EventHandler(this.BtnUnicodeDecode_Click); 223 | // 224 | // BtnUnicodeEncode 225 | // 226 | this.BtnUnicodeEncode.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 227 | this.BtnUnicodeEncode.Location = new System.Drawing.Point(15, 31); 228 | this.BtnUnicodeEncode.Name = "BtnUnicodeEncode"; 229 | this.BtnUnicodeEncode.Size = new System.Drawing.Size(121, 35); 230 | this.BtnUnicodeEncode.TabIndex = 6; 231 | this.BtnUnicodeEncode.Text = "Unicode编码"; 232 | this.BtnUnicodeEncode.UseVisualStyleBackColor = true; 233 | this.BtnUnicodeEncode.Click += new System.EventHandler(this.BtnUnicodeEncode_Click); 234 | // 235 | // GrpBase64 236 | // 237 | this.GrpBase64.Controls.Add(this.CboChooseEncodingForBase64); 238 | this.GrpBase64.Controls.Add(this.BtnBase64Decode); 239 | this.GrpBase64.Controls.Add(this.BtnBase64Encode); 240 | this.GrpBase64.Location = new System.Drawing.Point(19, 291); 241 | this.GrpBase64.Name = "GrpBase64"; 242 | this.GrpBase64.Size = new System.Drawing.Size(435, 83); 243 | this.GrpBase64.TabIndex = 8; 244 | this.GrpBase64.TabStop = false; 245 | this.GrpBase64.Text = "Base64编解码"; 246 | // 247 | // CboChooseEncodingForBase64 248 | // 249 | this.CboChooseEncodingForBase64.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 250 | this.CboChooseEncodingForBase64.FormattingEnabled = true; 251 | this.CboChooseEncodingForBase64.Items.AddRange(new object[] { 252 | "UTF-8", 253 | "GBK"}); 254 | this.CboChooseEncodingForBase64.Location = new System.Drawing.Point(294, 38); 255 | this.CboChooseEncodingForBase64.Name = "CboChooseEncodingForBase64"; 256 | this.CboChooseEncodingForBase64.Size = new System.Drawing.Size(121, 25); 257 | this.CboChooseEncodingForBase64.TabIndex = 6; 258 | // 259 | // BtnBase64Decode 260 | // 261 | this.BtnBase64Decode.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 262 | this.BtnBase64Decode.Location = new System.Drawing.Point(152, 31); 263 | this.BtnBase64Decode.Name = "BtnBase64Decode"; 264 | this.BtnBase64Decode.Size = new System.Drawing.Size(121, 35); 265 | this.BtnBase64Decode.TabIndex = 7; 266 | this.BtnBase64Decode.Text = "Base64解码"; 267 | this.BtnBase64Decode.UseVisualStyleBackColor = true; 268 | this.BtnBase64Decode.Click += new System.EventHandler(this.BtnBase64Decode_Click); 269 | // 270 | // BtnBase64Encode 271 | // 272 | this.BtnBase64Encode.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 273 | this.BtnBase64Encode.Location = new System.Drawing.Point(15, 31); 274 | this.BtnBase64Encode.Name = "BtnBase64Encode"; 275 | this.BtnBase64Encode.Size = new System.Drawing.Size(121, 35); 276 | this.BtnBase64Encode.TabIndex = 6; 277 | this.BtnBase64Encode.Text = "Base64编码"; 278 | this.BtnBase64Encode.UseVisualStyleBackColor = true; 279 | this.BtnBase64Encode.Click += new System.EventHandler(this.BtnBase64Encode_Click); 280 | // 281 | // BtnCopyToClipboard 282 | // 283 | this.BtnCopyToClipboard.Location = new System.Drawing.Point(998, 15); 284 | this.BtnCopyToClipboard.Name = "BtnCopyToClipboard"; 285 | this.BtnCopyToClipboard.Size = new System.Drawing.Size(99, 23); 286 | this.BtnCopyToClipboard.TabIndex = 9; 287 | this.BtnCopyToClipboard.Text = "复制到剪贴板"; 288 | this.BtnCopyToClipboard.UseVisualStyleBackColor = true; 289 | this.BtnCopyToClipboard.Click += new System.EventHandler(this.BtnCopyToClipboard_Click); 290 | // 291 | // GrpHash 292 | // 293 | this.GrpHash.Controls.Add(this.BtnSHA256); 294 | this.GrpHash.Controls.Add(this.CboChooseEncodingForHash); 295 | this.GrpHash.Controls.Add(this.ChkToLower); 296 | this.GrpHash.Controls.Add(this.BtnSHA1); 297 | this.GrpHash.Controls.Add(this.BtnMD5); 298 | this.GrpHash.Location = new System.Drawing.Point(19, 382); 299 | this.GrpHash.Name = "GrpHash"; 300 | this.GrpHash.Size = new System.Drawing.Size(435, 131); 301 | this.GrpHash.TabIndex = 9; 302 | this.GrpHash.TabStop = false; 303 | this.GrpHash.Text = "常用散列算法"; 304 | // 305 | // BtnSHA256 306 | // 307 | this.BtnSHA256.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 308 | this.BtnSHA256.Location = new System.Drawing.Point(294, 31); 309 | this.BtnSHA256.Name = "BtnSHA256"; 310 | this.BtnSHA256.Size = new System.Drawing.Size(121, 35); 311 | this.BtnSHA256.TabIndex = 9; 312 | this.BtnSHA256.Text = "SHA256加密"; 313 | this.BtnSHA256.UseVisualStyleBackColor = true; 314 | this.BtnSHA256.Click += new System.EventHandler(this.BtnSHA256_Click); 315 | // 316 | // CboChooseEncodingForHash 317 | // 318 | this.CboChooseEncodingForHash.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 319 | this.CboChooseEncodingForHash.FormattingEnabled = true; 320 | this.CboChooseEncodingForHash.Items.AddRange(new object[] { 321 | "UTF-8", 322 | "GBK"}); 323 | this.CboChooseEncodingForHash.Location = new System.Drawing.Point(152, 84); 324 | this.CboChooseEncodingForHash.Name = "CboChooseEncodingForHash"; 325 | this.CboChooseEncodingForHash.Size = new System.Drawing.Size(121, 25); 326 | this.CboChooseEncodingForHash.TabIndex = 8; 327 | // 328 | // ChkToLower 329 | // 330 | this.ChkToLower.AutoSize = true; 331 | this.ChkToLower.Location = new System.Drawing.Point(15, 86); 332 | this.ChkToLower.Name = "ChkToLower"; 333 | this.ChkToLower.Size = new System.Drawing.Size(99, 21); 334 | this.ChkToLower.TabIndex = 8; 335 | this.ChkToLower.Text = "转为英文小写"; 336 | this.ChkToLower.UseVisualStyleBackColor = true; 337 | // 338 | // BtnSHA1 339 | // 340 | this.BtnSHA1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 341 | this.BtnSHA1.Location = new System.Drawing.Point(152, 31); 342 | this.BtnSHA1.Name = "BtnSHA1"; 343 | this.BtnSHA1.Size = new System.Drawing.Size(121, 35); 344 | this.BtnSHA1.TabIndex = 7; 345 | this.BtnSHA1.Text = "SHA-1加密"; 346 | this.BtnSHA1.UseVisualStyleBackColor = true; 347 | this.BtnSHA1.Click += new System.EventHandler(this.BtnSHA1_Click); 348 | // 349 | // BtnMD5 350 | // 351 | this.BtnMD5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 352 | this.BtnMD5.Location = new System.Drawing.Point(15, 31); 353 | this.BtnMD5.Name = "BtnMD5"; 354 | this.BtnMD5.Size = new System.Drawing.Size(121, 35); 355 | this.BtnMD5.TabIndex = 6; 356 | this.BtnMD5.Text = "MD5加密"; 357 | this.BtnMD5.UseVisualStyleBackColor = true; 358 | this.BtnMD5.Click += new System.EventHandler(this.BtnMD5_Click); 359 | // 360 | // GrpTimestamp 361 | // 362 | this.GrpTimestamp.Controls.Add(this.BtnToTimestamp); 363 | this.GrpTimestamp.Controls.Add(this.BtnToSecondTimestamp); 364 | this.GrpTimestamp.Controls.Add(this.CboChooseUnitForToTimestamp); 365 | this.GrpTimestamp.Controls.Add(this.TxtInputTimeString); 366 | this.GrpTimestamp.Controls.Add(this.label4); 367 | this.GrpTimestamp.Controls.Add(this.BtnTimestampToString); 368 | this.GrpTimestamp.Controls.Add(this.TxtInputTimestamp); 369 | this.GrpTimestamp.Controls.Add(this.label3); 370 | this.GrpTimestamp.Location = new System.Drawing.Point(19, 522); 371 | this.GrpTimestamp.Name = "GrpTimestamp"; 372 | this.GrpTimestamp.Size = new System.Drawing.Size(435, 187); 373 | this.GrpTimestamp.TabIndex = 10; 374 | this.GrpTimestamp.TabStop = false; 375 | this.GrpTimestamp.Text = "时间戳转换"; 376 | // 377 | // BtnToTimestamp 378 | // 379 | this.BtnToTimestamp.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 380 | this.BtnToTimestamp.Location = new System.Drawing.Point(182, 132); 381 | this.BtnToTimestamp.Name = "BtnToTimestamp"; 382 | this.BtnToTimestamp.Size = new System.Drawing.Size(106, 35); 383 | this.BtnToTimestamp.TabIndex = 14; 384 | this.BtnToTimestamp.Text = "毫秒时间戳"; 385 | this.BtnToTimestamp.UseVisualStyleBackColor = true; 386 | this.BtnToTimestamp.Click += new System.EventHandler(this.BtnToTimestamp_Click); 387 | // 388 | // BtnToSecondTimestamp 389 | // 390 | this.BtnToSecondTimestamp.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 391 | this.BtnToSecondTimestamp.Location = new System.Drawing.Point(309, 132); 392 | this.BtnToSecondTimestamp.Name = "BtnToSecondTimestamp"; 393 | this.BtnToSecondTimestamp.Size = new System.Drawing.Size(106, 35); 394 | this.BtnToSecondTimestamp.TabIndex = 13; 395 | this.BtnToSecondTimestamp.Text = "秒时间戳"; 396 | this.BtnToSecondTimestamp.UseVisualStyleBackColor = true; 397 | this.BtnToSecondTimestamp.Click += new System.EventHandler(this.BtnToSecondTimestamp_Click); 398 | // 399 | // CboChooseUnitForToTimestamp 400 | // 401 | this.CboChooseUnitForToTimestamp.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 402 | this.CboChooseUnitForToTimestamp.FormattingEnabled = true; 403 | this.CboChooseUnitForToTimestamp.Items.AddRange(new object[] { 404 | "毫秒", 405 | "秒"}); 406 | this.CboChooseUnitForToTimestamp.Location = new System.Drawing.Point(174, 55); 407 | this.CboChooseUnitForToTimestamp.Name = "CboChooseUnitForToTimestamp"; 408 | this.CboChooseUnitForToTimestamp.Size = new System.Drawing.Size(75, 25); 409 | this.CboChooseUnitForToTimestamp.TabIndex = 12; 410 | // 411 | // TxtInputTimeString 412 | // 413 | this.TxtInputTimeString.Location = new System.Drawing.Point(15, 139); 414 | this.TxtInputTimeString.Name = "TxtInputTimeString"; 415 | this.TxtInputTimeString.Size = new System.Drawing.Size(137, 23); 416 | this.TxtInputTimeString.TabIndex = 11; 417 | // 418 | // label4 419 | // 420 | this.label4.AutoSize = true; 421 | this.label4.Location = new System.Drawing.Point(15, 108); 422 | this.label4.Name = "label4"; 423 | this.label4.Size = new System.Drawing.Size(284, 17); 424 | this.label4.TabIndex = 10; 425 | this.label4.Text = "时间字符串(yyyy-MM-dd HH:mm:ss) 转 时间戳"; 426 | // 427 | // BtnTimestampToString 428 | // 429 | this.BtnTimestampToString.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 430 | this.BtnTimestampToString.Location = new System.Drawing.Point(294, 50); 431 | this.BtnTimestampToString.Name = "BtnTimestampToString"; 432 | this.BtnTimestampToString.Size = new System.Drawing.Size(121, 35); 433 | this.BtnTimestampToString.TabIndex = 9; 434 | this.BtnTimestampToString.Text = "转时间字符串"; 435 | this.BtnTimestampToString.UseVisualStyleBackColor = true; 436 | this.BtnTimestampToString.Click += new System.EventHandler(this.BtnTimestampToString_Click); 437 | // 438 | // TxtInputTimestamp 439 | // 440 | this.TxtInputTimestamp.Location = new System.Drawing.Point(15, 57); 441 | this.TxtInputTimestamp.Name = "TxtInputTimestamp"; 442 | this.TxtInputTimestamp.Size = new System.Drawing.Size(137, 23); 443 | this.TxtInputTimestamp.TabIndex = 1; 444 | // 445 | // label3 446 | // 447 | this.label3.AutoSize = true; 448 | this.label3.Location = new System.Drawing.Point(15, 32); 449 | this.label3.Name = "label3"; 450 | this.label3.Size = new System.Drawing.Size(124, 17); 451 | this.label3.TabIndex = 0; 452 | this.label3.Text = "时间戳 转 时间字符串"; 453 | // 454 | // GrpTimeSpan 455 | // 456 | this.GrpTimeSpan.Controls.Add(this.BtnCalaulateTimeSpan); 457 | this.GrpTimeSpan.Controls.Add(this.label6); 458 | this.GrpTimeSpan.Controls.Add(this.DptEnd); 459 | this.GrpTimeSpan.Controls.Add(this.label5); 460 | this.GrpTimeSpan.Controls.Add(this.DptStart); 461 | this.GrpTimeSpan.Location = new System.Drawing.Point(19, 718); 462 | this.GrpTimeSpan.Name = "GrpTimeSpan"; 463 | this.GrpTimeSpan.Size = new System.Drawing.Size(435, 109); 464 | this.GrpTimeSpan.TabIndex = 11; 465 | this.GrpTimeSpan.TabStop = false; 466 | this.GrpTimeSpan.Text = "时间差计算"; 467 | // 468 | // BtnCalaulateTimeSpan 469 | // 470 | this.BtnCalaulateTimeSpan.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); 471 | this.BtnCalaulateTimeSpan.Location = new System.Drawing.Point(309, 43); 472 | this.BtnCalaulateTimeSpan.Name = "BtnCalaulateTimeSpan"; 473 | this.BtnCalaulateTimeSpan.Size = new System.Drawing.Size(106, 35); 474 | this.BtnCalaulateTimeSpan.TabIndex = 15; 475 | this.BtnCalaulateTimeSpan.Text = "计算时间差"; 476 | this.BtnCalaulateTimeSpan.UseVisualStyleBackColor = true; 477 | this.BtnCalaulateTimeSpan.Click += new System.EventHandler(this.BtnCalaulateTimeSpan_Click); 478 | // 479 | // label6 480 | // 481 | this.label6.AutoSize = true; 482 | this.label6.Location = new System.Drawing.Point(15, 72); 483 | this.label6.Name = "label6"; 484 | this.label6.Size = new System.Drawing.Size(68, 17); 485 | this.label6.TabIndex = 3; 486 | this.label6.Text = "结束时间:"; 487 | // 488 | // DptEnd 489 | // 490 | this.DptEnd.CustomFormat = "yyyy-MM-dd HH:mm:ss"; 491 | this.DptEnd.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 492 | this.DptEnd.Location = new System.Drawing.Point(99, 67); 493 | this.DptEnd.Name = "DptEnd"; 494 | this.DptEnd.Size = new System.Drawing.Size(174, 23); 495 | this.DptEnd.TabIndex = 2; 496 | // 497 | // label5 498 | // 499 | this.label5.AutoSize = true; 500 | this.label5.Location = new System.Drawing.Point(15, 36); 501 | this.label5.Name = "label5"; 502 | this.label5.Size = new System.Drawing.Size(68, 17); 503 | this.label5.TabIndex = 1; 504 | this.label5.Text = "起始时间:"; 505 | // 506 | // DptStart 507 | // 508 | this.DptStart.CustomFormat = "yyyy-MM-dd HH:mm:ss"; 509 | this.DptStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom; 510 | this.DptStart.Location = new System.Drawing.Point(99, 31); 511 | this.DptStart.Name = "DptStart"; 512 | this.DptStart.Size = new System.Drawing.Size(174, 23); 513 | this.DptStart.TabIndex = 0; 514 | // 515 | // ChkAutoCopyResultToCipboard 516 | // 517 | this.ChkAutoCopyResultToCipboard.AutoSize = true; 518 | this.ChkAutoCopyResultToCipboard.Checked = true; 519 | this.ChkAutoCopyResultToCipboard.CheckState = System.Windows.Forms.CheckState.Checked; 520 | this.ChkAutoCopyResultToCipboard.Location = new System.Drawing.Point(118, 843); 521 | this.ChkAutoCopyResultToCipboard.Name = "ChkAutoCopyResultToCipboard"; 522 | this.ChkAutoCopyResultToCipboard.Size = new System.Drawing.Size(207, 21); 523 | this.ChkAutoCopyResultToCipboard.TabIndex = 12; 524 | this.ChkAutoCopyResultToCipboard.Text = "将转换后的结果直接复制到剪贴板"; 525 | this.ChkAutoCopyResultToCipboard.UseVisualStyleBackColor = true; 526 | // 527 | // label7 528 | // 529 | this.label7.AutoSize = true; 530 | this.label7.Location = new System.Drawing.Point(19, 843); 531 | this.label7.Name = "label7"; 532 | this.label7.Size = new System.Drawing.Size(68, 17); 533 | this.label7.TabIndex = 13; 534 | this.label7.Text = "工具选项:"; 535 | // 536 | // ChkIsCRLF 537 | // 538 | this.ChkIsCRLF.AutoSize = true; 539 | this.ChkIsCRLF.Location = new System.Drawing.Point(118, 873); 540 | this.ChkIsCRLF.Name = "ChkIsCRLF"; 541 | this.ChkIsCRLF.Size = new System.Drawing.Size(157, 21); 542 | this.ChkIsCRLF.TabIndex = 14; 543 | this.ChkIsCRLF.Text = "将输入框中的\\n转为\\r\\n"; 544 | this.ChkIsCRLF.UseVisualStyleBackColor = true; 545 | // 546 | // label8 547 | // 548 | this.label8.AutoSize = true; 549 | this.label8.Location = new System.Drawing.Point(474, 877); 550 | this.label8.Name = "label8"; 551 | this.label8.Size = new System.Drawing.Size(56, 17); 552 | this.label8.TabIndex = 15; 553 | this.label8.Text = "字符数:"; 554 | // 555 | // label9 556 | // 557 | this.label9.AutoSize = true; 558 | this.label9.Location = new System.Drawing.Point(911, 877); 559 | this.label9.Name = "label9"; 560 | this.label9.Size = new System.Drawing.Size(56, 17); 561 | this.label9.TabIndex = 16; 562 | this.label9.Text = "字符数:"; 563 | // 564 | // LblOriginalTextLength 565 | // 566 | this.LblOriginalTextLength.AutoSize = true; 567 | this.LblOriginalTextLength.Location = new System.Drawing.Point(536, 877); 568 | this.LblOriginalTextLength.Name = "LblOriginalTextLength"; 569 | this.LblOriginalTextLength.Size = new System.Drawing.Size(15, 17); 570 | this.LblOriginalTextLength.TabIndex = 17; 571 | this.LblOriginalTextLength.Text = "0"; 572 | // 573 | // LblResultTextLength 574 | // 575 | this.LblResultTextLength.AutoSize = true; 576 | this.LblResultTextLength.Location = new System.Drawing.Point(973, 877); 577 | this.LblResultTextLength.Name = "LblResultTextLength"; 578 | this.LblResultTextLength.Size = new System.Drawing.Size(15, 17); 579 | this.LblResultTextLength.TabIndex = 18; 580 | this.LblResultTextLength.Text = "0"; 581 | // 582 | // MainForm 583 | // 584 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); 585 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 586 | this.ClientSize = new System.Drawing.Size(1620, 903); 587 | this.Controls.Add(this.LblResultTextLength); 588 | this.Controls.Add(this.LblOriginalTextLength); 589 | this.Controls.Add(this.label9); 590 | this.Controls.Add(this.label8); 591 | this.Controls.Add(this.ChkIsCRLF); 592 | this.Controls.Add(this.label7); 593 | this.Controls.Add(this.ChkAutoCopyResultToCipboard); 594 | this.Controls.Add(this.GrpTimeSpan); 595 | this.Controls.Add(this.GrpTimestamp); 596 | this.Controls.Add(this.GrpHash); 597 | this.Controls.Add(this.BtnCopyToClipboard); 598 | this.Controls.Add(this.GrpBase64); 599 | this.Controls.Add(this.GrpUnicode); 600 | this.Controls.Add(this.label2); 601 | this.Controls.Add(this.label1); 602 | this.Controls.Add(this.RtxResult); 603 | this.Controls.Add(this.GrpUrl); 604 | this.Controls.Add(this.GrpJson); 605 | this.Controls.Add(this.RtxOriginal); 606 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; 607 | this.MaximizeBox = false; 608 | this.Name = "MainForm"; 609 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 610 | this.Text = "编解码转换工具集合 by 张齐 (http://github.com/zhangqi-ulua)"; 611 | this.GrpJson.ResumeLayout(false); 612 | this.GrpUrl.ResumeLayout(false); 613 | this.GrpUnicode.ResumeLayout(false); 614 | this.GrpBase64.ResumeLayout(false); 615 | this.GrpHash.ResumeLayout(false); 616 | this.GrpHash.PerformLayout(); 617 | this.GrpTimestamp.ResumeLayout(false); 618 | this.GrpTimestamp.PerformLayout(); 619 | this.GrpTimeSpan.ResumeLayout(false); 620 | this.GrpTimeSpan.PerformLayout(); 621 | this.ResumeLayout(false); 622 | this.PerformLayout(); 623 | 624 | } 625 | 626 | #endregion 627 | 628 | private RichTextBox RtxOriginal; 629 | private GroupBox GrpJson; 630 | private Button BtnJsonAntiPrettyPrint; 631 | private Button BtnJsonToPrettyPrint; 632 | private GroupBox GrpUrl; 633 | private ComboBox CboChooseEncodingForUrl; 634 | private Button BtnUrlDecode; 635 | private Button BtnUrlEncode; 636 | private RichTextBox RtxResult; 637 | private Label label1; 638 | private Label label2; 639 | private GroupBox GrpUnicode; 640 | private Button BtnUnicodeDecode; 641 | private Button BtnUnicodeEncode; 642 | private GroupBox GrpBase64; 643 | private Button BtnBase64Decode; 644 | private Button BtnBase64Encode; 645 | private Button BtnCopyToClipboard; 646 | private GroupBox GrpHash; 647 | private CheckBox ChkToLower; 648 | private Button BtnSHA1; 649 | private Button BtnMD5; 650 | private GroupBox GrpTimestamp; 651 | private TextBox TxtInputTimeString; 652 | private Label label4; 653 | private Button BtnTimestampToString; 654 | private TextBox TxtInputTimestamp; 655 | private Label label3; 656 | private ComboBox CboChooseUnitForToTimestamp; 657 | private Button BtnToTimestamp; 658 | private Button BtnToSecondTimestamp; 659 | private GroupBox GrpTimeSpan; 660 | private DateTimePicker DptStart; 661 | private Label label5; 662 | private Button BtnCalaulateTimeSpan; 663 | private Label label6; 664 | private DateTimePicker DptEnd; 665 | private CheckBox ChkAutoCopyResultToCipboard; 666 | private Label label7; 667 | private CheckBox ChkIsCRLF; 668 | private Label label8; 669 | private Label label9; 670 | private Label LblOriginalTextLength; 671 | private Label LblResultTextLength; 672 | private ComboBox CboChooseEncodingForBase64; 673 | private Button BtnSHA256; 674 | private ComboBox CboChooseEncodingForHash; 675 | } 676 | } -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/MainForm.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/src/ConvertTools/ConvertTools/MainForm.cs -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/MainForm.resx: -------------------------------------------------------------------------------- 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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/Program.cs: -------------------------------------------------------------------------------- 1 | namespace ConvertTools 2 | { 3 | internal static class Program 4 | { 5 | /// 6 | /// The main entry point for the application. 7 | /// 8 | [STAThread] 9 | static void Main() 10 | { 11 | // To customize application configuration such as set high DPI settings or default font, 12 | // see https://aka.ms/applicationconfiguration. 13 | ApplicationConfiguration.Initialize(); 14 | Application.Run(new MainForm()); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/Utils/DateTimeUtil.cs: -------------------------------------------------------------------------------- 1 | namespace ConvertTools.Utils 2 | { 3 | internal class DateTimeUtil 4 | { 5 | private static DateTime SYSTEM_START_TIME = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1, 0, 0, 0)); 6 | private const string LONG_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; 7 | 8 | public static string DateTimeToLongDateString(DateTime dt) 9 | { 10 | return dt.ToString(LONG_TIME_FORMAT); 11 | } 12 | 13 | public static int DateTimeToTimestampSecond(DateTime dt) 14 | { 15 | return Convert.ToInt32((dt - SYSTEM_START_TIME).TotalSeconds); 16 | } 17 | 18 | public static long DateTimeToTimestamp(DateTime dt) 19 | { 20 | return Convert.ToInt64((dt - SYSTEM_START_TIME).TotalMilliseconds); 21 | } 22 | 23 | public static string TimestampSecondToLongDateString(int timestampSecond) 24 | { 25 | return DateTimeToLongDateString(TimestampSecondToDateTime(timestampSecond)); 26 | } 27 | 28 | public static string TimestampToLongDateString(long timestamp) 29 | { 30 | return DateTimeToLongDateString(TimestampToDateTime(timestamp)); 31 | } 32 | 33 | public static DateTime TimestampSecondToDateTime(int timestampSecond) 34 | { 35 | return SYSTEM_START_TIME.AddSeconds(timestampSecond); 36 | } 37 | 38 | public static DateTime TimestampToDateTime(long timestamp) 39 | { 40 | return SYSTEM_START_TIME.AddMilliseconds(timestamp); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/Utils/EncodeUtil.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Cryptography; 2 | using System.Text; 3 | using System.Web; 4 | 5 | namespace ConvertTools.Utils 6 | { 7 | internal class EncodeUtil 8 | { 9 | private static MD5 _MD5 = new MD5CryptoServiceProvider(); 10 | private static SHA1 _SHA1 = new SHA1CryptoServiceProvider(); 11 | private static SHA256 _SHA256 = new SHA256CryptoServiceProvider(); 12 | 13 | public static string UrlEncode(string text, Encoding encoding) 14 | { 15 | return HttpUtility.UrlEncode(text, encoding); 16 | } 17 | 18 | public static string UrlDecode(string text, Encoding encoding) 19 | { 20 | return HttpUtility.UrlDecode(text, encoding); 21 | } 22 | 23 | public static string UnicodeEncode(string text) 24 | { 25 | StringBuilder sb = new StringBuilder(); 26 | for (int i = 0; i < text.Length; i++) 27 | { 28 | sb.Append("\\u"); 29 | sb.Append(((int)text[i]).ToString("x")); 30 | } 31 | return sb.ToString(); 32 | } 33 | 34 | public static string UnicodeDecode(string text) 35 | { 36 | StringBuilder sb = new StringBuilder(); 37 | string[] split = text.Split("\\u"); 38 | for (int i = 1; i < split.Length; i++) 39 | { 40 | int charCode = Convert.ToInt32(split[i], 16); 41 | sb.Append((char)charCode); 42 | } 43 | return sb.ToString(); 44 | } 45 | 46 | public static string Base64Encode(string text, Encoding encoding) 47 | { 48 | return Convert.ToBase64String(encoding.GetBytes(text)); 49 | } 50 | 51 | public static string Base64Decode(string text, Encoding encoding) 52 | { 53 | return encoding.GetString(Convert.FromBase64String(text)); 54 | } 55 | 56 | public static string MD5Encrypt(string text, Encoding encoding) 57 | { 58 | byte[] result = _MD5.ComputeHash(encoding.GetBytes(text)); 59 | return BitConverter.ToString(result).Replace("-", ""); 60 | } 61 | 62 | public static string SHA1Encrypt(string text, Encoding encoding) 63 | { 64 | byte[] result = _SHA1.ComputeHash(encoding.GetBytes(text)); 65 | return BitConverter.ToString(result).Replace("-", ""); 66 | } 67 | 68 | public static string SHA256Encrypt(string text, Encoding encoding) 69 | { 70 | byte[] result = _SHA256.ComputeHash(encoding.GetBytes(text)); 71 | return BitConverter.ToString(result).Replace("-", ""); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/ConvertTools/ConvertTools/Utils/JsonUtil.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace ConvertTools.Utils 4 | { 5 | internal class JsonUtil 6 | { 7 | public static string ToPrettyPrint(string json, out bool isJsonError) 8 | { 9 | TextReader textReader = new StringReader(json); 10 | JsonTextReader jsonTextReader = new JsonTextReader(textReader); 11 | 12 | JsonSerializer jsonSerializer = new JsonSerializer(); 13 | object obj = null; 14 | try 15 | { 16 | obj = jsonSerializer.Deserialize(jsonTextReader); 17 | if (obj == null) 18 | { 19 | isJsonError = true; 20 | return null; 21 | } 22 | } 23 | catch 24 | { 25 | isJsonError = true; 26 | return null; 27 | } 28 | 29 | StringWriter stringWriter = new StringWriter(); 30 | JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter); 31 | jsonTextWriter.Formatting = Formatting.Indented; 32 | jsonTextWriter.IndentChar = ' '; 33 | jsonTextWriter.Indentation = 4; 34 | 35 | jsonSerializer.Serialize(jsonTextWriter, obj); 36 | isJsonError = false; 37 | return stringWriter.ToString(); 38 | } 39 | 40 | public static string AntiPrettyPrint(string json, out bool isJsonError) 41 | { 42 | TextReader textReader = new StringReader(json); 43 | JsonTextReader jsonTextReader = new JsonTextReader(textReader); 44 | 45 | JsonSerializer jsonSerializer = new JsonSerializer(); 46 | object obj = null; 47 | try 48 | { 49 | obj = jsonSerializer.Deserialize(jsonTextReader); 50 | if (obj == null) 51 | { 52 | isJsonError = true; 53 | return null; 54 | } 55 | } 56 | catch 57 | { 58 | isJsonError = true; 59 | return null; 60 | } 61 | 62 | StringWriter stringWriter = new StringWriter(); 63 | JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter); 64 | jsonTextWriter.Formatting = Formatting.None; 65 | 66 | jsonSerializer.Serialize(jsonTextWriter, obj); 67 | isJsonError = false; 68 | return stringWriter.ToString(); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangqi-ulua/ConvertTools/f9ea9239ca83395ca5818f2a60b05af063a7375a/ui.png --------------------------------------------------------------------------------