-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Multion pattern to instantiate just one object of each *Format.…
…cs type. This object is then utilized and controlled by the Formatter class.
- Loading branch information
dustin
authored and
dustin
committed
Jul 15, 2019
1 parent
a0a276e
commit cea308a
Showing
24 changed files
with
24,159 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,3 +80,5 @@ $RECYCLE.BIN/ | |
|
||
# Windows shortcuts | ||
*.lnk | ||
/Assets/Experica/Serialization/JSONFormat.cs.meta | ||
*.meta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Experica; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Experica | ||
{ | ||
class HDF5Format : IFormat | ||
{ | ||
/// <summary> | ||
/// NOT IMPLEMENTED. Will deserialize a string of text into an object. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="data"></param> | ||
/// <returns></returns> | ||
public T Deserialize<T>(string data) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
/// <summary> | ||
/// NOT IMPLEMENTED. Will Serialize an object into a serialize of bytes/text in hdf5 format | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="obj"></param> | ||
/// <returns></returns> | ||
public string Serialize<T>(T obj) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Experica; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Experica | ||
{ | ||
class JSONFormat : IFormat | ||
{ | ||
|
||
public T Deserialize<T>(string data) | ||
{ | ||
T obj = JsonConvert.DeserializeObject<T>(data); | ||
return obj; | ||
} | ||
|
||
public string Serialize<T>(T obj) | ||
{ | ||
string json = JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings() | ||
{ | ||
// This handles self-referencing loops. | ||
//PreserveReferencesHandling = PreserveReferencesHandling.All | ||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore | ||
//PreserveReferencesHandling = PreserveReferencesHandling.Objects | ||
}); | ||
return json; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.