本文整理汇总了C#中Serializer.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Serializer.Load方法的具体用法?C# Serializer.Load怎么用?C# Serializer.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Serializer
的用法示例。
在下文中一共展示了Serializer.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
void Init(){ // refactored this because Awake could be called after the first ExpectEvents call, wiping out the settings
if (initialized) return;
initialized = true;
if(target == null && transform.parent != null )
target = transform.parent.gameObject;
if ( target != null )
{
am = target.GetComponent<AnimationManager>();
tc = target.GetComponent<TaskCharacter>();
}
skippedEvents = new List<string>();
expectedEvents = new AnimEventList();
expectedEvents.events = new List<AnimationEvent>();
receivedEvents = new List<AnimationEvent>();
// MatchingLists = new List<AnimEventList>() ;
if (animEventList == null){
Serializer<List<AnimEventList>> serializer = new Serializer<List<AnimEventList>>();
string pathname = "XML/AnimEventList";
animEventList = serializer.Load(pathname);
// CheckForDuplicateClips(); // there are a lot of duplicates, we are dealing with it.
}
}
示例2: LoadXML
public virtual void LoadXML(string filename)
{
Serializer<List<StringMap>> serializer = new Serializer<List<StringMap>>();
List<StringMap> tmp = serializer.Load(filename);
if (tmp != null)
stringmap = tmp;
}
示例3: LoadFromXML
void LoadFromXML(string filepath){
Serializer<LinkableContentInfo> serializer = new Serializer<LinkableContentInfo>();
filepath = "XML/"+filepath.Replace (".xml","");
LinkableContentInfo info = new LinkableContentInfo();
info = serializer.Load(filepath);
InitFrom( info );
}
示例4: Start
public void Start()
{
#if BUILD
BuildCommandVariations("Variations");
#endif
#if LOADXML
Serializer<List<CommandVariation>> serializer2 = new Serializer<List<CommandVariation>>();
variations = serializer2.Load("XML/CommandVariations");
#endif
#if USE_SELECTION_WEIGHTS
LoadSelectionWeightsFromXML ();
#endif
}
示例5: OnInspectorGUI
public override void OnInspectorGUI()
{
if (!onSelected) // this must be Pauls name.
{
onSelected = true;
OnSelected(); //?this is called just to get OnSelected called when the first gui call happens ?
}
DrawDefaultInspector();
GUILayout.BeginHorizontal();
if ( GUILayout.Button ("Load Case Order" ) )
{
Serializer<List<string>> serializer = new Serializer<List<string>>();
myObject.CaseOrder = serializer.Load ("XML/CaseOrder");
}
if ( GUILayout.Button ("Save Case Order" ) )
{
Serializer<List<string>> serializer = new Serializer<List<string>>();
serializer.Save (Application.dataPath + "/Resources/XML/CaseOrder.xml",myObject.CaseOrder);
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
if ( myObject.UseLocalData == false )
{
if ( GUILayout.Button ("Save WEB Cases to CaseInfo.xml") )
{
if ( CaseConfiguratorMgr.GetInstance().CaseList == null || CaseConfiguratorMgr.GetInstance().CaseList.Count == 0 )
UnityEngine.Debug.LogError ("NO CASES, go to case selection screen first!");
else
CaseConfiguratorMgr.GetInstance().SaveXML (Application.dataPath + "/Resources/XML/CaseInfo.xml");
}
}
else
{
if ( GUILayout.Button ("Save Selected Case to WEB") )
{
if ( CaseConfiguratorMgr.GetInstance().CaseList == null || CaseConfiguratorMgr.GetInstance().CaseList.Count == 0 )
UnityEngine.Debug.LogError ("NO CASES, go to case selection screen first!");
else
// takes the current case and saves it to the database
CaseConfiguratorMgr.GetInstance().SaveCaseConfiguration(null);
}
}
GUILayout.EndHorizontal();
}
示例6: Main
public static void Main(string[] arguments)
{
Configuration configuration;
try
{
var serialiser = new Serializer<Configuration>("Configuration.xml");
configuration = serialiser.Load();
}
catch (XmlException exception)
{
Console.WriteLine("Configuration error: {0}", exception.Message);
return;
}
var client = new WarehouseClient(configuration);
client.Run();
}
示例7: ConnectExecuted
private void ConnectExecuted()
{
var login = activity as LoginViewModel;
if (login != null)
{
var serializer = new Serializer<List<ServerCredentialsModel>>();
// save the credential info
var credentials = File.Exists(ServerFile)
? serializer.Load(ServerFile)
: new List<ServerCredentialsModel>();
var model = login.ServerCredentials;
credentials.Add(model);
serializer.Save(credentials, ServerFile);
ShowServerOverview(model);
}
}
示例8: Load_GivenSerializedSolutionModel_MatchesSaved
public void Load_GivenSerializedSolutionModel_MatchesSaved()
{
var savedModel = new TestModel {TestInt = 5, TestString = "hello"};
TestModel loadedModel;
ISerializer<TestModel> test = new Serializer<TestModel>();
using (var stream = new MemoryStream())
{
test.Save(stream, savedModel, KnownTypes);
stream.Seek(0L, SeekOrigin.Begin);
loadedModel = test.Load(stream, KnownTypes);
}
Assert.NotSame(savedModel, loadedModel);
Assert.Equal(5, loadedModel.TestInt);
Assert.Equal("hello", loadedModel.TestString);
}
示例9: LoadXML
public void LoadXML(string xmlname)
{
Serializer<ObjectInteractionInfo> serializer = new Serializer<ObjectInteractionInfo>();
ObjectInteractionInfo info = serializer.Load(xmlname);
if (info != null)
{
// copy items
items.Clear();
foreach (string item in info.DialogItems)
{
InteractionMap map = InteractionMgr.GetInstance().Get(item);
if (map != null)
items.Add(map);
}
// set title
this.title = info.DialogTitle;
}
else
UnityEngine.Debug.Log("InteractionDialogMsg.LoadXML(" + xmlname + ") = null");
}
示例10: LoadXML
public virtual void LoadXML( string filename )
{
if (filename == null || filename == "")
{
#if DEBUG_OBJECT_INTERACTION
UnityEngine.Debug.Log("ObjectInteraction.LoadXML() : filename is NULL");
#endif
return;
}
if (ItemResponse == null)
ItemResponse = new List<InteractionMap>();
// read
Serializer<ObjectInteractionInfo> serializer = new Serializer<ObjectInteractionInfo>();
ObjectInteractionInfo info;
info = serializer.Load(filename);
if (info == null)
{
#if DEBUG_OBJECT_INTERACTION
UnityEngine.Debug.Log("ObjectInteraction.LoadXML(" + filename + ") : info is NULL");
#endif
return;
}
// grab info
Name = info.Name;
ItemResponse = info.ItemResponse;
prettyname = info.DialogTitle;
#if DEBUG_OBJECT_INTERACTION
UnityEngine.Debug.Log("ObjectInteraction.LoadXML(" + filename + ") : count=" + info.ItemResponse.Count + " : name=" + Name);
#endif
// load voice lists (if any)
VoiceMgr.GetInstance().LoadXML(info.VoiceList);
// get all the maps
if ( AllMaps == null )
AllMaps = new List<InteractionMap>();
GetInteractionMaps(ItemResponse, AllMaps);
}
示例11: LoadCaseOrder
public List<string> LoadCaseOrder( string filename=null )
{
if ( UsingCaseOrder == false )
{
CaseOrder = new List<string>();
foreach( CaseInfo item in CaseList )
{
CaseOrder.Add (item.name);
}
}
else
{
if ( filename == null )
filename = "XML/CaseOrder";
Serializer<List<string>> serializer = new Serializer<List<string>>();
CaseOrder = serializer.Load(filename);
if ( CaseOrder == null )
{
// we had an error, just get case order from CaseList
CaseOrder = new List<string>();
foreach( CaseInfo item in CaseList )
CaseOrder.Add (item.name);
}
}
return CaseOrder;
}
示例12: LoadXML
public List<CaseInfo> LoadXML( string filename )
{
if ( UsingLocalData == false )
return null;
Serializer<List<CaseInfo>> serializer = new Serializer<List<CaseInfo>>();
CaseList = serializer.Load(filename);
if ( CaseList == null )
UsingLocalData = false;
return CaseList;
}
示例13: LoadLinkablesFromXML
public void LoadLinkablesFromXML(string pathname){ // everything except the scripts
if (pathname == null || pathname == "") return;
ScriptedObjectInfo info=null;
/* if (Application.isEditor){ // from the editor, use the xml files directly
XmlSerializer serializer = new XmlSerializer(typeof(ScriptedObjectInfo));
FileStream stream = new FileStream(XMLDirectory+pathname, FileMode.Open);
info = serializer.Deserialize(stream) as ScriptedObjectInfo;
stream.Close();
}
else
*/
{ // use Rob's serializer to load from compiled resources folder at runtime
Serializer<ScriptedObjectInfo> serializer = new Serializer<ScriptedObjectInfo>();
pathname = "XML/"+pathname.Replace (".xml","");
info = serializer.Load(pathname);
if ( info == null )
{
UnityEngine.Debug.LogError("LoadFromXML(" + pathname + ") : error serializing!");
return;
}
}
LinkFrom(info);
}
示例14: LoadXML
public PatientStatus LoadXML(string filename)
{
Serializer<PatientStatus> serializer = new Serializer<PatientStatus>();
if (serializer != null)
{
PatientStatus status = serializer.Load(filename);
if ( Default != null )
status.CopyOptions(Default);
return status;
}
else
return null;
}
示例15: LoadXML
public void LoadXML( string name )
{
Serializer<StringMap> serializer = new Serializer<StringMap>();
Map = serializer.Load(name);
}