├── .editorconfig ├── .gitattributes ├── .gitignore ├── BeatSaberModManager.sln ├── BeatSaberModManager ├── BeatSaberModManager.csproj ├── Core │ ├── GroupSorter.cs │ ├── Helper.cs │ ├── InstallerLogic.cs │ ├── OneClickInstaller.cs │ ├── PathLogic.cs │ ├── RemoteLogic.cs │ └── UpdateLogic.cs ├── DataModels │ ├── GameVersion.cs │ ├── ModLink.cs │ ├── Platform.cs │ └── ReleaseInfo.cs ├── Dependencies │ ├── CommonMark │ │ ├── CommonMarkAdditionalFeatures.cs │ │ ├── CommonMarkConverter.cs │ │ ├── CommonMarkException.cs │ │ ├── CommonMarkSettings.cs │ │ ├── Formatters │ │ │ ├── HtmlFormatter.cs │ │ │ ├── HtmlFormatterSlim.cs │ │ │ ├── HtmlTextWriter.cs │ │ │ └── Printer.cs │ │ ├── Func.cs │ │ ├── Lazy.cs │ │ ├── OutputFormat.cs │ │ ├── Parser │ │ │ ├── BlockMethods.cs │ │ │ ├── EntityDecoder.cs │ │ │ ├── InlineMethods.cs │ │ │ ├── InlineStack.cs │ │ │ ├── LineInfo.cs │ │ │ ├── PositionOffset.cs │ │ │ ├── PositionTracker.cs │ │ │ ├── Scanner.cs │ │ │ ├── ScannerCharacterMatcher.cs │ │ │ ├── ScannerHtmlTag.cs │ │ │ ├── Subject.cs │ │ │ └── TabTextReader.cs │ │ ├── Syntax │ │ │ ├── Block.cs │ │ │ ├── BlockTag.cs │ │ │ ├── DocumentData.cs │ │ │ ├── EmphasisData.cs │ │ │ ├── Enumerable.cs │ │ │ ├── EnumeratorEntry.cs │ │ │ ├── FencedCodeData.cs │ │ │ ├── HeadingData.cs │ │ │ ├── HtmlBlockType.cs │ │ │ ├── Inline.cs │ │ │ ├── InlineContentLinkable.cs │ │ │ ├── InlineTag.cs │ │ │ ├── ListData.cs │ │ │ ├── ListDelimiter.cs │ │ │ ├── ListType.cs │ │ │ ├── Reference.cs │ │ │ ├── StringContent.cs │ │ │ └── StringContentPart.cs │ │ └── Utilities.cs │ ├── ICSharpCode.SharpZipLib │ │ ├── BZip2 │ │ │ ├── BZip2.cs │ │ │ ├── BZip2Constants.cs │ │ │ ├── BZip2Exception.cs │ │ │ ├── BZip2InputStream.cs │ │ │ └── BZip2OutputStream.cs │ │ ├── Checksum │ │ │ ├── Adler32.cs │ │ │ ├── BZip2Crc.cs │ │ │ ├── Crc32.cs │ │ │ └── IChecksum.cs │ │ ├── Core │ │ │ ├── Exceptions │ │ │ │ ├── SharpZipBaseException.cs │ │ │ │ ├── StreamDecodingException.cs │ │ │ │ ├── StreamUnsupportedException.cs │ │ │ │ ├── UnexpectedEndOfStreamException.cs │ │ │ │ └── ValueOutOfRangeException.cs │ │ │ ├── FileSystemScanner.cs │ │ │ ├── INameTransform.cs │ │ │ ├── IScanFilter.cs │ │ │ ├── InvalidNameException.cs │ │ │ ├── NameFilter.cs │ │ │ ├── PathFilter.cs │ │ │ ├── StreamUtils.cs │ │ │ └── WindowsPathUtils.cs │ │ ├── Encryption │ │ │ ├── PkzipClassic.cs │ │ │ ├── ZipAESStream.cs │ │ │ └── ZipAESTransform.cs │ │ ├── GZip │ │ │ ├── GZip.cs │ │ │ ├── GZipConstants.cs │ │ │ ├── GZipException.cs │ │ │ ├── GzipInputStream.cs │ │ │ └── GzipOutputStream.cs │ │ ├── Lzw │ │ │ ├── LzwConstants.cs │ │ │ ├── LzwException.cs │ │ │ └── LzwInputStream.cs │ │ ├── Tar │ │ │ ├── InvalidHeaderException.cs │ │ │ ├── TarArchive.cs │ │ │ ├── TarBuffer.cs │ │ │ ├── TarEntry.cs │ │ │ ├── TarException.cs │ │ │ ├── TarExtendedHeaderReader.cs │ │ │ ├── TarHeader.cs │ │ │ ├── TarInputStream.cs │ │ │ └── TarOutputStream.cs │ │ └── Zip │ │ │ ├── Compression │ │ │ ├── Deflater.cs │ │ │ ├── DeflaterConstants.cs │ │ │ ├── DeflaterEngine.cs │ │ │ ├── DeflaterHuffman.cs │ │ │ ├── DeflaterPending.cs │ │ │ ├── Inflater.cs │ │ │ ├── InflaterDynHeader.cs │ │ │ ├── InflaterHuffmanTree.cs │ │ │ ├── PendingBuffer.cs │ │ │ └── Streams │ │ │ │ ├── DeflaterOutputStream.cs │ │ │ │ ├── InflaterInputStream.cs │ │ │ │ ├── OutputWindow.cs │ │ │ │ └── StreamManipulator.cs │ │ │ ├── FastZip.cs │ │ │ ├── IEntryFactory.cs │ │ │ ├── WindowsNameTransform.cs │ │ │ ├── ZipConstants.cs │ │ │ ├── ZipEntry.cs │ │ │ ├── ZipEntryFactory.cs │ │ │ ├── ZipException.cs │ │ │ ├── ZipExtraData.cs │ │ │ ├── ZipFile.cs │ │ │ ├── ZipHelperStream.cs │ │ │ ├── ZipInputStream.cs │ │ │ ├── ZipNameTransform.cs │ │ │ ├── ZipOutputStream.cs │ │ │ └── ZipStrings.cs │ ├── RegHelper.cs │ ├── SemVer │ │ ├── Comparator.cs │ │ ├── ComparatorSet.cs │ │ ├── Desugarer.cs │ │ ├── PartialVersion.cs │ │ ├── PreReleaseVersion.cs │ │ ├── Range.cs │ │ ├── Tuple.cs │ │ └── Version.cs │ ├── SimpleJson.cs │ └── SteamFinder.cs ├── FodyWeavers.xml ├── FodyWeavers.xsd ├── Forms │ ├── FormAnnouncement.Designer.cs │ ├── FormAnnouncement.cs │ ├── FormAnnouncement.resx │ ├── FormDetailViewer.Designer.cs │ ├── FormDetailViewer.cs │ ├── FormDetailViewer.resx │ ├── FormMain.Designer.cs │ ├── FormMain.cs │ ├── FormMain.resx │ ├── FormPlatformSelect.Designer.cs │ ├── FormPlatformSelect.cs │ └── FormPlatformSelect.resx ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── app.config ├── app.manifest ├── icon.ico ├── packages.config └── saber.ico ├── README.md ├── packages └── MaterialSkin.0.2.1 │ ├── MaterialSkin.0.2.1.nupkg │ └── lib │ └── MaterialSkin.dll └── update.txt /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | 6 | [*.cs] 7 | indent_style = space 8 | indent_size = 4 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # Ignore NuGet packages 5 | **/packages/* 6 | !**/packages/repositories.config 7 | 8 | # User-specific files 9 | *.suo 10 | *.user 11 | *.sln.docstates 12 | .vs/ 13 | 14 | # Build results 15 | 16 | [Dd]ebug/ 17 | [Rr]elease/ 18 | x64/ 19 | build/ 20 | [Bb]in/ 21 | [Oo]bj/ 22 | 23 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 24 | !packages/*/build/ 25 | 26 | # MSTest test Results 27 | [Tt]est[Rr]esult*/ 28 | [Bb]uild[Ll]og.* 29 | 30 | *_i.c 31 | *_p.c 32 | *.ilk 33 | *.meta 34 | *.obj 35 | *.pch 36 | *.pdb 37 | *.pgc 38 | *.pgd 39 | *.rsp 40 | *.sbr 41 | *.tlb 42 | *.tli 43 | *.tlh 44 | *.tmp 45 | *.tmp_proj 46 | *.log 47 | *.vspscc 48 | *.vssscc 49 | .builds 50 | *.pidb 51 | *.log 52 | *.scc 53 | 54 | # Visual C++ cache files 55 | ipch/ 56 | *.aps 57 | *.ncb 58 | *.opensdf 59 | *.sdf 60 | *.cachefile 61 | 62 | # Visual Studio profiler 63 | *.psess 64 | *.vsp 65 | *.vspx 66 | 67 | # Guidance Automation Toolkit 68 | *.gpState 69 | 70 | # ReSharper is a .NET coding add-in 71 | _ReSharper*/ 72 | *.[Rr]e[Ss]harper 73 | 74 | # TeamCity is a build add-in 75 | _TeamCity* 76 | 77 | # DotCover is a Code Coverage Tool 78 | *.dotCover 79 | 80 | # NCrunch 81 | *.ncrunch* 82 | .*crunch*.local.xml 83 | 84 | # Installshield output folder 85 | [Ee]xpress/ 86 | 87 | # DocProject is a documentation generator add-in 88 | DocProject/buildhelp/ 89 | DocProject/Help/*.HxT 90 | DocProject/Help/*.HxC 91 | DocProject/Help/*.hhc 92 | DocProject/Help/*.hhk 93 | DocProject/Help/*.hhp 94 | DocProject/Help/Html2 95 | DocProject/Help/html 96 | 97 | # Click-Once directory 98 | publish/ 99 | 100 | # Publish Web Output 101 | *.Publish.xml 102 | 103 | # NuGet Packages Directory 104 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 105 | #packages/ 106 | 107 | # Windows Azure Build Output 108 | csx 109 | *.build.csdef 110 | 111 | # Windows Store app package directory 112 | AppPackages/ 113 | 114 | # Others 115 | sql/ 116 | *.Cache 117 | ClientBin/ 118 | [Ss]tyle[Cc]op.* 119 | ~$* 120 | *~ 121 | *.dbmdl 122 | *.[Pp]ublish.xml 123 | *.pfx 124 | *.publishsettings 125 | 126 | # RIA/Silverlight projects 127 | Generated_Code/ 128 | 129 | # Backup & report files from converting an old project file to a newer 130 | # Visual Studio version. Backup files are not needed, because we have git ;-) 131 | _UpgradeReport_Files/ 132 | Backup*/ 133 | UpgradeLog*.XML 134 | UpgradeLog*.htm 135 | 136 | # SQL Server files 137 | App_Data/*.mdf 138 | App_Data/*.ldf 139 | 140 | 141 | #LightSwitch generated files 142 | GeneratedArtifacts/ 143 | _Pvt_Extensions/ 144 | ModelManifest.xml 145 | 146 | # ========================= 147 | # Windows detritus 148 | # ========================= 149 | 150 | # Windows image file caches 151 | Thumbs.db 152 | ehthumbs.db 153 | 154 | # Folder config file 155 | Desktop.ini 156 | 157 | # Recycle Bin used on file shares 158 | $RECYCLE.BIN/ 159 | 160 | # Mac desktop service store files 161 | .DS_Store 162 | -------------------------------------------------------------------------------- /BeatSaberModManager.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.539 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeatSaberModManager", "BeatSaberModManager\BeatSaberModManager.csproj", "{A053076C-1827-4FD0-B29C-35CDEC751687}" 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 | {A053076C-1827-4FD0-B29C-35CDEC751687}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {A053076C-1827-4FD0-B29C-35CDEC751687}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {A053076C-1827-4FD0-B29C-35CDEC751687}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {A053076C-1827-4FD0-B29C-35CDEC751687}.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 = {C01193A5-9D64-4859-A33C-5BB02499FF85} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /BeatSaberModManager/Core/GroupSorter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | using BeatSaberModManager.DataModels; 5 | using static System.Windows.Forms.ListView; 6 | 7 | namespace BeatSaberModManager.Core 8 | { 9 | class GroupComparer : IComparer 10 | { 11 | public int Compare(ListViewGroup groupA, ListViewGroup groupB) 12 | { 13 | if (groupA.Header == "Other") 14 | return 1; 15 | if (groupB.Header == "Other") 16 | return -1; 17 | 18 | float weightA = CalculateWeight(groupA.Items); 19 | float weightB = CalculateWeight(groupB.Items); 20 | 21 | float compareWeights = weightB - weightA; 22 | if (compareWeights != 0f) 23 | return (int)compareWeights; 24 | 25 | return groupA.Header.CompareTo(groupB.Header); 26 | } 27 | 28 | float CalculateWeight(ListViewItemCollection items) 29 | { 30 | float weight = 0; 31 | 32 | foreach (ListViewItem item in items) 33 | { 34 | ReleaseInfo release = (ReleaseInfo)item.Tag; 35 | weight += release.weight; 36 | } 37 | 38 | return weight / items.Count; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /BeatSaberModManager/Core/Helper.cs: -------------------------------------------------------------------------------- 1 | using BeatSaberModManager.Dependencies; 2 | using System; 3 | using System.IO; 4 | using System.Net; 5 | using System.Windows.Forms; 6 | using ICSharpCode.SharpZipLib.Core; 7 | using ICSharpCode.SharpZipLib.Zip; 8 | using System.Reflection; 9 | 10 | namespace BeatSaberModManager.Core 11 | { 12 | public static class Helper 13 | { 14 | 15 | private static void CreateHttpErrorLog(WebException ex) 16 | { 17 | string response = ex.Response != null ? new StreamReader(ex.Response.GetResponseStream()).ReadToEnd().ToString() : "none"; 18 | string[] text = 19 | { 20 | "################################################################", 21 | "This is an automatic error log", 22 | $"generated by BeatSaberModManager {Assembly.GetEntryAssembly().GetName().Version}", 23 | $"on {DateTime.Now:s}", 24 | "################################################################", 25 | "Message :", 26 | ex.Message, 27 | "----------------------------------------------------------------", 28 | "Stack trace :", 29 | ex.StackTrace, 30 | "----------------------------------------------------------------", 31 | "Status :", 32 | ex.Status.ToString(), 33 | "----------------------------------------------------------------", 34 | "Complete error :", 35 | ex.ToString(), 36 | "----------------------------------------------------------------", 37 | "Complete response :", 38 | response, 39 | "----------------------------------------------------------------" 40 | }; 41 | string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), $"BeatSaberModManager_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.log"); 42 | 43 | System.IO.File.WriteAllLines(filePath, text); 44 | } 45 | public static string Get(string URL) { 46 | 47 | try 48 | { 49 | HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create(URL); 50 | request.Method = "GET"; 51 | request.KeepAlive = true; 52 | request.ContentType = "application/x-www-form-urlencoded"; 53 | request.UserAgent = $"BeatSaberModManager/{Assembly.GetEntryAssembly().GetName().Version}"; 54 | HttpWebResponse response = (HttpWebResponse) request.GetResponse(); 55 | using (StreamReader requestReader = new StreamReader(response.GetResponseStream())) 56 | { 57 | return requestReader.ReadToEnd(); 58 | } 59 | } 60 | catch (WebException ex) { 61 | MessageBox.Show($"Error trying to access: {URL}\n\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 62 | #if DEBUG 63 | CreateHttpErrorLog(ex); 64 | #endif 65 | Environment.Exit(0); 66 | return null; 67 | } 68 | } 69 | public static void UnzipFile(byte[] data, string directory) 70 | { 71 | using (MemoryStream ms = new MemoryStream(data)) 72 | { 73 | using (var zf = new ZipFile(ms)) 74 | { 75 | foreach (ZipEntry zipEntry in zf) 76 | { 77 | if (!zipEntry.IsFile) 78 | continue; 79 | 80 | string entryFileName = zipEntry.Name; 81 | 82 | byte[] buffer = new byte[4096]; 83 | Stream zipStream = zf.GetInputStream(zipEntry); 84 | 85 | string fullZipToPath = Path.Combine(directory, entryFileName); 86 | string directoryName = Path.GetDirectoryName(fullZipToPath); 87 | 88 | if (directoryName.Length > 0) 89 | Directory.CreateDirectory(directoryName); 90 | 91 | using (FileStream streamWriter = File.Create(fullZipToPath)) 92 | { 93 | StreamUtils.Copy(zipStream, streamWriter, buffer); 94 | } 95 | } 96 | } 97 | } 98 | } 99 | public static byte[] GetFile(string url) 100 | { 101 | WebClient client = new WebClient(); 102 | client.Proxy = null; 103 | return client.DownloadData(url); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /BeatSaberModManager/Core/InstallerLogic.cs: -------------------------------------------------------------------------------- 1 | using BeatSaberModManager.DataModels; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.IO; 6 | 7 | namespace BeatSaberModManager.Core 8 | { 9 | public class InstallerLogic 10 | { 11 | 12 | #region Events 13 | public event StatusUpdateHandler StatusUpdate; 14 | public delegate void StatusUpdateHandler(string status); 15 | #endregion 16 | 17 | #region Variables 18 | List releases; 19 | public string installDirectory; 20 | #endregion 21 | 22 | #region Constructor 23 | public InstallerLogic(List _releases, string _installDirectory) 24 | { 25 | releases = _releases; 26 | installDirectory = _installDirectory; 27 | } 28 | #endregion 29 | 30 | #region Logic 31 | public void Run() 32 | { 33 | try 34 | { 35 | StatusUpdate("Starting install sequence..."); 36 | 37 | ReleaseInfo bsipa = null; 38 | if ((bsipa = releases.Find(release => release.name.ToLower() == "bsipa")) != null) 39 | { 40 | StatusUpdate($"Downloading...{bsipa.title}"); 41 | byte[] file = Helper.GetFile(bsipa.downloadLink); 42 | StatusUpdate($"Unzipping...{bsipa.title}"); 43 | Helper.UnzipFile(file, installDirectory); 44 | StatusUpdate($"Unzipped! {bsipa.title}"); 45 | 46 | releases.Remove(bsipa); // don't want to double down 47 | } 48 | 49 | var toInstall = Path.Combine(installDirectory, "IPA", "Pending"); 50 | Directory.CreateDirectory(toInstall); 51 | 52 | foreach (ReleaseInfo release in releases) 53 | { 54 | if (release.install) 55 | { 56 | StatusUpdate($"Downloading...{release.title}"); 57 | byte[] file = Helper.GetFile(release.downloadLink); 58 | StatusUpdate($"Unzipping...{release.title}"); 59 | Helper.UnzipFile(file, toInstall); 60 | StatusUpdate($"Unzipped! {release.title}"); 61 | } 62 | } 63 | 64 | // Only ever going to be downloading BSIPA 65 | Process.Start(new ProcessStartInfo 66 | { 67 | FileName = Path.Combine(installDirectory, "IPA.exe"), 68 | WorkingDirectory = installDirectory, 69 | Arguments = "-n" 70 | }).WaitForExit(); 71 | 72 | StatusUpdate("Install complete!"); 73 | } catch (Exception ex) 74 | { 75 | StatusUpdate("Install failed! " + ex.ToString()); 76 | Console.WriteLine("Install failed! " + ex.ToString()); 77 | } 78 | 79 | } 80 | #endregion 81 | 82 | #region Helpers 83 | public string Quoted(string str) 84 | { 85 | return "\"" + str + "\""; 86 | } 87 | #endregion 88 | 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /BeatSaberModManager/Core/UpdateLogic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.IO; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using BeatSaberModManager.Dependencies.SimpleJSON; 11 | using Version = SemVer.Version; 12 | 13 | namespace BeatSaberModManager.Core 14 | { 15 | class UpdateLogic 16 | { 17 | static readonly string repo = "beat-saber-modding-group/BeatSaberModInstaller"; 18 | static readonly string releaseURL = $"https://api.github.com/repos/{repo}/releases/latest"; 19 | 20 | public JSONNode LatestRelease() 21 | { 22 | string resp = Helper.Get(releaseURL); 23 | return JSON.Parse(resp); 24 | } 25 | 26 | public Version CurrentVersion() 27 | { 28 | string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); 29 | version = version.Substring(2, version.Length - 2); 30 | return new Version(version, true); 31 | } 32 | 33 | public Version RemoteVersion() 34 | { 35 | JSONNode json = LatestRelease(); 36 | 37 | string tag = json["tag_name"]; 38 | return new Version(tag); 39 | } 40 | 41 | public Version RemoteVersion(JSONNode json) 42 | { 43 | string tag = json["tag_name"]; 44 | return new Version(tag); 45 | } 46 | 47 | public void CheckForUpdates() 48 | { 49 | // Define application paths 50 | string path = Application.ExecutablePath; 51 | string installDir = Path.GetDirectoryName(path); 52 | string tempPath = Path.Combine(installDir, "ModManagerOld.exe"); 53 | 54 | // Cleanup old releases 55 | if (File.Exists(tempPath)) 56 | File.Delete(tempPath); 57 | 58 | // Fetch release info 59 | JSONNode release = LatestRelease(); 60 | 61 | // Fetch version info 62 | Version current = CurrentVersion(); 63 | Version remote = RemoteVersion(release); 64 | 65 | bool updateAvailable = remote > current; 66 | if (!updateAvailable) 67 | return; 68 | 69 | // Fetch EXE from release 70 | JSONArray assets = release["assets"].AsArray; 71 | JSONObject exe; 72 | 73 | try 74 | { 75 | exe = assets.Linq.First(x => 76 | { 77 | string name = x.Value["name"].ToString().Trim('"'); 78 | return name.Contains("BeatSaberModManager.exe"); 79 | }).Value.AsObject; 80 | } 81 | catch 82 | { 83 | // Show handy warning when no EXE can be found 84 | MessageBox.Show( 85 | "A new version of the Mod Manager was found but no update could be downloaded.\n" + 86 | "Please check the new release manually.", 87 | "Update failed!", 88 | MessageBoxButtons.OK, 89 | MessageBoxIcon.Exclamation 90 | ); 91 | 92 | Process.Start($"https://github.com/{repo}/releases"); 93 | return; 94 | } 95 | 96 | // Prompt that a restart is about to happen 97 | MessageBox.Show( 98 | "A new version of the Mod Manager is available.\n" + 99 | "Click OK to install the update." + 100 | "\n\n" + 101 | "The mod manager will restart once the update has downloaded.", 102 | "Update available!", 103 | MessageBoxButtons.OK, 104 | MessageBoxIcon.Information 105 | ); 106 | 107 | // Download new version 108 | string downloadURL = exe["browser_download_url"]; 109 | byte[] newVersion = Helper.GetFile(downloadURL); 110 | 111 | // Move the current version to a temporary file so we can use the same EXE name 112 | File.Move(path, tempPath); 113 | File.WriteAllBytes(path, newVersion); 114 | 115 | // Restart with new update 116 | Process.Start(Application.ExecutablePath); 117 | 118 | Process.GetCurrentProcess().Kill(); 119 | Environment.Exit(0); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /BeatSaberModManager/DataModels/GameVersion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BeatSaberModManager.DataModels 8 | { 9 | public struct GameVersion 10 | { 11 | public string value; 12 | 13 | public GameVersion(string _value) 14 | { 15 | value = _value; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BeatSaberModManager/DataModels/ModLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BeatSaberModManager.DataModels 8 | { 9 | public struct ModLink 10 | { 11 | public string name; 12 | public string semver; 13 | 14 | public ModLink(string _name, string _semver) 15 | { 16 | name = _name; 17 | semver = _semver; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BeatSaberModManager/DataModels/Platform.cs: -------------------------------------------------------------------------------- 1 | public enum Platform 2 | { 3 | Default, 4 | Steam, 5 | Oculus 6 | } 7 | -------------------------------------------------------------------------------- /BeatSaberModManager/DataModels/ReleaseInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace BeatSaberModManager.DataModels 9 | { 10 | public class ReleaseInfo 11 | { 12 | public string name; 13 | public string title; 14 | public string author; 15 | 16 | public string version; 17 | public string description; 18 | 19 | public int weight; 20 | public string category; 21 | 22 | public string gameVersion; 23 | public string downloadLink; 24 | 25 | public string infoLink; 26 | 27 | public Platform platform; 28 | 29 | public bool install; 30 | public bool disabled; 31 | 32 | public ListViewItem itemHandle; 33 | 34 | public List dependsOn; 35 | public List conflictsWith; 36 | 37 | public ReleaseInfo( 38 | string _name, string _title, string _version, string _author, string _description, string _infoLink, 39 | int _weight, string _gameVersion, string _downloadLink, string _category, 40 | Platform _platform, List _dependsOn, List _conflictsWith 41 | ) 42 | { 43 | name = _name; 44 | title = _title; 45 | version = _version; 46 | author = _author; 47 | description = _description; 48 | infoLink = _infoLink; 49 | weight = _weight; 50 | gameVersion = _gameVersion; 51 | downloadLink = _downloadLink; 52 | category = _category.First().ToString().ToUpper() + _category.Substring(1); 53 | platform = _platform; 54 | dependsOn = _dependsOn; 55 | conflictsWith = _conflictsWith; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/CommonMarkAdditionalFeatures.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CommonMark 4 | { 5 | /// 6 | /// Lists additional features that can be enabled in . 7 | /// These features are not part of the standard and should not be used if interoperability with other 8 | /// CommonMark implementations is required. 9 | /// 10 | [Flags] 11 | public enum CommonMarkAdditionalFeatures 12 | { 13 | /// 14 | /// No additional features are enabled. This is the default. 15 | /// 16 | None = 0, 17 | 18 | /// 19 | /// The parser will recognize syntax ~~foo~~ that will be rendered as <del>foo</del>. 20 | /// 21 | StrikethroughTilde = 1, 22 | 23 | /// 24 | /// The parser will recognize syntax [foo], which will be encoded in a separate AST node that the host application may evaluate as desired. 25 | /// 26 | PlaceholderBracket = 2, 27 | 28 | /// 29 | /// All additional features are enabled. 30 | /// 31 | All = 0x7FFFFFFF 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/CommonMarkException.cs: -------------------------------------------------------------------------------- 1 | using CommonMark.Syntax; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace CommonMark 7 | { 8 | /// 9 | /// An exception that is caught during CommonMark parsing or formatting. 10 | /// 11 | #if v2_0 || v3_5 || v4_0 || v4_5 12 | [Serializable] 13 | #endif 14 | public class CommonMarkException : Exception 15 | { 16 | /// 17 | /// Gets the block that caused the exception. Can be . 18 | /// 19 | public Block BlockElement { get; private set; } 20 | 21 | /// 22 | /// Gets the inline element that caused the exception. Can be . 23 | /// 24 | public Inline InlineElement { get; private set; } 25 | 26 | /// Initializes a new instance of the class. 27 | public CommonMarkException() { } 28 | 29 | /// Initializes a new instance of the class with a specified error message. 30 | /// The message that describes the error. 31 | public CommonMarkException(string message) : base(message) { } 32 | 33 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 34 | /// The error message that explains the reason for the exception. 35 | /// The exception that is the cause of the current exception, or if no inner exception is specified. 36 | public CommonMarkException(string message, Exception innerException) : base(message, innerException) { } 37 | 38 | /// Initializes a new instance of the class with a specified error message, a reference to the element that caused it and a reference to the inner exception that is the cause of this exception. 39 | /// The error message that explains the reason for the exception. 40 | /// The inline element that is related to the exception cause. 41 | /// The exception that is the cause of the current exception, or if no inner exception is specified. 42 | public CommonMarkException(string message, Inline inline, Exception innerException = null) 43 | : base(message, innerException) 44 | { 45 | this.InlineElement = inline; 46 | } 47 | 48 | /// Initializes a new instance of the class with a specified error message, a reference to the element that caused it and a reference to the inner exception that is the cause of this exception. 49 | /// The error message that explains the reason for the exception. 50 | /// The block element that is related to the exception cause. 51 | /// The exception that is the cause of the current exception, or if no inner exception is specified. 52 | public CommonMarkException(string message, Block block, Exception innerException = null) 53 | : base(message, innerException) 54 | { 55 | this.BlockElement = block; 56 | } 57 | 58 | #if v2_0 || v3_5 || v4_0 || v4_5 59 | /// Initializes a new instance of the class from the specified instances of the and classes. 60 | /// A instance that contains the information required to deserialize the new instance. 61 | /// A instance. 62 | [System.Security.SecuritySafeCritical] 63 | protected CommonMarkException( 64 | System.Runtime.Serialization.SerializationInfo serializationInfo, 65 | System.Runtime.Serialization.StreamingContext streamingContext) 66 | : base(serializationInfo, streamingContext) 67 | { 68 | // Block and Inline classes are not marked [Serializable] and thus cannot be used here. 69 | // Currently there also aren't any good use cases where this would provide added value. 70 | ////this.BlockElement = (Block)info.GetValue("BlockElement", typeof(Block)); 71 | ////this.InlineElement = (Inline)info.GetValue("InlineElement", typeof(Inline)); 72 | } 73 | 74 | /// Sets the with information about the exception. 75 | /// The that holds the serialized object data about the exception being thrown. 76 | /// The that contains contextual information about the source or destination. 77 | /// The parameter is . 78 | [System.Security.SecurityCritical] 79 | public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) 80 | { 81 | base.GetObjectData(info, context); 82 | ////info.AddValue("BlockElement", this.BlockElement); 83 | ////info.AddValue("InlineElement", this.InlineElement); 84 | } 85 | #endif 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Formatters/HtmlTextWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using CommonMark.Syntax; 3 | 4 | namespace CommonMark.Formatters 5 | { 6 | /// 7 | /// A wrapper for that keeps track if the last symbol has been a newline. 8 | /// 9 | internal sealed class HtmlTextWriter 10 | { 11 | private readonly TextWriter _inner; 12 | private char _last = '\n'; 13 | private readonly bool _windowsNewLine; 14 | private readonly char[] _newline; 15 | 16 | /// 17 | /// A reusable char buffer. This is used internally in (and thus will modify the buffer) 18 | /// but can also be used from class. 19 | /// 20 | internal char[] Buffer = new char[256]; 21 | 22 | public HtmlTextWriter(TextWriter inner) 23 | { 24 | this._inner = inner; 25 | 26 | var nl = inner.NewLine; 27 | this._newline = nl.ToCharArray(); 28 | this._windowsNewLine = nl == "\r\n"; 29 | } 30 | 31 | public void WriteLine() 32 | { 33 | this._inner.Write(this._newline); 34 | this._last = '\n'; 35 | } 36 | 37 | public void WriteLine(char data) 38 | { 39 | if (data == '\n' && this._windowsNewLine && this._last != '\r') 40 | this._inner.Write('\r'); 41 | 42 | this._inner.Write(data); 43 | this._inner.Write(this._newline); 44 | this._last = '\n'; 45 | } 46 | 47 | public void Write(StringPart value) 48 | { 49 | if (value.Length == 0) 50 | return; 51 | 52 | if (this.Buffer.Length < value.Length) 53 | this.Buffer = new char[value.Length]; 54 | 55 | value.Source.CopyTo(value.StartIndex, this.Buffer, 0, value.Length); 56 | 57 | if (this._windowsNewLine) 58 | { 59 | var lastPos = value.StartIndex; 60 | var pos = lastPos; 61 | 62 | while (-1 != (pos = value.Source.IndexOf('\n', pos, value.Length - pos + value.StartIndex))) 63 | { 64 | var lastC = pos == 0 ? this._last : value.Source[pos - 1]; 65 | 66 | if (lastC != '\r') 67 | { 68 | this._inner.Write(this.Buffer, lastPos - value.StartIndex, pos - lastPos); 69 | this._inner.Write('\r'); 70 | lastPos = pos; 71 | } 72 | 73 | pos++; 74 | } 75 | 76 | this._inner.Write(this.Buffer, lastPos - value.StartIndex, value.Length - lastPos + value.StartIndex); 77 | } 78 | else 79 | { 80 | this._inner.Write(this.Buffer, 0, value.Length); 81 | } 82 | 83 | this._last = this.Buffer[value.Length - 1]; 84 | } 85 | 86 | /// 87 | /// Writes a value that is known not to contain any newlines. 88 | /// 89 | public void WriteConstant(char[] value) 90 | { 91 | this._last = 'c'; 92 | this._inner.Write(value, 0, value.Length); 93 | } 94 | 95 | /// 96 | /// Writes a value that is known not to contain any newlines. 97 | /// 98 | public void WriteConstant(char[] value, int startIndex, int length) 99 | { 100 | this._last = 'c'; 101 | this._inner.Write(value, startIndex, length); 102 | } 103 | 104 | /// 105 | /// Writes a value that is known not to contain any newlines. 106 | /// 107 | public void WriteConstant(string value) 108 | { 109 | this._last = 'c'; 110 | this._inner.Write(value); 111 | } 112 | 113 | /// 114 | /// Writes a value that is known not to contain any newlines. 115 | /// 116 | public void WriteLineConstant(string value) 117 | { 118 | this._last = '\n'; 119 | this._inner.Write(value); 120 | this._inner.Write(this._newline); 121 | } 122 | 123 | public void Write(char[] value, int index, int count) 124 | { 125 | if (value == null || count == 0) 126 | return; 127 | 128 | if (this._windowsNewLine) 129 | { 130 | var lastPos = index; 131 | var pos = index; 132 | 133 | while (pos < index + count) 134 | { 135 | if (value[pos] != '\n') 136 | { 137 | pos++; 138 | continue; 139 | } 140 | 141 | var lastC = pos == index ? this._last : value[pos - 1]; 142 | 143 | if (lastC != '\r') 144 | { 145 | this._inner.Write(value, lastPos, pos - lastPos); 146 | this._inner.Write('\r'); 147 | lastPos = pos; 148 | } 149 | 150 | pos++; 151 | } 152 | 153 | this._inner.Write(value, lastPos, index + count - lastPos); 154 | } 155 | else 156 | { 157 | this._inner.Write(value, index, count); 158 | } 159 | 160 | this._last = value[index + count - 1]; 161 | } 162 | 163 | public void Write(char value) 164 | { 165 | if (value == '\n' && this._windowsNewLine && this._last != '\r') 166 | this._inner.Write('\r'); 167 | 168 | this._last = value; 169 | this._inner.Write(value); 170 | } 171 | 172 | /// 173 | /// Adds a newline if the writer does not currently end with a newline. 174 | /// 175 | public void EnsureLine() 176 | { 177 | if (this._last != '\n') 178 | this.WriteLine(); 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Func.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CommonMark 4 | { 5 | #if v2_0 6 | /// An alternative to System.Func which is not present in .NET 2.0. 7 | public delegate TResult Func(); 8 | 9 | /// An alternative to System.Func which is not present in .NET 2.0. 10 | public delegate TResult Func(T arg); 11 | 12 | /// An alternative to System.Action which is not present in .NET 2.0. 13 | public delegate void Action(T1 arg1, T2 arg2, T3 arg3); 14 | #endif 15 | } 16 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Lazy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CommonMark 4 | { 5 | #if v2_0 || v3_5 6 | enum LazyThreadSafetyMode 7 | { 8 | None, 9 | PublicationOnly, 10 | ExecutionAndPublication 11 | } 12 | 13 | class Lazy 14 | { 15 | private readonly Func valueFactory; 16 | private readonly bool isThreadSafe; 17 | private readonly object _lock = new object(); 18 | private T value; 19 | 20 | public Lazy(Func valueFactory) 21 | : this(valueFactory, true) 22 | { 23 | } 24 | 25 | public Lazy(Func valueFactory, LazyThreadSafetyMode mode) 26 | : this(valueFactory, mode != LazyThreadSafetyMode.None) 27 | { 28 | } 29 | 30 | public Lazy(Func valueFactory, bool isThreadSafe) 31 | { 32 | this.valueFactory = valueFactory; 33 | this.isThreadSafe = isThreadSafe; 34 | } 35 | 36 | public T Value 37 | { 38 | get 39 | { 40 | if (value == null) 41 | { 42 | if (!isThreadSafe) 43 | { 44 | return value = valueFactory(); 45 | } 46 | lock (_lock) 47 | { 48 | if (value == null) 49 | { 50 | value = valueFactory(); 51 | } 52 | } 53 | } 54 | return value; 55 | } 56 | } 57 | } 58 | #endif 59 | } 60 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/OutputFormat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark 6 | { 7 | /// 8 | /// Specifies different formatters supported by the converter. 9 | /// 10 | public enum OutputFormat 11 | { 12 | /// 13 | /// The output is standard HTML format according to the CommonMark specification. 14 | /// 15 | Html, 16 | 17 | /// 18 | /// The output is a debug view of the syntax tree. Usable for debugging. 19 | /// 20 | SyntaxTree, 21 | 22 | /// 23 | /// The output is written using a delegate function specified in . 24 | /// 25 | CustomDelegate 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Parser/LineInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Parser 6 | { 7 | internal sealed class LineInfo 8 | { 9 | public LineInfo(bool trackPositions) 10 | { 11 | this.IsTrackingPositions = trackPositions; 12 | } 13 | 14 | public readonly bool IsTrackingPositions; 15 | 16 | public string Line; 17 | 18 | /// 19 | /// Gets or sets the offset in the source data at which the current line starts. 20 | /// 21 | public int LineOffset; 22 | 23 | public int LineNumber; 24 | 25 | public PositionOffset[] Offsets = new PositionOffset[20]; 26 | 27 | public int OffsetCount; 28 | 29 | public void AddOffset(int position, int offset) 30 | { 31 | if (offset == 0) 32 | return; 33 | 34 | if (this.OffsetCount == this.Offsets.Length) 35 | Array.Resize(ref this.Offsets, this.OffsetCount + 20); 36 | 37 | this.Offsets[this.OffsetCount++] = new PositionOffset(position, offset); 38 | } 39 | 40 | public override string ToString() 41 | { 42 | string ln; 43 | if (this.Line == null) 44 | ln = string.Empty; 45 | else if (this.Line.Length < 50) 46 | ln = this.Line; 47 | else 48 | ln = this.Line.Substring(0, 49) + "…"; 49 | 50 | return this.LineNumber.ToString(System.Globalization.CultureInfo.InvariantCulture) 51 | + ": " + ln; 52 | } 53 | 54 | public int CalculateOrigin(int position, bool isStartPosition) 55 | { 56 | return PositionTracker.CalculateOrigin(this.Offsets, this.OffsetCount, this.LineOffset + position, true, isStartPosition); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Parser/PositionOffset.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Parser 6 | { 7 | internal struct PositionOffset 8 | { 9 | public PositionOffset(int position, int offset) 10 | { 11 | this.Position = position; 12 | this.Offset = offset; 13 | } 14 | 15 | public int Position; 16 | public int Offset; 17 | 18 | public override string ToString() 19 | { 20 | if (this.Offset == 0) 21 | return "empty"; 22 | 23 | return (this.Offset < 0 ? string.Empty : "+") 24 | + this.Offset.ToString(System.Globalization.CultureInfo.InvariantCulture) 25 | + " chars @ " + this.Position.ToString(System.Globalization.CultureInfo.InvariantCulture); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Parser/PositionTracker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Parser 6 | { 7 | internal sealed class PositionTracker 8 | { 9 | public PositionTracker(int blockOffset) 10 | { 11 | this._blockOffset = blockOffset; 12 | } 13 | 14 | private static readonly PositionOffset EmptyPositionOffset = default(PositionOffset); 15 | 16 | private int _blockOffset; 17 | 18 | public void AddBlockOffset(int offset) 19 | { 20 | this._blockOffset += offset; 21 | } 22 | 23 | public void AddOffset(LineInfo line, int startIndex, int length) 24 | { 25 | if (this.OffsetCount + line.OffsetCount + 2 >= this.Offsets.Length) 26 | Array.Resize(ref this.Offsets, this.Offsets.Length + line.OffsetCount + 20); 27 | 28 | PositionOffset po1, po2; 29 | 30 | if (startIndex > 0) 31 | po1 = new PositionOffset( 32 | CalculateOrigin(line.Offsets, line.OffsetCount, line.LineOffset, false, true), 33 | startIndex); 34 | else 35 | po1 = EmptyPositionOffset; 36 | 37 | if (line.Line.Length - startIndex - length > 0) 38 | po2 = new PositionOffset( 39 | CalculateOrigin(line.Offsets, line.OffsetCount, line.LineOffset + startIndex + length, false, true), 40 | line.Line.Length - startIndex - length); 41 | else 42 | po2 = EmptyPositionOffset; 43 | 44 | var indexAfterLastCopied = 0; 45 | 46 | if (po1.Offset == 0) 47 | { 48 | if (po2.Offset == 0) 49 | goto FINTOTAL; 50 | 51 | po1 = po2; 52 | po2 = EmptyPositionOffset; 53 | } 54 | 55 | for (var i = 0; i < line.OffsetCount; i++) 56 | { 57 | var pc = line.Offsets[i]; 58 | if (pc.Position > po1.Position) 59 | { 60 | if (i > indexAfterLastCopied) 61 | { 62 | Array.Copy(line.Offsets, indexAfterLastCopied, this.Offsets, this.OffsetCount, i - indexAfterLastCopied); 63 | this.OffsetCount += i - indexAfterLastCopied; 64 | indexAfterLastCopied = i; 65 | } 66 | 67 | this.Offsets[this.OffsetCount++] = po1; 68 | 69 | po1 = po2; 70 | 71 | if (po1.Offset == 0) 72 | goto FIN; 73 | 74 | po2 = EmptyPositionOffset; 75 | } 76 | } 77 | 78 | FIN: 79 | if (po1.Offset != 0) 80 | this.Offsets[this.OffsetCount++] = po1; 81 | 82 | if (po2.Offset != 0) 83 | this.Offsets[this.OffsetCount++] = po2; 84 | 85 | FINTOTAL: 86 | Array.Copy(line.Offsets, indexAfterLastCopied, this.Offsets, this.OffsetCount, line.OffsetCount - indexAfterLastCopied); 87 | this.OffsetCount += line.OffsetCount - indexAfterLastCopied; 88 | } 89 | 90 | public int CalculateInlineOrigin(int position, bool isStartPosition) 91 | { 92 | return CalculateOrigin(this.Offsets, this.OffsetCount, this._blockOffset + position, true, isStartPosition); 93 | } 94 | 95 | internal static int CalculateOrigin(PositionOffset[] offsets, int offsetCount, int position, bool includeReduce, bool isStart) 96 | { 97 | if (isStart) 98 | position++; 99 | 100 | var minus = 0; 101 | for (var i = 0; i < offsetCount; i++) 102 | { 103 | var po = offsets[i]; 104 | if (po.Position < position) 105 | { 106 | if (po.Offset > 0) 107 | position += po.Offset; 108 | else 109 | minus += po.Offset; 110 | } 111 | else 112 | break; 113 | } 114 | 115 | if (includeReduce) 116 | position += minus; 117 | 118 | if (isStart) 119 | position--; 120 | 121 | return position; 122 | } 123 | 124 | private PositionOffset[] Offsets = new PositionOffset[10]; 125 | private int OffsetCount; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Parser/Subject.cs: -------------------------------------------------------------------------------- 1 | using CommonMark.Syntax; 2 | using System.Text; 3 | 4 | namespace CommonMark.Parser 5 | { 6 | [System.Diagnostics.DebuggerDisplay("{DebugToString()}")] 7 | internal sealed class Subject 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | /// Document data. 13 | public Subject(DocumentData documentData) 14 | { 15 | this.DocumentData = documentData; 16 | } 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// String buffer. 22 | /// Document data. 23 | public Subject(string buffer, DocumentData documentData) 24 | { 25 | this.Buffer = buffer; 26 | this.Length = buffer.Length; 27 | this.DocumentData = documentData; 28 | } 29 | 30 | #if DEBUG 31 | public int DebugStartIndex; 32 | #endif 33 | 34 | /// 35 | /// Gets or sets the whole buffer this instance is created over. 36 | /// 37 | public string Buffer; 38 | 39 | /// 40 | /// Gets or sets the current position in the buffer. 41 | /// 42 | public int Position; 43 | 44 | /// 45 | /// Gets or sets the length of the usable buffer. This can be less than the actual length of the 46 | /// buffer if some characters at the end of the buffer have to be ignored. 47 | /// 48 | public int Length; 49 | 50 | /// 51 | /// The last top-level inline parsed from this subject. 52 | /// 53 | public Inline LastInline; 54 | 55 | /// 56 | /// The last entry of the current stack of possible emphasis openers. Can be . 57 | /// 58 | public InlineStack LastPendingInline; 59 | 60 | /// 61 | /// The first entry of the current stack of possible emphasis openers. Can be . 62 | /// 63 | public InlineStack FirstPendingInline; 64 | 65 | /// 66 | /// A reusable StringBuilder that should be used instead of creating new instances to conserve memory. 67 | /// 68 | public StringBuilder ReusableStringBuilder = new StringBuilder(); 69 | 70 | /// 71 | /// Additional properties that apply to document nodes. 72 | /// 73 | public readonly DocumentData DocumentData; 74 | 75 | #if !NETCore 76 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Used by [DebuggerDisplay]")] 77 | #endif 78 | // ReSharper disable once UnusedMethodReturnValue.Local 79 | private string DebugToString() 80 | { 81 | var res = this.Buffer.Insert(this.Length, "|"); 82 | res = res.Insert(this.Position, "⁞"); 83 | 84 | #if DEBUG 85 | res = res.Insert(this.DebugStartIndex, "|"); 86 | #endif 87 | 88 | return res; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Parser/TabTextReader.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | 4 | namespace CommonMark.Parser 5 | { 6 | internal sealed class TabTextReader 7 | { 8 | private const int _bufferSize = 4000; 9 | private readonly TextReader _inner; 10 | private readonly char[] _buffer; 11 | private int _bufferLength; 12 | private int _bufferPosition; 13 | private int _previousBufferLength; 14 | private readonly StringBuilder _builder; 15 | private bool _endOfStream; 16 | 17 | public TabTextReader(TextReader inner) 18 | { 19 | this._inner = inner; 20 | this._buffer = new char[_bufferSize]; 21 | this._builder = new StringBuilder(256); 22 | } 23 | 24 | private bool ReadBuffer() 25 | { 26 | if (this._endOfStream) 27 | return false; 28 | 29 | this._previousBufferLength += this._bufferLength; 30 | this._bufferLength = this._inner.Read(this._buffer, 0, _bufferSize); 31 | this._endOfStream = this._bufferLength == 0; 32 | this._bufferPosition = 0; 33 | return !this._endOfStream; 34 | } 35 | 36 | public void ReadLine(LineInfo line) 37 | { 38 | line.LineOffset = this._previousBufferLength + this._bufferPosition; 39 | line.LineNumber++; 40 | line.OffsetCount = 0; 41 | line.Line = null; 42 | var tabIncreaseCount = 0; 43 | 44 | if (this._bufferPosition == this._bufferLength && !this.ReadBuffer()) 45 | return; 46 | 47 | bool useBuilder = false; 48 | int num; 49 | char c; 50 | 51 | while (true) 52 | { 53 | num = this._bufferPosition; 54 | do 55 | { 56 | c = this._buffer[num]; 57 | if (c == '\r' || c == '\n') 58 | goto IL_4A; 59 | 60 | if (c == '\0') 61 | this._buffer[num] = '\uFFFD'; 62 | 63 | num++; 64 | } 65 | while (num < this._bufferLength); 66 | 67 | num = this._bufferLength - this._bufferPosition; 68 | if (!useBuilder) 69 | { 70 | useBuilder = true; 71 | this._builder.Length = 0; 72 | } 73 | 74 | this._builder.Append(this._buffer, this._bufferPosition, num); 75 | if (!this.ReadBuffer()) 76 | { 77 | this._builder.Append('\n'); 78 | line.Line = this._builder.ToString(); 79 | return; 80 | } 81 | } 82 | 83 | IL_4A: 84 | string result; 85 | this._buffer[num] = '\n'; 86 | if (useBuilder) 87 | { 88 | this._builder.Append(this._buffer, this._bufferPosition, num - this._bufferPosition + 1); 89 | result = this._builder.ToString(); 90 | } 91 | else 92 | { 93 | result = new string(this._buffer, this._bufferPosition, num - this._bufferPosition + 1); 94 | } 95 | 96 | this._bufferPosition = num + 1; 97 | 98 | if (c == '\r' && (this._bufferPosition < this._bufferLength || this.ReadBuffer()) && this._buffer[this._bufferPosition] == '\n') 99 | { 100 | if (line.IsTrackingPositions) 101 | line.AddOffset(this._previousBufferLength + this._bufferPosition - 1 + tabIncreaseCount, 1); 102 | 103 | this._bufferPosition++; 104 | } 105 | 106 | line.Line = result; 107 | } 108 | 109 | public bool EndOfStream() 110 | { 111 | return this._endOfStream || (this._bufferPosition == this._bufferLength && !this.ReadBuffer()); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/BlockTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CommonMark.Syntax 4 | { 5 | /// 6 | /// Specifies the element type of a instance. 7 | /// 8 | public enum BlockTag : byte 9 | { 10 | /// 11 | /// The root element that represents the document itself. There should only be one in the tree. 12 | /// 13 | Document, 14 | 15 | /// 16 | /// A block-quote element. 17 | /// 18 | BlockQuote, 19 | 20 | /// 21 | /// A list element. Will contain nested blocks with type of . 22 | /// 23 | List, 24 | 25 | /// 26 | /// An item in a block element of type . 27 | /// 28 | ListItem, 29 | 30 | /// 31 | /// A code block element that was formatted with fences (for example, ~~~\nfoo\n~~~). 32 | /// 33 | FencedCode, 34 | 35 | /// 36 | /// A code block element that was formatted by indenting the lines with at least 4 spaces. 37 | /// 38 | IndentedCode, 39 | 40 | /// 41 | /// A raw HTML code block element. 42 | /// 43 | HtmlBlock, 44 | 45 | /// 46 | /// A paragraph block element. 47 | /// 48 | Paragraph, 49 | 50 | /// 51 | /// A heading element that was parsed from an ATX style markup (## heading 2). 52 | /// 53 | AtxHeading, 54 | 55 | /// 56 | /// Obsolete. Use instead. 57 | /// 58 | AtxHeader = AtxHeading, 59 | 60 | /// 61 | /// A heading element that was parsed from a Setext style markup (heading\n========). 62 | /// 63 | SetextHeading, 64 | 65 | /// 66 | /// Obsolete. Use instead. 67 | /// 68 | SETextHeader = SetextHeading, 69 | 70 | /// 71 | /// A thematic break element. 72 | /// 73 | ThematicBreak, 74 | 75 | /// 76 | /// Obsolete. Use instead. 77 | /// 78 | HorizontalRuler = ThematicBreak, 79 | 80 | /// 81 | /// A text block that contains only link reference definitions. 82 | /// 83 | ReferenceDefinition 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/DocumentData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace CommonMark.Syntax 4 | { 5 | /// 6 | /// Contains additional data for document elements. Used in the property. 7 | /// 8 | public class DocumentData 9 | { 10 | /// 11 | /// Gets or sets the dictionary containing resolved link references. Only set on the document node, 12 | /// and not used for all other elements. 13 | /// 14 | public Dictionary ReferenceMap { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/EmphasisData.cs: -------------------------------------------------------------------------------- 1 | namespace CommonMark.Syntax 2 | { 3 | /// 4 | /// Contains additional data for emphasis elements. Used in the property. 5 | /// 6 | public struct EmphasisData 7 | { 8 | /// 9 | /// Initializes a new instance of the struccture. 10 | /// 11 | /// Delimiter character. 12 | public EmphasisData(char delimiterCharacter) 13 | { 14 | DelimiterCharacter = delimiterCharacter; 15 | } 16 | 17 | /// 18 | /// Gets or sets the delimiter character. 19 | /// 20 | public char DelimiterCharacter { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/EnumeratorEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Syntax 6 | { 7 | /// 8 | /// Represents a single element in the document tree when traversing through it with the enumerator. 9 | /// 10 | /// 11 | public sealed class EnumeratorEntry 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | /// Specifies if this instance represents the opening of the block element. 17 | /// Specifies if this instance represents the closing of the block element (returned by the 18 | /// enumerator after the children have been enumerated). Both and 19 | /// can be specified at the same time if there are no children for the element. 20 | /// The block element being returned from the enumerator. 21 | public EnumeratorEntry(bool opening, bool closing, Block block) 22 | { 23 | this.IsOpening = opening; 24 | this.IsClosing = closing; 25 | this.Block = block; 26 | } 27 | 28 | /// 29 | /// Initializes a new instance of the class. 30 | /// 31 | /// Specifies if this instance represents the opening of the inline element. 32 | /// Specifies if this instance represents the closing of the inline element (returned by the 33 | /// enumerator after the children have been enumerated). Both and 34 | /// can be specified at the same time if there are no children for the element. 35 | /// The inlien element being returned from the enumerator. 36 | public EnumeratorEntry(bool opening, bool closing, Inline inline) 37 | { 38 | this.IsOpening = opening; 39 | this.IsClosing = closing; 40 | this.Inline = inline; 41 | } 42 | 43 | /// 44 | /// Gets the value indicating whether this instance represents the opening of the element (returned before enumerating 45 | /// over the children of the element). 46 | /// 47 | public bool IsOpening { get; private set; } 48 | 49 | /// 50 | /// Gets the value indicating whether this instance represents the closing of the element (returned by the 51 | /// enumerator after the children have been enumerated). Both and 52 | /// can be at the same time if there are no children for the given element. 53 | /// 54 | public bool IsClosing { get; private set; } 55 | 56 | /// 57 | /// Gets the inline element. Can be if is set. 58 | /// 59 | public Inline Inline { get; private set; } 60 | 61 | /// 62 | /// Gets the block element. Can be if is set. 63 | /// 64 | public Block Block { get; private set; } 65 | 66 | /// 67 | /// Returns a string that represents the current object. 68 | /// 69 | public override string ToString() 70 | { 71 | string r; 72 | 73 | if (this.IsOpening && this.IsClosing) 74 | r = "Complete "; 75 | else if (this.IsOpening) 76 | r = "Opening "; 77 | else if (this.IsClosing) 78 | r = "Closing "; 79 | else 80 | r = "Invalid "; 81 | 82 | if (this.Block != null) 83 | r += "block " + this.Block.Tag.ToString(); 84 | else if (this.Inline != null) 85 | { 86 | r += "inline " + this.Inline.Tag.ToString(); 87 | 88 | if (this.Inline.Tag == InlineTag.String) 89 | { 90 | if (this.Inline.LiteralContent == null) 91 | r += ": "; 92 | else if (this.Inline.LiteralContent.Length < 20) 93 | r += ": " + this.Inline.LiteralContent; 94 | else 95 | r += ": " + this.Inline.LiteralContent.Substring(0, 19) + "…"; 96 | } 97 | } 98 | else 99 | r += "empty"; 100 | 101 | return r; 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/FencedCodeData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Syntax 6 | { 7 | /// 8 | /// Contains additional data for fenced code blocks. Used in / 9 | /// 10 | public sealed class FencedCodeData 11 | { 12 | /// 13 | /// Gets or sets the number of characters that were used in the opening code fence. 14 | /// 15 | public int FenceLength { get; set; } 16 | 17 | /// 18 | /// Gets or sets the number of spaces the opening fence was indented. 19 | /// 20 | public int FenceOffset { get; set; } 21 | 22 | /// 23 | /// Gets or sets the character that is used in the fences. 24 | /// 25 | public char FenceChar { get; set; } 26 | 27 | /// 28 | /// Gets or sets the additional information that was present in the same line as the opening fence. 29 | /// 30 | public string Info { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/HeadingData.cs: -------------------------------------------------------------------------------- 1 | namespace CommonMark.Syntax 2 | { 3 | /// 4 | /// Contains additional data for heading elements. Used in the property. 5 | /// 6 | public struct HeadingData 7 | { 8 | /// 9 | /// Initializes a new instance of the structure. 10 | /// 11 | /// Heading level. 12 | public HeadingData(int level) 13 | { 14 | Level = level <= byte.MaxValue ? (byte)level : byte.MaxValue; 15 | } 16 | 17 | /// 18 | /// Gets or sets the heading level. 19 | /// 20 | public byte Level { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/HtmlBlockType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Syntax 6 | { 7 | /// 8 | /// Specifies the type of the HTML block a instance represents. 9 | /// See http://spec.commonmark.org/0.22/#html-block 10 | /// 11 | public enum HtmlBlockType 12 | { 13 | /// 14 | /// This is not a HTML block. 15 | /// 16 | None = 0, 17 | 18 | /// 19 | /// The HTML block represents script, pre or style element. Unline other HTML tags 20 | /// these are allowed to contain blank lines. 21 | /// 22 | InterruptingBlockWithEmptyLines = 1, 23 | 24 | /// 25 | /// The block represents an HTML comment. 26 | /// 27 | Comment = 2, 28 | 29 | /// 30 | /// The block represents a processing instruction <??> 31 | /// 32 | ProcessingInstruction = 3, 33 | 34 | /// 35 | /// The block represents a doctype element <!...> 36 | /// 37 | DocumentType = 4, 38 | 39 | /// 40 | /// The block represents <![CDATA[...]] element. 41 | /// 42 | CData = 5, 43 | 44 | /// 45 | /// This HTML block can interrupt paragraphs. 46 | /// 47 | InterruptingBlock = 6, 48 | 49 | /// 50 | /// This HTML block cannot interrupt paragraphs. 51 | /// 52 | NonInterruptingBlock = 7, 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/InlineContentLinkable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Syntax 6 | { 7 | /// 8 | /// An obsolete class. Used to contain properties specific to link inline elements. 9 | /// 10 | [Obsolete("These properties have been moved directly into the Inline element.")] 11 | [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 12 | public sealed class InlineContentLinkable 13 | { 14 | /// 15 | /// Gets or sets the URL of a link. Moved to . 16 | /// 17 | public string Url { get; set; } 18 | 19 | /// 20 | /// Gets or sets the title of a link. Moved to . 21 | /// 22 | public string Title { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/InlineTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CommonMark.Syntax 4 | { 5 | /// 6 | /// Specifies the element type of an instance. 7 | /// 8 | public enum InlineTag : byte 9 | { 10 | /// 11 | /// Represents a simple literal string content. Uses to specify the data. 12 | /// Cannot contain nested elements. 13 | /// 14 | String = 0, 15 | 16 | /// 17 | /// Represents a soft-break which by default is rendered as a simple newline and thus does not impact 18 | /// the display of the resulting HTML code. The 19 | /// property can be used to override this behavior and render soft-breaks as <br;> HTML 20 | /// elements. 21 | /// Cannot contain literal content or nested elements. 22 | /// 23 | SoftBreak, 24 | 25 | /// 26 | /// Represents a line-break which by default is rendered as a <br;> HTML element. 27 | /// Cannot contain literal content or nested elements. 28 | /// 29 | LineBreak, 30 | 31 | /// 32 | /// Represents an inline code element. Uses to specify the data. 33 | /// Cannot contain nested elements. 34 | /// 35 | Code, 36 | 37 | /// 38 | /// Represents raw HTML code. Uses to specify the data. 39 | /// Cannot contain nested elements. 40 | /// 41 | RawHtml, 42 | 43 | /// 44 | /// Represents an emphasis element. Uses to specify the contents. 45 | /// Cannot contain literal content. 46 | /// 47 | Emphasis, 48 | 49 | /// 50 | /// Represents a strong emphasis element. Uses to specify the contents. 51 | /// Cannot contain literal content. 52 | /// 53 | Strong, 54 | 55 | /// 56 | /// Represents a link element. Uses to specify the content (or label). 57 | /// Uses to specify the target of the link and 58 | /// to store the title of the link. 59 | /// 60 | Link, 61 | 62 | /// 63 | /// Represents an image element. Uses to specify the label (description). 64 | /// Uses to specify the source of the image and 65 | /// to store the title of the image. 66 | /// 67 | Image, 68 | 69 | /// 70 | /// Represents an inline element that has been "removed" (visually represented as strikethrough). 71 | /// Only present if the is enabled. 72 | /// 73 | Strikethrough, 74 | 75 | /// 76 | /// Represents a placeholder for context-specific features (substituted by the host application). 77 | /// If the host application does not process the placeholder, or the formatter does not support processing 78 | /// of placeholders, the placeholder will be rendered as text, including its delimiters. 79 | /// Only present if the is enabled. 80 | /// 81 | Placeholder 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/ListData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Syntax 6 | { 7 | /// 8 | /// Contains additional data for list block elements. Used in property. 9 | /// 10 | public sealed class ListData 11 | { 12 | /// 13 | /// Gets or sets the number of spaces the list markers are indented. 14 | /// 15 | public int MarkerOffset { get; set; } 16 | 17 | /// 18 | /// Gets or sets the position of the list item contents in the source text line. 19 | /// 20 | public int Padding { get; set; } 21 | 22 | /// 23 | /// Gets or sets the number for the first list item if is set to 24 | /// . 25 | /// 26 | public int Start { get; set; } 27 | 28 | /// 29 | /// Gets or sets the character used for unordered lists. Used if is set to 30 | /// . 31 | /// 32 | public char BulletChar { get; set; } 33 | 34 | /// 35 | /// Gets or sets the type (ordered or unordered) of this list. 36 | /// 37 | public ListType ListType { get; set; } 38 | 39 | /// 40 | /// Gets or sets the character that follows the number if is set to 41 | /// . 42 | /// 43 | public ListDelimiter Delimiter { get; set; } 44 | 45 | /// 46 | /// Gets or sets a value indicating whether the list is tight (such list will not render additional explicit 47 | /// paragraph elements). 48 | /// 49 | public bool IsTight { get; set; } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/ListDelimiter.cs: -------------------------------------------------------------------------------- 1 | namespace CommonMark.Syntax 2 | { 3 | /// 4 | /// Defines the delimiter used in the source for ordered lists. 5 | /// 6 | public enum ListDelimiter : byte 7 | { 8 | /// 9 | /// The item numbering is followed with a period (1. foo). 10 | /// 11 | Period = 0, 12 | 13 | /// 14 | /// The item numbering is followed with a closing parenthesis (1) foo). 15 | /// 16 | Parenthesis 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/ListType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Syntax 6 | { 7 | /// 8 | /// Defines the type of a list block element. 9 | /// 10 | public enum ListType 11 | { 12 | /// 13 | /// The list is unordered and its items are represented with bullets. 14 | /// 15 | Bullet = 0, 16 | 17 | /// 18 | /// The list is ordered and its items are numbered. 19 | /// 20 | Ordered 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/Reference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Syntax 6 | { 7 | /// 8 | /// Represents a parsed reference link definition. 9 | /// 10 | public sealed class Reference 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public Reference() 16 | { 17 | } 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | public Reference(string label, string url, string title) 23 | { 24 | this.Label = label; 25 | this.Url = url; 26 | this.Title = title; 27 | } 28 | 29 | /// 30 | /// Represents the maximum allowed length of a reference definition (foo in [foo]: /url). 31 | /// 32 | public const int MaximumReferenceLabelLength = 1000; 33 | 34 | /// 35 | /// A special constant reference that represents an collapsed reference link: [foo][] 36 | /// 37 | internal static readonly Reference SelfReference = new Reference(); 38 | 39 | /// 40 | /// A special constant reference that signifies that the reference label was not found: [foo][bar] 41 | /// 42 | internal static readonly Reference InvalidReference = new Reference(); 43 | 44 | /// 45 | /// Gets or sets the label (the key by which it is referenced in the mapping) of the reference. 46 | /// 47 | public string Label { get; set; } 48 | 49 | /// 50 | /// Gets or sets the URL of the reference. 51 | /// 52 | public string Url { get; set; } 53 | 54 | /// 55 | /// Gets or sets the title of the reference (used in <a title="...">). 56 | /// 57 | public string Title { get; set; } 58 | 59 | /// 60 | /// Gets or sets a value that indicates whether the current reference is a placeholder: [foo] 61 | /// 62 | public bool IsPlaceholder { get; set; } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Syntax/StringContentPart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark.Syntax 6 | { 7 | /// 8 | /// Represents a part of . 9 | /// 10 | internal struct StringPart 11 | { 12 | public StringPart(string source, int startIndex, int length) 13 | { 14 | this.Source = source; 15 | this.StartIndex = startIndex; 16 | this.Length = length; 17 | } 18 | 19 | /// 20 | /// Gets or sets the string object this part is created from. 21 | /// 22 | public string Source; 23 | 24 | /// 25 | /// Gets or sets the index at which this part starts. 26 | /// 27 | public int StartIndex; 28 | 29 | /// 30 | /// Gets or sets the length of the part. 31 | /// 32 | public int Length; 33 | 34 | public override string ToString() 35 | { 36 | if (this.Source == null) 37 | return null; 38 | 39 | return this.Source.Substring(this.StartIndex, this.Length); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/CommonMark/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CommonMark 6 | { 7 | /// 8 | /// Reusable utility functions, not directly related to parsing or formatting data. 9 | /// 10 | internal static class Utilities 11 | { 12 | /// 13 | /// Writes a warning to the Debug window. 14 | /// 15 | /// The message with optional formatting placeholders. 16 | /// The arguments for the formatting placeholders. 17 | [System.Diagnostics.Conditional("DEBUG")] 18 | public static void Warning(string message, params object[] args) 19 | { 20 | if (args != null && args.Length > 0) 21 | message = string.Format(System.Globalization.CultureInfo.InvariantCulture, message, args); 22 | 23 | System.Diagnostics.Debug.WriteLine(message, "Warning"); 24 | } 25 | 26 | #if OptimizeFor45 27 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 28 | #endif 29 | public static bool IsEscapableSymbol(char c) 30 | { 31 | // char.IsSymbol also works with Unicode symbols that cannot be escaped based on the specification. 32 | return (c > ' ' && c < '0') || (c > '9' && c < 'A') || (c > 'Z' && c < 'a') || (c > 'z' && c < 127) || c == '•'; 33 | } 34 | 35 | #if OptimizeFor45 36 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 37 | #endif 38 | public static bool IsAsciiLetter(char c) 39 | { 40 | return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); 41 | } 42 | 43 | #if OptimizeFor45 44 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 45 | #endif 46 | public static bool IsAsciiLetterOrDigit(char c) 47 | { 48 | return (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z'); 49 | } 50 | 51 | #if OptimizeFor45 52 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 53 | #endif 54 | public static bool IsWhitespace(char c) 55 | { 56 | return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f'; 57 | } 58 | 59 | /// 60 | /// Checks if the given character is an Unicode space or punctuation character. 61 | /// 62 | #if OptimizeFor45 63 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 64 | #endif 65 | public static void CheckUnicodeCategory(char c, out bool space, out bool punctuation) 66 | { 67 | // This method does the same as would calling the two built-in methods: 68 | // // space = char.IsWhiteSpace(c); 69 | // // punctuation = char.IsPunctuation(c); 70 | // 71 | // The performance benefit for using this method is ~50% when calling only on ASCII characters 72 | // and ~12% when calling only on Unicode characters. 73 | 74 | if (c <= 'ÿ') 75 | { 76 | space = c == ' ' || (c >= '\t' && c <= '\r') || c == '\u00a0' || c == '\u0085'; 77 | punctuation = (c >= 33 && c <= 47) || (c >= 58 && c <= 64) || (c >= 91 && c <= 96) || (c >= 123 && c <= 126); 78 | } 79 | else 80 | { 81 | var category = System.Globalization.CharUnicodeInfo.GetUnicodeCategory(c); 82 | space = category == System.Globalization.UnicodeCategory.SpaceSeparator 83 | || category == System.Globalization.UnicodeCategory.LineSeparator 84 | || category == System.Globalization.UnicodeCategory.ParagraphSeparator; 85 | punctuation = !space && 86 | (category == System.Globalization.UnicodeCategory.ConnectorPunctuation 87 | || category == System.Globalization.UnicodeCategory.DashPunctuation 88 | || category == System.Globalization.UnicodeCategory.OpenPunctuation 89 | || category == System.Globalization.UnicodeCategory.ClosePunctuation 90 | || category == System.Globalization.UnicodeCategory.InitialQuotePunctuation 91 | || category == System.Globalization.UnicodeCategory.FinalQuotePunctuation 92 | || category == System.Globalization.UnicodeCategory.OtherPunctuation); 93 | } 94 | } 95 | 96 | /// 97 | /// Determines if the first line (ignoring the first ) of a string contains only spaces. 98 | /// 99 | public static bool IsFirstLineBlank(string source, int startIndex) 100 | { 101 | char c; 102 | var lastIndex = source.Length; 103 | 104 | while (startIndex < lastIndex) 105 | { 106 | c = source[startIndex]; 107 | if (c == '\n') 108 | return true; 109 | 110 | if (c != ' ') 111 | return false; 112 | 113 | startIndex++; 114 | } 115 | 116 | return true; 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/BZip2/BZip2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace ICSharpCode.SharpZipLib.BZip2 5 | { 6 | /// 7 | /// An example class to demonstrate compression and decompression of BZip2 streams. 8 | /// 9 | public static class BZip2 10 | { 11 | /// 12 | /// Decompress the input writing 13 | /// uncompressed data to the output stream 14 | /// 15 | /// The readable stream containing data to decompress. 16 | /// The output stream to receive the decompressed data. 17 | /// Both streams are closed on completion if true. 18 | public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner) 19 | { 20 | if (inStream == null || outStream == null) { 21 | throw new Exception("Null Stream"); 22 | } 23 | 24 | try { 25 | using (BZip2InputStream bzipInput = new BZip2InputStream(inStream)) { 26 | bzipInput.IsStreamOwner = isStreamOwner; 27 | Core.StreamUtils.Copy(bzipInput, outStream, new byte[4096]); 28 | } 29 | } finally { 30 | if (isStreamOwner) { 31 | // inStream is closed by the BZip2InputStream if stream owner 32 | outStream.Dispose(); 33 | } 34 | } 35 | } 36 | 37 | /// 38 | /// Compress the input stream sending 39 | /// result data to output stream 40 | /// 41 | /// The readable stream to compress. 42 | /// The output stream to receive the compressed data. 43 | /// Both streams are closed on completion if true. 44 | /// Block size acts as compression level (1 to 9) with 1 giving 45 | /// the lowest compression and 9 the highest. 46 | public static void Compress(Stream inStream, Stream outStream, bool isStreamOwner, int level) 47 | { 48 | if (inStream == null || outStream == null) { 49 | throw new Exception("Null Stream"); 50 | } 51 | 52 | try { 53 | using (BZip2OutputStream bzipOutput = new BZip2OutputStream(outStream, level)) { 54 | bzipOutput.IsStreamOwner = isStreamOwner; 55 | Core.StreamUtils.Copy(inStream, bzipOutput, new byte[4096]); 56 | } 57 | } finally { 58 | if (isStreamOwner) { 59 | // outStream is closed by the BZip2OutputStream if stream owner 60 | inStream.Dispose(); 61 | } 62 | } 63 | } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/BZip2/BZip2Constants.cs: -------------------------------------------------------------------------------- 1 | namespace ICSharpCode.SharpZipLib.BZip2 2 | { 3 | /// 4 | /// Defines internal values for both compression and decompression 5 | /// 6 | internal sealed class BZip2Constants 7 | { 8 | /// 9 | /// Random numbers used to randomise repetitive blocks 10 | /// 11 | public readonly static int[] RandomNumbers = { 12 | 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, 13 | 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, 14 | 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, 15 | 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, 16 | 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, 17 | 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, 18 | 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, 19 | 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, 20 | 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, 21 | 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, 22 | 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, 23 | 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, 24 | 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, 25 | 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, 26 | 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, 27 | 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, 28 | 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, 29 | 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, 30 | 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, 31 | 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, 32 | 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, 33 | 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, 34 | 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, 35 | 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, 36 | 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, 37 | 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, 38 | 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, 39 | 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, 40 | 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, 41 | 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, 42 | 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, 43 | 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, 44 | 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, 45 | 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, 46 | 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, 47 | 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, 48 | 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, 49 | 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, 50 | 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, 51 | 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, 52 | 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, 53 | 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, 54 | 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, 55 | 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, 56 | 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, 57 | 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, 58 | 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, 59 | 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, 60 | 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, 61 | 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, 62 | 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 63 | 936, 638 64 | }; 65 | 66 | /// 67 | /// When multiplied by compression parameter (1-9) gives the block size for compression 68 | /// 9 gives the best compression but uses the most memory. 69 | /// 70 | public const int BaseBlockSize = 100000; 71 | 72 | /// 73 | /// Backend constant 74 | /// 75 | public const int MaximumAlphaSize = 258; 76 | 77 | /// 78 | /// Backend constant 79 | /// 80 | public const int MaximumCodeLength = 23; 81 | 82 | /// 83 | /// Backend constant 84 | /// 85 | public const int RunA = 0; 86 | 87 | /// 88 | /// Backend constant 89 | /// 90 | public const int RunB = 1; 91 | 92 | /// 93 | /// Backend constant 94 | /// 95 | public const int GroupCount = 6; 96 | 97 | /// 98 | /// Backend constant 99 | /// 100 | public const int GroupSize = 50; 101 | 102 | /// 103 | /// Backend constant 104 | /// 105 | public const int NumberOfIterations = 4; 106 | 107 | /// 108 | /// Backend constant 109 | /// 110 | public const int MaximumSelectors = (2 + (900000 / GroupSize)); 111 | 112 | /// 113 | /// Backend constant 114 | /// 115 | public const int OvershootBytes = 20; 116 | 117 | private BZip2Constants() 118 | { 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/BZip2/BZip2Exception.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.BZip2 4 | { 5 | /// 6 | /// BZip2Exception represents exceptions specific to BZip2 classes and code. 7 | /// 8 | public class BZip2Exception : SharpZipBaseException 9 | { 10 | /// 11 | /// Initialise a new instance of . 12 | /// 13 | public BZip2Exception() 14 | { 15 | } 16 | 17 | /// 18 | /// Initialise a new instance of with its message string. 19 | /// 20 | /// A that describes the error. 21 | public BZip2Exception(string message) 22 | : base(message) 23 | { 24 | } 25 | 26 | /// 27 | /// Initialise a new instance of . 28 | /// 29 | /// A that describes the error. 30 | /// The that caused this exception. 31 | public BZip2Exception(string message, Exception innerException) 32 | : base(message, innerException) 33 | { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Checksum/Adler32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.Checksum 4 | { 5 | /// 6 | /// Computes Adler32 checksum for a stream of data. An Adler32 7 | /// checksum is not as reliable as a CRC32 checksum, but a lot faster to 8 | /// compute. 9 | /// 10 | /// The specification for Adler32 may be found in RFC 1950. 11 | /// ZLIB Compressed Data Format Specification version 3.3) 12 | /// 13 | /// 14 | /// From that document: 15 | /// 16 | /// "ADLER32 (Adler-32 checksum) 17 | /// This contains a checksum value of the uncompressed data 18 | /// (excluding any dictionary data) computed according to Adler-32 19 | /// algorithm. This algorithm is a 32-bit extension and improvement 20 | /// of the Fletcher algorithm, used in the ITU-T X.224 / ISO 8073 21 | /// standard. 22 | /// 23 | /// Adler-32 is composed of two sums accumulated per byte: s1 is 24 | /// the sum of all bytes, s2 is the sum of all s1 values. Both sums 25 | /// are done modulo 65521. s1 is initialized to 1, s2 to zero. The 26 | /// Adler-32 checksum is stored as s2*65536 + s1 in most- 27 | /// significant-byte first (network) order." 28 | /// 29 | /// "8.2. The Adler-32 algorithm 30 | /// 31 | /// The Adler-32 algorithm is much faster than the CRC32 algorithm yet 32 | /// still provides an extremely low probability of undetected errors. 33 | /// 34 | /// The modulo on unsigned long accumulators can be delayed for 5552 35 | /// bytes, so the modulo operation time is negligible. If the bytes 36 | /// are a, b, c, the second sum is 3a + 2b + c + 3, and so is position 37 | /// and order sensitive, unlike the first sum, which is just a 38 | /// checksum. That 65521 is prime is important to avoid a possible 39 | /// large class of two-byte errors that leave the check unchanged. 40 | /// (The Fletcher checksum uses 255, which is not prime and which also 41 | /// makes the Fletcher check insensitive to single byte changes 0 - 42 | /// 255.) 43 | /// 44 | /// The sum s1 is initialized to 1 instead of zero to make the length 45 | /// of the sequence part of s2, so that the length does not have to be 46 | /// checked separately. (Any sequence of zeroes has a Fletcher 47 | /// checksum of zero.)" 48 | /// 49 | /// 50 | /// 51 | public sealed class Adler32 : IChecksum 52 | { 53 | #region Instance Fields 54 | /// 55 | /// largest prime smaller than 65536 56 | /// 57 | readonly static uint BASE = 65521; 58 | 59 | /// 60 | /// The CRC data checksum so far. 61 | /// 62 | uint checkValue; 63 | #endregion 64 | 65 | /// 66 | /// Initialise a default instance of 67 | /// 68 | public Adler32() 69 | { 70 | Reset(); 71 | } 72 | 73 | /// 74 | /// Resets the Adler32 data checksum as if no update was ever called. 75 | /// 76 | public void Reset() 77 | { 78 | checkValue = 1; 79 | } 80 | 81 | /// 82 | /// Returns the Adler32 data checksum computed so far. 83 | /// 84 | public long Value { 85 | get { 86 | return checkValue; 87 | } 88 | } 89 | 90 | /// 91 | /// Updates the checksum with the byte b. 92 | /// 93 | /// 94 | /// The data value to add. The high byte of the int is ignored. 95 | /// 96 | public void Update(int bval) 97 | { 98 | // We could make a length 1 byte array and call update again, but I 99 | // would rather not have that overhead 100 | uint s1 = checkValue & 0xFFFF; 101 | uint s2 = checkValue >> 16; 102 | 103 | s1 = (s1 + ((uint)bval & 0xFF)) % BASE; 104 | s2 = (s1 + s2) % BASE; 105 | 106 | checkValue = (s2 << 16) + s1; 107 | } 108 | 109 | /// 110 | /// Updates the Adler32 data checksum with the bytes taken from 111 | /// a block of data. 112 | /// 113 | /// Contains the data to update the checksum with. 114 | public void Update(byte[] buffer) 115 | { 116 | if (buffer == null) { 117 | throw new ArgumentNullException(nameof(buffer)); 118 | } 119 | 120 | Update(new ArraySegment(buffer, 0, buffer.Length)); 121 | } 122 | 123 | /// 124 | /// Update Adler32 data checksum based on a portion of a block of data 125 | /// 126 | /// 127 | /// The chunk of data to add 128 | /// 129 | public void Update(ArraySegment segment) 130 | { 131 | foreach (byte b in segment) 132 | { 133 | Update(b); 134 | } 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Checksum/IChecksum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.Checksum 4 | { 5 | /// 6 | /// Interface to compute a data checksum used by checked input/output streams. 7 | /// A data checksum can be updated by one byte or with a byte array. After each 8 | /// update the value of the current checksum can be returned by calling 9 | /// getValue. The complete checksum object can also be reset 10 | /// so it can be used again with new data. 11 | /// 12 | public interface IChecksum 13 | { 14 | /// 15 | /// Resets the data checksum as if no update was ever called. 16 | /// 17 | void Reset(); 18 | 19 | /// 20 | /// Returns the data checksum computed so far. 21 | /// 22 | long Value { 23 | get; 24 | } 25 | 26 | /// 27 | /// Adds one byte to the data checksum. 28 | /// 29 | /// 30 | /// the data value to add. The high byte of the int is ignored. 31 | /// 32 | void Update(int bval); 33 | 34 | /// 35 | /// Updates the data checksum with the bytes taken from the array. 36 | /// 37 | /// 38 | /// buffer an array of bytes 39 | /// 40 | void Update(byte[] buffer); 41 | 42 | /// 43 | /// Adds the byte array to the data checksum. 44 | /// 45 | /// 46 | /// The chunk of data to add 47 | /// 48 | void Update(ArraySegment segment); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/Exceptions/SharpZipBaseException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib 4 | { 5 | /// 6 | /// SharpZipBaseException is the base exception class for SharpZipLib. 7 | /// All library exceptions are derived from this. 8 | /// 9 | /// NOTE: Not all exceptions thrown will be derived from this class. 10 | /// A variety of other exceptions are possible for example 11 | public class SharpZipBaseException : Exception 12 | { 13 | /// 14 | /// Initializes a new instance of the SharpZipBaseException class. 15 | /// 16 | public SharpZipBaseException() 17 | { 18 | } 19 | 20 | /// 21 | /// Initializes a new instance of the SharpZipBaseException class with a specified error message. 22 | /// 23 | /// A message describing the exception. 24 | public SharpZipBaseException(string message) 25 | : base(message) 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the SharpZipBaseException class with a specified 31 | /// error message and a reference to the inner exception that is the cause of this exception. 32 | /// 33 | /// A message describing the exception. 34 | /// The inner exception 35 | public SharpZipBaseException(string message, Exception innerException) 36 | : base(message, innerException) 37 | { 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/Exceptions/StreamDecodingException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ICSharpCode.SharpZipLib 6 | { 7 | /// 8 | /// Indicates that an error occured during decoding of a input stream due to corrupt 9 | /// data or (unintentional) library incompability. 10 | /// 11 | public class StreamDecodingException: SharpZipBaseException 12 | { 13 | private const string GenericMessage = "Input stream could not be decoded"; 14 | 15 | /// 16 | /// Initializes a new instance of the StreamDecodingException with a generic message 17 | /// 18 | public StreamDecodingException() : base(GenericMessage) { } 19 | 20 | /// 21 | /// Initializes a new instance of the StreamDecodingException class with a specified error message. 22 | /// 23 | /// A message describing the exception. 24 | public StreamDecodingException(string message) : base(message) { } 25 | 26 | 27 | /// 28 | /// Initializes a new instance of the StreamDecodingException class with a specified 29 | /// error message and a reference to the inner exception that is the cause of this exception. 30 | /// 31 | /// A message describing the exception. 32 | /// The inner exception 33 | public StreamDecodingException(string message, Exception innerException) : base(message, innerException) { } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/Exceptions/StreamUnsupportedException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib 4 | { 5 | /// 6 | /// Indicates that the input stream could not decoded due to known library incompability or missing features 7 | /// 8 | public class StreamUnsupportedException : StreamDecodingException 9 | { 10 | private const string GenericMessage = "Input stream is in a unsupported format"; 11 | 12 | /// 13 | /// Initializes a new instance of the StreamUnsupportedException with a generic message 14 | /// 15 | public StreamUnsupportedException() : base(GenericMessage) { } 16 | 17 | /// 18 | /// Initializes a new instance of the StreamUnsupportedException class with a specified error message. 19 | /// 20 | /// A message describing the exception. 21 | public StreamUnsupportedException(string message) : base(message) { } 22 | 23 | 24 | /// 25 | /// Initializes a new instance of the StreamUnsupportedException class with a specified 26 | /// error message and a reference to the inner exception that is the cause of this exception. 27 | /// 28 | /// A message describing the exception. 29 | /// The inner exception 30 | public StreamUnsupportedException(string message, Exception innerException) : base(message, innerException) { } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/Exceptions/UnexpectedEndOfStreamException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib 4 | { 5 | /// 6 | /// Indicates that the input stream could not decoded due to the stream ending before enough data had been provided 7 | /// 8 | public class UnexpectedEndOfStreamException : StreamDecodingException 9 | { 10 | private const string GenericMessage = "Input stream ended unexpectedly"; 11 | 12 | /// 13 | /// Initializes a new instance of the UnexpectedEndOfStreamException with a generic message 14 | /// 15 | public UnexpectedEndOfStreamException() : base(GenericMessage) { } 16 | 17 | /// 18 | /// Initializes a new instance of the UnexpectedEndOfStreamException class with a specified error message. 19 | /// 20 | /// A message describing the exception. 21 | public UnexpectedEndOfStreamException(string message) : base(message) { } 22 | 23 | 24 | /// 25 | /// Initializes a new instance of the UnexpectedEndOfStreamException class with a specified 26 | /// error message and a reference to the inner exception that is the cause of this exception. 27 | /// 28 | /// A message describing the exception. 29 | /// The inner exception 30 | public UnexpectedEndOfStreamException(string message, Exception innerException) : base(message, innerException) { } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/Exceptions/ValueOutOfRangeException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ICSharpCode.SharpZipLib 6 | { 7 | 8 | /// 9 | /// Indicates that a value was outside of the expected range when decoding an input stream 10 | /// 11 | public class ValueOutOfRangeException : StreamDecodingException 12 | { 13 | /// 14 | /// Initializes a new instance of the ValueOutOfRangeException class naming the the causing variable 15 | /// 16 | /// Name of the variable, use: nameof() 17 | public ValueOutOfRangeException(string nameOfValue ) 18 | : base($"{nameOfValue} out of range") { } 19 | 20 | /// 21 | /// Initializes a new instance of the ValueOutOfRangeException class naming the the causing variable, 22 | /// it's current value and expected range. 23 | /// 24 | /// Name of the variable, use: nameof() 25 | /// The invalid value 26 | /// Expected maximum value 27 | /// Expected minimum value 28 | public ValueOutOfRangeException(string nameOfValue, long value, long maxValue, long minValue = 0) 29 | : this(nameOfValue, value.ToString(), maxValue.ToString(), minValue.ToString()) { } 30 | 31 | /// 32 | /// Initializes a new instance of the ValueOutOfRangeException class naming the the causing variable, 33 | /// it's current value and expected range. 34 | /// 35 | /// Name of the variable, use: nameof() 36 | /// The invalid value 37 | /// Expected maximum value 38 | /// Expected minimum value 39 | public ValueOutOfRangeException(string nameOfValue, string value, string maxValue, string minValue = "0") : 40 | base($"{nameOfValue} out of range: {value}, should be {minValue}..{maxValue}") { } 41 | 42 | private ValueOutOfRangeException() { } 43 | private ValueOutOfRangeException(string message, Exception innerException) : base(message, innerException) {} 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/INameTransform.cs: -------------------------------------------------------------------------------- 1 | namespace ICSharpCode.SharpZipLib.Core 2 | { 3 | /// 4 | /// INameTransform defines how file system names are transformed for use with archives, or vice versa. 5 | /// 6 | public interface INameTransform 7 | { 8 | /// 9 | /// Given a file name determine the transformed value. 10 | /// 11 | /// The name to transform. 12 | /// The transformed file name. 13 | string TransformFile(string name); 14 | 15 | /// 16 | /// Given a directory name determine the transformed value. 17 | /// 18 | /// The name to transform. 19 | /// The transformed directory name 20 | string TransformDirectory(string name); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/IScanFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ICSharpCode.SharpZipLib.Core 2 | { 3 | /// 4 | /// Scanning filters support filtering of names. 5 | /// 6 | public interface IScanFilter 7 | { 8 | /// 9 | /// Test a name to see if it 'matches' the filter. 10 | /// 11 | /// The name to test. 12 | /// Returns true if the name matches the filter, false if it does not match. 13 | bool IsMatch(string name); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/InvalidNameException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ICSharpCode.SharpZipLib.Core 6 | { 7 | 8 | /// 9 | /// InvalidNameException is thrown for invalid names such as directory traversal paths and names with invalid characters 10 | /// 11 | public class InvalidNameException: SharpZipBaseException 12 | { 13 | /// 14 | /// Initializes a new instance of the InvalidNameException class with a default error message. 15 | /// 16 | public InvalidNameException(): base("An invalid name was specified") 17 | { 18 | } 19 | 20 | /// 21 | /// Initializes a new instance of the InvalidNameException class with a specified error message. 22 | /// 23 | /// A message describing the exception. 24 | public InvalidNameException(string message) : base(message) 25 | { 26 | } 27 | 28 | /// 29 | /// Initializes a new instance of the InvalidNameException class with a specified 30 | /// error message and a reference to the inner exception that is the cause of this exception. 31 | /// 32 | /// A message describing the exception. 33 | /// The inner exception 34 | public InvalidNameException(string message, Exception innerException) : base(message, innerException) 35 | { 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Core/WindowsPathUtils.cs: -------------------------------------------------------------------------------- 1 | namespace ICSharpCode.SharpZipLib.Core 2 | { 3 | /// 4 | /// WindowsPathUtils provides simple utilities for handling windows paths. 5 | /// 6 | public abstract class WindowsPathUtils 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | internal WindowsPathUtils() 12 | { 13 | } 14 | 15 | /// 16 | /// Remove any path root present in the path 17 | /// 18 | /// A containing path information. 19 | /// The path with the root removed if it was present; path otherwise. 20 | /// Unlike the class the path isnt otherwise checked for validity. 21 | public static string DropPathRoot(string path) 22 | { 23 | string result = path; 24 | 25 | if (!string.IsNullOrEmpty(path)) { 26 | if ((path[0] == '\\') || (path[0] == '/')) { 27 | // UNC name ? 28 | if ((path.Length > 1) && ((path[1] == '\\') || (path[1] == '/'))) { 29 | int index = 2; 30 | int elements = 2; 31 | 32 | // Scan for two separate elements \\machine\share\restofpath 33 | while ((index <= path.Length) && 34 | (((path[index] != '\\') && (path[index] != '/')) || (--elements > 0))) { 35 | index++; 36 | } 37 | 38 | index++; 39 | 40 | if (index < path.Length) { 41 | result = path.Substring(index); 42 | } else { 43 | result = ""; 44 | } 45 | } 46 | } else if ((path.Length > 1) && (path[1] == ':')) { 47 | int dropCount = 2; 48 | if ((path.Length > 2) && ((path[2] == '\\') || (path[2] == '/'))) { 49 | dropCount = 3; 50 | } 51 | result = result.Remove(0, dropCount); 52 | } 53 | } 54 | return result; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Encryption/ZipAESStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Security.Cryptography; 4 | 5 | namespace ICSharpCode.SharpZipLib.Encryption 6 | { 7 | /// 8 | /// Encrypts and decrypts AES ZIP 9 | /// 10 | /// 11 | /// Based on information from http://www.winzip.com/aes_info.htm 12 | /// and http://www.gladman.me.uk/cryptography_technology/fileencrypt/ 13 | /// 14 | internal class ZipAESStream : CryptoStream 15 | { 16 | 17 | /// 18 | /// Constructor 19 | /// 20 | /// The stream on which to perform the cryptographic transformation. 21 | /// Instance of ZipAESTransform 22 | /// Read or Write 23 | public ZipAESStream(Stream stream, ZipAESTransform transform, CryptoStreamMode mode) 24 | : base(stream, transform, mode) 25 | { 26 | 27 | _stream = stream; 28 | _transform = transform; 29 | _slideBuffer = new byte[1024]; 30 | 31 | _blockAndAuth = CRYPTO_BLOCK_SIZE + AUTH_CODE_LENGTH; 32 | 33 | // mode: 34 | // CryptoStreamMode.Read means we read from "stream" and pass decrypted to our Read() method. 35 | // Write bypasses this stream and uses the Transform directly. 36 | if (mode != CryptoStreamMode.Read) { 37 | throw new Exception("ZipAESStream only for read"); 38 | } 39 | } 40 | 41 | // The final n bytes of the AES stream contain the Auth Code. 42 | private const int AUTH_CODE_LENGTH = 10; 43 | 44 | private Stream _stream; 45 | private ZipAESTransform _transform; 46 | private byte[] _slideBuffer; 47 | private int _slideBufStartPos; 48 | private int _slideBufFreePos; 49 | // Blocksize is always 16 here, even for AES-256 which has transform.InputBlockSize of 32. 50 | private const int CRYPTO_BLOCK_SIZE = 16; 51 | private int _blockAndAuth; 52 | 53 | /// 54 | /// Reads a sequence of bytes from the current CryptoStream into buffer, 55 | /// and advances the position within the stream by the number of bytes read. 56 | /// 57 | public override int Read(byte[] buffer, int offset, int count) 58 | { 59 | int nBytes = 0; 60 | while (nBytes < count) { 61 | // Calculate buffer quantities vs read-ahead size, and check for sufficient free space 62 | int byteCount = _slideBufFreePos - _slideBufStartPos; 63 | 64 | // Need to handle final block and Auth Code specially, but don't know total data length. 65 | // Maintain a read-ahead equal to the length of (crypto block + Auth Code). 66 | // When that runs out we can detect these final sections. 67 | int lengthToRead = _blockAndAuth - byteCount; 68 | if (_slideBuffer.Length - _slideBufFreePos < lengthToRead) { 69 | // Shift the data to the beginning of the buffer 70 | int iTo = 0; 71 | for (int iFrom = _slideBufStartPos; iFrom < _slideBufFreePos; iFrom++, iTo++) { 72 | _slideBuffer[iTo] = _slideBuffer[iFrom]; 73 | } 74 | _slideBufFreePos -= _slideBufStartPos; // Note the -= 75 | _slideBufStartPos = 0; 76 | } 77 | int obtained = _stream.Read(_slideBuffer, _slideBufFreePos, lengthToRead); 78 | _slideBufFreePos += obtained; 79 | 80 | // Recalculate how much data we now have 81 | byteCount = _slideBufFreePos - _slideBufStartPos; 82 | if (byteCount >= _blockAndAuth) { 83 | // At least a 16 byte block and an auth code remains. 84 | _transform.TransformBlock(_slideBuffer, 85 | _slideBufStartPos, 86 | CRYPTO_BLOCK_SIZE, 87 | buffer, 88 | offset); 89 | nBytes += CRYPTO_BLOCK_SIZE; 90 | offset += CRYPTO_BLOCK_SIZE; 91 | _slideBufStartPos += CRYPTO_BLOCK_SIZE; 92 | } else { 93 | // Last round. 94 | if (byteCount > AUTH_CODE_LENGTH) { 95 | // At least one byte of data plus auth code 96 | int finalBlock = byteCount - AUTH_CODE_LENGTH; 97 | _transform.TransformBlock(_slideBuffer, 98 | _slideBufStartPos, 99 | finalBlock, 100 | buffer, 101 | offset); 102 | 103 | nBytes += finalBlock; 104 | _slideBufStartPos += finalBlock; 105 | } else if (byteCount < AUTH_CODE_LENGTH) 106 | throw new Exception("Internal error missed auth code"); // Coding bug 107 | // Final block done. Check Auth code. 108 | byte[] calcAuthCode = _transform.GetAuthCode(); 109 | for (int i = 0; i < AUTH_CODE_LENGTH; i++) { 110 | if (calcAuthCode[i] != _slideBuffer[_slideBufStartPos + i]) { 111 | throw new Exception("AES Authentication Code does not match. This is a super-CRC check on the data in the file after compression and encryption. \r\n" 112 | + "The file may be damaged."); 113 | } 114 | } 115 | 116 | break; // Reached the auth code 117 | } 118 | } 119 | return nBytes; 120 | } 121 | 122 | /// 123 | /// Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. 124 | /// 125 | /// An array of bytes. This method copies count bytes from buffer to the current stream. 126 | /// The byte offset in buffer at which to begin copying bytes to the current stream. 127 | /// The number of bytes to be written to the current stream. 128 | public override void Write(byte[] buffer, int offset, int count) 129 | { 130 | // ZipAESStream is used for reading but not for writing. Writing uses the ZipAESTransform directly. 131 | throw new NotImplementedException(); 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/GZip/GZip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace ICSharpCode.SharpZipLib.GZip 5 | { 6 | using static Zip.Compression.Deflater; 7 | 8 | /// 9 | /// An example class to demonstrate compression and decompression of GZip streams. 10 | /// 11 | public static class GZip 12 | { 13 | /// 14 | /// Decompress the input writing 15 | /// uncompressed data to the output stream 16 | /// 17 | /// The readable stream containing data to decompress. 18 | /// The output stream to receive the decompressed data. 19 | /// Both streams are closed on completion if true. 20 | /// Input or output stream is null 21 | public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner) 22 | { 23 | if (inStream == null) 24 | throw new ArgumentNullException(nameof(inStream), "Input stream is null"); 25 | 26 | if (outStream == null) 27 | throw new ArgumentNullException(nameof(outStream), "Output stream is null"); 28 | 29 | try 30 | { 31 | using (GZipInputStream gzipInput = new GZipInputStream(inStream)) 32 | { 33 | gzipInput.IsStreamOwner = isStreamOwner; 34 | Core.StreamUtils.Copy(gzipInput, outStream, new byte[4096]); 35 | } 36 | } 37 | finally 38 | { 39 | if (isStreamOwner) 40 | { 41 | // inStream is closed by the GZipInputStream if stream owner 42 | outStream.Dispose(); 43 | } 44 | } 45 | } 46 | 47 | /// 48 | /// Compress the input stream sending 49 | /// result data to output stream 50 | /// 51 | /// The readable stream to compress. 52 | /// The output stream to receive the compressed data. 53 | /// Both streams are closed on completion if true. 54 | /// Deflate buffer size, minimum 512 55 | /// Deflate compression level, 0-9 56 | /// Input or output stream is null 57 | /// Buffer Size is smaller than 512 58 | /// Compression level outside 0-9 59 | public static void Compress(Stream inStream, Stream outStream, bool isStreamOwner, int bufferSize = 512, int level = 6) 60 | { 61 | if (inStream == null) 62 | throw new ArgumentNullException(nameof(inStream), "Input stream is null"); 63 | 64 | if(outStream == null) 65 | throw new ArgumentNullException(nameof(outStream), "Output stream is null"); 66 | 67 | if (bufferSize < 512) 68 | throw new ArgumentOutOfRangeException(nameof(bufferSize), "Deflate buffer size must be >= 512"); 69 | 70 | if (level BEST_COMPRESSION) 71 | throw new ArgumentOutOfRangeException(nameof(level), "Compression level must be 0-9"); 72 | 73 | try 74 | { 75 | using (GZipOutputStream gzipOutput = new GZipOutputStream(outStream, bufferSize)) 76 | { 77 | gzipOutput.SetLevel(level); 78 | gzipOutput.IsStreamOwner = isStreamOwner; 79 | Core.StreamUtils.Copy(inStream, gzipOutput, new byte[bufferSize]); 80 | } 81 | } 82 | finally 83 | { 84 | if (isStreamOwner) 85 | { 86 | // outStream is closed by the GZipOutputStream if stream owner 87 | inStream.Dispose(); 88 | } 89 | } 90 | } 91 | 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/GZip/GZipConstants.cs: -------------------------------------------------------------------------------- 1 | namespace ICSharpCode.SharpZipLib.GZip 2 | { 3 | /// 4 | /// This class contains constants used for gzip. 5 | /// 6 | sealed public class GZipConstants 7 | { 8 | /// 9 | /// Magic number found at start of GZIP header 10 | /// 11 | public const int GZIP_MAGIC = 0x1F8B; 12 | 13 | /* The flag byte is divided into individual bits as follows: 14 | 15 | bit 0 FTEXT 16 | bit 1 FHCRC 17 | bit 2 FEXTRA 18 | bit 3 FNAME 19 | bit 4 FCOMMENT 20 | bit 5 reserved 21 | bit 6 reserved 22 | bit 7 reserved 23 | */ 24 | 25 | /// 26 | /// Flag bit mask for text 27 | /// 28 | public const int FTEXT = 0x1; 29 | 30 | /// 31 | /// Flag bitmask for Crc 32 | /// 33 | public const int FHCRC = 0x2; 34 | 35 | /// 36 | /// Flag bit mask for extra 37 | /// 38 | public const int FEXTRA = 0x4; 39 | 40 | /// 41 | /// flag bitmask for name 42 | /// 43 | public const int FNAME = 0x8; 44 | 45 | /// 46 | /// flag bit mask indicating comment is present 47 | /// 48 | public const int FCOMMENT = 0x10; 49 | 50 | /// 51 | /// Initialise default instance. 52 | /// 53 | /// Constructor is private to prevent instances being created. 54 | GZipConstants() 55 | { 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/GZip/GZipException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.GZip 4 | { 5 | /// 6 | /// GZipException represents exceptions specific to GZip classes and code. 7 | /// 8 | public class GZipException : SharpZipBaseException 9 | { 10 | /// 11 | /// Initialise a new instance of . 12 | /// 13 | public GZipException() 14 | { 15 | } 16 | 17 | /// 18 | /// Initialise a new instance of with its message string. 19 | /// 20 | /// A that describes the error. 21 | public GZipException(string message) 22 | : base(message) 23 | { 24 | } 25 | 26 | /// 27 | /// Initialise a new instance of . 28 | /// 29 | /// A that describes the error. 30 | /// The that caused this exception. 31 | public GZipException(string message, Exception innerException) 32 | : base(message, innerException) 33 | { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/GZip/GzipOutputStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using ICSharpCode.SharpZipLib.Checksum; 4 | using ICSharpCode.SharpZipLib.Zip.Compression; 5 | using ICSharpCode.SharpZipLib.Zip.Compression.Streams; 6 | 7 | namespace ICSharpCode.SharpZipLib.GZip 8 | { 9 | /// 10 | /// This filter stream is used to compress a stream into a "GZIP" stream. 11 | /// The "GZIP" format is described in RFC 1952. 12 | /// 13 | /// author of the original java version : John Leuner 14 | /// 15 | /// This sample shows how to gzip a file 16 | /// 17 | /// using System; 18 | /// using System.IO; 19 | /// 20 | /// using ICSharpCode.SharpZipLib.GZip; 21 | /// using ICSharpCode.SharpZipLib.Core; 22 | /// 23 | /// class MainClass 24 | /// { 25 | /// public static void Main(string[] args) 26 | /// { 27 | /// using (Stream s = new GZipOutputStream(File.Create(args[0] + ".gz"))) 28 | /// using (FileStream fs = File.OpenRead(args[0])) { 29 | /// byte[] writeData = new byte[4096]; 30 | /// Streamutils.Copy(s, fs, writeData); 31 | /// } 32 | /// } 33 | /// } 34 | /// } 35 | /// 36 | /// 37 | public class GZipOutputStream : DeflaterOutputStream 38 | { 39 | enum OutputState 40 | { 41 | Header, 42 | Footer, 43 | Finished, 44 | Closed, 45 | }; 46 | 47 | #region Instance Fields 48 | /// 49 | /// CRC-32 value for uncompressed data 50 | /// 51 | protected Crc32 crc = new Crc32(); 52 | OutputState state_ = OutputState.Header; 53 | #endregion 54 | 55 | #region Constructors 56 | /// 57 | /// Creates a GzipOutputStream with the default buffer size 58 | /// 59 | /// 60 | /// The stream to read data (to be compressed) from 61 | /// 62 | public GZipOutputStream(Stream baseOutputStream) 63 | : this(baseOutputStream, 4096) 64 | { 65 | } 66 | 67 | /// 68 | /// Creates a GZipOutputStream with the specified buffer size 69 | /// 70 | /// 71 | /// The stream to read data (to be compressed) from 72 | /// 73 | /// 74 | /// Size of the buffer to use 75 | /// 76 | public GZipOutputStream(Stream baseOutputStream, int size) : base(baseOutputStream, new Deflater(Deflater.DEFAULT_COMPRESSION, true), size) 77 | { 78 | } 79 | #endregion 80 | 81 | #region Public API 82 | /// 83 | /// Sets the active compression level (0-9). The new level will be activated 84 | /// immediately. 85 | /// 86 | /// The compression level to set. 87 | /// 88 | /// Level specified is not supported. 89 | /// 90 | /// 91 | public void SetLevel(int level) 92 | { 93 | if (level < Deflater.NO_COMPRESSION || level > Deflater.BEST_COMPRESSION) 94 | throw new ArgumentOutOfRangeException(nameof(level), "Compression level must be 0-9"); 95 | 96 | deflater_.SetLevel(level); 97 | } 98 | 99 | /// 100 | /// Get the current compression level. 101 | /// 102 | /// The current compression level. 103 | public int GetLevel() 104 | { 105 | return deflater_.GetLevel(); 106 | } 107 | #endregion 108 | 109 | #region Stream overrides 110 | /// 111 | /// Write given buffer to output updating crc 112 | /// 113 | /// Buffer to write 114 | /// Offset of first byte in buf to write 115 | /// Number of bytes to write 116 | public override void Write(byte[] buffer, int offset, int count) 117 | { 118 | if (state_ == OutputState.Header) { 119 | WriteHeader(); 120 | } 121 | 122 | if (state_ != OutputState.Footer) { 123 | throw new InvalidOperationException("Write not permitted in current state"); 124 | } 125 | 126 | crc.Update(new ArraySegment(buffer, offset, count)); 127 | base.Write(buffer, offset, count); 128 | } 129 | 130 | /// 131 | /// Writes remaining compressed output data to the output stream 132 | /// and closes it. 133 | /// 134 | protected override void Dispose(bool disposing) 135 | { 136 | try { 137 | Finish(); 138 | } finally { 139 | if (state_ != OutputState.Closed) { 140 | state_ = OutputState.Closed; 141 | if (IsStreamOwner) { 142 | baseOutputStream_.Dispose(); 143 | } 144 | } 145 | } 146 | } 147 | #endregion 148 | 149 | #region DeflaterOutputStream overrides 150 | /// 151 | /// Finish compression and write any footer information required to stream 152 | /// 153 | public override void Finish() 154 | { 155 | // If no data has been written a header should be added. 156 | if (state_ == OutputState.Header) { 157 | WriteHeader(); 158 | } 159 | 160 | if (state_ == OutputState.Footer) { 161 | state_ = OutputState.Finished; 162 | base.Finish(); 163 | 164 | var totalin = (uint)(deflater_.TotalIn & 0xffffffff); 165 | var crcval = (uint)(crc.Value & 0xffffffff); 166 | 167 | byte[] gzipFooter; 168 | 169 | unchecked { 170 | gzipFooter = new byte[] { 171 | (byte) crcval, (byte) (crcval >> 8), 172 | (byte) (crcval >> 16), (byte) (crcval >> 24), 173 | 174 | (byte) totalin, (byte) (totalin >> 8), 175 | (byte) (totalin >> 16), (byte) (totalin >> 24) 176 | }; 177 | } 178 | 179 | baseOutputStream_.Write(gzipFooter, 0, gzipFooter.Length); 180 | } 181 | } 182 | #endregion 183 | 184 | #region Support Routines 185 | void WriteHeader() 186 | { 187 | if (state_ == OutputState.Header) { 188 | state_ = OutputState.Footer; 189 | 190 | var mod_time = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000L); // Ticks give back 100ns intervals 191 | byte[] gzipHeader = { 192 | // The two magic bytes 193 | (byte) (GZipConstants.GZIP_MAGIC >> 8), (byte) (GZipConstants.GZIP_MAGIC & 0xff), 194 | 195 | // The compression type 196 | (byte) Deflater.DEFLATED, 197 | 198 | // The flags (not set) 199 | 0, 200 | 201 | // The modification time 202 | (byte) mod_time, (byte) (mod_time >> 8), 203 | (byte) (mod_time >> 16), (byte) (mod_time >> 24), 204 | 205 | // The extra flags 206 | 0, 207 | 208 | // The OS type (unknown) 209 | (byte) 255 210 | }; 211 | baseOutputStream_.Write(gzipHeader, 0, gzipHeader.Length); 212 | } 213 | } 214 | #endregion 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Lzw/LzwConstants.cs: -------------------------------------------------------------------------------- 1 | namespace ICSharpCode.SharpZipLib.Lzw 2 | { 3 | /// 4 | /// This class contains constants used for LZW 5 | /// 6 | sealed public class LzwConstants 7 | { 8 | /// 9 | /// Magic number found at start of LZW header: 0x1f 0x9d 10 | /// 11 | public const int MAGIC = 0x1f9d; 12 | 13 | /// 14 | /// Maximum number of bits per code 15 | /// 16 | public const int MAX_BITS = 16; 17 | 18 | /* 3rd header byte: 19 | * bit 0..4 Number of compression bits 20 | * bit 5 Extended header 21 | * bit 6 Free 22 | * bit 7 Block mode 23 | */ 24 | 25 | /// 26 | /// Mask for 'number of compression bits' 27 | /// 28 | public const int BIT_MASK = 0x1f; 29 | 30 | /// 31 | /// Indicates the presence of a fourth header byte 32 | /// 33 | public const int EXTENDED_MASK = 0x20; 34 | //public const int FREE_MASK = 0x40; 35 | 36 | /// 37 | /// Reserved bits 38 | /// 39 | public const int RESERVED_MASK = 0x60; 40 | 41 | /// 42 | /// Block compression: if table is full and compression rate is dropping, 43 | /// clear the dictionary. 44 | /// 45 | public const int BLOCK_MODE_MASK = 0x80; 46 | 47 | /// 48 | /// LZW file header size (in bytes) 49 | /// 50 | public const int HDR_SIZE = 3; 51 | 52 | /// 53 | /// Initial number of bits per code 54 | /// 55 | public const int INIT_BITS = 9; 56 | 57 | LzwConstants() 58 | { 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Lzw/LzwException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.Lzw 4 | { 5 | /// 6 | /// LzwException represents exceptions specific to LZW classes and code. 7 | /// 8 | public class LzwException : SharpZipBaseException 9 | { 10 | /// 11 | /// Initialise a new instance of . 12 | /// 13 | public LzwException() 14 | { 15 | } 16 | 17 | /// 18 | /// Initialise a new instance of with its message string. 19 | /// 20 | /// A that describes the error. 21 | public LzwException(string message) 22 | : base(message) 23 | { 24 | } 25 | 26 | /// 27 | /// Initialise a new instance of . 28 | /// 29 | /// A that describes the error. 30 | /// The that caused this exception. 31 | public LzwException(string message, Exception innerException) 32 | : base(message, innerException) 33 | { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Tar/InvalidHeaderException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.Tar 4 | { 5 | /// 6 | /// This exception is used to indicate that there is a problem 7 | /// with a TAR archive header. 8 | /// 9 | public class InvalidHeaderException : TarException 10 | { 11 | /// 12 | /// Initialise a new instance of the InvalidHeaderException class. 13 | /// 14 | public InvalidHeaderException() 15 | { 16 | } 17 | 18 | /// 19 | /// Initialises a new instance of the InvalidHeaderException class with a specified message. 20 | /// 21 | /// Message describing the exception cause. 22 | public InvalidHeaderException(string message) 23 | : base(message) 24 | { 25 | } 26 | 27 | /// 28 | /// Initialise a new instance of InvalidHeaderException 29 | /// 30 | /// Message describing the problem. 31 | /// The exception that is the cause of the current exception. 32 | public InvalidHeaderException(string message, Exception exception) 33 | : base(message, exception) 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Tar/TarException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.Tar 4 | { 5 | /// 6 | /// TarException represents exceptions specific to Tar classes and code. 7 | /// 8 | public class TarException : SharpZipBaseException 9 | { 10 | 11 | /// 12 | /// Initialise a new instance of . 13 | /// 14 | public TarException() 15 | { 16 | } 17 | 18 | /// 19 | /// Initialise a new instance of with its message string. 20 | /// 21 | /// A that describes the error. 22 | public TarException(string message) 23 | : base(message) 24 | { 25 | } 26 | 27 | /// 28 | /// Initialise a new instance of . 29 | /// 30 | /// A that describes the error. 31 | /// The that caused this exception. 32 | public TarException(string message, Exception innerException) 33 | : base(message, innerException) 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Tar/TarExtendedHeaderReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace ICSharpCode.SharpZipLib.Tar 7 | { 8 | public class TarExtendedHeaderReader 9 | { 10 | const byte LENGTH = 0; 11 | const byte KEY = 1; 12 | const byte VALUE = 2; 13 | const byte END = 3; 14 | 15 | private readonly Dictionary headers = new Dictionary(); 16 | 17 | private string[] headerParts = new string[3]; 18 | 19 | int bbIndex; 20 | private byte[] byteBuffer; 21 | private char[] charBuffer; 22 | 23 | private readonly StringBuilder sb = new StringBuilder(); 24 | private readonly Decoder decoder = Encoding.UTF8.GetDecoder(); 25 | 26 | private int state = LENGTH; 27 | 28 | private static readonly byte[] StateNext = new[] { (byte)' ', (byte)'=', (byte)'\n' }; 29 | 30 | public TarExtendedHeaderReader() 31 | { 32 | ResetBuffers(); 33 | } 34 | 35 | public void Read(byte[] buffer, int length) 36 | { 37 | for (int i = 0; i < length; i++) 38 | { 39 | byte next = buffer[i]; 40 | 41 | if (next == StateNext[state]) 42 | { 43 | Flush(); 44 | headerParts[state] = sb.ToString(); 45 | sb.Clear(); 46 | 47 | if (++state == END) 48 | { 49 | headers.Add(headerParts[KEY], headerParts[VALUE]); 50 | headerParts = new string[3]; 51 | state = LENGTH; 52 | } 53 | } 54 | else 55 | { 56 | byteBuffer[bbIndex++] = next; 57 | if (bbIndex == 4) 58 | Flush(); 59 | } 60 | } 61 | } 62 | 63 | private void Flush() 64 | { 65 | decoder.Convert(byteBuffer, 0, bbIndex, charBuffer, 0, 4, false, out int bytesUsed, out int charsUsed, out bool completed); 66 | 67 | sb.Append(charBuffer, 0, charsUsed); 68 | ResetBuffers(); 69 | } 70 | 71 | private void ResetBuffers() 72 | { 73 | charBuffer = new char[4]; 74 | byteBuffer = new byte[4]; 75 | bbIndex = 0; 76 | } 77 | 78 | 79 | public Dictionary Headers 80 | { 81 | get 82 | { 83 | // TODO: Check for invalid state? -NM 2018-07-01 84 | return headers; 85 | } 86 | } 87 | 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Zip/Compression/DeflaterConstants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.Zip.Compression 4 | { 5 | /// 6 | /// This class contains constants used for deflation. 7 | /// 8 | public static class DeflaterConstants 9 | { 10 | /// 11 | /// Set to true to enable debugging 12 | /// 13 | public const bool DEBUGGING = false; 14 | 15 | /// 16 | /// Written to Zip file to identify a stored block 17 | /// 18 | public const int STORED_BLOCK = 0; 19 | 20 | /// 21 | /// Identifies static tree in Zip file 22 | /// 23 | public const int STATIC_TREES = 1; 24 | 25 | /// 26 | /// Identifies dynamic tree in Zip file 27 | /// 28 | public const int DYN_TREES = 2; 29 | 30 | /// 31 | /// Header flag indicating a preset dictionary for deflation 32 | /// 33 | public const int PRESET_DICT = 0x20; 34 | 35 | /// 36 | /// Sets internal buffer sizes for Huffman encoding 37 | /// 38 | public const int DEFAULT_MEM_LEVEL = 8; 39 | 40 | /// 41 | /// Internal compression engine constant 42 | /// 43 | public const int MAX_MATCH = 258; 44 | 45 | /// 46 | /// Internal compression engine constant 47 | /// 48 | public const int MIN_MATCH = 3; 49 | 50 | /// 51 | /// Internal compression engine constant 52 | /// 53 | public const int MAX_WBITS = 15; 54 | 55 | /// 56 | /// Internal compression engine constant 57 | /// 58 | public const int WSIZE = 1 << MAX_WBITS; 59 | 60 | /// 61 | /// Internal compression engine constant 62 | /// 63 | public const int WMASK = WSIZE - 1; 64 | 65 | /// 66 | /// Internal compression engine constant 67 | /// 68 | public const int HASH_BITS = DEFAULT_MEM_LEVEL + 7; 69 | 70 | /// 71 | /// Internal compression engine constant 72 | /// 73 | public const int HASH_SIZE = 1 << HASH_BITS; 74 | 75 | /// 76 | /// Internal compression engine constant 77 | /// 78 | public const int HASH_MASK = HASH_SIZE - 1; 79 | 80 | /// 81 | /// Internal compression engine constant 82 | /// 83 | public const int HASH_SHIFT = (HASH_BITS + MIN_MATCH - 1) / MIN_MATCH; 84 | 85 | /// 86 | /// Internal compression engine constant 87 | /// 88 | public const int MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1; 89 | 90 | /// 91 | /// Internal compression engine constant 92 | /// 93 | public const int MAX_DIST = WSIZE - MIN_LOOKAHEAD; 94 | 95 | /// 96 | /// Internal compression engine constant 97 | /// 98 | public const int PENDING_BUF_SIZE = 1 << (DEFAULT_MEM_LEVEL + 8); 99 | 100 | /// 101 | /// Internal compression engine constant 102 | /// 103 | public static int MAX_BLOCK_SIZE = Math.Min(65535, PENDING_BUF_SIZE - 5); 104 | 105 | /// 106 | /// Internal compression engine constant 107 | /// 108 | public const int DEFLATE_STORED = 0; 109 | 110 | /// 111 | /// Internal compression engine constant 112 | /// 113 | public const int DEFLATE_FAST = 1; 114 | 115 | /// 116 | /// Internal compression engine constant 117 | /// 118 | public const int DEFLATE_SLOW = 2; 119 | 120 | /// 121 | /// Internal compression engine constant 122 | /// 123 | public static int[] GOOD_LENGTH = { 0, 4, 4, 4, 4, 8, 8, 8, 32, 32 }; 124 | 125 | /// 126 | /// Internal compression engine constant 127 | /// 128 | public static int[] MAX_LAZY = { 0, 4, 5, 6, 4, 16, 16, 32, 128, 258 }; 129 | 130 | /// 131 | /// Internal compression engine constant 132 | /// 133 | public static int[] NICE_LENGTH = { 0, 8, 16, 32, 16, 32, 128, 128, 258, 258 }; 134 | 135 | /// 136 | /// Internal compression engine constant 137 | /// 138 | public static int[] MAX_CHAIN = { 0, 4, 8, 32, 16, 32, 128, 256, 1024, 4096 }; 139 | 140 | /// 141 | /// Internal compression engine constant 142 | /// 143 | public static int[] COMPR_FUNC = { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2 }; 144 | 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Zip/Compression/DeflaterPending.cs: -------------------------------------------------------------------------------- 1 | namespace ICSharpCode.SharpZipLib.Zip.Compression 2 | { 3 | /// 4 | /// This class stores the pending output of the Deflater. 5 | /// 6 | /// author of the original java version : Jochen Hoenicke 7 | /// 8 | public class DeflaterPending : PendingBuffer 9 | { 10 | /// 11 | /// Construct instance with default buffer size 12 | /// 13 | public DeflaterPending() : base(DeflaterConstants.PENDING_BUF_SIZE) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Zip/Compression/InflaterDynHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ICSharpCode.SharpZipLib.Zip.Compression.Streams; 4 | 5 | namespace ICSharpCode.SharpZipLib.Zip.Compression 6 | { 7 | class InflaterDynHeader 8 | { 9 | #region Constants 10 | 11 | // maximum number of literal/length codes 12 | const int LITLEN_MAX = 286; 13 | 14 | // maximum number of distance codes 15 | const int DIST_MAX = 30; 16 | 17 | // maximum data code lengths to read 18 | const int CODELEN_MAX = LITLEN_MAX + DIST_MAX; 19 | 20 | // maximum meta code length codes to read 21 | const int META_MAX = 19; 22 | 23 | static readonly int[] MetaCodeLengthIndex = 24 | { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; 25 | 26 | #endregion 27 | 28 | /// 29 | /// Continue decoding header from until more bits are needed or decoding has been completed 30 | /// 31 | /// Returns whether decoding could be completed 32 | public bool AttemptRead() 33 | => !state.MoveNext() || state.Current; 34 | 35 | public InflaterDynHeader(StreamManipulator input) 36 | { 37 | this.input = input; 38 | stateMachine = CreateStateMachine(); 39 | state = stateMachine.GetEnumerator(); 40 | } 41 | 42 | private IEnumerable CreateStateMachine() 43 | { 44 | 45 | // Read initial code length counts from header 46 | while (!input.TryGetBits(5, ref litLenCodeCount, 257)) yield return false; 47 | while (!input.TryGetBits(5, ref distanceCodeCount, 1)) yield return false; 48 | while (!input.TryGetBits(4, ref metaCodeCount, 4)) yield return false; 49 | var dataCodeCount = litLenCodeCount + distanceCodeCount; 50 | 51 | if (litLenCodeCount > LITLEN_MAX) throw new ValueOutOfRangeException(nameof(litLenCodeCount)); 52 | if (distanceCodeCount > DIST_MAX) throw new ValueOutOfRangeException(nameof(distanceCodeCount)); 53 | if (metaCodeCount > META_MAX) throw new ValueOutOfRangeException(nameof(metaCodeCount)); 54 | 55 | // Load code lengths for the meta tree from the header bits 56 | for (int i=0; i < metaCodeCount; i++) 57 | { 58 | while (!input.TryGetBits(3, ref codeLengths, MetaCodeLengthIndex[i])) yield return false; 59 | } 60 | 61 | var metaCodeTree = new InflaterHuffmanTree(codeLengths); 62 | 63 | // Decompress the meta tree symbols into the data table code lengths 64 | int index = 0; 65 | while (index < dataCodeCount) 66 | { 67 | byte codeLength; 68 | int symbol; 69 | 70 | while ((symbol = metaCodeTree.GetSymbol(input)) < 0) yield return false; 71 | 72 | if (symbol < 16) 73 | { 74 | // append literal code length 75 | codeLengths[index++] = (byte)symbol; 76 | } 77 | else 78 | { 79 | int repeatCount = 0; 80 | 81 | if (symbol == 16) // Repeat last code length 3..6 times 82 | { 83 | 84 | if (index == 0) 85 | throw new StreamDecodingException("Cannot repeat previous code length when no other code length has been read"); 86 | 87 | codeLength = codeLengths[index - 1]; 88 | 89 | // 2 bits + 3, [3..6] 90 | while(!input.TryGetBits(2, ref repeatCount, 3)) yield return false; 91 | } 92 | else if (symbol == 17) // Repeat zero 3..10 times 93 | { 94 | codeLength = 0; 95 | 96 | // 3 bits + 3, [3..10] 97 | while (!input.TryGetBits(3, ref repeatCount, 3)) yield return false; 98 | } 99 | else // (symbol == 18), Repeat zero 11..138 times 100 | { 101 | codeLength = 0; 102 | 103 | // 7 bits + 11, [11..138] 104 | while (!input.TryGetBits(7, ref repeatCount, 11)) yield return false; 105 | } 106 | 107 | if (index + repeatCount > dataCodeCount) 108 | throw new StreamDecodingException("Cannot repeat code lengths past total number of data code lengths"); 109 | 110 | while (repeatCount-- > 0) 111 | codeLengths[index++] = codeLength; 112 | } 113 | } 114 | 115 | if (codeLengths[256] == 0) 116 | throw new StreamDecodingException("Inflater dynamic header end-of-block code missing"); 117 | 118 | litLenTree = new InflaterHuffmanTree(new ArraySegment(codeLengths, 0, litLenCodeCount)); 119 | distTree = new InflaterHuffmanTree(new ArraySegment(codeLengths, litLenCodeCount, distanceCodeCount)); 120 | 121 | yield return true; 122 | } 123 | 124 | /// 125 | /// Get literal/length huffman tree, must not be used before has returned true 126 | /// 127 | /// If hader has not been successfully read by the state machine 128 | public InflaterHuffmanTree LiteralLengthTree 129 | => litLenTree ?? throw new StreamDecodingException("Header properties were accessed before header had been successfully read"); 130 | 131 | /// 132 | /// Get distance huffman tree, must not be used before has returned true 133 | /// 134 | /// If hader has not been successfully read by the state machine 135 | public InflaterHuffmanTree DistanceTree 136 | => distTree ?? throw new StreamDecodingException("Header properties were accessed before header had been successfully read"); 137 | 138 | #region Instance Fields 139 | 140 | private readonly StreamManipulator input; 141 | private readonly IEnumerator state; 142 | private readonly IEnumerable stateMachine; 143 | 144 | private byte[] codeLengths = new byte[CODELEN_MAX]; 145 | 146 | private InflaterHuffmanTree litLenTree; 147 | private InflaterHuffmanTree distTree; 148 | 149 | int litLenCodeCount, distanceCodeCount, metaCodeCount; 150 | 151 | #endregion 152 | 153 | } 154 | 155 | } 156 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Zip/Compression/InflaterHuffmanTree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ICSharpCode.SharpZipLib.Zip.Compression.Streams; 4 | 5 | namespace ICSharpCode.SharpZipLib.Zip.Compression 6 | { 7 | /// 8 | /// Huffman tree used for inflation 9 | /// 10 | public class InflaterHuffmanTree 11 | { 12 | #region Constants 13 | const int MAX_BITLEN = 15; 14 | #endregion 15 | 16 | #region Instance Fields 17 | short[] tree; 18 | #endregion 19 | 20 | /// 21 | /// Literal length tree 22 | /// 23 | public static InflaterHuffmanTree defLitLenTree; 24 | 25 | /// 26 | /// Distance tree 27 | /// 28 | public static InflaterHuffmanTree defDistTree; 29 | 30 | static InflaterHuffmanTree() 31 | { 32 | try { 33 | byte[] codeLengths = new byte[288]; 34 | int i = 0; 35 | while (i < 144) { 36 | codeLengths[i++] = 8; 37 | } 38 | while (i < 256) { 39 | codeLengths[i++] = 9; 40 | } 41 | while (i < 280) { 42 | codeLengths[i++] = 7; 43 | } 44 | while (i < 288) { 45 | codeLengths[i++] = 8; 46 | } 47 | defLitLenTree = new InflaterHuffmanTree(codeLengths); 48 | 49 | codeLengths = new byte[32]; 50 | i = 0; 51 | while (i < 32) { 52 | codeLengths[i++] = 5; 53 | } 54 | defDistTree = new InflaterHuffmanTree(codeLengths); 55 | } catch (Exception) { 56 | throw new SharpZipBaseException("InflaterHuffmanTree: static tree length illegal"); 57 | } 58 | } 59 | 60 | #region Constructors 61 | /// 62 | /// Constructs a Huffman tree from the array of code lengths. 63 | /// 64 | /// 65 | /// the array of code lengths 66 | /// 67 | public InflaterHuffmanTree(IList codeLengths) 68 | { 69 | BuildTree(codeLengths); 70 | } 71 | #endregion 72 | 73 | void BuildTree(IList codeLengths) 74 | { 75 | int[] blCount = new int[MAX_BITLEN + 1]; 76 | int[] nextCode = new int[MAX_BITLEN + 1]; 77 | 78 | for (int i = 0; i < codeLengths.Count; i++) { 79 | int bits = codeLengths[i]; 80 | if (bits > 0) { 81 | blCount[bits]++; 82 | } 83 | } 84 | 85 | int code = 0; 86 | int treeSize = 512; 87 | for (int bits = 1; bits <= MAX_BITLEN; bits++) { 88 | nextCode[bits] = code; 89 | code += blCount[bits] << (16 - bits); 90 | if (bits >= 10) { 91 | /* We need an extra table for bit lengths >= 10. */ 92 | int start = nextCode[bits] & 0x1ff80; 93 | int end = code & 0x1ff80; 94 | treeSize += (end - start) >> (16 - bits); 95 | } 96 | } 97 | 98 | /* -jr comment this out! doesnt work for dynamic trees and pkzip 2.04g 99 | if (code != 65536) 100 | { 101 | throw new SharpZipBaseException("Code lengths don't add up properly."); 102 | } 103 | */ 104 | /* Now create and fill the extra tables from longest to shortest 105 | * bit len. This way the sub trees will be aligned. 106 | */ 107 | tree = new short[treeSize]; 108 | int treePtr = 512; 109 | for (int bits = MAX_BITLEN; bits >= 10; bits--) { 110 | int end = code & 0x1ff80; 111 | code -= blCount[bits] << (16 - bits); 112 | int start = code & 0x1ff80; 113 | for (int i = start; i < end; i += 1 << 7) { 114 | tree[DeflaterHuffman.BitReverse(i)] = (short)((-treePtr << 4) | bits); 115 | treePtr += 1 << (bits - 9); 116 | } 117 | } 118 | 119 | for (int i = 0; i < codeLengths.Count; i++) { 120 | int bits = codeLengths[i]; 121 | if (bits == 0) { 122 | continue; 123 | } 124 | code = nextCode[bits]; 125 | int revcode = DeflaterHuffman.BitReverse(code); 126 | if (bits <= 9) { 127 | do { 128 | tree[revcode] = (short)((i << 4) | bits); 129 | revcode += 1 << bits; 130 | } while (revcode < 512); 131 | } else { 132 | int subTree = tree[revcode & 511]; 133 | int treeLen = 1 << (subTree & 15); 134 | subTree = -(subTree >> 4); 135 | do { 136 | tree[subTree | (revcode >> 9)] = (short)((i << 4) | bits); 137 | revcode += 1 << bits; 138 | } while (revcode < treeLen); 139 | } 140 | nextCode[bits] = code + (1 << (16 - bits)); 141 | } 142 | 143 | } 144 | 145 | /// 146 | /// Reads the next symbol from input. The symbol is encoded using the 147 | /// huffman tree. 148 | /// 149 | /// 150 | /// input the input source. 151 | /// 152 | /// 153 | /// the next symbol, or -1 if not enough input is available. 154 | /// 155 | public int GetSymbol(StreamManipulator input) 156 | { 157 | int lookahead, symbol; 158 | if ((lookahead = input.PeekBits(9)) >= 0) 159 | { 160 | if ((symbol = tree[lookahead]) >= 0) 161 | { 162 | input.DropBits(symbol & 15); 163 | return symbol >> 4; 164 | } 165 | int subtree = -(symbol >> 4); 166 | int bitlen = symbol & 15; 167 | if ((lookahead = input.PeekBits(bitlen)) >= 0) 168 | { 169 | symbol = tree[subtree | (lookahead >> 9)]; 170 | input.DropBits(symbol & 15); 171 | return symbol >> 4; 172 | } 173 | else 174 | { 175 | int bits = input.AvailableBits; 176 | lookahead = input.PeekBits(bits); 177 | symbol = tree[subtree | (lookahead >> 9)]; 178 | if ((symbol & 15) <= bits) 179 | { 180 | input.DropBits(symbol & 15); 181 | return symbol >> 4; 182 | } 183 | else 184 | { 185 | return -1; 186 | } 187 | } 188 | } 189 | else // Less than 9 bits 190 | { 191 | int bits = input.AvailableBits; 192 | lookahead = input.PeekBits(bits); 193 | symbol = tree[lookahead]; 194 | if (symbol >= 0 && (symbol & 15) <= bits) 195 | { 196 | input.DropBits(symbol & 15); 197 | return symbol >> 4; 198 | } 199 | else 200 | { 201 | return -1; 202 | } 203 | } 204 | } 205 | } 206 | } 207 | 208 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Zip/Compression/Streams/OutputWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams 4 | { 5 | /// 6 | /// Contains the output from the Inflation process. 7 | /// We need to have a window so that we can refer backwards into the output stream 8 | /// to repeat stuff.
9 | /// Author of the original java version : John Leuner 10 | ///
11 | public class OutputWindow 12 | { 13 | #region Constants 14 | const int WindowSize = 1 << 15; 15 | const int WindowMask = WindowSize - 1; 16 | #endregion 17 | 18 | #region Instance Fields 19 | byte[] window = new byte[WindowSize]; //The window is 2^15 bytes 20 | int windowEnd; 21 | int windowFilled; 22 | #endregion 23 | 24 | /// 25 | /// Write a byte to this output window 26 | /// 27 | /// value to write 28 | /// 29 | /// if window is full 30 | /// 31 | public void Write(int value) 32 | { 33 | if (windowFilled++ == WindowSize) { 34 | throw new InvalidOperationException("Window full"); 35 | } 36 | window[windowEnd++] = (byte)value; 37 | windowEnd &= WindowMask; 38 | } 39 | 40 | 41 | private void SlowRepeat(int repStart, int length, int distance) 42 | { 43 | while (length-- > 0) { 44 | window[windowEnd++] = window[repStart++]; 45 | windowEnd &= WindowMask; 46 | repStart &= WindowMask; 47 | } 48 | } 49 | 50 | /// 51 | /// Append a byte pattern already in the window itself 52 | /// 53 | /// length of pattern to copy 54 | /// distance from end of window pattern occurs 55 | /// 56 | /// If the repeated data overflows the window 57 | /// 58 | public void Repeat(int length, int distance) 59 | { 60 | if ((windowFilled += length) > WindowSize) { 61 | throw new InvalidOperationException("Window full"); 62 | } 63 | 64 | int repStart = (windowEnd - distance) & WindowMask; 65 | int border = WindowSize - length; 66 | if ((repStart <= border) && (windowEnd < border)) { 67 | if (length <= distance) { 68 | System.Array.Copy(window, repStart, window, windowEnd, length); 69 | windowEnd += length; 70 | } else { 71 | // We have to copy manually, since the repeat pattern overlaps. 72 | while (length-- > 0) { 73 | window[windowEnd++] = window[repStart++]; 74 | } 75 | } 76 | } else { 77 | SlowRepeat(repStart, length, distance); 78 | } 79 | } 80 | 81 | /// 82 | /// Copy from input manipulator to internal window 83 | /// 84 | /// source of data 85 | /// length of data to copy 86 | /// the number of bytes copied 87 | public int CopyStored(StreamManipulator input, int length) 88 | { 89 | length = Math.Min(Math.Min(length, WindowSize - windowFilled), input.AvailableBytes); 90 | int copied; 91 | 92 | int tailLen = WindowSize - windowEnd; 93 | if (length > tailLen) { 94 | copied = input.CopyBytes(window, windowEnd, tailLen); 95 | if (copied == tailLen) { 96 | copied += input.CopyBytes(window, 0, length - tailLen); 97 | } 98 | } else { 99 | copied = input.CopyBytes(window, windowEnd, length); 100 | } 101 | 102 | windowEnd = (windowEnd + copied) & WindowMask; 103 | windowFilled += copied; 104 | return copied; 105 | } 106 | 107 | /// 108 | /// Copy dictionary to window 109 | /// 110 | /// source dictionary 111 | /// offset of start in source dictionary 112 | /// length of dictionary 113 | /// 114 | /// If window isnt empty 115 | /// 116 | public void CopyDict(byte[] dictionary, int offset, int length) 117 | { 118 | if (dictionary == null) { 119 | throw new ArgumentNullException(nameof(dictionary)); 120 | } 121 | 122 | if (windowFilled > 0) { 123 | throw new InvalidOperationException(); 124 | } 125 | 126 | if (length > WindowSize) { 127 | offset += length - WindowSize; 128 | length = WindowSize; 129 | } 130 | System.Array.Copy(dictionary, offset, window, 0, length); 131 | windowEnd = length & WindowMask; 132 | } 133 | 134 | /// 135 | /// Get remaining unfilled space in window 136 | /// 137 | /// Number of bytes left in window 138 | public int GetFreeSpace() 139 | { 140 | return WindowSize - windowFilled; 141 | } 142 | 143 | /// 144 | /// Get bytes available for output in window 145 | /// 146 | /// Number of bytes filled 147 | public int GetAvailable() 148 | { 149 | return windowFilled; 150 | } 151 | 152 | /// 153 | /// Copy contents of window to output 154 | /// 155 | /// buffer to copy to 156 | /// offset to start at 157 | /// number of bytes to count 158 | /// The number of bytes copied 159 | /// 160 | /// If a window underflow occurs 161 | /// 162 | public int CopyOutput(byte[] output, int offset, int len) 163 | { 164 | int copyEnd = windowEnd; 165 | if (len > windowFilled) { 166 | len = windowFilled; 167 | } else { 168 | copyEnd = (windowEnd - windowFilled + len) & WindowMask; 169 | } 170 | 171 | int copied = len; 172 | int tailLen = len - copyEnd; 173 | 174 | if (tailLen > 0) { 175 | System.Array.Copy(window, WindowSize - tailLen, output, offset, tailLen); 176 | offset += tailLen; 177 | len = copyEnd; 178 | } 179 | System.Array.Copy(window, copyEnd - len, output, offset, len); 180 | windowFilled -= copied; 181 | if (windowFilled < 0) { 182 | throw new InvalidOperationException(); 183 | } 184 | return copied; 185 | } 186 | 187 | /// 188 | /// Reset by clearing window so GetAvailable returns 0 189 | /// 190 | public void Reset() 191 | { 192 | windowFilled = windowEnd = 0; 193 | } 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Zip/IEntryFactory.cs: -------------------------------------------------------------------------------- 1 | using ICSharpCode.SharpZipLib.Core; 2 | 3 | namespace ICSharpCode.SharpZipLib.Zip 4 | { 5 | /// 6 | /// Defines factory methods for creating new values. 7 | /// 8 | public interface IEntryFactory 9 | { 10 | /// 11 | /// Create a for a file given its name 12 | /// 13 | /// The name of the file to create an entry for. 14 | /// Returns a file entry based on the passed. 15 | ZipEntry MakeFileEntry(string fileName); 16 | 17 | /// 18 | /// Create a for a file given its name 19 | /// 20 | /// The name of the file to create an entry for. 21 | /// If true get details from the file system if the file exists. 22 | /// Returns a file entry based on the passed. 23 | ZipEntry MakeFileEntry(string fileName, bool useFileSystem); 24 | 25 | /// 26 | /// Create a for a file given its actual name and optional override name 27 | /// 28 | /// The name of the file to create an entry for. 29 | /// An alternative name to be used for the new entry. Null if not applicable. 30 | /// If true get details from the file system if the file exists. 31 | /// Returns a file entry based on the passed. 32 | ZipEntry MakeFileEntry(string fileName, string entryName, bool useFileSystem); 33 | 34 | /// 35 | /// Create a for a directory given its name 36 | /// 37 | /// The name of the directory to create an entry for. 38 | /// Returns a directory entry based on the passed. 39 | ZipEntry MakeDirectoryEntry(string directoryName); 40 | 41 | /// 42 | /// Create a for a directory given its name 43 | /// 44 | /// The name of the directory to create an entry for. 45 | /// If true get details from the file system for this directory if it exists. 46 | /// Returns a directory entry based on the passed. 47 | ZipEntry MakeDirectoryEntry(string directoryName, bool useFileSystem); 48 | 49 | /// 50 | /// Get/set the applicable. 51 | /// 52 | INameTransform NameTransform { get; set; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Zip/ZipException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.SharpZipLib.Zip 4 | { 5 | /// 6 | /// ZipException represents exceptions specific to Zip classes and code. 7 | /// 8 | public class ZipException : SharpZipBaseException 9 | { 10 | 11 | /// 12 | /// Initialise a new instance of . 13 | /// 14 | public ZipException() 15 | { 16 | } 17 | 18 | /// 19 | /// Initialise a new instance of with its message string. 20 | /// 21 | /// A that describes the error. 22 | public ZipException(string message) 23 | : base(message) 24 | { 25 | } 26 | 27 | /// 28 | /// Initialise a new instance of . 29 | /// 30 | /// A that describes the error. 31 | /// The that caused this exception. 32 | public ZipException(string message, Exception innerException) 33 | : base(message, innerException) 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/ICSharpCode.SharpZipLib/Zip/ZipStrings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace ICSharpCode.SharpZipLib.Zip 5 | { 6 | /// 7 | /// This static class contains functions for encoding and decoding zip file strings 8 | /// 9 | public static class ZipStrings 10 | { 11 | 12 | static ZipStrings() 13 | { 14 | try 15 | { 16 | var codePage = Encoding.GetEncoding(0).CodePage; 17 | SystemDefaultCodePage = (codePage == 1 || codePage == 2 || codePage == 3 || codePage == 42) ? FallbackCodePage : codePage; 18 | } 19 | catch 20 | { 21 | SystemDefaultCodePage = FallbackCodePage; 22 | } 23 | } 24 | 25 | /// Code page backing field 26 | /// 27 | /// The original Zip specification (https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) states 28 | /// that file names should only be encoded with IBM Code Page 437 or UTF-8. 29 | /// In practice, most zip apps use OEM or system encoding (typically cp437 on Windows). 30 | /// Let's be good citizens and default to UTF-8 http://utf8everywhere.org/ 31 | /// 32 | private static int codePage = Encoding.UTF8.CodePage; 33 | 34 | 35 | /// 36 | /// Encoding used for string conversion. Setting this to 65001 (UTF-8) will 37 | /// also set the Language encoding flag to indicate UTF-8 encoded file names. 38 | /// 39 | public static int CodePage 40 | { 41 | get 42 | { 43 | return codePage; 44 | } 45 | set 46 | { 47 | if ((value < 0) || (value > 65535) || 48 | (value == 1) || (value == 2) || (value == 3) || (value == 42)) 49 | { 50 | throw new ArgumentOutOfRangeException(nameof(value)); 51 | } 52 | 53 | codePage = value; 54 | } 55 | } 56 | 57 | 58 | private const int FallbackCodePage = 437; 59 | 60 | /// 61 | /// Attempt to get the operating system default codepage, or failing that, to 62 | /// the fallback code page IBM 437. 63 | /// 64 | public static int SystemDefaultCodePage { get; } 65 | 66 | /// 67 | /// Get wether the default codepage is set to UTF-8. Setting this property to false will 68 | /// set the to 69 | /// 70 | /// 71 | /// /// Get OEM codepage from NetFX, which parses the NLP file with culture info table etc etc. 72 | /// But sometimes it yields the special value of 1 which is nicknamed CodePageNoOEM in sources (might also mean CP_OEMCP, but Encoding puts it so). 73 | /// This was observed on Ukranian and Hindu systems. 74 | /// Given this value, throws an . 75 | /// So replace it with , (IBM 437 which is the default code page in a default Windows installation console. 76 | /// 77 | public static bool UseUnicode 78 | { 79 | get 80 | { 81 | return codePage == Encoding.UTF8.CodePage; 82 | } 83 | set 84 | { 85 | if (value) 86 | { 87 | codePage = Encoding.UTF8.CodePage; 88 | } 89 | else 90 | { 91 | codePage = SystemDefaultCodePage; 92 | } 93 | } 94 | } 95 | 96 | /// 97 | /// Convert a portion of a byte array to a string using 98 | /// 99 | /// 100 | /// Data to convert to string 101 | /// 102 | /// 103 | /// Number of bytes to convert starting from index 0 104 | /// 105 | /// 106 | /// data[0]..data[count - 1] converted to a string 107 | /// 108 | public static string ConvertToString(byte[] data, int count) 109 | => data == null 110 | ? string.Empty 111 | : Encoding.GetEncoding(CodePage).GetString(data, 0, count); 112 | 113 | /// 114 | /// Convert a byte array to a string using 115 | /// 116 | /// 117 | /// Byte array to convert 118 | /// 119 | /// 120 | /// dataconverted to a string 121 | /// 122 | public static string ConvertToString(byte[] data) 123 | => ConvertToString(data, data.Length); 124 | 125 | private static Encoding EncodingFromFlag(int flags) 126 | => ((flags & (int)GeneralBitFlags.UnicodeText) != 0) 127 | ? Encoding.UTF8 128 | : Encoding.GetEncoding(SystemDefaultCodePage); 129 | 130 | /// 131 | /// Convert a byte array to a string using 132 | /// 133 | /// The applicable general purpose bits flags 134 | /// 135 | /// Byte array to convert 136 | /// 137 | /// The number of bytes to convert. 138 | /// 139 | /// dataconverted to a string 140 | /// 141 | public static string ConvertToStringExt(int flags, byte[] data, int count) 142 | => (data == null) 143 | ? string.Empty 144 | : EncodingFromFlag(flags).GetString(data, 0, count); 145 | 146 | /// 147 | /// Convert a byte array to a string using 148 | /// 149 | /// 150 | /// Byte array to convert 151 | /// 152 | /// The applicable general purpose bits flags 153 | /// 154 | /// dataconverted to a string 155 | /// 156 | public static string ConvertToStringExt(int flags, byte[] data) 157 | => ConvertToStringExt(flags, data, data.Length); 158 | 159 | /// 160 | /// Convert a string to a byte array using 161 | /// 162 | /// 163 | /// String to convert to an array 164 | /// 165 | /// Converted array 166 | public static byte[] ConvertToArray(string str) 167 | => str == null 168 | ? new byte[0] 169 | : Encoding.GetEncoding(CodePage).GetBytes(str); 170 | 171 | /// 172 | /// Convert a string to a byte array using 173 | /// 174 | /// The applicable general purpose bits flags 175 | /// 176 | /// String to convert to an array 177 | /// 178 | /// Converted array 179 | public static byte[] ConvertToArray(int flags, string str) 180 | => (string.IsNullOrEmpty(str)) 181 | ? new byte[0] 182 | : EncodingFromFlag(flags).GetBytes(str); 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/RegHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BeatSaberModManager.Dependencies 9 | { 10 | enum RegSAM 11 | { 12 | QueryValue = 0x0001, 13 | SetValue = 0x0002, 14 | CreateSubKey = 0x0004, 15 | EnumerateSubKeys = 0x0008, 16 | Notify = 0x0010, 17 | CreateLink = 0x0020, 18 | WOW64_32Key = 0x0200, 19 | WOW64_64Key = 0x0100, 20 | WOW64_Res = 0x0300, 21 | Read = 0x00020019, 22 | Write = 0x00020006, 23 | Execute = 0x00020019, 24 | AllAccess = 0x000f003f 25 | } 26 | 27 | static class RegHive 28 | { 29 | public static UIntPtr HKEY_LOCAL_MACHINE = new UIntPtr(0x80000002u); 30 | public static UIntPtr HKEY_CURRENT_USER = new UIntPtr(0x80000001u); 31 | } 32 | 33 | static class RegistryWOW6432 34 | { 35 | [DllImport("Advapi32.dll")] 36 | static extern uint RegOpenKeyEx(UIntPtr hKey, string lpSubKey, uint ulOptions, int samDesired, out int phkResult); 37 | 38 | [DllImport("Advapi32.dll")] 39 | static extern uint RegCloseKey(int hKey); 40 | 41 | [DllImport("advapi32.dll", EntryPoint = "RegQueryValueEx")] 42 | public static extern int RegQueryValueEx(int hKey, string lpValueName, int lpReserved, ref uint lpType, System.Text.StringBuilder lpData, ref uint lpcbData); 43 | 44 | static public string GetRegKey64(UIntPtr inHive, String inKeyName, string inPropertyName) 45 | { 46 | return GetRegKey64(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName); 47 | } 48 | 49 | static public string GetRegKey32(UIntPtr inHive, String inKeyName, string inPropertyName) 50 | { 51 | return GetRegKey64(inHive, inKeyName, RegSAM.WOW64_32Key, inPropertyName); 52 | } 53 | 54 | static public string GetRegKey64(UIntPtr inHive, String inKeyName, RegSAM in32or64key, string inPropertyName) 55 | { 56 | //UIntPtr HKEY_LOCAL_MACHINE = (UIntPtr)0x80000002; 57 | int hkey = 0; 58 | 59 | try 60 | { 61 | uint lResult = RegOpenKeyEx(RegHive.HKEY_LOCAL_MACHINE, inKeyName, 0, (int)RegSAM.QueryValue | (int)in32or64key, out hkey); 62 | if (0 != lResult) return null; 63 | uint lpType = 0; 64 | uint lpcbData = 1024; 65 | StringBuilder AgeBuffer = new StringBuilder(1024); 66 | RegQueryValueEx(hkey, inPropertyName, 0, ref lpType, AgeBuffer, ref lpcbData); 67 | string Age = AgeBuffer.ToString(); 68 | return Age; 69 | } 70 | finally 71 | { 72 | if (0 != hkey) RegCloseKey(hkey); 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/SemVer/PartialVersion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace SemVer 6 | { 7 | // A version that might not have a minor or patch 8 | // number, for use in ranges like "^1.2" or "2.x" 9 | internal class PartialVersion 10 | { 11 | public int? Major { get; set; } 12 | 13 | public int? Minor { get; set; } 14 | 15 | public int? Patch { get; set; } 16 | 17 | public string PreRelease { get; set; } 18 | 19 | private static Regex regex = new Regex(@"^ 20 | [v=\s]* 21 | (\d+|[Xx\*]) # major version 22 | ( 23 | \. 24 | (\d+|[Xx\*]) # minor version 25 | ( 26 | \. 27 | (\d+|[Xx\*]) # patch version 28 | (\-?([0-9A-Za-z\-\.]+))? # pre-release version 29 | (\+([0-9A-Za-z\-\.]+))? # build version (ignored) 30 | )? 31 | )? 32 | $", 33 | RegexOptions.IgnorePatternWhitespace); 34 | 35 | public PartialVersion(string input) 36 | { 37 | 38 | string[] xValues = { "X", "x", "*" }; 39 | 40 | if (input.Trim() == "") 41 | { 42 | // Empty input means any version 43 | return; 44 | } 45 | 46 | var match = regex.Match(input); 47 | if (!match.Success) 48 | { 49 | throw new ArgumentException(String.Format("Invalid version string: \"{0}\"", input)); 50 | } 51 | 52 | if (xValues.Contains(match.Groups[1].Value)) 53 | { 54 | Major = null; 55 | } 56 | else 57 | { 58 | Major = Int32.Parse(match.Groups[1].Value); 59 | } 60 | 61 | if (match.Groups[2].Success) 62 | { 63 | if (xValues.Contains(match.Groups[3].Value)) 64 | { 65 | Minor = null; 66 | } 67 | else 68 | { 69 | Minor = Int32.Parse(match.Groups[3].Value); 70 | } 71 | } 72 | 73 | if (match.Groups[4].Success) 74 | { 75 | if (xValues.Contains(match.Groups[5].Value)) 76 | { 77 | Patch = null; 78 | } 79 | else 80 | { 81 | Patch = Int32.Parse(match.Groups[5].Value); 82 | } 83 | } 84 | 85 | if (match.Groups[6].Success) 86 | { 87 | PreRelease = match.Groups[7].Value; 88 | } 89 | } 90 | 91 | public Version ToZeroVersion() 92 | { 93 | return new Version( 94 | Major ?? 0, 95 | Minor ?? 0, 96 | Patch ?? 0, 97 | PreRelease); 98 | } 99 | 100 | public bool IsFull() 101 | { 102 | return Major.HasValue && Minor.HasValue && Patch.HasValue; 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/SemVer/PreReleaseVersion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace SemVer 6 | { 7 | static internal class PreReleaseVersion 8 | { 9 | public static int Compare(string a, string b) 10 | { 11 | if (a == null && b == null) 12 | { 13 | return 0; 14 | } 15 | else if (a == null) 16 | { 17 | // No pre-release is > having a pre-release version 18 | return 1; 19 | } 20 | else if (b == null) 21 | { 22 | return -1; 23 | } 24 | else 25 | { 26 | foreach (var c in IdentifierComparisons(Identifiers(a), Identifiers(b))) 27 | { 28 | if (c != 0) 29 | { 30 | return c; 31 | } 32 | } 33 | return 0; 34 | } 35 | } 36 | 37 | public static string Clean(string input) 38 | { 39 | var identifierStrings = Identifiers(input).Select(i => i.Clean()); 40 | return String.Join(".", identifierStrings.ToArray()); 41 | } 42 | 43 | private class Identifier 44 | { 45 | public bool IsNumeric { get; set; } 46 | public int IntValue { get; set; } 47 | public string Value { get; set; } 48 | 49 | public Identifier(string input) 50 | { 51 | Value = input; 52 | SetNumeric(); 53 | } 54 | 55 | public string Clean() 56 | { 57 | return IsNumeric ? IntValue.ToString() : Value; 58 | } 59 | 60 | private void SetNumeric() 61 | { 62 | int x; 63 | bool couldParse = Int32.TryParse(Value, out x); 64 | IsNumeric = couldParse && x >= 0; 65 | IntValue = x; 66 | } 67 | } 68 | 69 | private static IEnumerable Identifiers(string input) 70 | { 71 | foreach (var identifier in input.Split('.')) 72 | { 73 | yield return new Identifier(identifier); 74 | } 75 | } 76 | 77 | private static IEnumerable IdentifierComparisons( 78 | IEnumerable aIdentifiers, IEnumerable bIdentifiers) 79 | { 80 | foreach (var identifiers in ZipIdentifiers(aIdentifiers, bIdentifiers)) 81 | { 82 | var a = identifiers.Item1; 83 | var b = identifiers.Item2; 84 | if (a == b) 85 | { 86 | yield return 0; 87 | } 88 | else if (a == null) 89 | { 90 | yield return -1; 91 | } 92 | else if (b == null) 93 | { 94 | yield return 1; 95 | } 96 | else 97 | { 98 | if (a.IsNumeric && b.IsNumeric) 99 | { 100 | yield return a.IntValue.CompareTo(b.IntValue); 101 | } 102 | else if (!a.IsNumeric && !b.IsNumeric) 103 | { 104 | yield return String.CompareOrdinal(a.Value, b.Value); 105 | } 106 | else if (a.IsNumeric && !b.IsNumeric) 107 | { 108 | yield return -1; 109 | } 110 | else // !a.IsNumeric && b.IsNumeric 111 | { 112 | yield return 1; 113 | } 114 | } 115 | } 116 | } 117 | 118 | // Zip identifier sets until both have been exhausted, returning null 119 | // for identifier components not in one set. 120 | private static IEnumerable> ZipIdentifiers( 121 | IEnumerable first, IEnumerable second) 122 | { 123 | using (var ie1 = first.GetEnumerator()) 124 | using (var ie2 = second.GetEnumerator()) 125 | { 126 | while (ie1.MoveNext()) 127 | { 128 | if (ie2.MoveNext()) 129 | { 130 | yield return Tuple.Create(ie1.Current, ie2.Current); 131 | } 132 | else 133 | { 134 | yield return Tuple.Create(ie1.Current, null); 135 | } 136 | } 137 | while (ie2.MoveNext()) 138 | { 139 | yield return Tuple.Create(null, ie2.Current); 140 | } 141 | } 142 | } 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /BeatSaberModManager/Dependencies/SemVer/Tuple.cs: -------------------------------------------------------------------------------- 1 | #if NET35 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | namespace System 6 | { 7 | internal static class Tuple 8 | { 9 | public static Tuple Create(T1 item1, T2 item2) 10 | { 11 | return new Tuple(item1, item2); 12 | } 13 | } 14 | 15 | [Serializable] 16 | internal class Tuple 17 | { 18 | #region Variables 19 | public readonly T1 Item1; 20 | public readonly T2 Item2; 21 | 22 | private static readonly IEqualityComparer Item1Cpmparer = EqualityComparer.Default; 23 | private static readonly IEqualityComparer Item2Comparer = EqualityComparer.Default; 24 | 25 | #endregion 26 | 27 | 28 | #region Constructors 29 | 30 | public Tuple(T1 _item1, T2 _item2)//originally is _internal_ 31 | { 32 | Item1 = _item1; 33 | Item2 = _item2; 34 | } 35 | 36 | #endregion 37 | 38 | #region Public Frunctions 39 | public override string ToString() 40 | { 41 | return string.Format("<{0},`1,}>", Item1, Item2); 42 | } 43 | 44 | #endregion 45 | 46 | #region Private Functions 47 | 48 | private static bool IsNull(object obj) 49 | { 50 | return obj is null; 51 | } 52 | 53 | #endregion 54 | 55 | #region Opreators 56 | 57 | public static bool operator ==(Tuple a, Tuple b) 58 | { 59 | if (IsNull(a) && !IsNull(b)) 60 | return false; 61 | 62 | if (!IsNull(a) && IsNull(b)) 63 | return false; 64 | 65 | if (IsNull(a) && IsNull(b)) 66 | return true; 67 | 68 | return 69 | a.Item1.Equals(b.Item1) && 70 | a.Item2.Equals(b.Item2); 71 | } 72 | 73 | public static bool operator !=(Tuple a, Tuple b) 74 | { 75 | return !(a == b); 76 | } 77 | 78 | #endregion 79 | } 80 | } 81 | #endif 82 | -------------------------------------------------------------------------------- /BeatSaberModManager/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /BeatSaberModManager/Forms/FormAnnouncement.cs: -------------------------------------------------------------------------------- 1 | using MaterialSkin.Controls; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Diagnostics; 7 | using System.Drawing; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | 13 | namespace BeatSaberModManager.Forms 14 | { 15 | public partial class FormAnnouncement : MaterialForm 16 | { 17 | public FormAnnouncement() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void FormAnnouncement_Load(object sender, EventArgs e) 23 | { 24 | 25 | } 26 | 27 | private void materialLabel1_Click(object sender, EventArgs e) 28 | { 29 | 30 | } 31 | 32 | private void richTextBox1_TextChanged(object sender, EventArgs e) 33 | { 34 | 35 | } 36 | 37 | private void buttonModAssistant_Click(object sender, EventArgs e) 38 | { 39 | Process.Start("https://github.com/Assistant/ModAssistant"); 40 | } 41 | 42 | private void buttonBeatDrop_Click(object sender, EventArgs e) 43 | { 44 | Process.Start("https://github.com/StarGazer1258/BeatDrop"); 45 | } 46 | 47 | private void buttonNoThanks_Click(object sender, EventArgs e) 48 | { 49 | this.Close(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /BeatSaberModManager/Forms/FormDetailViewer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Windows.Forms; 4 | using CommonMark; 5 | using BeatSaberModManager.DataModels; 6 | using mshtml; 7 | using MaterialSkin.Controls; 8 | using MaterialSkin; 9 | 10 | namespace BeatSaberModManager 11 | { 12 | public partial class FormDetailViewer : MaterialForm 13 | { 14 | private ReleaseInfo _release; 15 | public FormDetailViewer(ReleaseInfo release) 16 | { 17 | InitializeComponent(); 18 | _release = release; 19 | this.Text = string.Format("{0} by {1} {2}", release.title, release.author, release.version); 20 | DescriptionHandler(); 21 | } 22 | private void DescriptionHandler() 23 | { 24 | string description = CommonMarkConverter.Convert(_release.description); 25 | webBrowserDescription.DocumentText = description; 26 | } 27 | 28 | private void webBrowserDescription_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) 29 | { 30 | InitCSS(); 31 | } 32 | 33 | // Add CSS styling to the webBrowser object 34 | private void InitCSS() 35 | { 36 | IHTMLDocument2 document = (webBrowserDescription.Document.DomDocument) as IHTMLDocument2; 37 | 38 | // The first parameter is the url, the second is the index of the added style sheet. 39 | IHTMLStyleSheet styleSheet = document.createStyleSheet("", 0); 40 | 41 | // Change the font for everything in the document. Font list taken from the Github readme page 42 | int index = styleSheet.addRule("*", "font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";"); 43 | 44 | // Dark Theme 45 | if (MaterialSkinManager.Instance.Theme == MaterialSkinManager.Themes.DARK) 46 | { 47 | styleSheet.addRule("body", "background: #282828; color: whitesmoke;"); 48 | } 49 | 50 | // Edit existing rules 51 | // styleSheet.cssText = @"h1 { color: blue; }"; 52 | 53 | // Remove existing rules 54 | // styleSheet.removeRule(index); 55 | } 56 | 57 | private void MaterialRaisedButton1_Click(object sender, EventArgs e) 58 | { 59 | this.Close(); 60 | } 61 | 62 | private void MaterialRaisedButton1_Click_1(object sender, EventArgs e) 63 | { 64 | if (_release.downloadLink.StartsWith("https://")) 65 | { 66 | Process.Start(_release.downloadLink); 67 | } 68 | } 69 | 70 | private void buttonExternalLink_Click(object sender, EventArgs e) 71 | { 72 | if (_release.infoLink.StartsWith("https://")) 73 | { 74 | Process.Start(_release.infoLink); 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /BeatSaberModManager/Forms/FormPlatformSelect.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace BeatSaberModManager 2 | { 3 | partial class FormPlatformSelect 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormPlatformSelect)); 32 | this.radioButtonSteam = new MaterialSkin.Controls.MaterialRadioButton(); 33 | this.radioButtonOculus = new MaterialSkin.Controls.MaterialRadioButton(); 34 | this.buttonConfirm = new MaterialSkin.Controls.MaterialRaisedButton(); 35 | this.SuspendLayout(); 36 | // 37 | // radioButtonSteam 38 | // 39 | this.radioButtonSteam.AutoSize = true; 40 | this.radioButtonSteam.Depth = 0; 41 | this.radioButtonSteam.Font = new System.Drawing.Font("Roboto", 10F); 42 | this.radioButtonSteam.Location = new System.Drawing.Point(20, 80); 43 | this.radioButtonSteam.Margin = new System.Windows.Forms.Padding(0); 44 | this.radioButtonSteam.MouseLocation = new System.Drawing.Point(-1, -1); 45 | this.radioButtonSteam.MouseState = MaterialSkin.MouseState.HOVER; 46 | this.radioButtonSteam.Name = "radioButtonSteam"; 47 | this.radioButtonSteam.Ripple = true; 48 | this.radioButtonSteam.Size = new System.Drawing.Size(224, 30); 49 | this.radioButtonSteam.TabIndex = 3; 50 | this.radioButtonSteam.TabStop = true; 51 | this.radioButtonSteam.Text = "I purchased the game on Steam"; 52 | this.radioButtonSteam.UseVisualStyleBackColor = true; 53 | // 54 | // radioButtonOculus 55 | // 56 | this.radioButtonOculus.AutoSize = true; 57 | this.radioButtonOculus.Depth = 0; 58 | this.radioButtonOculus.Font = new System.Drawing.Font("Roboto", 10F); 59 | this.radioButtonOculus.Location = new System.Drawing.Point(20, 122); 60 | this.radioButtonOculus.Margin = new System.Windows.Forms.Padding(0); 61 | this.radioButtonOculus.MouseLocation = new System.Drawing.Point(-1, -1); 62 | this.radioButtonOculus.MouseState = MaterialSkin.MouseState.HOVER; 63 | this.radioButtonOculus.Name = "radioButtonOculus"; 64 | this.radioButtonOculus.Ripple = true; 65 | this.radioButtonOculus.Size = new System.Drawing.Size(286, 30); 66 | this.radioButtonOculus.TabIndex = 4; 67 | this.radioButtonOculus.TabStop = true; 68 | this.radioButtonOculus.Text = "I purchased the game on the Oculus Store"; 69 | this.radioButtonOculus.UseVisualStyleBackColor = true; 70 | // 71 | // buttonConfirm 72 | // 73 | this.buttonConfirm.Anchor = System.Windows.Forms.AnchorStyles.Bottom; 74 | this.buttonConfirm.Depth = 0; 75 | this.buttonConfirm.Location = new System.Drawing.Point(124, 166); 76 | this.buttonConfirm.MouseState = MaterialSkin.MouseState.HOVER; 77 | this.buttonConfirm.Name = "buttonConfirm"; 78 | this.buttonConfirm.Primary = true; 79 | this.buttonConfirm.Size = new System.Drawing.Size(157, 39); 80 | this.buttonConfirm.TabIndex = 5; 81 | this.buttonConfirm.Text = "Confirm"; 82 | this.buttonConfirm.UseVisualStyleBackColor = true; 83 | this.buttonConfirm.Click += new System.EventHandler(this.MaterialRaisedButton1_Click); 84 | // 85 | // FormPlatformSelect 86 | // 87 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 88 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 89 | this.ClientSize = new System.Drawing.Size(404, 219); 90 | this.Controls.Add(this.buttonConfirm); 91 | this.Controls.Add(this.radioButtonOculus); 92 | this.Controls.Add(this.radioButtonSteam); 93 | this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 94 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 95 | this.MaximizeBox = false; 96 | this.MinimizeBox = false; 97 | this.Name = "FormPlatformSelect"; 98 | this.ShowIcon = false; 99 | this.ShowInTaskbar = false; 100 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 101 | this.Text = "Please select your platform"; 102 | this.TopMost = true; 103 | this.ResumeLayout(false); 104 | this.PerformLayout(); 105 | 106 | } 107 | 108 | #endregion 109 | private MaterialSkin.Controls.MaterialRadioButton radioButtonSteam; 110 | private MaterialSkin.Controls.MaterialRadioButton radioButtonOculus; 111 | private MaterialSkin.Controls.MaterialRaisedButton buttonConfirm; 112 | } 113 | } -------------------------------------------------------------------------------- /BeatSaberModManager/Forms/FormPlatformSelect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using BeatSaberModManager.Core; 4 | using MaterialSkin.Controls; 5 | using MaterialSkin; 6 | 7 | namespace BeatSaberModManager 8 | { 9 | public partial class FormPlatformSelect : MaterialForm 10 | { 11 | PathLogic logic; 12 | public FormPlatformSelect(PathLogic _logic) 13 | { 14 | InitializeComponent(); 15 | logic = _logic; 16 | } 17 | 18 | private void MaterialRaisedButton1_Click(object sender, EventArgs e) 19 | { 20 | if (radioButtonOculus.Checked) 21 | { 22 | logic.platform = Platform.Oculus; 23 | } 24 | else 25 | { 26 | logic.platform = Platform.Steam; 27 | } 28 | this.Close(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /BeatSaberModManager/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.Reflection; 4 | using BeatSaberModManager.Forms; 5 | 6 | namespace BeatSaberModManager 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | static void Main(string[] args) 15 | { 16 | bool close = false; 17 | for (int i = 0; i < args.Length; i++) 18 | { 19 | switch (args[i]) 20 | { 21 | case "--install": 22 | Core.OneClickInstaller.InstallFile(args[i + 1]); 23 | close = true; 24 | break; 25 | 26 | default: 27 | break; 28 | } 29 | } 30 | 31 | if (close) 32 | return; 33 | 34 | Application.EnableVisualStyles(); 35 | Application.SetCompatibleTextRenderingDefault(false); 36 | // Open the announcement window 37 | Application.Run(new FormAnnouncement()); 38 | Application.Run(new FormMain()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /BeatSaberModManager/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Beat Saber Mod Manager")] 10 | [assembly: AssemblyDescription("Beat Saber Mod Manager Beat Mods BETA")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("BeatSaberModManager")] 14 | [assembly: AssemblyCopyright("Copyright © Umbranox 2018")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("3187e247-19d8-4aa8-8f7c-9eef3fd77399")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("0.3.6.1")] 37 | [assembly: AssemblyFileVersion("0.3.6.1")] 38 | [assembly: NeutralResourcesLanguage("en")] 39 | 40 | -------------------------------------------------------------------------------- /BeatSaberModManager/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace BeatSaberModManager.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BeatSaberModManager.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /BeatSaberModManager/Properties/Resources.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 | -------------------------------------------------------------------------------- /BeatSaberModManager/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace BeatSaberModManager.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 DarkTheme { 30 | get { 31 | return ((bool)(this["DarkTheme"])); 32 | } 33 | set { 34 | this["DarkTheme"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 41 | public int Theme { 42 | get { 43 | return ((int)(this["Theme"])); 44 | } 45 | set { 46 | this["Theme"] = value; 47 | } 48 | } 49 | 50 | [global::System.Configuration.UserScopedSettingAttribute()] 51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 | [global::System.Configuration.DefaultSettingValueAttribute("")] 53 | public string ModsList { 54 | get { 55 | return ((string)(this["ModsList"])); 56 | } 57 | set { 58 | this["ModsList"] = value; 59 | } 60 | } 61 | 62 | [global::System.Configuration.UserScopedSettingAttribute()] 63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 | [global::System.Configuration.DefaultSettingValueAttribute("True")] 65 | public bool UpgradeRequired { 66 | get { 67 | return ((bool)(this["UpgradeRequired"])); 68 | } 69 | set { 70 | this["UpgradeRequired"] = value; 71 | } 72 | } 73 | 74 | [global::System.Configuration.UserScopedSettingAttribute()] 75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 76 | [global::System.Configuration.DefaultSettingValueAttribute("")] 77 | public string InstallPath { 78 | get { 79 | return ((string)(this["InstallPath"])); 80 | } 81 | set { 82 | this["InstallPath"] = value; 83 | } 84 | } 85 | 86 | [global::System.Configuration.UserScopedSettingAttribute()] 87 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 88 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 89 | public int Platform { 90 | get { 91 | return ((int)(this["Platform"])); 92 | } 93 | set { 94 | this["Platform"] = value; 95 | } 96 | } 97 | 98 | [global::System.Configuration.UserScopedSettingAttribute()] 99 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 100 | [global::System.Configuration.DefaultSettingValueAttribute("")] 101 | public string VersionsList { 102 | get { 103 | return ((string)(this["VersionsList"])); 104 | } 105 | set { 106 | this["VersionsList"] = value; 107 | } 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /BeatSaberModManager/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | False 7 | 8 | 9 | 0 10 | 11 | 12 | 13 | 14 | 15 | True 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /BeatSaberModManager/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | False 12 | 13 | 14 | 0 15 | 16 | 17 | 18 | 19 | 20 | True 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /BeatSaberModManager/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 59 | 60 | 61 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /BeatSaberModManager/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsmg/BeatSaberModInstaller/c5de96c5879e248d31e8e0d949781bc62c950e63/BeatSaberModManager/icon.ico -------------------------------------------------------------------------------- /BeatSaberModManager/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BeatSaberModManager/saber.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsmg/BeatSaberModInstaller/c5de96c5879e248d31e8e0d949781bc62c950e63/BeatSaberModManager/saber.ico -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > # **This repository is deprecated!** 2 | > ### Please use [Mod Assistant](https://github.com/Assistant/ModAssistant) to install mods now, this installer is no longer supported. 3 | 4 | 5 | # Beat Saber Mod Manager (BeatMods Edition!) 6 | 7 | *This is a fork of the Beat Saber Mod Manager by Umbranoxio.* 8 | *It has been adapted to work with https://beatmods.com instead of https://modsaber.org* 9 | 10 | This program will install custom mods into Beat Saber automatically, and can be re-run in order to update the mods. 11 | 12 | The program currently supports 13 | * Every approved mod on https://beatmods.com 14 | 15 | This uses BeatMods to get the latest approved and manually verified mods latest version automatically. 16 | 17 | ![Preview](https://user-images.githubusercontent.com/27714637/55780977-02170700-5a5e-11e9-9622-9b1ccdd1b982.png) 18 | -------------------------------------------------------------------------------- /packages/MaterialSkin.0.2.1/MaterialSkin.0.2.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsmg/BeatSaberModInstaller/c5de96c5879e248d31e8e0d949781bc62c950e63/packages/MaterialSkin.0.2.1/MaterialSkin.0.2.1.nupkg -------------------------------------------------------------------------------- /packages/MaterialSkin.0.2.1/lib/MaterialSkin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bsmg/BeatSaberModInstaller/c5de96c5879e248d31e8e0d949781bc62c950e63/packages/MaterialSkin.0.2.1/lib/MaterialSkin.dll -------------------------------------------------------------------------------- /update.txt: -------------------------------------------------------------------------------- 1 | 15 2 | --------------------------------------------------------------------------------