Merge pull request #74 from mlavik1/assetstore-fix
Read .dic files from Resources folder instead of StreamingAssets.
This commit is contained in:
Коммит
13abae6746
|
@ -434,6 +434,25 @@ namespace openDicom.Registry
|
|||
if (global == null) Global = this;
|
||||
}
|
||||
|
||||
public void LoadFromMemory(MemoryStream memStream, DictionaryFileFormat fileFormat)
|
||||
{
|
||||
if (!IsEmpty) Clear();
|
||||
StreamReader streamReader = new StreamReader(memStream);
|
||||
switch (fileFormat)
|
||||
{
|
||||
case DictionaryFileFormat.BinaryFile:
|
||||
LoadFromBinary(streamReader); break;
|
||||
case DictionaryFileFormat.PropertyFile:
|
||||
LoadFromProperty(streamReader); break;
|
||||
case DictionaryFileFormat.CsvFile:
|
||||
LoadFromCsv(streamReader); break;
|
||||
case DictionaryFileFormat.XmlFile:
|
||||
LoadFromXml(streamReader); break;
|
||||
}
|
||||
streamReader.Close();
|
||||
if (global == null) Global = this;
|
||||
}
|
||||
|
||||
private void SaveAsBinary(StreamWriter streamWriter,
|
||||
DataElementDictionaryEntry[] entryArray)
|
||||
{
|
||||
|
|
|
@ -308,6 +308,25 @@ namespace openDicom.Registry
|
|||
if (global == null) Global = this;
|
||||
}
|
||||
|
||||
public void LoadFromMemory(MemoryStream memStream, DictionaryFileFormat fileFormat)
|
||||
{
|
||||
if (!IsEmpty) Clear();
|
||||
StreamReader streamReader = new StreamReader(memStream);
|
||||
switch (fileFormat)
|
||||
{
|
||||
case DictionaryFileFormat.BinaryFile:
|
||||
LoadFromBinary(streamReader); break;
|
||||
case DictionaryFileFormat.PropertyFile:
|
||||
LoadFromProperty(streamReader); break;
|
||||
case DictionaryFileFormat.CsvFile:
|
||||
LoadFromCsv(streamReader); break;
|
||||
case DictionaryFileFormat.XmlFile:
|
||||
LoadFromXml(streamReader); break;
|
||||
}
|
||||
streamReader.Close();
|
||||
if (global == null) Global = this;
|
||||
}
|
||||
|
||||
private void SaveAsBinary(StreamWriter streamWriter,
|
||||
UidDictionaryEntry[] entryArray)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 973e06d586332ae47bed697dfab2de3d
|
||||
DefaultImporter:
|
||||
guid: 995b791e7a90b494194aa1d02cedc49c
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
|
@ -1,6 +1,6 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dbc53a7688d64154eb54ec48178d29dd
|
||||
DefaultImporter:
|
||||
guid: 53bd64257ce5dc444ba9bc04d58de1e7
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
|
@ -54,8 +54,14 @@ namespace UnityVolumeRendering
|
|||
UidDictionary uidDictionary = new UidDictionary();
|
||||
try
|
||||
{
|
||||
dataElementDictionary.LoadFrom(Path.Combine(Application.streamingAssetsPath, "dicom-elements-2007.dic"), DictionaryFileFormat.BinaryFile);
|
||||
uidDictionary.LoadFrom(Path.Combine(Application.streamingAssetsPath, "dicom-uids-2007.dic"), DictionaryFileFormat.BinaryFile);
|
||||
// Load .dic files from Resources
|
||||
TextAsset dcmElemAsset = (TextAsset)Resources.Load("dicom-elements-2007.dic");
|
||||
Debug.Assert(dcmElemAsset != null, "dicom-elements-2007.dic is missing from the Resources folder");
|
||||
TextAsset dcmUidsAsset = (TextAsset)Resources.Load("dicom-uids-2007.dic");
|
||||
Debug.Assert(dcmUidsAsset != null, "dicom-uids-2007.dic is missing from the Resources folder");
|
||||
|
||||
dataElementDictionary.LoadFromMemory(new MemoryStream(dcmElemAsset.bytes), DictionaryFileFormat.BinaryFile);
|
||||
uidDictionary.LoadFromMemory(new MemoryStream(dcmUidsAsset.bytes), DictionaryFileFormat.BinaryFile);
|
||||
}
|
||||
catch (Exception dictionaryException)
|
||||
{
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b11b1f848245f974ab893c35ca3aae92
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Загрузка…
Ссылка в новой задаче