private DirectiveResult ParseIdleResultData(byte[] bytes) { var ret = new DirectiveResult(); if (!DirectiveHelper.IsValidationResult(bytes, ((DirectiveTypeEnum)bytes[1]).GetFeedbackLength())) { ret.Status = false; return(ret); } ret.Status = true; var data = new TemperatureDirectiveData(); data.DeviceId = bytes[0]; data.DirectiveType = (DirectiveTypeEnum)bytes[1]; data.Temperature = DirectiveHelper.Parse2BytesToNumber(bytes.Skip(2).Take(2).ToArray()) / 10; data.DirectiveId = (int)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(4).Take(2).ToArray()); data.DeviceType = (TargetDeviceTypeEnum)bytes.Skip(6).Take(1).FirstOrDefault(); ret.Data = data; ret.SourceDirectiveType = DirectiveTypeEnum.Idle; return(ret); }
private byte[] generatePingBytes(byte id) { var p = new byte[] { id, 0x03, 0xff, 0xfe, 0x00 }; var t = DirectiveHelper.GenerateCheckCode(p); return(p.Concat(t).ToArray()); }
private DirectiveResult ParsePausingResultData(byte[] bytes) { var ret = new DirectiveResult(); if (!DirectiveHelper.IsValidationResult(bytes, ((DirectiveTypeEnum)bytes[1]).GetFeedbackLength())) { ret.Status = false; return(ret); } ret.Status = true; var data = new RockerDirectiveData(); data.DeviceId = bytes[0]; data.DirectiveType = (DirectiveTypeEnum)bytes[1]; data.TimeInterval = (int)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(2).Take(2).ToArray()); data.Speed = DirectiveHelper.Parse2BytesToNumber(bytes.Skip(4).Take(2).ToArray()); data.DeviceStatus = bytes.Skip(6).Take(1).FirstOrDefault(); data.DirectiveId = (int)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(7).Take(2).ToArray()); data.DeviceType = TargetDeviceTypeEnum.Rocker; ret.SourceDirectiveType = DirectiveTypeEnum.Pausing; ret.Data = data; return(ret); }
private DirectiveResult ParseRunningResultData(byte[] bytes) { var ret = new DirectiveResult(); if (!DirectiveHelper.IsValidationResult(bytes, ((DirectiveTypeEnum)bytes[1]).GetFeedbackLength())) { ret.Status = false; return(ret); } ret.Status = true; var data = new GasDirectiveData(); data.DeviceId = bytes[0]; data.DirectiveType = (DirectiveTypeEnum)bytes[1]; data.Concentration = (double)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(2).Take(2).ToArray()) / 10; data.Flowrate = DirectiveHelper.Parse2BytesToNumber(bytes.Skip(4).Take(2).ToArray()); data.DeviceStatus = bytes.Skip(6).Take(1).FirstOrDefault(); data.DirectiveId = (int)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(8).Take(2).ToArray()); data.DeviceType = TargetDeviceTypeEnum.Gas; ret.SourceDirectiveType = DirectiveTypeEnum.Running; ret.Data = data; return(ret); }
public UpdateBlock(string rawValue, ArgumentCollection arguments) : base(DirectiveTypes.UpdateBlock, arguments) { this.DirectiveId = DirectiveHelper.CaptureDirectiveId(rawValue); this._Contents = new ContentDescription(rawValue); this.UpdateBlockIds.Add(this.DirectiveId); }
public Control(string rawValue, ArgumentCollection arguments) : base(DirectiveTypes.Control, arguments) { this._RawValue = rawValue; this.DirectiveId = DirectiveHelper.CaptureDirectiveId(rawValue); this.BoundDirectiveId = DirectiveHelper.CaptureBoundDirectiveId(rawValue); this.Leveling = LevelingInfo.Create(rawValue); }
public PartialCache(string rawValue, int positionId, ArgumentCollection arguments) : base(DirectiveTypes.PartialCache, arguments) { this._PositionId = positionId; this._Parameters = DirectiveHelper.CaptureDirectiveParameters(rawValue, true); this._CacheIdExtensions = new string[this._Parameters.Length]; this._Contents = new ContentDescription(rawValue); }
public InLineStatement(string rawValue, ArgumentCollection arguments) : base(DirectiveTypes.InLineStatement, arguments) { this.DirectiveId = DirectiveHelper.CaptureDirectiveId(rawValue); this.BoundDirectiveId = DirectiveHelper.CaptureBoundDirectiveId(rawValue); this._Contents = new ContentDescription(rawValue); this._Cache = true; this._ParametersDefinition = null; }
public Execution(string rawValue, ArgumentCollection arguments) : base(DirectiveTypes.Execution, arguments) { this.Leveling = LevelingInfo.Create(rawValue); this.BoundDirectiveId = DirectiveHelper.CaptureBoundDirectiveId(rawValue); string[] controlValueParts = rawValue.Split(':'); this.Bind = Basics.Execution.Bind.Make(string.Join(":", controlValueParts, 1, controlValueParts.Length - 1)); }
private DirectiveResult ParseCloseResultData(byte[] bytes) { var ret = new DirectiveResult(); if (!DirectiveHelper.IsValidationResult(bytes, ((DirectiveTypeEnum)bytes[1]).GetFeedbackLength())) { ret.Status = false; return(ret); } return(ret); }
public static IControl MakeControl(int rawStartIndex, string rawValue, ArgumentInfoCollection contentArguments, ControlResolveHandler controlResolveHandler) { Renderless dummy = new Renderless(rawStartIndex, rawValue, contentArguments); string controlID = DirectiveHelper.CaptureControlID(dummy.Value); ControlSettings controlSettings = ControlHelper.GetControlSettings(controlID, controlResolveHandler); if (controlSettings == null) { return(new Unknown(rawStartIndex, rawValue, contentArguments, new ControlSettings())); } switch (controlSettings.Type) { case ControlTypes.Button: return(new Button(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.Checkbox: return(new Checkbox(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.ConditionalStatement: return(new ConditionalStatement(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.DataList: return(new DataList(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.ImageButton: return(new ImageButton(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.LinkButton: return(new LinkButton(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.Password: return(new Password(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.RadioButton: return(new RadioButton(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.Textarea: return(new Textarea(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.Textbox: return(new Textbox(rawStartIndex, rawValue, contentArguments, controlSettings)); case ControlTypes.VariableBlock: return(new VariableBlock(rawStartIndex, rawValue, contentArguments, controlSettings)); default: return(new Unknown(rawStartIndex, rawValue, contentArguments, controlSettings)); } }
public Control(int rawStartIndex, string rawValue, ArgumentInfoCollection contentArguments, ControlSettings settings) : base(rawStartIndex, rawValue, DirectiveTypes.Control, contentArguments) { this.Settings = settings; this.Type = settings.Type; this.ControlID = DirectiveHelper.CaptureControlID(this.Value); this.BoundControlID = DirectiveHelper.CaptureBoundControlID(this.Value); this.Leveling = LevelingInfo.Create(this.Value); this.Security = settings.Security; this.Bind = settings.Bind; this.Attributes = settings.Attributes; }
public DirectiveCollection( object source, IEnumerable <DirectiveDefinition> directiveDefinitions) { if (directiveDefinitions is null) { throw new ArgumentNullException(nameof(directiveDefinitions)); } _source = source ?? throw new ArgumentNullException(nameof(source)); _definitions = directiveDefinitions.Any() ? directiveDefinitions.ToArray() : Array.Empty <DirectiveDefinition>(); _location = DirectiveHelper.InferDirectiveLocation(source); }
private DirectiveResult ParseRunningResultData(byte[] bytes) { var ret = new DirectiveResult(); if (DirectiveHelper.IsValidationResult(bytes, ((DirectiveTypeEnum)bytes[1]).GetFeedbackLength() + 2)) { return(ParseLongRunningResultData(bytes)); } if (DirectiveHelper.IsValidationResult(bytes, ((DirectiveTypeEnum)bytes[1]).GetFeedbackLength())) { return(ParseNormalRunningResultData(bytes)); } ret.Status = false; return(ret); }
private static byte[] GetCommonBufferData(BaseDirective directive) { if (null == directive) { return(new byte[0]); } IList <byte> list = new List <byte>(); list.Add((byte)directive.TargetDeviceId); list.Add((byte)directive.DirectiveType); list = list.Concat(DirectiveHelper.ParseNumberTo2Bytes(directive.DirectiveId)).ToList(); list.Add((byte)directive.DeviceType); list = list.Concat(DirectiveHelper.GenerateCheckCode(list.ToArray())).ToList(); return(list.ToArray()); }
private byte[] GenerateDirectiveBuffer(TryStartDirective directive) { if (null == directive) { return(new byte[0]); } IList <byte> list = new List <byte>(); list.Add((byte)directive.TargetDeviceId); list.Add((byte)directive.DirectiveType); list = list.Concat(DirectiveHelper.ParseNumberTo2Bytes(directive.Param1)).ToList(); list = list.Concat(DirectiveHelper.ParseNumberTo2Bytes(directive.Param2)).ToList(); list.Add((byte)directive.Mode); list = list.Concat(DirectiveHelper.ParseNumberTo2Bytes(directive.DirectiveId)).ToList(); list.Add((byte)directive.DeviceType); list = list.Concat(DirectiveHelper.GenerateCheckCode(list.ToArray())).ToList(); return(list.ToArray()); }
private DirectiveResult ParseNormalRunningResultData(byte[] bytes) { var ret = new DirectiveResult(); ret.Status = true; var data = new RockerDirectiveData(); data.DeviceId = bytes[0]; data.DirectiveType = (DirectiveTypeEnum)bytes[1]; data.Angle = (double)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(2).Take(2).ToArray()) / 10; data.Speed = DirectiveHelper.Parse2BytesToNumber(bytes.Skip(4).Take(2).ToArray()); data.DeviceStatus = bytes.Skip(6).Take(1).FirstOrDefault(); data.RockMode = (RockEnum)bytes.Skip(7).Take(1).FirstOrDefault(); data.DirectiveId = (int)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(8).Take(2).ToArray()); data.DeviceType = TargetDeviceTypeEnum.Rocker; ret.SourceDirectiveType = DirectiveTypeEnum.Running; ret.Data = data; return(ret); }
private DirectiveResult ParseLongRunningResultData(byte[] bytes) { var ret = new DirectiveResult(); ret.Status = true; var data = new RockerDirectiveData(); data.DeviceId = bytes[0]; data.DirectiveType = (DirectiveTypeEnum)bytes[1]; data.CenterTemperature = DirectiveHelper.Parse2BytesToNumber(bytes.Skip(2).Take(2).ToArray()) / 10; data.Speed = DirectiveHelper.Parse2BytesToNumber(bytes.Skip(4).Take(2).ToArray()); data.HeaterTemperature = DirectiveHelper.Parse2BytesToNumber(bytes.Skip(6).Take(2).ToArray()) / 10; data.EnvTemperature = DirectiveHelper.Parse2BytesToNumber(bytes.Skip(8).Take(2).ToArray()) / 10; data.DirectiveId = (int)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(10).Take(2).ToArray()); data.DeviceType = TargetDeviceTypeEnum.Rocker; ret.SourceDirectiveType = DirectiveTypeEnum.Running; ret.Data = data; return(ret); }
private DirectiveResult ParseTryStartResultData(byte[] bytes) { var ret = new DirectiveResult(); if (!DirectiveHelper.IsValidationResult(bytes, ((DirectiveTypeEnum)bytes[1]).GetFeedbackLength())) { ret.Status = false; return(ret); } ret.Status = true; var data = new RockerDirectiveData(); data.DeviceId = bytes[0]; data.DirectiveType = (DirectiveTypeEnum)bytes[1]; data.DirectiveId = (int)DirectiveHelper.Parse2BytesToNumber(bytes.Skip(2).Take(2).ToArray()); data.DeviceType = TargetDeviceTypeEnum.Rocker; ret.SourceDirectiveType = DirectiveTypeEnum.TryStart; ret.Data = data; return(ret); }
public Translation(string rawValue, ArgumentCollection arguments) : base(DirectiveTypes.Translation, arguments) { this._TranslationId = DirectiveHelper.CaptureDirectiveId(rawValue); }
public void Parse() { if (this._Settings.Bind == null) { throw new System.ArgumentNullException(nameof(this._Settings.Bind)); } // Execution preparation should be done at the same level with it's parent. Because of that, send parent as parameters this._Settings.Bind.Parameters.Prepare( parameter => { string query = parameter.Query; int paramIndex = DirectiveHelper.CaptureParameterPointer(query); if (paramIndex < 0) { return(Property.Render(this._Parent, query).Item2); } if (paramIndex >= this._Parameters.Length) { throw new Exceptions.FormatIndexOutOfRangeException("VariableBlock"); } return(Property.Render(this._Parent, this._Parameters[paramIndex]).Item2); } ); Basics.Execution.InvokeResult <Basics.ControlResult.VariableBlock> invokeResult = Manager.Executer.InvokeBind <Basics.ControlResult.VariableBlock>(Basics.Helpers.Context.Request.Header.Method, this._Settings.Bind, Manager.ExecuterTypes.Control); if (invokeResult.Exception != null) { throw new Exceptions.ExecutionException(invokeResult.Exception); } // ---- if (invokeResult.Result == null) { return; } if (invokeResult.Result.Message != null) { if (!this._Contents.HasMessageTemplate) { this._Parent.Children.Clear(); if (!string.IsNullOrEmpty(invokeResult.Result.Message.Content)) { this._Parent.Children.Add(new Static(invokeResult.Result.Message.Content)); } } else { this._Parent.Arguments.AppendKeyWithValue("MessageType", invokeResult.Result.Message.Type); this._Parent.Arguments.AppendKeyWithValue("Message", invokeResult.Result.Message.Content); this._Parent.Mother.RequestParsing(this._Contents.MessageTemplate, this._Parent.Children, this._Parent.Arguments); } return; } if (invokeResult.Result != null) { foreach (string key in invokeResult.Result.Keys) { this._Parent.Arguments.AppendKeyWithValue(key, invokeResult.Result[key]); } } this._Parent.Mother.RequestParsing(this._Contents.Parts[0], this._Parent.Children, this._Parent.Arguments); }
private void OnParseRequest(string rawValue, ref ControllerCollection childrenContainer, Global.ArgumentInfoCollection contentArguments) { MatchCollection mainPatternMatches = RegularExpression.Current.MainCapturePattern.Matches(rawValue); if (mainPatternMatches.Count == 0) { childrenContainer.Add(new Renderless(0, rawValue, contentArguments)); } else { int lastIndex = 0; Match mainSearchMatch; // For Opening Brackets Match bracketOpenExamMatch; string directiveType, directiveID; // For Separator Brackets Match bracketSeparatorExamMatch; // For Closing Brackets Match bracketCloseExamMatch; IEnumerator remEnum = mainPatternMatches.GetEnumerator(); while (remEnum.MoveNext()) { mainSearchMatch = (Match)remEnum.Current; // Check till this match any renderless content exists if (mainSearchMatch.Index > lastIndex) { childrenContainer.Add( new Renderless( lastIndex, rawValue.Substring(lastIndex, mainSearchMatch.Index - lastIndex), contentArguments ) ); lastIndex = mainSearchMatch.Index; } // Exam For Bracketed Regex Result bracketOpenExamMatch = RegularExpression.Current.BracketedControllerOpenPattern.Match(mainSearchMatch.Value); if (bracketOpenExamMatch.Success) { directiveType = bracketOpenExamMatch.Result("${DirectiveType}"); directiveID = bracketOpenExamMatch.Result("${ItemID}"); if (directiveID != null) { int innerMatch = 0; List <int> separatorIndexes = new List <int>(); while (remEnum.MoveNext()) { Match mainSearchMatchExam = (Match)remEnum.Current; // Exam For Opening Bracketed Regex Result bracketOpenExamMatch = RegularExpression.Current.BracketedControllerOpenPattern.Match(mainSearchMatchExam.Value); // Check is Another Same Named Control Internally Opened Bracket if (bracketOpenExamMatch.Success && string.Compare(directiveID, bracketOpenExamMatch.Result("${ItemID}")) == 0) { innerMatch += 1; continue; } // Exam For Separator Bracketed Regex Result bracketSeparatorExamMatch = RegularExpression.Current.BracketedControllerSeparatorPattern.Match(mainSearchMatchExam.Value); // Check is Same Named Highlevel Control Separator Bracket if (bracketSeparatorExamMatch.Success && string.Compare(directiveID, bracketSeparatorExamMatch.Result("${ItemID}")) == 0 && innerMatch == 0) { // Point the location of Separator Bracket index separatorIndexes.Add(mainSearchMatchExam.Index - mainSearchMatch.Index); continue; } // Exam For Closing Bracketed Regex Result bracketCloseExamMatch = RegularExpression.Current.BracketedControllerClosePattern.Match(mainSearchMatchExam.Value); // Check is Same Named Control Internally Closed Bracket if (bracketCloseExamMatch.Success && string.Compare(directiveID, bracketCloseExamMatch.Result("${ItemID}")) == 0) { if (innerMatch > 0) { innerMatch -= 1; continue; } string modifierText = string.Format("~{0}", mainSearchMatch.Index); string pointedOriginalValue = rawValue.Substring(mainSearchMatch.Index, (mainSearchMatchExam.Index + mainSearchMatchExam.Length) - mainSearchMatch.Index); pointedOriginalValue = pointedOriginalValue.Insert(pointedOriginalValue.Length - 1, modifierText); for (int idxID = separatorIndexes.Count - 1; idxID >= 0; idxID += -1) { pointedOriginalValue = pointedOriginalValue.Insert((separatorIndexes[idxID] + string.Format("}}:{0}", directiveID).Length), modifierText); } pointedOriginalValue = pointedOriginalValue.Insert(mainSearchMatch.Length - 2, modifierText); IController workingDirective = null; string directiveRawValue = string.Format("${0}:", (string.IsNullOrEmpty(directiveType) ? directiveID : directiveType)); switch (DirectiveHelper.CaptureDirectiveType(directiveRawValue)) { case DirectiveTypes.Control: workingDirective = ControlHelper.MakeControl(mainSearchMatch.Index, pointedOriginalValue, null, this.OnControlResolveRequest); break; case DirectiveTypes.InLineStatement: workingDirective = new InLineStatement(mainSearchMatch.Index, pointedOriginalValue, null); break; case DirectiveTypes.UpdateBlock: workingDirective = new UpdateBlock(mainSearchMatch.Index, pointedOriginalValue, null); break; case DirectiveTypes.EncodedExecution: workingDirective = new EncodedExecution(mainSearchMatch.Index, pointedOriginalValue, null); break; case DirectiveTypes.MessageBlock: workingDirective = new MessageBlock(mainSearchMatch.Index, pointedOriginalValue, null); break; case DirectiveTypes.PartialCache: workingDirective = new PartialCache(mainSearchMatch.Index, pointedOriginalValue, null); break; } if (workingDirective != null) { if (workingDirective is IDeploymentAccessRequires) { ((IDeploymentAccessRequires)workingDirective).DeploymentAccessRequested += this.OnDeploymentAccessRequest; } if (workingDirective is IInstanceRequires) { ((IInstanceRequires)workingDirective).InstanceRequested += this.OnInstanceRequest; } childrenContainer.Add(workingDirective); } lastIndex = (mainSearchMatchExam.Index + mainSearchMatchExam.Length); break; } } } } else { switch (ControllerHelper.CaptureControllerType(mainSearchMatch.Value)) { case ControllerTypes.Property: Property propertyDirective = new Property(mainSearchMatch.Index, mainSearchMatch.Value, contentArguments); propertyDirective.InstanceRequested += this.OnInstanceRequest; childrenContainer.Add(propertyDirective); break; case ControllerTypes.Directive: IController workingDirective = null; switch (DirectiveHelper.CaptureDirectiveType(mainSearchMatch.Value)) { case DirectiveTypes.Control: workingDirective = ControlHelper.MakeControl(mainSearchMatch.Index, mainSearchMatch.Value, null, this.OnControlResolveRequest); break; case DirectiveTypes.Template: workingDirective = new Template(mainSearchMatch.Index, mainSearchMatch.Value, null); break; case DirectiveTypes.Translation: workingDirective = new Translation(mainSearchMatch.Index, mainSearchMatch.Value, null); break; case DirectiveTypes.HashCodePointedTemplate: workingDirective = new HashCodePointedTemplate(mainSearchMatch.Index, mainSearchMatch.Value, null); break; case DirectiveTypes.Execution: workingDirective = new Execution(mainSearchMatch.Index, mainSearchMatch.Value, null); break; case DirectiveTypes.InLineStatement: workingDirective = new InLineStatement(mainSearchMatch.Index, mainSearchMatch.Value, null); break; case DirectiveTypes.UpdateBlock: workingDirective = new UpdateBlock(mainSearchMatch.Index, mainSearchMatch.Value, null); break; case DirectiveTypes.EncodedExecution: workingDirective = new EncodedExecution(mainSearchMatch.Index, mainSearchMatch.Value, null); break; case DirectiveTypes.PartialCache: workingDirective = new PartialCache(mainSearchMatch.Index, mainSearchMatch.Value, null); break; } if (workingDirective != null) { if (workingDirective is IDeploymentAccessRequires) { ((IDeploymentAccessRequires)workingDirective).DeploymentAccessRequested += this.OnDeploymentAccessRequest; } if (workingDirective is IInstanceRequires) { ((IInstanceRequires)workingDirective).InstanceRequested += this.OnInstanceRequest; } childrenContainer.Add(workingDirective); } break; } lastIndex = (mainSearchMatch.Index + mainSearchMatch.Value.Length); } } if (rawValue.Length - lastIndex > 1) { childrenContainer.Add( new Renderless(lastIndex, rawValue.Substring(lastIndex), contentArguments)); } } }
public PermissionBlock(string rawValue, ArgumentCollection arguments) : base(DirectiveTypes.PermissionBlock, arguments) { this.DirectiveId = DirectiveHelper.CaptureDirectiveId(rawValue); this._Contents = new ContentDescription(rawValue); }
public void Parse() { if (this._Settings.Bind == null) { throw new System.ArgumentNullException(nameof(this._Settings.Bind)); } this._Settings.Bind.Parameters.Prepare( parameter => { string query = parameter.Query; int paramIndex = DirectiveHelper.CaptureParameterPointer(query); if (paramIndex < 0) { return(Property.Render(this._Parent, query).Item2); } if (paramIndex >= this._Parameters.Length) { throw new Exceptions.FormatIndexOutOfRangeException("ConditionalStatement"); } return(Property.Render(this._Parent, this._Parameters[paramIndex]).Item2); } ); Basics.Execution.InvokeResult <Basics.ControlResult.Conditional> invokeResult = Manager.Executer.InvokeBind <Basics.ControlResult.Conditional>(Basics.Helpers.Context.Request.Header.Method, this._Settings.Bind, Manager.ExecuterTypes.Control); if (invokeResult.Exception != null) { throw new Exceptions.ExecutionException(invokeResult.Exception); } // ---- if (invokeResult.Result == null) { return; } switch (invokeResult.Result.Result) { case Basics.ControlResult.Conditional.Conditions.True: if (string.IsNullOrEmpty(this._Contents.Parts[0])) { break; } this._Parent.Mother.RequestParsing( this._Contents.Parts[0], this._Parent.Children, this._Parent.Arguments); break; case Basics.ControlResult.Conditional.Conditions.False: if (this._Contents.Parts.Count < 2) { break; } if (string.IsNullOrEmpty(this._Contents.Parts[1])) { break; } this._Parent.Mother.RequestParsing( this._Contents.Parts[1], this._Parent.Children, this._Parent.Arguments); break; case Basics.ControlResult.Conditional.Conditions.Unknown: // Reserved For Future Uses return; } }
public ReplaceableTranslation(string rawValue, ArgumentCollection arguments) : base(DirectiveTypes.ReplaceableTranslation, arguments) { this.DirectiveId = DirectiveHelper.CaptureDirectiveId(rawValue); this._Contents = new ContentDescription(rawValue); }
public void Load() { this.Mother.RequestInstance(out IDomain instance); this.Mother.RequestControlResolve(this.DirectiveId, ref instance, out IBase control); switch (control.Type) { case ControlTypes.Unknown: this._Control = new Unknown(this); break; case ControlTypes.ConditionalStatement: this._Control = new ConditionalStatement( this, new ContentDescription(this._RawValue), DirectiveHelper.CaptureDirectiveParameters(this._RawValue, false), (Application.Controls.ConditionalStatement)control ); break; case ControlTypes.DataList: this._Control = new DataList( this, new ContentDescription(this._RawValue), DirectiveHelper.CaptureDirectiveParameters(this._RawValue, false), (Application.Controls.DataList)control, this.CacheHandler ); break; case ControlTypes.VariableBlock: this._Control = new VariableBlock( this, new ContentDescription(this._RawValue), DirectiveHelper.CaptureDirectiveParameters(this._RawValue, false), (Application.Controls.VariableBlock)control ); break; case ControlTypes.Button: this._Control = new Button(this, (Application.Controls.Button)control); break; case ControlTypes.Checkbox: this._Control = new Checkbox(this, (Application.Controls.Checkbox)control); break; case ControlTypes.ImageButton: this._Control = new ImageButton(this, (Application.Controls.ImageButton)control); break; case ControlTypes.LinkButton: this._Control = new LinkButton(this, (Application.Controls.LinkButton)control); break; case ControlTypes.Password: this._Control = new Password(this, (Application.Controls.Password)control); break; case ControlTypes.RadioButton: this._Control = new RadioButton(this, (Application.Controls.RadioButton)control); break; case ControlTypes.Textarea: this._Control = new Textarea(this, (Application.Controls.Textarea)control); break; case ControlTypes.Textbox: this._Control = new Textbox(this, (Application.Controls.Textbox)control); break; } this.Type = control.Type; }
public UpdateBlock(int rawStartIndex, string rawValue, Global.ArgumentInfoCollection contentArguments) : base(rawStartIndex, rawValue, DirectiveTypes.UpdateBlock, contentArguments) { this.ControlID = DirectiveHelper.CaptureControlID(this.Value); }
public void Parse() { if (this._Settings.Bind == null) { throw new ArgumentNullException(nameof(this._Settings.Bind)); } // Execution preparation should be done at the same level with it's parent. Because of that, send parent as parameters this._Settings.Bind.Parameters.Prepare( parameter => { string query = parameter.Query; int paramIndex = DirectiveHelper.CaptureParameterPointer(query); if (paramIndex < 0) { return(Property.Render(this._Parent, query).Item2); } if (paramIndex >= this._Parameters.Length) { throw new Exceptions.FormatIndexOutOfRangeException("DataList"); } return(Property.Render(this._Parent, this._Parameters[paramIndex]).Item2); } ); Basics.Execution.InvokeResult <Basics.ControlResult.IDataSource> invokeResult = Manager.Executer.InvokeBind <Basics.ControlResult.IDataSource>(Helpers.Context.Request.Header.Method, this._Settings.Bind, Manager.ExecuterTypes.Control); if (invokeResult.Exception != null) { throw new Exceptions.ExecutionException(invokeResult.Exception); } this._Parent.Parent.Arguments.AppendKeyWithValue( this._Parent.DirectiveId, new DataListOutputInfo(this._Parent.UniqueId, 0, 0, true) ); if (invokeResult.Result.Message != null) { this.RenderError(invokeResult.Result.Message.Type, invokeResult.Result.Message.Content); return; } if (this._CacheHandler(invokeResult.Result.ResultId)) { return; } this.ResultId = invokeResult.Result.ResultId; switch (invokeResult.Result.Type) { case Basics.ControlResult.DataSourceTypes.DirectDataAccess: this.RenderDirectDataAccess(ref invokeResult); break; case Basics.ControlResult.DataSourceTypes.ObjectFeed: this.RenderObjectFeed(ref invokeResult); break; case Basics.ControlResult.DataSourceTypes.PartialDataTable: this.RenderPartialDataTable(ref invokeResult); break; } }