public string CreateItem(string name, string guid, string parentguid, CiType citype) { if (citype == CiType.Project) { return this.CreateProject2(name); } else if (citype == CiType.Httpdd) { return this.Insert(name, guid, CiType.HttpddConf, Httpdd.GetDefaultHttpddHtml(name)); } else if (citype == CiType.Pkg) { return this.Insert(name, guid, CiType.PkgHtml, Pkg.GetDefaultPkgHtml(name, name)); } else if (citype == CiType.Layers) { Layer layer = new Layer() { name = name }; return this.Insert(name, guid, CiType.LayerXML, Utility.XMLUtil.SerializeXML<Layer>(layer)); } else if (citype == CiType.Symbols) { Symbol symbol = new Symbol() { name = name }; return this.Insert(name, guid, CiType.SymbolXML, Utility.XMLUtil.SerializeXML<Symbol>(symbol)); } else if (citype == CiType.Map) { Map map = new Map() { name = name }; map.Web.Add(new Web() { maxScaleDenom=0, minScaleDenom=0 }); return this.Insert(name, guid, CiType.MapXML, Utility.XMLUtil.SerializeXML<Map>(map)); } else return ""; }
protected override void WriteNew(CiType type) { CiArrayStorageType arrayType = type as CiArrayStorageType; if (arrayType != null) { if (arrayType.ElementType == CiByteType.Value) { Write("new Uint8Array(new ArrayBuffer("); if (arrayType.LengthExpr != null) Write(arrayType.LengthExpr); else Write(arrayType.Length); Write("))"); return; } if (arrayType.ElementType == CiIntType.Value) { Write("new Int32Array(new ArrayBuffer("); if (arrayType.LengthExpr != null) { WriteChild(CiPriority.Shift, arrayType.LengthExpr); Write(" << 2"); } else Write(arrayType.Length << 2); Write("))"); return; } } base.WriteNew(type); }
protected override void WriteInitArrayStorageVar(CiVar stmt) { CiType type = ((CiArrayStorageType)stmt.Type).ElementType; if (type != CiByteType.Value && type != CiIntType.Value) { base.WriteInitArrayStorageVar(stmt); } }
protected override void WriteNew(CiType type) { CiArrayStorageType arrayType = type as CiArrayStorageType; if (arrayType != null) { if (arrayType.ElementType == CiByteType.Value) { Write("new Uint8Array(new ArrayBuffer("); if (arrayType.LengthExpr != null) { Write(arrayType.LengthExpr); } else { Write(arrayType.Length); } Write("))"); return; } if (arrayType.ElementType == CiIntType.Value) { Write("new Int32Array(new ArrayBuffer("); if (arrayType.LengthExpr != null) { WriteChild(5, arrayType.LengthExpr); Write(" << 2"); } else { Write(arrayType.Length << 2); } Write("))"); return; } } base.WriteNew(type); }
public string LoadJsonString(string guid, string parentguid, CiType citype) { if (citype == CiType.AllProjects) { var qObj = new MSObject() { CiType = CiType.Project }; var lst = this.dao.Query(qObj); List<object> lstObjects = new List<object>(); foreach (MSObject o in lst) { lstObjects.Add(new { text = o.Name, leaf = false, guid = o.Guid, parentguid = o.ParentGuid, citype = o.CiType.ToString() }); } return JsonConvert.SerializeObject(lstObjects); } else if (citype == CiType.Project) { List<object> lstObjects = new List<object>(); { lstObjects.Add(new { text = "pkg", leaf = false, guid = guid, parentguid = guid, citype = CiType.Pkg.ToString() }); lstObjects.Add(new { text = "app", leaf = false, guid = guid, parentguid = guid, citype = CiType.App.ToString() }); lstObjects.Add(new { text = "httpdd", leaf = false, guid = guid, parentguid = guid, citype = CiType.Httpdd.ToString() }); } return JsonConvert.SerializeObject(lstObjects); } else if (citype == CiType.App) { List<object> lstObjects = new List<object>(); { lstObjects.Add(new { text = "Layers", leaf = false, guid = guid, parentguid = guid, citype = CiType.Layers.ToString() }); lstObjects.Add(new { text = "Fonts", leaf = false, guid = guid, parentguid = guid, citype = CiType.Fonts.ToString() }); lstObjects.Add(new { text = "Map", leaf = false, guid = guid, parentguid = guid, citype = CiType.Map.ToString() }); lstObjects.Add(new { text = "Sysmols", leaf = false, guid = guid, parentguid = guid, citype = CiType.Symbols.ToString() }); lstObjects.Add(new { text = "Etc", leaf = false, guid = guid, parentguid = guid, citype = CiType.Etc.ToString() }); lstObjects.Add(new { text = "Data", leaf = false, guid = guid, parentguid = guid, citype = CiType.Data.ToString() }); lstObjects.Add(new { text = "Graphics", leaf = false, guid = guid, parentguid = guid, citype = CiType.Graphics.ToString() }); } return JsonConvert.SerializeObject(lstObjects); } else if (citype == CiType.Pkg) { return GetJsonNode(guid, CiType.PkgHtml); } else if (citype == CiType.Httpdd) { return GetJsonNode(guid, CiType.HttpddConf); } else if (citype == CiType.Layers ) { return GetJsonNode(guid, CiType.LayerXML); } else if (citype == CiType.Map) { return GetJsonNode(guid, CiType.MapXML); } else if (citype == CiType.Symbols) { IList<CiType> lst = new List<CiType>() { CiType.SymbolXML, CiType.SymbolFile }; return GetJsonNode(guid, lst); } else if (citype == CiType.PkgHtml || citype == CiType.Httpdd || citype == CiType.LayerXML || citype == CiType.SymbolXML || citype == CiType.SymbolFile || citype == CiType.GraphicImg || citype == CiType.MapXML) { var qObj = new MSObject() { ParentGuid = guid, CiType = citype }; var lst = this.dao.QueryByTypeAndPID(qObj); List<object> lstObjects = new List<object>(); foreach (MSObject o in lst) { lstObjects.Add(new { text = o.Name, leaf = true, guid = o.Guid, parentguid = o.ParentGuid, citype = o.CiType.ToString() }); } return JsonConvert.SerializeObject(lstObjects); } else return ""; }
public string LoadContentString(string guid, string parentguid, CiType citype) { if (citype == CiType.PkgHtml || citype == CiType.HttpddConf || citype == CiType.LayerXML || citype == CiType.SymbolXML || citype == CiType.SymbolFile || citype == CiType.GraphicImg || citype == CiType.MapXML) { var qObj = this.dao.Query(guid); return JsonConvert.SerializeObject(new { content = qObj.Content, citype = qObj.CiType.ToString() }); } else return ""; }
/// <summary> /// 返回json字符串 /// </summary> public string Insert(string name, string parentguid, CiType icitype,string content) { var qObj = new MSObject() { Name = name, CiType = icitype, ParentGuid = parentguid, Flag = Flag.OK, Content = content }; this.dao.Insert(qObj); List<object> lstObjects = new List<object>(); { lstObjects.Add(new { text = qObj.Name, leaf = true, guid = qObj.Guid, parentguid = qObj.ParentGuid, citype = qObj.CiType.ToString() }); } return JsonConvert.SerializeObject(lstObjects); }
public string GetJsonNode(string guid, CiType citype) { var qObj = new MSObject() { ParentGuid = guid, CiType = citype }; var lst = this.dao.QueryByTypeAndPID(qObj); List<object> lstObjects = new List<object>(); foreach (MSObject o in lst) { lstObjects.Add(new { text = o.Name, leaf = true, guid = o.Guid, parentguid = o.ParentGuid, citype = o.CiType.ToString() }); } return JsonConvert.SerializeObject(lstObjects); }