diff --git a/c-sharp/Projects/ParatextProjectDataProviderFactory.cs b/c-sharp/Projects/ParatextProjectDataProviderFactory.cs
index a4b1244bc8..64fd5ddba1 100644
--- a/c-sharp/Projects/ParatextProjectDataProviderFactory.cs
+++ b/c-sharp/Projects/ParatextProjectDataProviderFactory.cs
@@ -24,7 +24,7 @@ protected override ResponseToRequest GetProjectDataProviderID(
string projectStorageInterpreterId
)
{
- if (_paratextPsi.StorageType.ToSerializedString() != projectStorageInterpreterId)
+ if (_paratextPsi.StorageType != projectStorageInterpreterId)
return ResponseToRequest.Failed(
$"Unexpected project storage interpreter requested: {projectStorageInterpreterId}"
);
diff --git a/c-sharp/Projects/ProjectMetadata.cs b/c-sharp/Projects/ProjectMetadata.cs
index 27b86d3026..e3694efadd 100644
--- a/c-sharp/Projects/ProjectMetadata.cs
+++ b/c-sharp/Projects/ProjectMetadata.cs
@@ -5,12 +5,7 @@ namespace Paranext.DataProvider.Projects;
///
public class ProjectMetadata
{
- public ProjectMetadata(
- Guid id,
- string name,
- ProjectStorageType projectStorageType,
- string projectType
- )
+ public ProjectMetadata(Guid id, string name, string projectStorageType, string projectType)
{
ID = id;
Name = name;
@@ -31,7 +26,7 @@ string projectType
///
/// Indicates how the project is persisted to storage
///
- public ProjectStorageType ProjectStorageType { get; }
+ public string ProjectStorageType { get; }
///
/// Indicates what sort of project this is which implies its data shape (e.g., what data streams should be available)
@@ -54,11 +49,11 @@ protected bool Equals(ProjectMetadata other)
public override int GetHashCode()
{
- return HashCode.Combine(ID, Name, (int)ProjectStorageType, ProjectType);
+ return HashCode.Combine(ID, Name, ProjectStorageType, ProjectType);
}
public override string ToString()
{
- return $"[{Name} ({ID}): {ProjectStorageType.ToSerializedString()}, {ProjectType}]";
+ return $"[{Name} ({ID}): {ProjectStorageType}, {ProjectType}]";
}
}
diff --git a/c-sharp/Projects/ProjectStorageInterpreter.cs b/c-sharp/Projects/ProjectStorageInterpreter.cs
index 2311228958..fa4c58e306 100644
--- a/c-sharp/Projects/ProjectStorageInterpreter.cs
+++ b/c-sharp/Projects/ProjectStorageInterpreter.cs
@@ -13,12 +13,12 @@ namespace Paranext.DataProvider.Projects;
internal abstract class ProjectStorageInterpreter : NetworkObjects.DataProvider
{
protected ProjectStorageInterpreter(
- ProjectStorageType storageType,
+ string storageType,
IReadOnlyList projectTypes,
PapiClient papiClient
)
// TODO: Register one network object per (storage type, project type) pair or come up with a better approach
- : base($"platform.{storageType.ToSerializedString()}-{projectTypes[0]}-psi", papiClient)
+ : base($"platform.{storageType}-{projectTypes[0]}-psi", papiClient)
{
StorageType = storageType;
ProjectTypes = projectTypes;
@@ -64,13 +64,13 @@ private ResponseToRequest GetSupportedTypes()
return ResponseToRequest.Succeeded(
new JObject
{
- ["storageType"] = StorageType.ToSerializedString(),
+ ["storageType"] = StorageType,
["projectTypes"] = JsonConvert.SerializeObject(ProjectTypes)
}.ToString()
);
}
- public ProjectStorageType StorageType { get; }
+ public string StorageType { get; }
public IEnumerable ProjectTypes { get; }
///
diff --git a/c-sharp/Projects/ProjectStorageType.cs b/c-sharp/Projects/ProjectStorageType.cs
index 728d1f98b1..f3cabb8a4e 100644
--- a/c-sharp/Projects/ProjectStorageType.cs
+++ b/c-sharp/Projects/ProjectStorageType.cs
@@ -4,50 +4,9 @@ namespace Paranext.DataProvider.Projects;
/// Structure of the data in persisted storage.
/// This is not related to the format of the data itself but the way it is stored
///
-public enum ProjectStorageType
+public static class ProjectStorageType
{
- Unknown,
- ParatextFolders,
- ParatextZipped
-}
-
-// Add an extension methods related to the enum
-public static class ProjectStorageTypeExtensions
-{
- ///
- /// Convert a ProjectStorageType into a value recognized by PAPI
- ///
- /// Enum value
- /// String that represents the enum value that can be passed over the network
- public static string ToSerializedString(this ProjectStorageType projectStorageType)
- {
- return projectStorageType switch
- {
- ProjectStorageType.Unknown => "unknown",
- ProjectStorageType.ParatextFolders => "paratextFolders",
- ProjectStorageType.ParatextZipped => "paratextZipped",
- _ => throw new Exception("Unexpected project storage type: " + projectStorageType)
- };
- }
-
- ///
- /// Convert a string from PAPI into a ProjectStorageType enum value
- ///
- /// string representing a ProjectStorageType value
- /// ProjectStorageType enum value
- public static void FromSerializedString(this string input, out ProjectStorageType output)
- {
- switch (input)
- {
- case "paratextFolders":
- output = ProjectStorageType.ParatextFolders;
- return;
- case "paratextZipped":
- output = ProjectStorageType.ParatextZipped;
- return;
- default:
- output = ProjectStorageType.Unknown;
- return;
- }
- }
+ public const string Unknown = "unknown";
+ public const string ParatextFolders = "paratextFolders";
+ public const string ParatextZipped = "paratextZipped";
}
diff --git a/c-sharp/Projects/ProjectType.cs b/c-sharp/Projects/ProjectType.cs
index c6c8f9d6a8..456795fa77 100644
--- a/c-sharp/Projects/ProjectType.cs
+++ b/c-sharp/Projects/ProjectType.cs
@@ -3,7 +3,7 @@ namespace Paranext.DataProvider.Projects;
///
/// Format of main (Project Data Provider, not extension) data in a project
///
-internal static class ProjectType
+public static class ProjectType
{
public const string Paratext = "ParatextStandard";
}