public void AddProjectXMLNode(string value) { if (ProjectXML == null) { string projectpath = EngineNS.CEngine.Instance.FileManager.ProjectSourceRoot + "Batman.Droid/"; ProjectXML = EngineNS.IO.XmlHolder.LoadXML(projectpath + "Batman.Droid.csproj"); CorrectProjectCatalogue(ProjectXML.RootNode); } EngineNS.IO.XmlNode ItemGroupNode = ProjectXML.RootNode.AddNode("ItemGroup", "", ProjectXML); EngineNS.IO.XmlNode AndroidAssetNode = ItemGroupNode.AddNode("AndroidAsset", "", ProjectXML); //test value = value.Replace("/", "\\"); AndroidAssetNode.AddAttrib("Include", value); }
public EngineNS.IO.XmlNode FindAndAddAssetNode(EngineNS.IO.XmlNode node, string name) { List <EngineNS.IO.XmlNode> nodes = node.GetNodes(); foreach (var i in nodes) { //这里不能是空 EngineNS.IO.XmlAttrib att = i.FindAttrib("Name"); if (att != null && att.Value.Equals(name)) { return(i); } } EngineNS.IO.XmlNode sunnode = node.AddNode("Folder", "", AssetInfos); sunnode.AddAttrib("Name", name); return(sunnode); }
public void AddAssetInfos(string filename) { if (!System.IO.File.Exists(filename) || filename.EndsWith(".noused")) { return; } string allpath = EngineNS.CEngine.Instance.FileManager._GetRelativePathFromAbsPath(filename, EngineNS.CEngine.Instance.FileManager.CookingRoot); allpath = EngineNS.CEngine.Instance.FileManager.GetPathFromFullName(allpath, false); allpath = allpath.Replace("\\", "/"); allpath = "Assets/" + allpath; string name = EngineNS.CEngine.Instance.FileManager.GetPureFileFromFullName(filename); string[] folders = allpath.Split('/'); EngineNS.IO.XmlNode node = AssetInfos.RootNode; EngineNS.IO.XmlNode subnode; for (int i = 0; i < folders.Length; i++) { if (folders[i].Equals("")) { break; } subnode = FindAndAddAssetNode(node, folders[i]); node = subnode; } EngineNS.IO.XmlNode filenode = node.FindNode("Files"); if (filenode == null) { filenode = node.AddNode("Files", "", AssetInfos); } foreach (var i in filenode.GetNodes()) { if (i.FindAttrib("Name").Value == name) { return; } } var value = filenode.AddNode("File", "", AssetInfos); value.AddAttrib("Name", name); //生成MD5码 try { var MD5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); System.IO.FileStream fs = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read); byte[] code = MD5.ComputeHash(fs); string str = System.Text.Encoding.ASCII.GetString(code); value.AddAttrib("MD5", System.Text.Encoding.ASCII.GetString(code)); if (IsNeedProject) { AddProjectXMLNode(allpath + name); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } }
public void ReadObjectXML(EngineNS.IO.XmlNode node) { EngineNS.IO.Serializer.SerializerHelper.ReadObjectXML(this, node); }
void LoadPerformanceTree(EngineNS.IO.XmlNode parentNode, PerformanceItem parent, string inheritName) { foreach (var node in parentNode.GetNodes()) { PerformanceItem item = new PerformanceItem_Parent(); if (node.GetAttribs().Count > 0) { string desc = ""; var att = node.FindAttrib("Desc"); if (att != null) { desc = att.Value; } att = node.FindAttrib("Value"); if (att != null) { var pf = new PerformanceItem_PerfCount(); pf.KeyName = att.Value; pf.ToolTip = desc; //item.onav item = pf; } att = node.FindAttrib("Variable"); if (att != null) { var nor = new PerformanceItem_Data(); nor.KeyName = att.Value; var viewer = EngineNS.CEngine.Instance.Stat.PViewer.CreateViewer(nor.KeyName); if (viewer == null) { continue; } Func <string[]> getValueAction = viewer.GetValueAction; Func <string[]> getNameAction = viewer.GetValueNameAction; if (getValueAction == null) { nor.ListeningVisible = Visibility.Collapsed; } nor.ToolTip = desc; item = nor; } } item.Plotter = plotter_Graph; item.OnListeningChanged = (listening) => { if (listening) { if (!mListenedItems.Contains(item)) { mListenedItems.Add(item); } } else { mListenedItems.Remove(item); } }; item.ItemName = node.Name; item.InheritName = inheritName; if (parent == null) { mItems.Add(item); } else { parent.Childrens.Add(item); item.Parent = parent; } LoadPerformanceTree(node, item, inheritName + "|" + node.Name); } }