public bool DebugLoadXml() { string path = $"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}/AcbFormatHelper.xml"; if (File.Exists(path)) { YAXSerializer serializer = new YAXSerializer(typeof(AcbFormatHelperMain), YAXSerializationOptions.DontSerializeNullObjects); AcbFormatHelperMain = (AcbFormatHelperMain)serializer.DeserializeFromFile(path); return(true); } else { AcbFormatHelperMain = new AcbFormatHelperMain(); return(false); } }
//These functions are primarily for use when creating a AcbFormatHelper.xml (done with external tool) private void LoadXml() { //Attempt to load from file if in debug mode bool loadedXml = false; #if DEBUG loadedXml = DebugLoadXml(); #endif //Load it from embedded resources. For normal use. if (!loadedXml) { YAXSerializer serializer = new YAXSerializer(typeof(AcbFormatHelperMain), YAXSerializationOptions.DontSerializeNullObjects); #if XenoKit //XenoKit uses linked code rather than Xv2CoreLib.dll currently, so it cannot access Xv2CoreLib.Properties AcbFormatHelperMain = (AcbFormatHelperMain)serializer.Deserialize(XenoKit.Properties.Resources.AcbFormatHelper); #else AcbFormatHelperMain = (AcbFormatHelperMain)serializer.Deserialize(Properties.Resources.AcbFormatHelper); #endif } }
public void CreateNewHelper() { AcbFormatHelperMain = new AcbFormatHelperMain(); }