Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BasisSerializer.OdinSerializer;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
Expand All @@ -14,8 +15,13 @@ public class AvatarKey
public string Url;
public string Pass;
}
#if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
private static string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Application.companyName, Application.productName);
public static string FilePath = Path.Combine(directory, "KeyStore.json");
#else
public static string FilePath = Path.Combine(Application.persistentDataPath, "KeyStore.json");


#endif
[SerializeField]
private static List<AvatarKey> keys = new List<AvatarKey>();

Expand Down Expand Up @@ -63,20 +69,40 @@ public static async Task LoadKeys()
else
{
BasisDebug.Log("No key file found. Starting fresh.");
#if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
string checkMigration = Path.Combine(Application.persistentDataPath, "KeyStore.json");
if (File.Exists(checkMigration))
{
File.Copy(checkMigration, FilePath);
}
#endif
}
}

private static async Task SaveKeysToFile()
{
try
{
#if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
#endif
byte[] byteData = SerializationUtility.SerializeValue<List<AvatarKey>>(keys, DataFormat.Binary);
await File.WriteAllBytesAsync(FilePath, byteData);
BasisDebug.Log($"Keys saved to file at: {FilePath}");
}
catch (System.Exception e)
{
BasisDebug.LogError($"Failed to save keys: {e.Message}");
if (File.Exists(FilePath)) {
File.Copy(FilePath, Path.ChangeExtension(FilePath, ".json.bak"));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public static bool ReportIfNoIll2CPP()
}
private void ShowErrorPanel(VisualElement Root, List<BasisValidationIssue> errors)
{
string IssueList = string.Empty;
List<string> IssueList = new List<string>();
for (int Index = 0; Index < errors.Count; Index++)
{
BasisValidationIssue issue = errors[Index];
Expand All @@ -497,9 +497,12 @@ private void ShowErrorPanel(VisualElement Root, List<BasisValidationIssue> error
{
AutoFixButton(Root, ActFix, issue.Message);
}
IssueList += issue.Message;
if (!IssueList.Exists(i => i == issue.Message))
{
IssueList.Add(issue.Message);
}
}
errorMessageLabel.text = string.Join("\n", IssueList);
errorMessageLabel.text = string.Join("\n", IssueList.ToArray());
errorPanel.style.display = DisplayStyle.Flex;
}
private void HideErrorPanel()
Expand All @@ -508,7 +511,7 @@ private void HideErrorPanel()
}
private void ShowWarningPanel(VisualElement Root,List<BasisValidationIssue> warnings)
{
string warningsList = string.Empty;
List<string> warningsList = new List<string>();
for (int Index = 0; Index < warnings.Count; Index++)
{
BasisValidationIssue issue = warnings[Index];
Expand All @@ -517,9 +520,12 @@ private void ShowWarningPanel(VisualElement Root,List<BasisValidationIssue> warn
{
AutoFixButton(Root, ActFix, issue.Message);
}
warningsList += issue.Message;
if (!warningsList.Exists(i => i==issue.Message))
{
warningsList.Add(issue.Message);
}
}
warningMessageLabel.text = string.Join("\n", warningsList);
warningMessageLabel.text = string.Join("\n", warningsList.ToArray());
warningPanel.style.display = DisplayStyle.Flex;
}
public void ClearFixButtons(VisualElement rootElement)
Expand Down
Loading