public override object InformationToProperty(IInformation information, Type propertyType) { var value = information as IInformationValue; if (value == null) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, $"'{information.Name}' must be a value type."); } try { // Change .md or .markdown extensions to .html and change macros to an XML form. var menuString = MarkdownProcessor.Transform( ParsingUtils.ReplaceMacros( Regex.Replace( OtherUtils.ReadAllText(value.Value), @"\w+?\.(?:md|markdown)", match => PathUtils.ChangeExtension(match.Value, "html")))); return XmlUtils.WrapAndParse("Menu", menuString); } catch (Exception e) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, e.Message); } }
private static byte[] GetBytes(IInformation information, params byte[][] other) { var byteList = new List <byte>(); var typeCode = (byte)information.TypeCode; var id = BitConverter.GetBytes(information.Id); var message = Encoding.UTF8.GetBytes(information.Message ?? ""); var messageLength = BitConverter.GetBytes(message.Length); var data = Encoding.UTF8.GetBytes(information.Json ?? ""); var length = 1 + id.Length + message.Length + messageLength.Length + data.Length; // 处理传入的参数 length += other.Sum(x => x.Length); byteList.AddRange(BitConverter.GetBytes(length)); byteList.Add(typeCode); // 1 byteList.AddRange(id); // 4 foreach (var item in other) { byteList.AddRange(item); } byteList.AddRange(messageLength); byteList.AddRange(message); byteList.AddRange(data); return(byteList.ToArray()); }
public void ShowAbout() { #if DEBUG const string buildType = "Debug"; #elif UAT const string buildType = "UAT"; #elif STAGING const string buildType = "Staging"; #else const string buildType = "Prod"; #endif Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this); Android.App.AlertDialog alertDialog = builder.Create(); IInformation information = Resolver.Instance.Get <IInformation>(); alertDialog.SetTitle(Resource.String.app_name); alertDialog.SetMessage(string.Format( Resources.GetString(Resource.String.build_version), information.DeviceAppVersion, information.CoreVersion, information.BuildTime, buildType)); alertDialog.SetButton(GetString(Resource.String.ok), (s, eventArgs) => { alertDialog.Dismiss(); }); alertDialog.Show(); }
/// <summary> /// Constructor sets the origin of the coordinates to the middle of the window and object which responses for /// input/output information in program also it sets lengths of sides and coordinates of left-bottom point of /// rectangle. /// </summary> /// <param name="view">Type of class, which response for input/output information in program.</param> /// <param name="width">Length of top and bottom sides of rectangle.</param> /// <param name="height">Length of left and right sides of rectangle.</param> /// <param name="leftBottom">Left-bottom point of rectangle.</param> public Rectangle(IInformation view, int width, int height, Point leftBottom) : this(view) { this.leftBottom.X = this.writer.WindowWidth / 2 + leftBottom.X; this.leftBottom.Y = this.writer.WindowHeight / 2 - leftBottom.Y; this.Height = height; this.Width = width; if (this.Width + this.leftBottom.X - this.writer.WindowWidth / 2 >= this.writer.WindowWidth / 2 || this.leftBottom.X <= CoordinateSystem.EndOfUserUI || this.leftBottom.Y < this.Height || this.leftBottom.Y >= this.writer.WindowHeight) { this.Height = 5; this.Width = 3; this.leftBottom.X = this.writer.WindowWidth / 2; this.leftBottom.Y = this.writer.WindowHeight / 2; this.IncorrectSize += UIPart.OupputMessage; if (this.IncorrectSize != null) { var message = "Rectangle has invalid coordinates and can't fits into dispaly!\n" + "Height is assigned to 5\nWidth is assigned to 3\nCoordinates assigned to (0, 0)"; this.IncorrectSize(this, message); } } }
public override object InformationToProperty(IInformation information, Type propertyType) { var value = information as IInformationValue; if (value == null) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, $"'{information.Name}' must be a value type."); } try { var xElements = new List <XElement>(); // The path could contain wildcards, so use a PathList. var pathList = new PathList() { PathStorage = PathStorageMode.Relative }; pathList.Add(value.Value.Trim()); foreach (var path in pathList) { var xElement = new XElement("UserPage"); xElement.Add(new XElement("Path", PathUtils.ChangeExtension(path, ".html"))); xElement.Add(XmlUtils.WrapAndParse("Content", new Markdown().Transform(OtherUtils.ReadAllText(path)))); xElements.Add(xElement); } return(xElements); } catch (Exception e) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, e.Message); } }
/// <summary> /// Return queue info queried from Tags on Azure scaleset. The info includes: /// 1. Whether the queue exists. /// 2. Friendly description (if available) of queue, otherwise instructions how /// to fix that (ping dnceng) /// 3. Path to place the Jenkins workspace on disk. /// 4. Whether queue is used for internal customers only. /// 5. What OS the machines in the group use (windows/linux/osx). /// 6. List of users to which this queue is restricted, “all” if the queue is /// NOT restricted. /// 7. If the machine is on premises /// 8. What is the current Queue Depth (Number of messages still in the queue) /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <QueueInfo> > QueueInfoListAsync(this IInformation operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.QueueInfoListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// 获取我的通知信息 /// </summary> /// <param name="userId">当前用户ID</param> /// <param name="infoType">信息类型</param> /// <returns></returns> public DataTable GetMyInformation(int userId, Int32 infoType) { IInformation dal = baseDal as IInformation; // TODO return(dal.GetMyInformation(userId, 1)); }
private List <IInformation> Informations = new List <IInformation>(); //not used maybe some different aproach? #endregion #region Logic /// <summary>Adds an IInformation to the list</summary> /// <param name="info"></param> public void addInformation(IInformation info) { if (Informations.Contains(info)) { //throw exception? return; } Informations.Add(info); }
/// <summary>Removes an IInformation from the List of displayed Informations</summary> /// <param name="info"></param> public void removeInformation(IInformation info) { if (Informations.Contains(info)) { Informations.Remove(info); return; } //Throw exception? }
public virtual ClientListCommand CreateClientList(List<IClientInformation> availableClients, IInformation senderInformation) { var clientListCommand = new ClientListCommand { SenderInformation = senderInformation, AvailableClients = availableClients, }; return clientListCommand; }
public virtual MessageCommand CreateMessage(string subject, string text, IInformation senderInformation) { var message = new MessageCommand() { SenderInformation = senderInformation, Subject = subject, Text = text }; return message; }
public HandShakeCommand CreateHandShakeCommand(string subject, string text, IClient client, IInformation information) { var handShakeCommand = new HandShakeCommand { Recipient = client, SenderInformation = information, Subject = subject, Text = text }; return handShakeCommand; }
public MainWindow() { InitializeComponent(); var o = JsonConvert.DeserializeObject <SampleResponse1>(json); var array = new IInformation[o.X, o.Y]; foreach (var i in o.Information) { array[i.X, i.Y] = i; } }
public ILink Make(string link, string info, string name, int vers = 0) { IInformation information = InfoFactoryImplementation.Make(info, name, vers); switch (link) { case "Link": return(Link.CreateLink(information)); default: return(null); } }
/// <summary> /// Converts an <see cref="IInformation" /> to an <see cref="XElement" />. /// </summary> /// <param name="information">The meta-data to be converted.</param> /// <returns>The result of the conversion.</returns> private static XElement ToXml(IInformation information) { var value = information as IInformationValue; if (value != null) { return(new XElement(value.Name, value.Value)); } var group = (IInformationGroup)information; return(new XElement(group.Name, group.SubObjects.OfType <IInformation>().Select(ToXml))); }
/// <summary> /// Converts the intermediary <see cref="IInformation" /> to a <see cref="XElement" />. /// </summary> /// <param name="information">The meta-data to be converted.</param> /// <param name="propertyType">The actual type of the property this attribute was applied to.</param> /// <returns>The result of the conversion.</returns> /// <exception cref="InvalidPropertyTypeException"> /// Thrown when the property this attribute was applied to is not of type /// <see cref="XElement" />. /// </exception> public override object InformationToProperty(IInformation information, Type propertyType) { if (propertyType != typeof(XElement)) { throw new InvalidPropertyTypeException(nameof(this.InformationToProperty), typeof(XElement), propertyType); } if (this.Strict && !_allowedNames.Contains(information.Name)) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, $"'{information.Name}' is not a recognised option."); } return(ToXml(information)); }
public override object InformationToProperty(IInformation information, Type propertyType) { var infoV = information as IInformationValue; if (infoV == null) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, $"'{information.Name}' can only be a value type and not a group."); } if (this.Strict && !_allowedNames.Contains(infoV.Name)) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, $"'{information.Name}' is not a recognised option."); } return(infoV.Value.ToIConvertable(propertyType)); }
/// <summary> /// This is general task method, here is described logic of types behavior. /// </summary> /// <param name="view">Type of class, which response for input/output information in program.</param> public void Run(IInformation view) { UIPart.Writer = view; List <IDrawable> drawFigures = new List <IDrawable>(); IDrawable coordinateSystem = new CoordinateSystem(view); List <IChangeable> objects = new List <IChangeable>() { new Circle(view, 5), new Rectangle(view, 12, 10, new Point(1, 3)), }; ObjectController.ObjectCount = objects.Count; foreach (var obj in objects) { drawFigures.Add(obj); } UIPart.DrawLine(); coordinateSystem.Draw(); do { foreach (var obj in drawFigures) { obj.Draw(); } var keyInfo = view.ReadKey(true); view.Clear(CoordinateSystem.EndOfUserUI); foreach (var obj in drawFigures) { obj.Draw(' '); } try { ObjectController.ObjectAction(objects[ObjectController.CurrentObject], keyInfo); } catch (NullReferenceException e) { UIPart.PrintString(e.Message); } UIPart.PrintStats(objects[ObjectController.CurrentObject]); }while (true); }
public override object InformationToProperty(IInformation information, Type propertyType) { var infoV = information as IInformationValue; if (infoV == null) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, $"'{information.Name}' can only be a value type and not a group."); } try { return(infoV.Value.Trim().ToIConvertable(propertyType)); } catch (FormatException e) { throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, e.Message); } }
/// <summary> /// Constructor sets the origin of the coordinates to the middle of the window and object which responses for /// input/output information in program also it sets lengths of sides. /// </summary> /// <param name="view">Type of class, which response for input/output information in program.</param> /// <param name="width">Length of top and bottom sides of rectangle.</param> /// <param name="height">Length of left and right sides of rectangle.</param> public Rectangle(IInformation view, int width, int height) : this(view) { this.Height = height; this.Width = width; if (width > this.writer.WindowWidth / 2 || height > this.writer.WindowHeight / 2) { this.Height = 5; this.Width = 3; this.IncorrectSize += UIPart.OupputMessage; if (this.IncorrectSize != null) { var message = "Width or height of rectangle is bigger than window size!\n" + "Height is assigned to 5\nWidth is assigned to 3"; this.IncorrectSize(this, message); } } }
internal void MessagesUpdated(IInformation clientInformation, string message) { object[] args = new Object[] {clientInformation.Name, message}; Delegate d = new UpdateMessagesDelegate(UpdateMessages); Invoke(d, args); }
/// <summary> /// Constructor sets the origin of the coordinates to the middle of the window and object which responses for /// input/output information in program. /// </summary> /// <param name="view">Type of class, which response for input/output information in program.</param> public Circle(IInformation view) { this.writer = view; this.center.X = this.writer.WindowWidth / 2; this.center.Y = this.writer.WindowHeight / 2; }
/// <summary> /// /// </summary> /// <param name="node"></param> /// <param name="mgr"></param> /// <returns></returns> public override IFeature FromXml(XmlNode node, XmlNamespaceManager mgr) { if (node != null && node.HasChildNodes) { if (node.FirstChild.Attributes.Count > 0) { Id = node.FirstChild.Attributes["gml:id"].InnerText; } var featureObjectIdentifierNode = node.FirstChild.SelectSingleNode("s100:featureObjectIdentifier", mgr); if (featureObjectIdentifierNode != null && featureObjectIdentifierNode.HasChildNodes) { FeatureObjectIdentifier = new FeatureObjectIdentifier(); FeatureObjectIdentifier.FromXml(featureObjectIdentifierNode, mgr); } var categoryOfTemporalVariation = node.FirstChild.SelectSingleNode("categoryOfTemporalVariation", mgr); if (categoryOfTemporalVariation != null) { CategoryOfTemporalVariation = categoryOfTemporalVariation.InnerText; } var dataAssessment = node.FirstChild.SelectSingleNode("dataAssessment", mgr); if (dataAssessment != null) { DataAssessment = dataAssessment.InnerText; } var sourceIndicationNode = node.FirstChild.SelectSingleNode("sourceIndication", mgr); if (sourceIndicationNode != null && sourceIndicationNode.HasChildNodes) { SourceIndication = new SourceIndication(); SourceIndication.FromXml(sourceIndicationNode, mgr); } var horizontalDistanceUncertaintyNodes = node.FirstChild.SelectNodes("horizontalDistanceUncertainty", mgr); if (horizontalDistanceUncertaintyNodes != null && horizontalDistanceUncertaintyNodes.Count > 0) { var distanceUncertainties = new List <string>(); foreach (XmlNode horizontalDistanceUncertaintyNode in horizontalDistanceUncertaintyNodes) { if (horizontalDistanceUncertaintyNode != null && horizontalDistanceUncertaintyNode.HasChildNodes) { distanceUncertainties.Add(horizontalDistanceUncertaintyNode.FirstChild.InnerText); } } HorizontalDistanceUncertainty = distanceUncertainties.ToArray(); } var horizontalPositionalUncertaintyNode = node.FirstChild.SelectSingleNode("horizontalPositionalUncertainty", mgr); if (horizontalPositionalUncertaintyNode != null && horizontalPositionalUncertaintyNode.HasChildNodes) { HorizontalPositionalUncertainty = new HorizontalPositionalUncertainty(); HorizontalPositionalUncertainty.FromXml(horizontalPositionalUncertaintyNode, mgr); } var directionUncertaintyNode = node.FirstChild.SelectSingleNode("directionUncertainty", mgr); if (directionUncertaintyNode != null && directionUncertaintyNode.HasChildNodes) { DirectionUncertainty = directionUncertaintyNode.FirstChild.InnerText; } var surveyDateRangeNode = node.FirstChild.SelectSingleNode("surveyDateRange", mgr); if (surveyDateRangeNode != null && surveyDateRangeNode.HasChildNodes) { SurveyDateRange = new SurveyDateRange(); SurveyDateRange.FromXml(surveyDateRangeNode, mgr); } var informationNode = node.FirstChild.SelectSingleNode("information", mgr); if (informationNode != null && informationNode.HasChildNodes) { Information = new Information(); Information.FromXml(informationNode, mgr); } } var linkNodes = node.FirstChild.SelectNodes("*[boolean(@xlink:href)]", mgr); if (linkNodes != null && linkNodes.Count > 0) { var links = new List <Link>(); foreach (XmlNode linkNode in linkNodes) { var newLink = new Link(); newLink.FromXml(linkNode, mgr); links.Add(newLink); } Links = links.ToArray(); } return(this); }
/// <summary> /// Constructor sets the origin of the coordinates to the middle of the window and object which responses for /// input/output information in program also it sets value for radius of circle. /// </summary> /// <param name="view">Type of class, which response for input/output information in program.</param> /// <param name="radius">Radius of circle.</param> public Circle(IInformation view, int radius) : this(view) { this.Radius = radius; }
/// <summary> /// Constructor sets the origin of the coordinates to the middle of the window and object which responses for /// input/output information in program. /// </summary> /// <param name="view">Type of class, which response for input/output information in program.</param> public Rectangle(IInformation view) { this.writer = view; this.leftBottom.X = this.writer.WindowWidth / 2; this.leftBottom.Y = this.writer.WindowHeight / 2; }
/// <summary> /// 获取我的通知信息 /// </summary> /// <param name="userId">当前用户ID</param> /// <param name="infoType">信息类型</param> /// <returns></returns> public DataTable GetMyInformation(int userId, InformationCategory infoType) { IInformation dal = baseDal as IInformation; return(dal.GetMyInformation(userId, InformationCategory.通知公告)); }
public Worker(IInformation information) { Loggeding = information.Log; Email = information.Email; }
/// <summary> /// Converts the data to the type <paramref name="type" />. /// </summary> /// <param name="convert">The conversion procedure.</param> /// <param name="information">The information to convert.</param> /// <param name="type">The type to convert the meta-data to.</param> /// <returns>The converted meta-data.</returns> /// <exception cref="ParserException"> /// This is thrown when there has been an exception converting <paramref name="information" /> /// to type <paramref name="type" />. /// </exception> private object CheckAndConvertValue(Func <IInformation, Type, object> convert, IInformation information, Type type) { try { return(convert(information, type)); } catch (OptionReaderException e) { this.ErrorListener.Error(e); return(null); } }
/// <summary> /// Constructor sets the origin of the coordinates to the middle of the window and object which responses for /// input/output information in program. /// </summary> /// <param name="view">Type of class, which response for input/output information in program.</param> public CoordinateSystem(IInformation view) { this.writer = view; this.startX = this.writer.WindowWidth / 2; this.startY = this.writer.WindowHeight / 2; }
/// <summary> This method copy's each database field into the <paramref name="target"/> interface. </summary> public void Copy_To(IInformation target, bool includePrimaryKey = false) { if (includePrimaryKey) target.Id = this.Id; target.NameId = this.NameId; target.Titel = this.Titel; target.TypId = this.TypId; target.DataDependencyId = this.DataDependencyId; target.SourceTable = this.SourceTable; target.Status = this.Status; target.BearbeitungsHinweis = this.BearbeitungsHinweis; target.SourceId = this.SourceId; target.ModifyTimeStamp = this.ModifyTimeStamp; target.ProcessingStatus = this.ProcessingStatus; target.CreatedBy = this.CreatedBy; target.LastModifiedBy = this.LastModifiedBy; target.AccessRightsId = this.AccessRightsId; target.LastUpdateToken = this.LastUpdateToken; }
/// <summary> This method copy's each database field from the <paramref name="source"/> interface to this data row.</summary> public void Copy_From(IInformation source, bool includePrimaryKey = false) { if (includePrimaryKey) this.Id = source.Id; this.NameId = source.NameId; this.Titel = source.Titel; this.TypId = source.TypId; this.DataDependencyId = source.DataDependencyId; this.SourceTable = source.SourceTable; this.Status = source.Status; this.BearbeitungsHinweis = source.BearbeitungsHinweis; this.SourceId = source.SourceId; this.ModifyTimeStamp = source.ModifyTimeStamp; this.ProcessingStatus = source.ProcessingStatus; this.CreatedBy = source.CreatedBy; this.LastModifiedBy = source.LastModifiedBy; this.AccessRightsId = source.AccessRightsId; this.LastUpdateToken = source.LastUpdateToken; }
public void update(IObserver ob, IInformation info) { throw new NotImplementedException(); }
/// <summary> /// This method copy's each database field which is in the <paramref name="includedColumns"/> /// from the <paramref name="source"/> interface to this data row. /// </summary> public void Copy_From_But_TakeOnly(IInformation source, params string[] includedColumns) { if (includedColumns.Contains(InformationenTable.IdCol)) this.Id = source.Id; if (includedColumns.Contains(InformationenTable.NameIdCol)) this.NameId = source.NameId; if (includedColumns.Contains(InformationenTable.TitelCol)) this.Titel = source.Titel; if (includedColumns.Contains(InformationenTable.TypIdCol)) this.TypId = source.TypId; if (includedColumns.Contains(InformationenTable.DataDependencyIdCol)) this.DataDependencyId = source.DataDependencyId; if (includedColumns.Contains(InformationenTable.SourceTableCol)) this.SourceTable = source.SourceTable; if (includedColumns.Contains(InformationenTable.StatusCol)) this.Status = source.Status; if (includedColumns.Contains(InformationenTable.BearbeitungsHinweisCol)) this.BearbeitungsHinweis = source.BearbeitungsHinweis; if (includedColumns.Contains(InformationenTable.SourceIdCol)) this.SourceId = source.SourceId; if (includedColumns.Contains(InformationenTable.ModifyTimeStampCol)) this.ModifyTimeStamp = source.ModifyTimeStamp; if (includedColumns.Contains(InformationenTable.ProcessingStatusCol)) this.ProcessingStatus = source.ProcessingStatus; if (includedColumns.Contains(InformationenTable.CreatedByCol)) this.CreatedBy = source.CreatedBy; if (includedColumns.Contains(InformationenTable.LastModifiedByCol)) this.LastModifiedBy = source.LastModifiedBy; if (includedColumns.Contains(InformationenTable.AccessRightsIdCol)) this.AccessRightsId = source.AccessRightsId; if (includedColumns.Contains(InformationenTable.LastUpdateTokenCol)) this.LastUpdateToken = source.LastUpdateToken; }
public abstract object InformationToProperty(IInformation information, Type propertyType);
// don't care about type of object passed into Information, only that it implements IInformation private static string Information(IInformation info) { return(info.GetInformation()); }
public DataTable GetMyInformation(int userId, InformationCategory infoType) { IInformation baseDal = base.baseDal as IInformation; return(baseDal.GetMyInformation(userId, InformationCategory.const_0)); }