public static Save ( Component component, string fullPath ) : void | ||
component | Component | |
fullPath | string | |
return | void |
public static string Save(Component component, string fullPath) { vp_ComponentPreset vp_ComponentPreset = new vp_ComponentPreset(); vp_ComponentPreset.InitFromComponent(component); return(vp_ComponentPreset.Save(vp_ComponentPreset, fullPath, false)); }
public static string SaveDifference(vp_ComponentPreset initialStatePreset, Component modifiedComponent, string fullPath, vp_ComponentPreset diskPreset) { if (initialStatePreset.ComponentType != modifiedComponent.GetType()) { vp_ComponentPreset.Error("Tried to save difference between different type components in 'SaveDifference'"); return(null); } vp_ComponentPreset vp_ComponentPreset = new vp_ComponentPreset(); vp_ComponentPreset.InitFromComponent(modifiedComponent); vp_ComponentPreset vp_ComponentPreset2 = new vp_ComponentPreset(); vp_ComponentPreset2.m_ComponentType = vp_ComponentPreset.ComponentType; for (int i = 0; i < vp_ComponentPreset.m_Fields.Count; i++) { if (!initialStatePreset.m_Fields[i].Args.Equals(vp_ComponentPreset.m_Fields[i].Args)) { vp_ComponentPreset2.m_Fields.Add(vp_ComponentPreset.m_Fields[i]); } } foreach (vp_ComponentPreset.Field current in diskPreset.m_Fields) { bool flag = true; foreach (vp_ComponentPreset.Field current2 in vp_ComponentPreset2.m_Fields) { if (current.FieldHandle == current2.FieldHandle) { flag = false; } } bool flag2 = false; foreach (vp_ComponentPreset.Field current3 in vp_ComponentPreset.m_Fields) { if (current.FieldHandle == current3.FieldHandle) { flag2 = true; } } if (!flag2) { flag = false; } if (flag) { vp_ComponentPreset2.m_Fields.Add(current); } } return(vp_ComponentPreset.Save(vp_ComponentPreset2, fullPath, true)); }