public static string Serialize(Skin skin) { if (!skin.isValid) { return(string.Empty); } try { skin.Properties = GZip.Compress(skin.Properties); SkinImpl si = (SkinImpl)skin; XmlSerializer xs = new XmlSerializer(typeof(SkinImpl)); StringWriter sw = new StringWriter(); xs.Serialize(sw, si); sw.Close(); return(sw.GetStringBuilder().ToString()); } catch (Exception) { } return(string.Empty); }
public static string Serialize(Skin skin, DebugDelegate deb) { if (!skin.isValid) { return(string.Empty); } try { skin.Properties = skin.Properties; SkinImpl si = (SkinImpl)skin; XmlSerializer xs = new XmlSerializer(typeof(SkinImpl)); StringWriter sw = new StringWriter(); xs.Serialize(sw, si); sw.Close(); return(sw.GetStringBuilder().ToString()); } catch (Exception ex) { debug(deb, "Error saving skin: " + ex.Message + ex.StackTrace); } return(string.Empty); }
void loadskin(string fn) { // load skin SkinImpl skn = new SkinImpl(); bool ok = Util.FromFile<SkinImpl>(fn,ref skn,debug); // load tickfiles from skin foreach (string file in skn.TickFiles) loadfile(file); // load response myres = (Response)SkinImpl.DeskinFile(fn, debug); }