/// <summary> /// Creates a Shallow Copy of the ConfigNode `source`. /// Only the values are duplicated, any nodes are just relinked into the new copy. /// Any changes to values will preserve the origin from changes, but any change on the subnodes will affect the originals. /// </summary> /// <param name="source"></param> /// <returns></returns> public static global::ConfigNode CreateShallowCopy(global::ConfigNode source) { global::ConfigNode r = new global::ConfigNode { id = source.id, name = source.name, comment = source.comment }; { for (int i = 0; i < source.values.Count; ++i) { global::ConfigNode.Value ov = source.values[i]; global::ConfigNode.Value nv = new global::ConfigNode.Value(ov.name, ov.value, ov.comment); r.values.Add(nv); } for (int i = 0; i < source.nodes.Count; ++i) { global::ConfigNode o = source.nodes[i]; r.nodes.Add(o); } } return(r); }
public static ConfigNodeWithSteroids from(global::ConfigNode obj) { ConfigNodeWithSteroids r = new ConfigNodeWithSteroids(); r.CopyFrom(obj); return(r); }
/* I CAN'T MAKE THIS THING TO WORK! */ internal static KAssemblyLoader.LoadedAssembly LoadPlugin(string searchPath, string asmName, string asmFile) { string asmPath = SIO.Path.Combine(searchPath, asmFile); Uri uri = new Uri(BASEURI, asmPath); SIO.FileInfo fi = new SIO.FileInfo(uri.AbsolutePath); //LOG.debug("fi {0} -- url {1}", fi.FullName, uri.AbsoluteUri); global::ConfigNode cn = new global::ConfigNode(); if (!KAssemblyLoader.LoadPlugin(fi, uri.AbsoluteUri, cn)) // If the return value of this thing working as expected? { throw new DllNotFoundException(string.Format("Could not load {0} from {1}!", asmName, asmFile)); } foreach (KAssemblyLoader.LoadedAssembly a in KAssemblyLoader.loadedAssemblies) { if (a.name.Equals(asmName)) { a.Load(); return(a); } } throw new DllNotFoundException(string.Format("Could not load {0} from {1}!", asmName, asmFile)); }