Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc614492

Browse files
committed
add support for 2022.x custom asset store downloads location,fixes#73
1 parentc52e739 commitc614492

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

‎UnityLauncherPro/MainWindow.xaml.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,7 @@ private void ChkAllowSingleInstanceOnly_CheckedChanged(object sender, RoutedEven
18271827

18281828
privatevoidBtnAssetPackages_Click(objectsender,RoutedEventArgse)
18291829
{
1830+
Tools.OpenCustomAssetPath();
18301831
Tools.OpenAppdataSpecialFolder("../Roaming/Unity/Asset Store-5.x");
18311832
}
18321833

‎UnityLauncherPro/Tools.cs‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,8 @@ public static string ParseDownloadURLFromWebpage(string version, bool preferFull
829829
else
830830
{
831831
// TODO version here is actually HASH
832-
url=$"https://beta.unity3d.com/download/{version}/download.html";
832+
stringhash=version;
833+
url=$"https://beta.unity3d.com/download/{hash}/download.html";
833834

834835
//Console.WriteLine(url);
835836

@@ -838,7 +839,7 @@ public static string ParseDownloadURLFromWebpage(string version, bool preferFull
838839
//Console.WriteLine(version);
839840
if(string.IsNullOrEmpty(version))
840841
{
841-
Console.WriteLine("Failed to get version number from hash: "+version);
842+
SetStatus("Failed to get version("+version+")number from hash: "+hash);
842843
returnnull;
843844
}
844845
}
@@ -2218,6 +2219,40 @@ internal static void SaveProjectSettings(Project proj, string customEnvVars)
22182219
Console.WriteLine(fullPath);
22192220
}
22202221
}
2222+
2223+
internalstaticvoidOpenCustomAssetPath()
2224+
{
2225+
// check if custom asset folder is used, then open both *since older versions might have assets in old folder
2226+
stringkeyPath=@"SOFTWARE\Unity Technologies\Unity Editor 5.x";
2227+
using(RegistryKeykey=Registry.CurrentUser.OpenSubKey(keyPath))
2228+
{
2229+
if(key==null)return;
2230+
// Enumerate subkeys
2231+
foreach(stringvalueNameinkey.GetValueNames())
2232+
{
2233+
// Check if the subkey matches the desired pattern
2234+
if(Regex.IsMatch(valueName,@"AssetStoreCacheRootPath_h\d+")==false)continue;
2235+
2236+
stringcustomAssetPath="";
2237+
varvalueKind=key.GetValueKind(valueName);
2238+
2239+
if(valueKind==RegistryValueKind.Binary)
2240+
{
2241+
byte[]bytes=(byte[])key.GetValue(valueName);
2242+
customAssetPath=Encoding.UTF8.GetString(bytes,0,bytes.Length-1);
2243+
}
2244+
else// should be string then
2245+
{
2246+
customAssetPath=(string)key.GetValue(valueName);
2247+
}
2248+
2249+
if(string.IsNullOrEmpty(customAssetPath)==false&&Directory.Exists(customAssetPath))
2250+
{
2251+
Tools.LaunchExplorer(Path.Combine(customAssetPath,"Asset Store-5.x"));
2252+
}
2253+
}
2254+
}
2255+
}
22212256
}// class
22222257

22232258
}// namespace

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp