@@ -33,15 +33,7 @@ public static void EnsureServerInstalled()
3333 }
3434 else
3535 {
36- string pyprojectPath = Path . Combine (
37- saveLocation ,
38- ServerFolder ,
39- "src" ,
40- "pyproject.toml"
41- ) ;
42- string installedVersion = ParseVersionFromPyproject (
43- File . ReadAllText ( pyprojectPath )
44- ) ;
36+ string installedVersion = GetInstalledVersion ( ) ;
4537 string latestVersion = GetLatestVersion ( ) ;
4638
4739 if ( IsNewerVersion ( latestVersion , installedVersion ) )
@@ -148,10 +140,24 @@ private static void InstallServer(string location)
148140 RunCommand ( "git" , $ "checkout { BranchName } ", workingDirectory : location ) ;
149141 }
150142
143+ /// <summary>
144+ /// Fetches the currently installed version from the local pyproject.toml file.
145+ /// </summary>
146+ public static string GetInstalledVersion ( )
147+ {
148+ string pyprojectPath = Path . Combine (
149+ GetSaveLocation ( ) ,
150+ ServerFolder ,
151+ "src" ,
152+ "pyproject.toml"
153+ ) ;
154+ return ParseVersionFromPyproject ( File . ReadAllText ( pyprojectPath ) ) ;
155+ }
156+
151157 /// <summary>
152158 /// Fetches the latest version from the GitHub pyproject.toml file.
153159 /// </summary>
154- private static string GetLatestVersion ( )
160+ public static string GetLatestVersion ( )
155161 {
156162 using WebClient webClient = new ( ) ;
157163 string pyprojectContent = webClient . DownloadString ( PyprojectUrl ) ;
@@ -188,7 +194,7 @@ private static string ParseVersionFromPyproject(string content)
188194 /// <summary>
189195 /// Compares two version strings to determine if the latest is newer.
190196 /// </summary>
191- private static bool IsNewerVersion ( string latest , string installed )
197+ public static bool IsNewerVersion ( string latest , string installed )
192198 {
193199 int [ ] latestParts = latest . Split ( '.' ) . Select ( int . Parse ) . ToArray ( ) ;
194200 int [ ] installedParts = installed . Split ( '.' ) . Select ( int . Parse ) . ToArray ( ) ;
0 commit comments