├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── Vikings.Base.Tests ├── EnumTests.cs ├── Properties │ ├── AssemblyInfo.cs │ └── PexAssemblyInfo.cs ├── Vikings.Base.Tests.csproj └── packages.config ├── Vikings.Base ├── Collections │ └── Generic │ │ └── StringLogicalComparer.cs ├── Enum.cs ├── Math │ ├── Speed.cs │ └── SpeedQueue.cs ├── Net │ └── WebClient.cs ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── Threading │ └── Tasks │ │ └── Delay.cs └── Vikings.Base.csproj ├── Vikings.CodeHelper ├── CodeHelperPackage.cs ├── CodeHelperPackage.vsct ├── CodeSiteCmd.cs ├── GlobalSuppressions.cs ├── Key.snk ├── Properties │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ └── Settings.settings ├── ReleaseNotes.txt ├── Resources │ ├── CodeHelperPackage.ico │ └── CodeSiteCmd.png ├── VSPackage.resx ├── View │ ├── BaseDialogWindow.cs │ ├── CodeSiteWindow.xaml │ ├── CodeSiteWindow.xaml.cs │ └── vsCMElement │ │ ├── vsCMElementClass.png │ │ ├── vsCMElementConverter.cs │ │ ├── vsCMElementFunction.png │ │ ├── vsCMElementNamespace.png │ │ ├── vsCMElementProperty.png │ │ └── vsCMElementStruct.png ├── ViewModel │ ├── CodeElementViewModel.cs │ ├── CodeFunctionExtension.cs │ ├── CodeSiteViewModel.cs │ ├── NuGetExtension.cs │ ├── RelayCommand.cs │ └── ViewModelBase.cs ├── Vikings.CodeHelper.csproj ├── app.config ├── packages.config └── source.extension.vsixmanifest ├── Vikings.CodeSite.Extensions ├── ExceptionExtension.cs ├── Properties │ └── AssemblyInfo.cs └── Vikings.CodeSite.Extensions.csproj ├── Vikings.Swf.Extensions ├── Properties │ └── AssemblyInfo.cs ├── Vikings.Swf.Extensions.csproj └── Windows │ └── Forms │ └── ControlExtension.cs ├── Vikings.Swf ├── Properties │ └── AssemblyInfo.cs ├── UCFormAlign.cs ├── UCFormAlign.designer.cs ├── UCFormAlign.resx ├── Vikings.Swf.csproj └── packages.config ├── Vikings.System.Extensions ├── CodeDom │ └── CodeExpressionExtension.cs ├── Drawing │ └── ImageExtension.cs ├── Int32Extension.cs ├── Linq │ └── ClassExtension.cs ├── Net │ ├── IPAddressExtension.cs │ └── WebClientExtension.cs ├── Properties │ └── AssemblyInfo.cs ├── Security │ └── Cryptography │ │ └── HashAlgorithmExtension.cs ├── StringExtension.cs ├── UriExtension.cs └── Vikings.System.Extensions.csproj ├── Vikings.Translate.Tests ├── GoogleTranslateTest.GetTK.g.cs ├── GoogleTranslateTest.cs ├── Properties │ ├── AssemblyInfo.cs │ └── PexAssemblyInfo.cs ├── Vikings.Translate.Tests.csproj └── packages.config ├── Vikings.Translate ├── GoogleTranslate.cs ├── Properties │ └── AssemblyInfo.cs ├── Vikings.Translate.csproj └── packages.config ├── Vikings.Wpf.Extensions ├── Drawing │ └── ImageExtension.cs ├── Vikings.Wpf.Extensions.csproj └── Windows │ ├── ApplicationExtension.cs │ ├── Controls │ └── ButtonBaseExtension.cs │ ├── DependencyObjectExtension.cs │ ├── MessageBoxException.cs │ ├── UserCanceledException.cs │ └── WindowExtension.cs ├── Vikings.Wpf.Sample ├── App.config ├── App.xaml ├── App.xaml.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings └── Vikings.Wpf.Sample.csproj ├── Vikings.Wpf ├── NativeMethods.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Themes │ └── Generic.xaml ├── Vikings.Wpf.csproj └── WindowAlign.cs └── Vikings.sln /.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 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc 262 | *.nuspec 263 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 noctwolf 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vikings 2 | - Vikings是一个.NET工具包,可在nuget直接下载编译过的包。其主要目的是为.NET框架增加易用的扩展 3 | - 一些扩展、助手类和CodeSite方法跟踪器 4 | - Vikings is a .NET coding utility package, binary package avaliable on nuget for Visual Studio. Its main purpose is adding some awesome extensions to .NET Framework. 5 | 6 | # Extensions list 7 | ## Vikings.Swf.Extensions and Vikings.Wpf.Extensions 8 | - .NET WinForm和WPF的扩展,将LINQ引入界面控件查询。其主要目的在于简化代码并提高代码可读性。 9 | - .NET WinForm and WPF extension, introducing LINQ to UI controls retrieval. Its main purpose is code reducing and readability improving. 10 | ### Usage: 11 | - (some winform object).All() return a IEnumable object contained all UI controls in the given win form Control object 12 | - (some WPF form object).All() return a IEnumable object contained all UI controls in the given WPF form object 13 | - (some WPF form object).Child() return a IEnumable object contained all child UI controls in the given WPF form object 14 | ```C# 15 | if (!this.All().OfType().Any(f => f.IsChecked == true)) 16 | MessageBox.Show("请至少选择一个"); 17 | ``` 18 | So, you can use LINQ functions like Any() Where() to retrieval controls 19 | 20 | ## Vikings.Translate 21 | - Google 翻译调用,简化代码,一行搞定 22 | - Google translation, very simple, only one line 23 | ### Usage: 24 | - Vikings.Translate.Translate("some text to be translate","original language code,like en-US, support 'auto'","target language code, like zh-CN") 25 | ```C# 26 | Vikings.Translate.GoogleTranslate.Translate("新年快乐!","auto","en-US"); 27 | ``` 28 | -------------------------------------------------------------------------------- /Vikings.Base.Tests/EnumTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace Vikings.Base.Tests 7 | { 8 | [TestClass] 9 | public class EnumTests 10 | { 11 | [TestMethod] 12 | public void ToDictionaryTest() 13 | { 14 | var dict = Enum.ToDictionary(); 15 | dict.ToList().ForEach(f => Console.WriteLine($"{f.Key}={f.Value}")); 16 | Assert.IsTrue(dict.Any(f => f.Key == Test.A && f.Value == "枚举A")); 17 | Assert.IsTrue(dict.Any(f => f.Key == Test.Ab && f.Value == "枚举AB")); 18 | Assert.IsTrue(dict.Any(f => f.Key == Test.Abc && f.Value == "Abc")); 19 | } 20 | } 21 | 22 | public enum Test 23 | { 24 | [Display(Name = "枚举A")] 25 | A, 26 | [Display(Name = "枚举AB")] 27 | Ab, 28 | //[System.ComponentModel.Description("CCC")] 29 | Abc 30 | } 31 | } -------------------------------------------------------------------------------- /Vikings.Base.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noctwolf/Vikings/123a9c5576a85afe6d48a91fde5bc45a48c0b21a/Vikings.Base.Tests/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /Vikings.Base.Tests/Properties/PexAssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noctwolf/Vikings/123a9c5576a85afe6d48a91fde5bc45a48c0b21a/Vikings.Base.Tests/Properties/PexAssemblyInfo.cs -------------------------------------------------------------------------------- /Vikings.Base.Tests/Vikings.Base.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {700EF515-5284-4452-9CE3-D2937D191598} 8 | Library 9 | Properties 10 | Vikings.Base.Tests 11 | Vikings.Base.Tests 12 | v4.5 13 | 512 14 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 10.0 16 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 17 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 18 | False 19 | UnitTest 20 | True 21 | Full 22 | 23 | 24 | 25 | 26 | true 27 | full 28 | false 29 | bin\Debug\ 30 | DEBUG;TRACE 31 | prompt 32 | 4 33 | 34 | 35 | pdbonly 36 | true 37 | bin\Release\ 38 | TRACE 39 | prompt 40 | 4 41 | 42 | 43 | 44 | False 45 | 46 | 47 | ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll 48 | 49 | 50 | ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll 51 | 52 | 53 | 54 | 55 | 56 | 57 | {95B4E7D8-420D-4B3A-BAF3-D840DDDA46FD} 58 | Vikings.Base 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | False 82 | 83 | 84 | False 85 | 86 | 87 | False 88 | 89 | 90 | False 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 100 | 101 | 102 | 103 | 104 | 105 | 112 | -------------------------------------------------------------------------------- /Vikings.Base.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Vikings.Base/Collections/Generic/StringLogicalComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Vikings.Collections.Generic 5 | { 6 | /// 7 | /// 比较两个Unicode字符串。字符串中的数字被视为数字内容而不是文本。此测试不区分大小写。 8 | /// 9 | public class StringLogicalComparer : Comparer 10 | { 11 | [DllImport("Shlwapi", SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] 12 | private static extern int StrCmpLogicalW(string psz1, string psz2); 13 | 14 | /// 15 | /// 内部调用 StrCmpLogicalW 比较 16 | /// 17 | /// 要比较的第一个对象 18 | /// 要比较的第二个对象 19 | /// 20 | public override int Compare(string x, string y) => StrCmpLogicalW(x, y); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Vikings.Base/Enum.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.Linq; 4 | using System.Reflection; 5 | 6 | namespace Vikings 7 | { 8 | /// 9 | /// enum 扩展 10 | /// 11 | public static class Enum 12 | { 13 | /// 14 | /// 获取包含描述的Dictionary 15 | /// 16 | /// 类型 17 | /// 包含描述的Dictionary 18 | public static Dictionary ToDictionary() where TKey : System.Enum => 19 | typeof(TKey).GetEnumValues().OfType().ToDictionary(f => f, f => 20 | typeof(TKey).GetMember(f.ToString())[0].GetCustomAttribute()?.Name ?? f.ToString()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Vikings.Base/Math/Speed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Vikings.Math 4 | { 5 | /// 6 | /// 速度 7 | /// 8 | public class Speed 9 | { 10 | /// 11 | /// 时间 12 | /// 13 | public DateTime DateTime { get; set; } = DateTime.Now; 14 | 15 | /// 16 | /// 长度 17 | /// 18 | public long Length { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /Vikings.Base/Math/SpeedQueue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Vikings.Math 6 | { 7 | /// 8 | /// 速度记录队列 9 | /// 10 | public class SpeedQueue : Queue 11 | { 12 | /// 13 | /// 队列容量 14 | /// 15 | public int BoundedCapacity { get; set; } = 100; 16 | 17 | /// 18 | /// 添加长度 19 | /// 20 | /// 21 | public void Enqueue(long length) => Enqueue(new Speed { Length = length }); 22 | 23 | /// 24 | /// 添加速度 25 | /// 26 | /// 27 | public new void Enqueue(Speed item) 28 | { 29 | if (this.LastOrDefault()?.DateTime > item.DateTime) 30 | throw new Exception($"{nameof(item.DateTime)}必须大于队列中已有值"); 31 | while (Count >= BoundedCapacity) Dequeue(); 32 | base.Enqueue(item); 33 | } 34 | 35 | /// 36 | /// 获取最后速度 37 | /// 38 | /// 采样数量 39 | /// 最后速度 40 | public double LastSpeed(int count = 2) 41 | { 42 | if (count < 2) throw new ArgumentException(nameof(count)); 43 | return CalcSpeed(this.Skip(Count - count)); 44 | } 45 | 46 | /// 47 | /// 获取最后速度 48 | /// 49 | /// 采样时间,单位(秒) 50 | /// 最后速度 51 | public double LastTimeSpeed(double seconds = 1) => LastTimeSpeed(TimeSpan.FromSeconds(seconds)); 52 | 53 | /// 54 | /// 获取最后速度 55 | /// 56 | /// 时间间隔 57 | /// 最后速度 58 | public double LastTimeSpeed(TimeSpan timeSpan) 59 | { 60 | var lastTime = this.SkipWhile(f => f.DateTime < DateTime.Now - timeSpan); 61 | if (lastTime.Count() == 1 && Count > 1) lastTime = this.Skip(Count - 2); 62 | return CalcSpeed(lastTime); 63 | } 64 | 65 | double CalcSpeed(IEnumerable source) 66 | { 67 | if (!source.Skip(2).Any()) return 0; 68 | return (source.Last().Length - source.First().Length) / 69 | (source.Last().DateTime - source.First().DateTime).TotalSeconds; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Vikings.Base/Net/WebClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | 4 | namespace Vikings.Net 5 | { 6 | /// 7 | /// 扩展 8 | /// 9 | public class WebClient: System.Net.WebClient 10 | { 11 | /// 12 | /// 获取或设置请求超时之前的时间长度(以毫秒为单位)。 13 | /// 14 | public virtual int Timeout { get; set; } 15 | 16 | /// 17 | /// 重载,设置超时 18 | /// 19 | /// 20 | /// 21 | protected override WebRequest GetWebRequest(Uri address) 22 | { 23 | var webRequest = base.GetWebRequest(address); 24 | if (Timeout != 0) webRequest.Timeout = Timeout; 25 | return webRequest; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Vikings.Base/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Vikings.Base")] 9 | [assembly: AssemblyDescription("Vikings Base")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Vikings")] 12 | [assembly: AssemblyProduct("Vikings.Base")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 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("95b4e7d8-420d-4b3a-baf3-d840ddda46fd")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.4")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | [assembly: InternalsVisibleTo("Vikings.Base.Tests")] 38 | [assembly: InternalsVisibleTo("Vikings.Base.Explorables")] 39 | 40 | -------------------------------------------------------------------------------- /Vikings.Base/README.md: -------------------------------------------------------------------------------- 1 | # Vikings.Base 2 | - Vikings.Base is a base utility package, contains some mathematics, network and threading utility classes. 3 | 4 | # Utility list 5 | ## Vikings.Threading.Tasks 6 | - Delay utility class provide action delayed starting 7 | ### Usage: 8 | - Delay.IntervalAsync Do not block the current thread for a interval and then calls your action 9 | - 不阻塞当前线程,按照固定的时间间隔调用你的操作,在时间到达之前的多次操作仅保留最后一次。 10 | 比如,每秒刷新一次界面上的进度条,在一秒内多次调用这个方法,但是实际只执行最后一次,之前的操作都被忽略。 11 | ```C# 12 | Vikings.Threading.Tasks.Delay.IntervalAsync(() => progressBar.Value = downloadLength); 13 | ``` 14 | -------------------------------------------------------------------------------- /Vikings.Base/Threading/Tasks/Delay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.CompilerServices; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Vikings.Threading.Tasks 8 | { 9 | /// 10 | /// 延迟执行 11 | /// 12 | public static class Delay 13 | { 14 | private class Caller 15 | { 16 | protected internal CancellationTokenSource CancellationTokenSource; 17 | protected internal DateTime LastTime; 18 | } 19 | 20 | [ThreadStatic] 21 | private static Dictionary callerDict; 22 | 23 | private static void ThreadInit() => callerDict = callerDict ?? new Dictionary(); 24 | 25 | private static async Task Async(Action action, int milliseconds, string name, bool isInterval = false) 26 | { 27 | ThreadInit(); 28 | if (!callerDict.ContainsKey(name)) callerDict[name] = new Caller(); 29 | var caller = callerDict[name]; 30 | caller.CancellationTokenSource?.Cancel(); 31 | caller.CancellationTokenSource = new CancellationTokenSource(); 32 | var ct = caller.CancellationTokenSource.Token; 33 | if (isInterval) milliseconds -= (int)(DateTime.Now - caller.LastTime).TotalMilliseconds; 34 | if (milliseconds > 0) 35 | { 36 | var task = Task.Delay(milliseconds, ct); 37 | await task; 38 | if (ct.IsCancellationRequested) throw new TaskCanceledException(task);//处理取消时已经完成延迟任务 39 | } 40 | caller.LastTime = DateTime.Now; 41 | action?.Invoke(); 42 | } 43 | 44 | /// 45 | /// 防抖 46 | /// 47 | public static Task DebounceAsync(Action action = null, int milliseconds = 500, [CallerFilePath]string name = "") 48 | => Async(action, milliseconds, name); 49 | 50 | /// 51 | /// 节流 52 | /// 53 | public static Task ThrottleAsync(Action action = null, int milliseconds = 1000, [CallerFilePath]string name = "") 54 | => Async(action, milliseconds, name, true); 55 | 56 | /// 57 | /// 固定时间间隔 58 | /// 59 | [Obsolete("Use ThrottleAsync")] 60 | public static Task IntervalAsync(Action action = null, int milliseconds = 1000, [CallerFilePath]string name = "") 61 | => ThrottleAsync(action, milliseconds, name); 62 | 63 | /// 64 | /// 重置延迟时间 65 | /// 66 | [Obsolete("Use DebounceAsync")] 67 | public static Task ResetAsync(Action action = null, int milliseconds = 500, [CallerFilePath]string name = "") 68 | => DebounceAsync(action, milliseconds, name); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Vikings.Base/Vikings.Base.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {95B4E7D8-420D-4B3A-BAF3-D840DDDA46FD} 8 | Library 9 | Properties 10 | Vikings 11 | Vikings.Base 12 | v4.5 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | bin\Debug\Vikings.Base.xml 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Component 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/CodeHelperPackage.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell; 2 | using System; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Runtime.InteropServices; 5 | using System.Threading; 6 | using Task = System.Threading.Tasks.Task; 7 | 8 | namespace Vikings.CodeHelper 9 | { 10 | /// 11 | /// This is the class that implements the package exposed by this assembly. 12 | /// 13 | /// 14 | /// 15 | /// The minimum requirement for a class to be considered a valid package for Visual Studio 16 | /// is to implement the IVsPackage interface and register itself with the shell. 17 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 18 | /// to do it: it derives from the Package class that provides the implementation of the 19 | /// IVsPackage interface and uses the registration attributes defined in the framework to 20 | /// register itself and its components with the shell. These attributes tell the pkgdef creation 21 | /// utility what data to put into .pkgdef file. 22 | /// 23 | /// 24 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. 25 | /// 26 | /// 27 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 28 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 29 | [Guid(PackageGuidString)] 30 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 31 | [ProvideMenuResource("Menus.ctmenu", 1)] 32 | public sealed class CodeHelperPackage : AsyncPackage 33 | { 34 | /// 35 | /// CodeHelperPackage GUID string. 36 | /// 37 | public const string PackageGuidString = "cd7d83ad-a13b-434a-9b95-2b050aaad483"; 38 | 39 | /// 40 | /// Initializes a new instance of the class. 41 | /// 42 | public CodeHelperPackage() 43 | { 44 | // Inside this method you can place any initialization code that does not require 45 | // any Visual Studio service because at this point the package object is created but 46 | // not sited yet inside Visual Studio environment. The place to do all the other 47 | // initialization is the Initialize method. 48 | } 49 | 50 | #region Package Members 51 | 52 | /// 53 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 54 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 55 | /// 56 | /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down. 57 | /// A provider for progress updates. 58 | /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method. 59 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 60 | { 61 | // When initialized asynchronously, the current thread may be a background thread at this point. 62 | // Do any initialization that requires the UI thread after switching to the UI thread. 63 | await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 64 | await CodeSiteCmd.InitializeAsync(this); 65 | } 66 | 67 | #endregion 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/CodeHelperPackage.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 47 | 48 | 55 | 62 | 63 | 64 | 65 | 66 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/CodeSiteCmd.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using Microsoft; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | using System; 6 | using System.ComponentModel.Design; 7 | using System.Threading.Tasks; 8 | using Vikings.CodeHelper.View; 9 | using Task = System.Threading.Tasks.Task; 10 | 11 | namespace Vikings.CodeHelper 12 | { 13 | /// 14 | /// Command handler 15 | /// 16 | internal sealed class CodeSiteCmd 17 | { 18 | /// 19 | /// Command ID. 20 | /// 21 | public const int CommandId = 0x0100; 22 | 23 | /// 24 | /// Command menu group (command set GUID). 25 | /// 26 | public static readonly Guid CommandSet = new Guid("497d5c2b-5985-4ad0-a581-eb084e00195b"); 27 | 28 | /// 29 | /// VS Package that provides this command, not null. 30 | /// 31 | private readonly AsyncPackage package; 32 | 33 | /// 34 | /// Initializes a new instance of the class. 35 | /// Adds our command handlers for menu (commands must exist in the command table file) 36 | /// 37 | /// Owner package, not null. 38 | /// Command service to add command to, not null. 39 | private CodeSiteCmd(AsyncPackage package, OleMenuCommandService commandService) 40 | { 41 | this.package = package ?? throw new ArgumentNullException(nameof(package)); 42 | commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); 43 | 44 | var menuCommandID = new CommandID(CommandSet, CommandId); 45 | var menuItem = new MenuCommand(Execute, menuCommandID); 46 | commandService.AddCommand(menuItem); 47 | } 48 | 49 | /// 50 | /// Gets the instance of the command. 51 | /// 52 | public static CodeSiteCmd Instance { get; private set; } 53 | 54 | /// 55 | /// Gets the service provider from the owner package. 56 | /// 57 | //private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider => package; 58 | 59 | /// 60 | /// Initializes the singleton instance of the command. 61 | /// 62 | /// Owner package, not null. 63 | public static async Task InitializeAsync(AsyncPackage package) 64 | { 65 | // Switch to the main thread - the call to AddCommand in CodeSiteCmd's constructor requires 66 | // the UI thread. 67 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); 68 | 69 | OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService; 70 | Instance = new CodeSiteCmd(package, commandService); 71 | } 72 | 73 | /// 74 | /// This function is the callback used to execute the command when the menu item is clicked. 75 | /// See the constructor to see how the menu item is associated with this function using 76 | /// OleMenuCommandService service and MenuCommand class. 77 | /// 78 | /// Event sender. 79 | /// Event args. 80 | private async void Execute(object sender, EventArgs e) 81 | { 82 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 83 | if (await CheckCodeModelAsync()) new CodeSiteWindow().ShowModal(); 84 | //string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); 85 | //string title = "CodeSiteCmd"; 86 | 87 | //// Show a message box to prove we were here 88 | //VsShellUtilities.ShowMessageBox( 89 | // this.package, 90 | // message, 91 | // title, 92 | // OLEMSGICON.OLEMSGICON_INFO, 93 | // OLEMSGBUTTON.OLEMSGBUTTON_OK, 94 | // OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 95 | } 96 | 97 | async Task CheckCodeModelAsync() 98 | { 99 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 100 | try 101 | { 102 | DTE dte = await package.GetServiceAsync(typeof(DTE)) as DTE; 103 | Assumes.Present(dte); 104 | Document doc = dte.ActiveDocument; 105 | if (doc == null) 106 | ShowMessage("没有活动文档"); 107 | else 108 | { 109 | FileCodeModel fcm = doc.ProjectItem.FileCodeModel; 110 | if (fcm == null) 111 | ShowMessage("活动文档没有代码模型"); 112 | else if (!fcm.Language.Equals(CodeModelLanguageConstants.vsCMLanguageCSharp)) 113 | ShowMessage("代码的编程语言不是C#语言"); 114 | else 115 | return true; 116 | } 117 | } 118 | catch (Exception ex) 119 | { 120 | //ex.SendCodeSite(); 121 | ShowMessage("未知异常\r\n" + ex.Message); 122 | } 123 | return false; 124 | } 125 | 126 | void ShowMessage(string message) 127 | { 128 | VsShellUtilities.ShowMessageBox(package, message, "加载文档", 129 | OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 |  2 | // This file is used by Code Analysis to maintain SuppressMessage 3 | // attributes that are applied to this project. 4 | // Project-level suppressions either have no target or are given 5 | // a specific target and scoped to a namespace, type, member, etc. 6 | 7 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeFunctionExtension.GetSetName(EnvDTE.CodeFunction)~System.String")] 8 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeFunctionExtension.EqualsOffset(EnvDTE.CodeFunction,EnvDTE.CodeFunction)~System.Boolean")] 9 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeFunctionExtension.HasExpressionBody(EnvDTE.CodeFunction)~System.Boolean")] 10 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeFunctionExtension.HasBody(EnvDTE.CodeFunction)~System.Boolean")] 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeFunctionExtension.CSText(EnvDTE.CodeFunction,Vikings.CodeHelper.ViewModel.CodeFunctionExtension.CSTextPart)~System.String")] 12 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeFunctionExtension.AddCodeSite(EnvDTE.CodeFunction)")] 13 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeFunctionExtension.DeleteCodeSite(EnvDTE.CodeFunction,System.Boolean)~System.Boolean")] 14 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeFunctionExtension.ExistsCodeSite(EnvDTE.CodeFunction)~System.Boolean")] 15 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~P:Vikings.CodeHelper.ViewModel.CodeElementViewModel.CodeFunction")] 16 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeElementViewModel.#ctor(EnvDTE.CodeElement)")] 17 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeElementViewModel.LoadChild(EnvDTE.CodeElement)")] 18 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.ViewModel.CodeSiteViewModel.#ctor")] 19 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~P:Vikings.CodeHelper.ViewModel.CodeSiteViewModel.OkCommand")] 20 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:在主线程上调用单线程类型", Justification = "<挂起>", Scope = "member", Target = "~M:Vikings.CodeHelper.View.CodeSiteWindow.TreeViewItem_MouseDoubleClick(System.Object,System.Windows.Input.MouseButtonEventArgs)")] -------------------------------------------------------------------------------- /Vikings.CodeHelper/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noctwolf/Vikings/123a9c5576a85afe6d48a91fde5bc45a48c0b21a/Vikings.CodeHelper/Key.snk -------------------------------------------------------------------------------- /Vikings.CodeHelper/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Vikings.CodeHelper")] 9 | [assembly: AssemblyDescription("Vikings 代码助手")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("noctwolf")] 12 | [assembly: AssemblyProduct("Vikings.CodeHelper")] 13 | [assembly: AssemblyCopyright("noctwolf@gmail.com")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.8")] 33 | [assembly: AssemblyFileVersion("1.0.0.8")] 34 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Vikings.CodeHelper.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 29 | public bool IncludeCatch { 30 | get { 31 | return ((bool)(this["IncludeCatch"])); 32 | } 33 | set { 34 | this["IncludeCatch"] = value; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | False 7 | 8 | 9 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/ReleaseNotes.txt: -------------------------------------------------------------------------------- 1 | v1.2,2017-09-23 2 | +在树上查找方法 3 | v1.3, 2017-09-23 4 | *窗口大小微调 5 | *加载后出现滚动条时,显示出第一个节点 6 | v1.4, 2017-09-28 7 | +在树的方法节点双击,编辑器跳转到双击的方法位置 8 | v1.5, 2017-12-17 9 | *修复类名或方法名中包含“try”字符的bug 10 | v1.6, 2019-01-31 11 | +支持表达式主体 12 | +添加NuGet包Vikings.CodeSite.Extensions 13 | v1.7, 2019-02-03 14 | +用WPF重构WinForm窗口 15 | *修复checked传递 16 | v1.8, 2019-02-11 17 | *读取属性访问器bug,一个是程序块主体一个是表达式主体 18 | *树上的复选框垂直居中 19 | *没有输入查找文本,直接点击查找按钮时空引用异常 20 | +查找到的节点,自动滚动到可见区域 -------------------------------------------------------------------------------- /Vikings.CodeHelper/Resources/CodeHelperPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noctwolf/Vikings/123a9c5576a85afe6d48a91fde5bc45a48c0b21a/Vikings.CodeHelper/Resources/CodeHelperPackage.ico -------------------------------------------------------------------------------- /Vikings.CodeHelper/Resources/CodeSiteCmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noctwolf/Vikings/123a9c5576a85afe6d48a91fde5bc45a48c0b21a/Vikings.CodeHelper/Resources/CodeSiteCmd.png -------------------------------------------------------------------------------- /Vikings.CodeHelper/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | CodeHelper 122 | 123 | 124 | Vikings 代码助手 125 | 126 | 127 | 128 | Resources\CodeHelperPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/View/BaseDialogWindow.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.PlatformUI; 2 | 3 | namespace Vikings.CodeHelper.View 4 | { 5 | public class BaseDialogWindow : DialogWindow 6 | { 7 | public BaseDialogWindow() 8 | { 9 | HasMaximizeButton = true; 10 | HasMinimizeButton = true; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Vikings.CodeHelper/View/CodeSiteWindow.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |