#68: Moved .dic files from StreamingAssets to Resources.
This commit is contained in:
Родитель
e6cc256c69
Коммит
108383dd56
|
@ -434,6 +434,25 @@ namespace openDicom.Registry
|
||||||
if (global == null) Global = this;
|
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,
|
private void SaveAsBinary(StreamWriter streamWriter,
|
||||||
DataElementDictionaryEntry[] entryArray)
|
DataElementDictionaryEntry[] entryArray)
|
||||||
{
|
{
|
||||||
|
|
|
@ -308,6 +308,25 @@ namespace openDicom.Registry
|
||||||
if (global == null) Global = this;
|
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,
|
private void SaveAsBinary(StreamWriter streamWriter,
|
||||||
UidDictionaryEntry[] entryArray)
|
UidDictionaryEntry[] entryArray)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 973e06d586332ae47bed697dfab2de3d
|
guid: 995b791e7a90b494194aa1d02cedc49c
|
||||||
DefaultImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
|
@ -1,6 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: dbc53a7688d64154eb54ec48178d29dd
|
guid: 53bd64257ce5dc444ba9bc04d58de1e7
|
||||||
DefaultImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
|
@ -54,8 +54,14 @@ namespace UnityVolumeRendering
|
||||||
UidDictionary uidDictionary = new UidDictionary();
|
UidDictionary uidDictionary = new UidDictionary();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataElementDictionary.LoadFrom(Path.Combine(Application.streamingAssetsPath, "dicom-elements-2007.dic"), DictionaryFileFormat.BinaryFile);
|
// Load .dic files from Resources
|
||||||
uidDictionary.LoadFrom(Path.Combine(Application.streamingAssetsPath, "dicom-uids-2007.dic"), DictionaryFileFormat.BinaryFile);
|
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)
|
catch (Exception dictionaryException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: b11b1f848245f974ab893c35ca3aae92
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Загрузка…
Ссылка в новой задаче