private void ConfigureDataSource() { var dataSource = new UICollectionViewDiffableDataSource <NS <Section>, NS <int> >( collectionView: _collectionView, cellProvider: (collectionView, indexPath, identifier) => { var cell = (DummyCell)collectionView.DequeueReusableCell(DummyCell.Key, indexPath); cell.Configure(((NS <int>)identifier).Value.ToString()); return(cell); }); // initial data const int ItemsPerSection = 6; var snapshot = new NSDiffableDataSourceSnapshot <NS <Section>, NS <int> >(); EnumExtensions.Apply <Section>(section => { var ns = new NS <Section>(section); snapshot.AppendSections(new[] { ns }); var itemOffset = ((int)ns.Value) * ItemsPerSection; var itemUpperbound = itemOffset + ItemsPerSection; var items = Enumerable.Range(itemOffset, itemUpperbound).Select(x => new NS <int>(x)).ToArray(); snapshot.AppendItems(items); }); dataSource.ApplySnapshot(snapshot, animatingDifferences: false); }
public void LoadXml(XmlElement value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } XmlNamespaceManager nsm = new XmlNamespaceManager(value.OwnerDocument.NameTable); nsm.AddNamespace("enc", XmlNameSpace.Url[NS.XmlEncNamespaceUrl]); XmlElement encryptionMethodElement = value; var algorithmUrl = ElementUtils.GetAttribute(encryptionMethodElement, "Algorithm", NS.XmlEncNamespaceUrl); _algorithm = XmlNameSpace.Url.FirstOrDefault(x => x.Value == algorithmUrl).Key; XmlNode keySizeNode = value.SelectSingleNode("enc:KeySize", nsm); if (keySizeNode != null) { KeySize = Convert.ToInt32(ParserUtils.DiscardWhiteSpaces(keySizeNode.InnerText), null); } _cachedXml = value; }
private void msg_NoticeAll(String msg, String NotSendTargetsNick) { NetworkStream NS; Rtxt_Chat_Log.Invoke(new writeLog(writeChatLog), (ServerNick + " : " + msg)); msg = ServerNick + " : " + msg; msg = "" + (char)0x0002 + Convert.ToChar(msg.Length * 2) + (char)0x0000 + msg + (char)0x0003; byte[] Sending_Msg = Encoding.Unicode.GetBytes(msg); // 문자열을 아스키형 바이트로 형변환 for (int index = 0; index < MaxConnectable; ++index) { if (ClientGroup[index] != null) { if (ClientGroup[index].NickName == NotSendTargetsNick) { continue; } try { if (ClientGroup[index] != null) { NS = ClientGroup[index].Socket.GetStream(); Thread.Sleep(SleepTime); NS.Write(Sending_Msg, 0, Sending_Msg.Length); } } catch { } } } }
private static bool IsSafeTransform(NS transformAlgorithm, SignedXml signedXml) { foreach (string safeAlgorithm in signedXml.SafeCanonicalizationMethods) { if (string.Equals(safeAlgorithm, XmlNameSpace.Url[transformAlgorithm], StringComparison.OrdinalIgnoreCase)) { return(true); } } foreach (string safeAlgorithm in DefaultSafeTransformMethods(SignedXml.s_defaultSafeTransformMethods)) { if (string.Equals(safeAlgorithm, XmlNameSpace.Url[transformAlgorithm], StringComparison.OrdinalIgnoreCase)) { return(true); } } SignedXmlDebugLog.LogUnsafeTransformMethod( signedXml, XmlNameSpace.Url[transformAlgorithm], signedXml.SafeCanonicalizationMethods, DefaultSafeTransformMethods(SignedXml.s_defaultSafeTransformMethods)); return(false); }
static NS GetOrAddNamespace(Dictionary <string, NS> dict, string fullName) { NS ns; if (dict.TryGetValue(fullName, out ns)) { return(ns); } int pos = fullName.LastIndexOf('.'); NS parent; string name; if (pos < 0) { parent = dict[string.Empty]; // root name = fullName; } else { parent = GetOrAddNamespace(dict, fullName.Substring(0, pos)); name = fullName.Substring(pos + 1); } ns = new NS(parent, fullName, name); parent.childNamespaces.Add(ns); dict.Add(fullName, ns); return(ns); }
public void Ctor_String(NS algorithm) { EncryptionMethod method = new EncryptionMethod(algorithm); Assert.Equal(0, method.KeySize); Assert.Equal(algorithm, method.KeyAlgorithm); }
/// <summary> /// Helper to retrieve the namespace and path from a relative page path string /// </summary> private Title PrefixedMWPathToTitle(string fullPath) { NS ns = NS.MAIN; string path = fullPath.Trim(); // if there is a namespace, retrieve it int nsPos = path.IndexOf(':'); if (nsPos > 1) { ns = StringToNS(path.Substring(0, nsPos)); // if the namespace is not found, default to using the main namespace // if found, extract the namespace from the title text if (NS.UNKNOWN == ns) { ns = NS.MAIN; } else { path = path.Substring(nsPos + 1); } } return(Title.FromDbPath(ns, path, null)); }
public void RecentChanges_Insert(DateTime timestamp, PageBE page, UserBE user, string comment, ulong lastoldid, RC type, uint movedToNS, string movedToTitle, bool isMinorChange, uint transactionId) { string dbtimestamp = DbUtils.ToString(timestamp); string pageTitle = String.Empty; NS pageNamespace = NS.MAIN; ulong pageID = 0; uint userID = 0; if (page != null) { pageTitle = page.Title.AsUnprefixedDbPath(); pageNamespace = page.Title.Namespace; pageID = page.ID; } if (user != null) { userID = user.ID; } string q = "/* RecentChanges_Insert */"; if (lastoldid > 0) { q += @" UPDATE recentchanges SET rc_this_oldid = ?LASTOLDID WHERE rc_namespace = ?NS AND rc_title = ?TITLE AND rc_this_oldid=0;"; } q += @" INSERT INTO recentchanges (rc_timestamp, rc_cur_time, rc_user, rc_namespace, rc_title, rc_comment, rc_cur_id, rc_this_oldid, rc_last_oldid, rc_type, rc_moved_to_ns, rc_moved_to_title, rc_minor, rc_transaction_id) VALUES (?TS, ?TS, ?USER, ?NS, ?TITLE, ?COMMENT, ?CURID, 0, ?LASTOLDID, ?TYPE, ?MOVEDTONS, ?MOVEDTOTITLE, ?MINOR, ?TRANID); "; if (!string.IsNullOrEmpty(comment) && comment.Length > MAXCOMMENTLENGTH) { string segment1 = comment.Substring(0, MAXCOMMENTLENGTH / 2); string segment2 = comment.Substring(comment.Length - MAXCOMMENTLENGTH / 2 + 3); comment = string.Format("{0}...{1}", segment1, segment2); } Catalog.NewQuery(q) .With("TS", dbtimestamp) .With("USER", userID) .With("NS", pageNamespace) .With("TITLE", pageTitle) .With("COMMENT", comment) .With("CURID", pageID) .With("LASTOLDID", lastoldid) .With("TYPE", (uint)type) .With("MOVEDTONS", movedToNS) .With("MOVEDTOTITLE", movedToTitle) .With("MINOR", isMinorChange ? 1 : 0) .With("TRANID", transactionId) .Execute(); }
/// <summary> /// Return a title of the form namespace:text, or text if in the main namespace. /// </summary> private static String NSAndPathToString(NS ns, string path) { if (NS.MAIN == ns) { return(path); } return(NSToString(ns) + ":" + path); }
public void AddOneProp_NameSpaceTest() { NS ns = new NS(typeof(string).Namespace); Assert.AreEqual(0, ns.getTypesList().Count); ns.addMethod(typeof(string), typeof(string).GetMethods()[0]); Assert.AreNotEqual(null, ns.getTypesList()[0].methods[0]); }
public NS(NS parentNamespace, string fullName, string name) { this.assembly = parentNamespace.assembly; this.parentNamespace = parentNamespace; this.fullName = fullName; this.name = name; this.types = new Dictionary <FullNameAndTypeParameterCount, ITypeDefinition>(parentNamespace.types.Comparer); }
//--- Constructors --- public Title(Title title) { _namespace = title._namespace; _path = title._path; _displayName = title._displayName; _filename = title._filename; _anchor = title._anchor; _query = title._query; }
public void KeyAlgorithm_Set_SetsValue(NS value) { EncryptionMethod method = new EncryptionMethod() { KeyAlgorithm = value }; Assert.Equal(value, method.KeyAlgorithm); }
private Title(NS ns, string path, string displayName, string filename, string anchor, string query) { _namespace = ns; _path = path; _displayName = displayName; _filename = filename; _anchor = anchor; _query = query; }
public int ChangeDateCoreFast(bool first = false) { Log($"SwitchOS.ChangeDateCoreFast({first})"); const int WAIT_MS = 50; int reset = 0; while (true) { NS.Down(Keys.A); Wait(200); if (first) { NS.Down(Keys.LStick.Right); Wait(WAIT_MS); NS.Down(Keys.RStick.Right); Wait(WAIT_MS); NS.Reset(); } else { NS.Down(Keys.LStick.Left); Wait(WAIT_MS); NS.Down(Keys.RStick.Left); Wait(WAIT_MS); NS.Down(Keys.HAT.Left); Wait(WAIT_MS); } // change date NS.Up(Keys.A); NS.Down(Keys.LStick.Up); Wait(WAIT_MS); NS.Down(Keys.RStick.Right); Wait(WAIT_MS); NS.Down(Keys.LStick.Right); Wait(WAIT_MS); NS.Down(Keys.HAT.Right); Wait(WAIT_MS); if (!VideoCapture.Match(45, 478, Color.FromArgb(105, 105, 105), DefaultColorCap)) { // reset Reset(); Wait(300); Press(Keys.HAT.Down); Wait(100); Press(Keys.HAT.Down); Wait(100); reset++; continue; } NS.Down(Keys.A); Wait(WAIT_MS); NS.Reset(); Wait(200); return(reset); } }
/// <summary> /// 获取FT集合 /// </summary> /// <returns></returns> public FTCCollection GetFTCList() { FTCCollection list = new FTCCollection(); FTC ftc = new FTC("平面"); ftc.Name = "平面"; //获取全部对象类型 DataTable objTypeDt = SqlServerDBHelper.GetDataTable("SELECT BOTID,FT FROM OBJECTTYPE "); //DataTable dt; foreach (DataRow row in objTypeDt.Rows) { FT ft = new FT(row["FT"].ToString()); ft.Name = row["FT"].ToString(); SqlParameter[] parameters = { new SqlParameter("BOTID", SqlDbType.VarChar, 36) }; parameters[0].Value = row["BOTID"].ToString(); DataTable dt = new DataTable(); //MD不截取发布服务出错 dt = SqlServerDBHelper.GetDataTable("SELECT MD AS MD,NS FROM OBJTYPEPROPERTY WHERE BOTID = @BOTID ", parameters); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i]["MD"].ToString())) { NS ns = new NS(dt.Rows[i]["NS"].ToString()); ns.Name = dt.Rows[i]["NS"].ToString(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(dt.Rows[i]["MD"].ToString()); for (int j = 0; j < xmlDoc.SelectNodes("PropertySet/P").Count; j++) { FeatureParameter para = new FeatureParameter(xmlDoc.SelectNodes("PropertySet/P").Item(j).Attributes[0].Value); para.Name = xmlDoc.SelectNodes("PropertySet/P").Item(j).Attributes[0].Value; if (xmlDoc.SelectNodes("PropertySet/P").Item(j).Attributes[1].Value.ToUpper() == Jurassic.PKS.Service.PropertyDataType.String.ToString().ToUpper()) { para.DataType = PropertyDataType.String; } else if (xmlDoc.SelectNodes("PropertySet/P").Item(j).Attributes[1].Value.ToUpper() == Jurassic.PKS.Service.PropertyDataType.Decimal.ToString().ToUpper()) { para.DataType = PropertyDataType.Decimal; } else { para.DataType = PropertyDataType.Date; } ns.Parameters.Add(para); } ft.NSs.Add(ns); } } ftc.FTs.Add(ft); } list.Add(ftc); return(list); }
public void addType_typeList__NameSpaceTest() { NS ns = new NS(typeof(string).Namespace); Assert.AreEqual(0, ns.getTypesList().Count); ns.addType(typeof(string)); Assert.AreEqual(1, ns.getTypesList().Count); //Assert.Pass(); }
/// <summary> /// Retrieve the string corresponding to the namespace type. /// </summary> public static String NSToString(NS ns) { String nsString; if (_namespaceNames.TryGetValue(ns, out nsString)) { return(nsString); } return(String.Empty); }
public TypeRequirement(Type t, NS ns) { type = t; //set the type findReq(); //find types that it depends on foreach (Type req in requirements) //add the import declarations for each requirement to my namespace { if ((req.Namespace != null) && (req.Namespace != type.Namespace) && (!Generator.isPrimitive(req)) && req.IsVisible) ns.getCreateDImport(req.Namespace); } }
private string GetNameSpaceFilterQuery(NS ns) { if (ns == NS.UNKNOWN) { return(string.Empty); } else { return(string.Format(" AND rc_namespace = {0}", (int)ns)); } }
private void Application_NewMailEx(string EntryIDCollection) { MWMailItem item = new MWMailItem(NS.GetItemFromID(EntryIDCollection) as MailItem); // if item received was a mail (it could be a meeting invitation of something else) if (item != null) { Utils.Debug($"New mail received.\n{item}"); this.MWContoller.HandleExistingMail(item); } }
public NS(NS parentNamespace, string fullName, string name) { this.assembly = parentNamespace.assembly; this.parentNamespace = parentNamespace; this.fullName = fullName; this.name = name; if (parentNamespace.types != null) { this.types = new Dictionary <TopLevelTypeName, ITypeDefinition>(parentNamespace.types.Comparer); } }
/// <summary> /// Retrieve the type corresponding to the namespace name. /// </summary> public NS StringToNS(String nsString) { NS ns = Title.StringToNS(nsString); if (NS.UNKNOWN == ns) { if (!_namespaceValues.TryGetValue(nsString.ToLowerInvariant(), out ns)) { ns = NS.UNKNOWN; } } return(ns); }
public IList <PageBE> Pages_GetChildren(ulong parentPageId, NS nameSpace, bool filterOutRedirects) { List <PageBE> pages = new List <PageBE>(); string q = string.Format(@" SET group_concat_max_len = @@max_allowed_packet; SELECT {0}, ( SELECT cast(group_concat( p1.page_id, '') as char) FROM pages p1 WHERE p1.page_parent = p.page_id AND p.page_title <> '' AND p1.page_namespace = ?NS AND p.page_id <> p1.page_id {2} group by p1.page_parent ) as page_children, ( SELECT count(*) FROM resources WHERE res_type = 2 AND res_deleted = 0 AND resrev_parent_page_id = p.page_id ) as page_attachment_count FROM pages p WHERE p.page_parent = ?PARENTPAGEID AND p.page_namespace = ?NS AND p.page_title <> '' {1} ORDER BY p.page_title; ", PAGEFIELDS, filterOutRedirects ? "AND p.page_is_redirect = 0" : string.Empty, filterOutRedirects ? "AND p1.page_is_redirect = 0" : string.Empty); Catalog.NewQuery(q) .With("PARENTPAGEID", parentPageId) .With("NS", (int)nameSpace) .Execute(delegate(IDataReader dr) { while (dr.Read()) { PageBE p = Pages_PopulatePage(dr); p.AttachmentCount = DbUtils.Convert.To <uint>(dr["page_attachment_count"].ToString()); p.ChildPageIds = DbUtils.ConvertDelimittedStringToArray <ulong>(',', dr["page_children"].ToString()); pages.Add(p); } }); return(pages); }
public static string Nr(this NS value) { int num = (int)value; string text = num.ToString(); if (text.Length == 1) { text = "00" + text; } if (text.Length == 2) { text = "0" + text; } return(text); }
internal XmlElement GetXml(XmlDocument document, NS ns) { XmlElement transformsElement = document.CreateElement("Transforms", XmlNameSpace.Url[ns]); foreach (Transform transform in _transforms) { if (transform != null) { XmlElement transformElement = transform.GetXml(document); if (transformElement != null) { transformsElement.AppendChild(transformElement); } } } return(transformsElement); }
public override IntPtr GetAddress(IntPtr function) { unsafe { // Add a leading underscore to the function name // As of OpenGL 4.4, all functions are < 64 bytes // in length. Double that just to be sure. const int max = 128; byte * fun = stackalloc byte[max]; byte * ptr = fun; byte * cur = (byte *)function.ToPointer(); int i = 0; *ptr++ = (byte)'_'; while (*cur != 0 && ++i < max) { *ptr++ = *cur++; } if (i >= max - 1) { Debug.Print("Function {0} too long. Loading will fail.", Marshal.PtrToStringAnsi(function)); } IntPtr address = IntPtr.Zero; IntPtr symbol = IntPtr.Zero; if (opengl != IntPtr.Zero) { symbol = NS.LookupSymbolInImage(opengl, new IntPtr(fun), SymbolLookupFlags.Bind | SymbolLookupFlags.ReturnOnError); } if (symbol == IntPtr.Zero && opengles != IntPtr.Zero) { symbol = NS.LookupSymbolInImage(opengles, new IntPtr(fun), SymbolLookupFlags.Bind | SymbolLookupFlags.ReturnOnError); } if (symbol != IntPtr.Zero) { address = NS.AddressOfSymbol(symbol); } return(address); } }
private void msg_SendAll(String msg, String Nick) { NetworkStream NS; Rtxt_Chat_Log.Invoke(new writeLog(writeChatLog), (Nick + " : " + msg)); msg = Nick + " : " + msg; msg = "" + (char)0x0002 + Convert.ToChar(msg.Length * 2) + (char)0x0000 + msg + (char)0x0003; byte[] Sending_Msg = Encoding.Unicode.GetBytes(msg); // 문자열을 아스키형 바이트로 형변환 for (int index = 0; index < MaxConnectable; ++index) { if (ClientGroup[index] != null) { if (ClientGroup[index].NickName == Nick) { continue; } try { if (ClientGroup[index] != null) { if (Nick == ServerNick && CLB_ConnectedList.GetItemChecked(index) != false) { NS = ClientGroup[index].Socket.GetStream(); Thread.Sleep(SleepTime); NS.Write(Sending_Msg, 0, Sending_Msg.Length); } else if (chk_Chat_Allow.Checked && Nick != ServerNick) { NS = ClientGroup[index].Socket.GetStream(); Thread.Sleep(SleepTime); NS.Write(Sending_Msg, 0, Sending_Msg.Length); } } } catch { } } } }
protected CodeConstructor EmitTemplate(CodeTypeDeclaration ctd) { EmitAttribute(ctd); // A(n optional) field pointing to our bound structure if (UsesStructure) { CodeMemberField f = new CodeMemberField(); f.Name = "stmpl"; f.Attributes = MemberAttributes.Private; f.Type = NS.ParamsType.AsCodeDom; ctd.Members.Add(f); } // The template apply method. CodeMemberMethod meth = new CodeMemberMethod(); meth.Name = "ApplyTemplate"; meth.Attributes = MemberAttributes.Public | MemberAttributes.Override; meth.ReturnType = null; meth.Parameters.Add(CDH.Param(typeof(TargetBuilder), "tb")); CDH.EmitBaseChainVoid(meth); CodeVariableReferenceExpression tb = CDH.VRef("tb"); if (UsesStructure) { info.Converter = delegate(string val) { return(NS.MakeTargetNameExpr(val, CDH.ThisDot("stmpl"), null)); }; } info.EmitInfo(meth, tb); ctd.Members.Add(meth); // Constructor return(EmitConstructor(ctd)); }
public XDoc RecentChanges_GetSiteRecentChanges(DateTime since, string language, bool createOnly, NS nsFilter, uint? limit, int maxScanSize) { string query = @"/* RecentChanges_GetSiteRecentChanges */ SELECT rc_id, rc_comment, rc_cur_id, rc_last_oldid, rc_this_oldid, rc_namespace, rc_timestamp, rc_title, rc_type, rc_moved_to_ns, rc_moved_to_title, user_name AS rc_user_name, user_real_name as rc_full_name, (page_id IS NOT NULL) AS rc_page_exists, IF(page_id IS NULL, 0, page_revision) AS rc_revision, cmnt_id, cmnt_number, cmnt_content, cmnt_content_mimetype, (cmnt_delete_date IS NOT NULL) as cmnt_deleted, old_is_hidden FROM recentchanges FORCE INDEX (PRIMARY) LEFT JOIN old ON rc_this_oldid=old_id LEFT JOIN users ON rc_user=user_id LEFT JOIN comments ON ((rc_type=40 AND cmnt_page_id=rc_cur_id AND rc_user=cmnt_poster_user_id AND STR_TO_DATE(rc_timestamp,'%Y%m%e%H%i%s')=cmnt_create_date) OR (rc_type=41 AND cmnt_page_id=rc_cur_id AND rc_user=cmnt_last_edit_user_id AND STR_TO_DATE(rc_timestamp,'%Y%m%e%H%i%s')=cmnt_last_edit) OR (rc_type=42 AND cmnt_page_id=rc_cur_id AND rc_user=cmnt_deleter_user_id AND STR_TO_DATE(rc_timestamp,'%Y%m%e%H%i%s')=cmnt_delete_date)) LEFT JOIN pages ON rc_cur_id=page_id WHERE (page_is_redirect=0 OR page_is_redirect IS NULL) AND rc_id > ( select count(*) from recentchanges ) - {5} {0} {1} {2} {3} ORDER BY rc_timestamp DESC, rc_id DESC LIMIT {4}"; //NOTE (maxm): only scanning at most the top maxScanSize rows of the recentchanges table to look for matching changes query = string.Format(query, Nav_GetTimestampQuery(since), Nav_GetChangeTypeLimitQuery(createOnly), Nav_GetLanguageQuery(language), GetNameSpaceFilterQuery(nsFilter), limit, maxScanSize); return Catalog.NewQuery(query).ReadAsXDoc("table", "change"); }
protected void gvChildGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (ChildFlag) { if (e.Row.RowType == DataControlRowType.DataRow) { string errortbl = Session["Errortbl"].ToString(); com += Convert.ToInt32(e.Row.Cells[1].Text != " " ? e.Row.Cells[1].Text : e.Row.Cells[1].Text = "0"); if (e.Row.Cells[2].Text != " ") { inc += Convert.ToInt32(e.Row.Cells[2].Text); } else { e.Row.Cells[2].Text = "0"; } if (e.Row.Cells[3].Text != " ") { inp += Convert.ToInt32(e.Row.Cells[3].Text); } else { e.Row.Cells[3].Text = "0"; } if (e.Row.Cells[4].Text != " ") { TS += Convert.ToInt32(e.Row.Cells[4].Text); } else { e.Row.Cells[4].Text = "0"; } if (e.Row.Cells[5].Text != " ") { ES += Convert.ToInt32(e.Row.Cells[5].Text); } else { e.Row.Cells[5].Text = "0"; } if (e.Row.Cells[6].Text != " ") { NS += Convert.ToInt32(e.Row.Cells[6].Text); } else { e.Row.Cells[6].Text = "0"; } NoStatus += Convert.ToInt32(e.Row.Cells[7].Text != " " ? e.Row.Cells[7].Text : e.Row.Cells[7].Text = "0"); No_OF_Works += Convert.ToInt32(e.Row.Cells[8].Text); AACost += Convert.ToDecimal(e.Row.Cells[9].Text); TSCost += Convert.ToDecimal(e.Row.Cells[10].Text); TotalProvision += Convert.ToDecimal(e.Row.Cells[11].Text); TotalExp += Convert.ToDecimal(e.Row.Cells[12].Text); } if (e.Row.RowType == DataControlRowType.Footer) { string errortbl = Session["Errortbl"].ToString(); e.Row.Cells[0].Text = "Total"; e.Row.Cells[1].Text = com.ToString(); e.Row.Cells[2].Text = inc.ToString(); e.Row.Cells[3].Text = inp.ToString(); e.Row.Cells[4].Text = TS.ToString(); e.Row.Cells[5].Text = ES.ToString(); e.Row.Cells[6].Text = NS.ToString(); e.Row.Cells[7].Text = NoStatus.ToString(); e.Row.Cells[8].Text = No_OF_Works.ToString(); e.Row.Cells[9].Text = AACost.ToString(); e.Row.Cells[10].Text = TSCost.ToString(); e.Row.Cells[11].Text = TotalProvision.ToString(); e.Row.Cells[12].Text = TotalExp.ToString(); } } else { if (e.Row.RowType == DataControlRowType.DataRow) { string errortbl = Session["Errortbl"].ToString(); if (flag) { dr = Dumy_dt.NewRow(); } flag = false; dr[0] = HeadName; if (e.Row.Cells[0].Text.Trim() == "Completed" || e.Row.Cells[0].Text.Trim() == "पूर्ण") { e.Row.Cells[0].Text = "पूर्ण"; arr[0] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[1] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Incomplete" || e.Row.Cells[0].Text.Trim() == "अपूर्ण") { e.Row.Cells[0].Text = "अपूर्ण"; arr[1] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[2] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Inprogress" || e.Row.Cells[0].Text.Trim() == "Processing" || e.Row.Cells[0].Text.Trim() == "Current" || e.Row.Cells[0].Text.Trim() == "चालू" || e.Row.Cells[0].Text.Trim() == "प्रगतीत") { e.Row.Cells[0].Text = "प्रगतीत"; arr[2] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[3] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Tender Stage" || e.Row.Cells[0].Text.Trim() == "निविदा स्तर") { e.Row.Cells[0].Text = "निविदा स्तर"; arr[3] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[4] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Estimated Stage" || e.Row.Cells[0].Text.Trim() == "अंदाजपत्रकिय स्थर" || e.Row.Cells[0].Text.Trim() == "अंदाजपत्रकिय स्तर") { e.Row.Cells[0].Text = "अंदाजपत्रकिय स्थर"; arr[4] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[5] = e.Row.Cells[1].Text; } else if (e.Row.Cells[0].Text.Trim() == "Not Started" || e.Row.Cells[0].Text.Trim() == "सुरू करणे" || e.Row.Cells[0].Text.Trim() == "सुरु न झालेली") { e.Row.Cells[0].Text = "सुरु न झालेली"; arr[5] += Convert.ToDecimal(e.Row.Cells[1].Text); dr[6] = e.Row.Cells[1].Text; } else { e.Row.Cells[0].Text = "सध्यास्तिथी उपलब्ध नाही"; dr[7] = e.Row.Cells[1].Text; } //e.Row.Cells[0].BackColor = System.Drawing.Color.Red; TotalWork += Convert.ToDecimal(e.Row.Cells[1].Text); AACost += Convert.ToDecimal(e.Row.Cells[2].Text); TSCost += Convert.ToDecimal(e.Row.Cells[3].Text); TotalProvision += Convert.ToDecimal(e.Row.Cells[4].Text); TotalExp += Convert.ToDecimal(e.Row.Cells[5].Text); } if (e.Row.RowType == DataControlRowType.Footer) { string errortbl = Session["Errortbl"].ToString(); dr[8] = TotalWork.ToString(); dr[9] = AACost.ToString(); dr[10] = TSCost.ToString(); dr[11] = TotalProvision.ToString(); dr[12] = TotalExp.ToString(); Dumy_dt.Rows.Add(dr); flag = true; e.Row.Cells[0].Text = "एकूण"; e.Row.Cells[1].Text = TotalWork.ToString(); e.Row.Cells[2].Text = AACost.ToString(); e.Row.Cells[3].Text = TSCost.ToString(); e.Row.Cells[4].Text = TotalProvision.ToString(); e.Row.Cells[5].Text = TotalExp.ToString(); arr[6] += AACost; arr[7] += TSCost; arr[8] += TotalProvision; arr[9] += TotalExp; } } }
public static DekiResource PERMISSIONS_NOT_ALLOWED_ON(string pagePath, NS pageNamespace) { return new DekiResource("System.API.Error.permissions_not_allowed_on", pagePath, pageNamespace); }
private string GetNameSpaceFilterQuery(NS ns) { if(ns == NS.UNKNOWN) { return string.Empty; } else { return string.Format(" AND rc_namespace = {0}", (int)ns); } }
//--- Cosntructors --- public IndexRebuilder( IDekiChangeSink eventSink, UserBE currentUser, ISearchBL searchBL, IPageBL pageBL, ICommentBL commentBL, IAttachmentBL attachmentBL, IUserBL userBL, NS[] indexNameSpaceWhitelist, DateTime now ) { _eventSink = eventSink; _currentUser = currentUser; _searchBL = searchBL; _pageBL = pageBL; _commentBL = commentBL; _attachmentBL = attachmentBL; _userBL = userBL; _indexNameSpaceWhitelist = indexNameSpaceWhitelist; _now = now; }
public IList<PageBE> Pages_GetChildren(ulong parentPageId, NS nameSpace, bool filterOutRedirects) { Stopwatch sw = Stopwatch.StartNew(); var ret = _next.Pages_GetChildren(parentPageId, nameSpace, filterOutRedirects); LogQuery(CATEGORY_PAGE, "Pages_GetChildren", sw, "parentPageId", parentPageId, "nameSpace", nameSpace, "filterOutRedirects", filterOutRedirects); return ret; }
public NS(NS parentNamespace, string fullName, string name) { this.assembly = parentNamespace.assembly; this.parentNamespace = parentNamespace; this.fullName = fullName; this.name = name; if (parentNamespace.types != null) this.types = new Dictionary<TopLevelTypeName, ITypeDefinition>(parentNamespace.types.Comparer); }
public static DekiResource PAGE_MOVE_CONFLICT_SOURCE_NAMESPACE(NS @namespace) { return new DekiResource("System.API.Error.cannot-move-from-namespace", @namespace); }
public override void Generate(GenerationInfo gen_info) { gen_info.CurrentType = Name; string asm_name = gen_info.AssemblyName.Length == 0 ? NS.ToLower() + "-sharp" : gen_info.AssemblyName; DirectoryInfo di = GetDirectoryInfo(gen_info.Dir, asm_name); StreamWriter sw = gen_info.Writer = gen_info.OpenStream(Name); sw.WriteLine("namespace " + NS + " {"); sw.WriteLine(); sw.WriteLine("\tusing System;"); sw.WriteLine("\tusing System.Collections;"); sw.WriteLine("\tusing System.Runtime.InteropServices;"); sw.WriteLine(); SymbolTable table = SymbolTable.Table; sw.WriteLine("#region Autogenerated code"); if (IsDeprecated) { sw.WriteLine("\t[Obsolete]"); } foreach (string attr in custom_attrs) { sw.WriteLine("\t" + attr); } sw.Write("\t{0} {1}class " + Name, IsInternal ? "internal" : "public", IsAbstract ? "abstract " : ""); string cs_parent = table.GetCSType(Elem.GetAttribute("parent")); if (cs_parent != "") { di.objects.Add(CName, QualifiedName); sw.Write(" : " + cs_parent); } foreach (string iface in interfaces) { if (Parent != null && Parent.Implements(iface)) { continue; } sw.Write(", " + table.GetCSType(iface)); } foreach (string iface in managed_interfaces) { if (Parent != null && Parent.Implements(iface)) { continue; } sw.Write(", " + iface); } sw.WriteLine(" {"); sw.WriteLine(); GenCtors(gen_info); GenProperties(gen_info, null); GenFields(gen_info); GenChildProperties(gen_info); bool has_sigs = (sigs != null && sigs.Count > 0); if (!has_sigs) { foreach (string iface in interfaces) { ClassBase igen = table.GetClassGen(iface); if (igen != null && igen.Signals != null) { has_sigs = true; break; } } } if (has_sigs && Elem.HasAttribute("parent")) { GenSignals(gen_info, null); } if (vm_nodes.Count > 0) { if (gen_info.GlueEnabled) { GenVirtualMethods(gen_info); } else { Statistics.VMIgnored = true; Statistics.ThrottledCount += vm_nodes.Count; } } GenMethods(gen_info, null, null); if (interfaces.Count != 0) { Hashtable all_methods = new Hashtable(); foreach (Method m in Methods.Values) { all_methods[m.Name] = m; } Hashtable collisions = new Hashtable(); foreach (string iface in interfaces) { ClassBase igen = table.GetClassGen(iface); foreach (Method m in igen.Methods.Values) { Method collision = all_methods[m.Name] as Method; if (collision != null && collision.Signature.Types == m.Signature.Types) { collisions[m.Name] = true; } else { all_methods[m.Name] = m; } } } foreach (string iface in interfaces) { if (Parent != null && Parent.Implements(iface)) { continue; } ClassBase igen = table.GetClassGen(iface); igen.GenMethods(gen_info, collisions, this); igen.GenProperties(gen_info, this); igen.GenSignals(gen_info, this); } } foreach (XmlElement str in strings) { sw.Write("\t\tpublic static string " + str.GetAttribute("name")); sw.WriteLine(" {\n\t\t\t get { return \"" + str.GetAttribute("value") + "\"; }\n\t\t}"); } if (cs_parent != String.Empty && GetExpected(CName) != QualifiedName) { sw.WriteLine(); sw.WriteLine("\t\tstatic " + Name + " ()"); sw.WriteLine("\t\t{"); sw.WriteLine("\t\t\tGtkSharp." + Studlify(asm_name) + ".ObjectManager.Initialize ();"); sw.WriteLine("\t\t}"); } sw.WriteLine("#endregion"); AppendCustom(sw, gen_info.CustomDir); sw.WriteLine("\t}"); sw.WriteLine("}"); sw.Close(); gen_info.Writer = null; Statistics.ObjectCount++; }
public static NS getCreateNS(string name) { NS n = namespaces.Find(delegate(NS ns) { return ns.name == name; }); if (n == null) { n = new NS(name); namespaces.Add(n); } return n; }
public IList<PageBE> Pages_GetChildren(ulong parentPageId, NS nameSpace, bool filterOutRedirects) { List<PageBE> pages = new List<PageBE>(); string q = string.Format(@" SET group_concat_max_len = @@max_allowed_packet; SELECT {0}, ( SELECT cast(group_concat( p1.page_id, '') as char) FROM pages p1 WHERE p1.page_parent = p.page_id AND p.page_title <> '' AND p1.page_namespace = ?NS AND p.page_id <> p1.page_id {2} group by p1.page_parent ) as page_children, ( SELECT count(*) FROM resources WHERE res_type = 2 AND res_deleted = 0 AND resrev_parent_page_id = p.page_id ) as page_attachment_count FROM pages p WHERE p.page_parent = ?PARENTPAGEID AND p.page_namespace = ?NS AND p.page_title <> '' {1} ORDER BY p.page_title; ", PAGEFIELDS, filterOutRedirects ? "AND p.page_is_redirect = 0" : string.Empty, filterOutRedirects ? "AND p1.page_is_redirect = 0" : string.Empty); Catalog.NewQuery(q) .With("PARENTPAGEID", parentPageId) .With("NS", (int)nameSpace) .Execute(delegate(IDataReader dr) { while(dr.Read()) { PageBE p = Pages_PopulatePage(dr); p.AttachmentCount = DbUtils.Convert.To<uint>(dr["page_attachment_count"].ToString()); p.ChildPageIds = DbUtils.ConvertDelimittedStringToArray<ulong>(',', dr["page_children"].ToString()); pages.Add(p); } }); return pages; }
public bool CreateLanguageHierarchyForNS(NS ns) { // create a namespace heirarchy for everything but the user and template namespaces return (NS.USER != ns && NS.USER_TALK != ns && NS.TEMPLATE != ns && NS.TEMPLATE_TALK != ns && NS.SPECIAL != ns); }
public static DekiResource PAGE_MOVE_CONFLICT_TITLE_NOT_EDITABLE(NS @namespace) { return new DekiResource("System.API.Error.cannot-move-to-namespace", @namespace); }
public static IEnumerable<PageBE> GetAllPagesChunked(NS[] whitelist) { uint limit = 1000; uint offset = 0; while(true) { var chunk = DbUtils.CurrentSession.Pages_GetByNamespaces(whitelist, offset, limit); _log.DebugFormat("got chunk of {0} pages", chunk.Count); foreach(var page in chunk) { yield return page; } if(chunk.Count < limit) { yield break; } offset += limit; } }
public NS(NS parentNamespace, string fullName, string name) { this.assembly = parentNamespace.assembly; this.parentNamespace = parentNamespace; this.fullName = fullName; this.name = name; if (parentNamespace.types != null) this.types = new Dictionary<FullNameAndTypeParameterCount, ITypeDefinition>(parentNamespace.types.Comparer); }
public PageMoveTitleEditeConflictException(NS @namespace) : base(DekiResources.PAGE_MOVE_CONFLICT_TITLE_NOT_EDITABLE(@namespace)) { }
static NS GetOrAddNamespace(Dictionary<string, NS> dict, string fullName) { NS ns; if (dict.TryGetValue(fullName, out ns)) return ns; int pos = fullName.LastIndexOf('.'); NS parent; string name; if (pos < 0) { parent = dict[string.Empty]; // root name = fullName; } else { parent = GetOrAddNamespace(dict, fullName.Substring(0, pos)); name = fullName.Substring(pos + 1); } ns = new NS(parent, fullName, name); parent.childNamespaces.Add(ns); dict.Add(fullName, ns); return ns; }
public PageMoveSourceNamespaceConflictException(NS @namespace) : base(DekiResources.PAGE_MOVE_CONFLICT_SOURCE_NAMESPACE(@namespace)) { }
public IEnumerable<PageBE> GetAllPagesChunked(NS[] whitelist) { throw new NotImplementedException(); }
public PermissionsNotAllowedForbiddenException(string pagePath, NS pageNamespace) : base(DekiResources.PERMISSIONS_NOT_ALLOWED_ON(pagePath, pageNamespace)) { }
public XDoc RecentChanges_GetSiteRecentChanges(DateTime since, string language, bool createOnly, NS nsFilter, uint? limit, int maxScanSize) { Stopwatch sw = Stopwatch.StartNew(); var ret = _next.RecentChanges_GetSiteRecentChanges(since, language, createOnly, nsFilter, limit, maxScanSize); LogQuery(CATEGORY_RC, "RecentChanges_GetSiteRecentChanges", sw, "since", since, "language", language, "createOnly", createOnly, "nsFilter", nsFilter, "limit", limit, "maxScanSize", maxScanSize); return ret; }
private static void ExtractRecentChangesParameters(DreamContext context, out DateTime since, out int limit, out int offset, out FeedFormat format, out string language, out NS ns, ref List<string> feedNameSuffixes) { // extract 'since' parameter since = DbUtils.ToDateTime(context.GetParam("since", DbUtils.ToString(DateTime.MinValue))); // extract 'limit' parameter limit = context.GetParam("limit", 100); if((limit <= 0) || (limit > MAX_RECENT_CHANGES)) { throw new MaxParameterInvalidArgumentException(); } // extract 'offset' parameter offset = context.GetParam("offset", 0); if(offset < 0) { throw new OffsetParameterInvalidArgumentException(); } // extract 'format' parameter switch(context.GetParam("format", "daily")) { case "raw": format = FeedFormat.RAW; break; case "rawdaily": case "dailyraw": case "digest": format = FeedFormat.RAW_DAILY; break; case "daily": case "atom": format = FeedFormat.ATOM_DAILY; break; case "all": format = FeedFormat.ATOM_ALL; break; default: throw new FormatParameterInvalidArgumentException(); } // extract 'language' parameter language = context.GetParam("language", null); if(null != language) { PageBL.ValidatePageLanguage(language); } // extract 'namespace' parameter ns = context.GetParam<NS>("namespace", NS.UNKNOWN); // determine feed suffix if(feedNameSuffixes == null) { feedNameSuffixes = new List<string>(); } if(context.GetParam("format", null) != null) { feedNameSuffixes.Add(string.Format("format={0}", context.GetParam("format", null))); } if(context.GetParam("since", null) != null) { feedNameSuffixes.Add(string.Format("since={0}", DbUtils.ToString(since))); } if(context.GetParam("limit", null) != null) { feedNameSuffixes.Add(string.Format("limit={0}", limit)); } if(context.GetParam("offset", null) != null) { feedNameSuffixes.Add(string.Format("offset={0}", offset)); } if(context.GetParam("language", null) != null) { feedNameSuffixes.Add(string.Format("lang={0}", language)); } if(ns != NS.UNKNOWN) { feedNameSuffixes.Add(string.Format("namespace={0}", ns)); } }
private IEnumerable<RecentChangeEntry> QuerySiteRecentChanges(DateTime since, int offset, int count, string language, bool createOnly, NS nsFilter, bool filterByPermissions) { return ConvertAndFilterXmlToRecentChanges(DbUtils.CurrentSession.RecentChanges_GetSiteRecentChanges(since, language, createOnly, nsFilter, MAX_RECENT_CHANGES, DekiContext.Current.Instance.RecentChangesScanSize), offset, count, filterByPermissions); }
public IEnumerable<PageBE> GetAllPagesChunked(NS[] whitelist) { return PageBL.GetAllPagesChunked(whitelist); }