/// <summary> /// Send HTTP POST request to the server and get the response. /// </summary> /// <param name="commandName">The name of the command to send.</param> /// <param name="commandParameters">The command parameters.</param> /// <param name="requestBody">The plain text request.</param> /// <returns>The plain text response.</returns> public SendStringResponse HTTPPOST(CommandName commandName, IDictionary<CmdParameterName, object> commandParameters, string requestBody) { SendStringResponse postResponse = this.activeSyncClient.SendStringRequest(commandName, commandParameters, requestBody); Site.Assert.IsNotNull(postResponse, "The HTTP POST response returned from server should not be null."); this.VerifyHTTPPOSTResponse(postResponse); this.VerifyTransportType(); return postResponse; }
public static string ArduinoCommand(CommandName commandName, List<string> commandParameters) { StringBuilder parameters = new StringBuilder(); foreach (string parameter in commandParameters) { parameters.Append(" " + parameter); } return ((int)commandName).ToString() + parameters.ToString() + "\r"; }
/// <summary> /// Creates an <see cref="ICommand"/> according to the specified <see cref="CommandName"/>. /// </summary> /// <param name="commandName">One of the values of <see cref="CommandName"/>.</param> /// <param name="communicationProxy">The communication proxy as an instance of <see cref="IDokuWikiProvider"/>.</param> /// <param name="wikiClient">The "local" wiki client which has access to the persited data.</param> /// <returns> /// The created instance to the given named command. /// </returns> /// <exception cref="ArgumentNullException">Is thrown when <paramref name="communicationProxy"/> is a <see langword="null"/> reference.</exception> /// <exception cref="ArgumentNullException"> Is thrown when /// <para><paramref name="communicationProxy"/> is a <see langword="null"/> reference</para> /// <para>- or -</para> /// <para><paramref name="wikiClient"/> is a <see langword="null"/> reference.</para> /// </exception> /// <exception cref="ArgumentException">Is thrown when <paramref name="commandName"/> is not defined in <see cref="CommandName"/>.</exception> public static ICommand CreateCommand(CommandName commandName, IDokuWikiProvider communicationProxy, IDokuWikiClient wikiClient) { if (communicationProxy == null) { throw new ArgumentNullException("communicationProxy"); } if (wikiClient == null) { throw new ArgumentNullException("wikiClient"); } if (!Enum.IsDefined(typeof(CommandName), commandName)) { throw new ArgumentException("Unkown command name", "commandName"); } switch (commandName) { case CommandName.GetWikiPage: return new GetWikiPageCommand(communicationProxy); case CommandName.GetAllPages: return new GetAllPageItemsCommand(communicationProxy); case CommandName.GetWikiPageAsHtml: return new GetWikiPageAsHtmlCommand(communicationProxy); case CommandName.LoadMethodHelp: return new LoadMethodHelpCommand(communicationProxy); case CommandName.LoadMethodSignatures: return new LoadMethodSignaturesCommand(communicationProxy); case CommandName.ListStoredWikiAccounts: return new ListStoredWikiAccountsCommand(wikiClient, communicationProxy); case CommandName.ListServerMethods: return new ListServerMethodsCommand(communicationProxy); case CommandName.ExitApplication: default: throw new NotImplementedException("No command available for this command name."); } }
internal void Init(CommandName cmd) { Bytes = new byte[Commands.ExpectedByteCount[cmd]]; }
byte[] FormCommandElectricBarred(CommandName bCommand, byte[] option) { CommandName CurCommand = (CommandName)bCommand; int iSize = 0; byte[] bufComand = new byte[100]; switch (CurCommand) { default: if (CurCommand != CommandName.GetStatus) { } foreach (byte i in option) { bufComand[iSize++] = i;// option[i]; } break; } byte[] tmpBuf = new byte[iSize]; for (int i = 0; i < tmpBuf.Length; i++) { tmpBuf[i] = bufComand[i]; } return tmpBuf; }
private void AndlizeElectricBarredCommand(CommandName CurCommand, byte* bBuf) { switch (CurCommand) { // case CommandName.CurrentStim: case CommandName.GetStatus: //Status break; case CommandName.ComSetting: break; } }
public void TaskCommand( CommandName Cn, char[] bufOpt, EventHandler evHadler = null) { byte[] BufCom = new byte[bufOpt.Length]; for (int i = 0; i < bufOpt.Length; i++) BufCom[i] = (byte)bufOpt[i]; CommandArr.Add( new CommandExch() { _com_name = Cn, _bufCom = BufCom, evHand = evHadler }); }
public void TaskCommand( CommandName Cn, byte[] bufOpt = null, EventHandler evHand = null) { CommandArr.Add( new CommandExch() { _com_name = Cn, _bufCom = bufOpt, evHand = evHand }); }
public void TaskCommand(CommandName Cn) { CommandArr.Add( new CommandExch() { _com_name = Cn, _bufCom = null, evHand = null }); }
public ICommand Resolve(CommandName commandName) { return _resolver.Resolve(commandName); }
/// <summary> /// Verify WBXML Capture for WBXML process. /// </summary> /// <param name="cmdName">Current MS-ASCMD command name.</param> /// <param name="response">MS-ASCMD response.</param> private void VerifyWBXMLCapture(CommandName cmdName, object response) { #region Get the WbxmlTracer Instance for WBXML data. this.msaswbxmlImplementation = this.activeSyncClient.GetMSASWBXMLImplementationInstance(); if (cmdName == CommandName.GetAttachment) { // Ignore the GetAttachment command as it does not have any WBXML process. return; } #endregion #region Capture global WBXML tokens related requirements // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R801"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 801, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 0 [for Token name] SWITCH_PAGE, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R802"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 802, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 1 [for Token name] END, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R803"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 803, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 2 [for Token name] ENTITY, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R804"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 804, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 3 [for Token name] STR_I, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R805"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 805, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 4 [for Token name] LITERAL, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R806"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 806, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 40 [for Token name] EXT_I_0, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R807"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 807, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 41 [for Token name] EXT_I_1, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R808"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 808, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 42 [for Token name] EXT_I_2, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R809"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 809, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 43 [for Token name] PI, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R810"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 810, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 44 [for Token name] LITERAL_C, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R811"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 811, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 80 [for Token name] EXT_T_0, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R812"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 812, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 81 [for Token name] EXT_T_1, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R813"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 813, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 82 [for Token name] EXT_T_2, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R814"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 814, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 83 [for Token name] STR_T, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R815"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 815, @"[In Standards Assignments] [This algorithm uses the global WBXML token] 84 [for Token name] LITERAL_A, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R816"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 816, @"[In Standards Assignments] [This algorithm uses the global WBXML token] C0 [for Token name] EXT_0, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R817"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 817, @"[In Standards Assignments] [This algorithm uses the global WBXML token] C1 [for Token name] EXT_1, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R818"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 818, @"[In Standards Assignments] [This algorithm uses the global WBXML token] C2 [for Token name] EXT_2, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R819"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 819, @"[In Standards Assignments] [This algorithm uses the global WBXML token] C3 [for Token name] OPAQUE, Reference [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R820"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 820, @"[In Standards Assignments] [This algorithm uses the global WBXML token] C4 [for Token name] LITERAL_AC, Reference [WBXML1.2]."); #endregion #region Capture Code Pages related requirements AdapterHelper adapterHelper = new AdapterHelper(); byte statusOfResponses = adapterHelper.GetStatusFromResponses(response); // Status 102 means the WBXML decode/encode error on Server if (statusOfResponses != 102) { // Get decode data and capture requirement for decode processing Dictionary<string, int> decodeData = this.msaswbxmlImplementation.DecodeDataCollection; foreach (KeyValuePair<string, int> decodeDataItem in decodeData) { byte token; string tagName = Common.GetTagName(decodeDataItem.Key, out token); string codePageName = Common.GetCodePageName(decodeDataItem.Key); int currentCodepage = decodeDataItem.Value; bool isValidCodePage = currentCodepage >= 0 && currentCodepage <= 24; Site.Assert.IsTrue(isValidCodePage, "Code page value should between 0-24,actual value is :{0}", currentCodepage); // begin to capture requirement this.CaptureCodePageRequirement(currentCodepage, codePageName, tagName, token); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R1"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 1, @"[In ActiveSync WBXML Algorithm Details] ActiveSync messages are transported as HTTP POST messages, as specified in [MS-ASHTTP], where the body of the message contains WBXML formatted data."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R6"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 6, @"[In Initialization] The XML tags in both request and response messages are encoded by using WBXML tokenization, as specified in [WBXML1.2]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R8"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 8, @"[In Initialization] WBXML parsers MUST use the WBXML code pages specified in the following sections [2.1.2.1 Code Pages]."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R655"); // ActiveSyncClient will encode and decode the response by using WBXML, so if response is successfully returned this requirement can be covered. Site.CaptureRequirement( "MS-ASWBXML", 655, @"[In Processing Rules] This algorithm uses the following features that are specified in [WBXML1.2]: WBXML tokens to encode XML tags WBXML code pages to support multiple XML namespaces Inline strings Opaque data"); } } string protocolVersion = Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site); if (string.Compare(protocolVersion, "14.0") == 0 || string.Compare(protocolVersion, "14.1") == 0 || string.Compare(protocolVersion, "16.0") == 0) { if (this.isClassTagInPage0Exist) { // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASWBXML_R825"); // Verify MS-ASWBXML requirement: MS-ASWBXML_R825 Site.CaptureRequirementIfIsTrue( this.isClassTagInPage6Exist == false, "MS-ASWBXML", 825, @"[In Code Page 6: GetItemEstimate] Note 1: The Class tag in WBXML code page 0 (AirSync) is used instead of the Class tag in WBXML code page 6 with protocol versions 14.0, 14.1, and 16.0."); } } #endregion }
public ConsoleCommand(CommandName name) : base(name) { }
public void ExecuteCommand(CommandName commandName, int repeat) { if (repeat == 0) { switch (commandName) { case CommandName.Nop: break; case CommandName.ToggleMenu: break; case CommandName.Ok: break; case CommandName.Cancel: if (Settings.StartVideoMode == VideoMode.Fullscreen) ExecuteCommand(CommandName.VideoModeNormal); break; case CommandName.Left: break; case CommandName.Right: break; case CommandName.Up: break; case CommandName.Down: break; case CommandName.Key0: BuildChannelNumber(0); break; case CommandName.Key1: BuildChannelNumber(1); break; case CommandName.Key2: BuildChannelNumber(2); break; case CommandName.Key3: BuildChannelNumber(3); break; case CommandName.Key4: BuildChannelNumber(4); break; case CommandName.Key5: BuildChannelNumber(5); break; case CommandName.Key6: BuildChannelNumber(6); break; case CommandName.Key7: BuildChannelNumber(7); break; case CommandName.Key8: BuildChannelNumber(8); break; case CommandName.Key9: BuildChannelNumber(9); break; case CommandName.VolumePlus: this.panelMediaTuning.trackBarVolume.Value = Math.Min(this.panelMediaTuning.trackBarVolume.Value + 250, 0); break; case CommandName.VolumeMinus: this.panelMediaTuning.trackBarVolume.Value = Math.Max(this.panelMediaTuning.trackBarVolume.Value - 250, -10000); break; case CommandName.ChannelNextInFolder: { GraphBuilderTV currentGraph = this.currentGraphBuilder as GraphBuilderTV; if (currentGraph != null) { Channel channel = currentGraph.CurrentChannel; if (channel != null) { ChannelFolder parentChannel = channel.Parent; int pos = parentChannel.ChannelList.IndexOf(channel); if (pos >= 0 && pos < parentChannel.ChannelList.Count - 1) { Channel newChannel = parentChannel.ChannelList[pos + 1]; if (newChannel is ChannelTV) TuneChannelGUI(newChannel); } } } } break; case CommandName.ChannelPreviousInFolder: { GraphBuilderTV currentGraph = this.currentGraphBuilder as GraphBuilderTV; if (currentGraph != null) { Channel channel = currentGraph.CurrentChannel; if (channel != null) { ChannelFolder parentChannel = channel.Parent; int pos = parentChannel.ChannelList.IndexOf(channel); if (pos > 0) { Channel newChannel = parentChannel.ChannelList[pos - 1]; if (newChannel is ChannelTV) TuneChannelGUI(newChannel); } } } } break; case CommandName.ChannelNext: { short currentNumber = (short)-1; bool channelFound = false; GraphBuilderTV currentGraph = this.currentGraphBuilder as GraphBuilderTV; if (currentGraph != null) { ChannelTV channel = currentGraph.CurrentChannel as ChannelTV; if (channel != null && channel.ChannelNumber >= 0) { currentNumber = channel.ChannelNumber; channelFound = true; } } if (!channelFound) { if (panelChannel.treeViewChannel.SelectedNode != null) { ChannelTV channel = panelChannel.treeViewChannel.SelectedNode.Tag as ChannelTV; if (channel != null && channel.ChannelNumber >= 0) { currentNumber = channel.ChannelNumber; channelFound = true; } } } ChannelTV newChannel = null; while ((newChannel = this.channelByChannelNumber[++currentNumber] as ChannelTV) == null && currentNumber <= channelNumberMax) ; if (newChannel is ChannelTV) TuneChannelGUI(newChannel); } break; case CommandName.ChannelPrevious: { short currentNumber = (short)(channelNumberMax + 1); bool channelFound = false; GraphBuilderTV currentGraph = this.currentGraphBuilder as GraphBuilderTV; if (currentGraph != null) { ChannelTV channel = currentGraph.CurrentChannel as ChannelTV; if (channel != null && channel.ChannelNumber >= 0) { currentNumber = channel.ChannelNumber; channelFound = true; } } if (!channelFound) { if (panelChannel.treeViewChannel.SelectedNode != null) { ChannelTV channel = panelChannel.treeViewChannel.SelectedNode.Tag as ChannelTV; if (channel != null && channel.ChannelNumber >= 0) { currentNumber = channel.ChannelNumber; channelFound = true; } } } ChannelTV newChannel = null; while ((newChannel = this.channelByChannelNumber[--currentNumber] as ChannelTV) == null && currentNumber >= 0); if (newChannel is ChannelTV) TuneChannelGUI(newChannel); } break; case CommandName.MediaPlay: if (this.currentGraphBuilder is ITimeShifting) (this.currentGraphBuilder as ITimeShifting).Resume(); else if (this.currentGraphBuilder is IPlayer) (this.currentGraphBuilder as IPlayer).Play(); break; case CommandName.MediaPause: if (this.currentGraphBuilder is IBDA) { if (!(this.currentGraphBuilder is ITimeShifting) && !Settings.TimeShiftingActivated) { Settings.TimeShiftingActivated = true; //this.graphBuilderType = GraphBuilderType.BDATimeShifting; //this.toolStripButtonTimeShifting.Checked = true; //ChannelDVB currentChannelDVB = (this.currentGraphBuilder as ITV).CurrentChannel as ChannelDVB; //if (currentChannelDVB != null) // TuneChannelGUI(currentChannelDVB, true); } if (this.currentGraphBuilder is ITimeShifting) { if ((this.currentGraphBuilder as ITimeShifting).Status == TimeShiftingStatus.Recording) (this.currentGraphBuilder as ITimeShifting).Pause(); else if ((this.currentGraphBuilder as ITimeShifting).Status == TimeShiftingStatus.Paused) (this.currentGraphBuilder as ITimeShifting).Resume(); } } else if (this.currentGraphBuilder is IPlayer) (this.currentGraphBuilder as IPlayer).Pause(); break; case CommandName.MediaStop: if (this.currentGraphBuilder is IRecorder) { IRecorder recorder = this.currentGraphBuilder as IRecorder; if (recorder.Status == RecorderStatus.Recording) { recorder.Stop(); break; } } else if (this.currentGraphBuilder is ITimeShifting && Settings.TimeShiftingActivated) { Settings.TimeShiftingActivated = false; //this.graphBuilderType = GraphBuilderType.BDA; //this.toolStripButtonTimeShifting.Checked = false; //ChannelDVB currentChannelDVB = (this.currentGraphBuilder as ITV).CurrentChannel as ChannelDVB; //if (currentChannelDVB != null) // TuneChannelGUI(currentChannelDVB, true); } else //if (this.currentGraphBuilder is IPlayer) //(this.currentGraphBuilder as IPlayer).Stop(); ClearGraph(); break; case CommandName.MediaRecord: if (this.currentGraphBuilder is IBDA) { if (!(this.currentGraphBuilder is IRecorder) && !Settings.TimeShiftingActivated) { Settings.TimeShiftingActivated = true; //this.graphBuilderType = GraphBuilderType.BDATimeShifting; //this.toolStripButtonTimeShifting.Checked = true; //ChannelDVB currentChannelDVB = (this.currentGraphBuilder as ITV).CurrentChannel as ChannelDVB; //if (currentChannelDVB != null) // TuneChannelGUI(currentChannelDVB, true); } if (this.currentGraphBuilder is IRecorder) { IRecorder recorder = this.currentGraphBuilder as IRecorder; if (recorder.Status == RecorderStatus.Stopped) { string filename = DateTime.Now.ToString(Properties.Resources.VideoRecorderTimeFormat); if (this.currentGraphBuilder is ITV) { ITV tv = this.currentGraphBuilder as ITV; if (tv.CurrentChannel != null) filename += " " + tv.CurrentChannel.Name; } if (!Directory.Exists(Settings.VideosFolder)) Directory.CreateDirectory(Settings.VideosFolder); filename += ".dvr-ms"; recorder.Start(Settings.VideosFolder + "\\" + filename); toolStripStatusLabelVideoStatus.Text = string.Format(Properties.Resources.RecordingInFile, filename); } else if (recorder.Status == RecorderStatus.Recording) { recorder.Stop(); } } } break; case CommandName.MediaRewind: break; case CommandName.MediaFastForward: break; case CommandName.VideoReset: case CommandName.VideoZoomHalf: case CommandName.VideoZoomNormal: case CommandName.VideoZoomDouble: case CommandName.VideoZoomFreeMode: case CommandName.VideoZoomFromInside: case CommandName.VideoZoomFromOutside: case CommandName.VideoZoomStretchToWindow: case CommandName.VideoZoomIncrease: case CommandName.VideoZoomDecrease: case CommandName.VideoResetAspectRatio: case CommandName.VideoIncreaseAspectRatio: case CommandName.VideoDecreaseAspectRatio: case CommandName.VideoCenter: case CommandName.VideoMoveLeft: case CommandName.VideoMoveRight: case CommandName.VideoMoveUp: case CommandName.VideoMoveDown: if (this.currentGraphBuilder != null) { int x = 0, y = 0; int dx = 0, dy = 0; PointF videoOffset = this.currentGraphBuilder.VideoOffset; double videoZoom = this.currentGraphBuilder.VideoZoom; double videoAspectRatioFactor = this.currentGraphBuilder.VideoAspectRatioFactor; switch (commandName) { case CommandName.VideoReset: videoOffset = new PointF(0.5f, 0.5f); videoZoom = 1.0; videoAspectRatioFactor = 1.0; break; case CommandName.VideoZoomHalf: this.currentGraphBuilder.VideoZoomMode = VideoSizeMode.Free; videoZoom = 0.5; break; case CommandName.VideoZoomNormal: this.currentGraphBuilder.VideoZoomMode = VideoSizeMode.Free; videoZoom = 1.0; break; case CommandName.VideoZoomDouble: this.currentGraphBuilder.VideoZoomMode = VideoSizeMode.Free; videoZoom = 2.0; break; case CommandName.VideoZoomFreeMode: this.currentGraphBuilder.VideoZoomMode = VideoSizeMode.Free; break; case CommandName.VideoZoomFromInside: this.currentGraphBuilder.VideoZoomMode = VideoSizeMode.FromInside; videoOffset = new PointF(0.5f, 0.5f); videoZoom = 1.0; break; case CommandName.VideoZoomFromOutside: this.currentGraphBuilder.VideoZoomMode = VideoSizeMode.FromOutside; videoOffset = new PointF(0.5f, 0.5f); videoZoom = 1.0; break; case CommandName.VideoZoomStretchToWindow: this.currentGraphBuilder.VideoZoomMode = VideoSizeMode.StretchToWindow; break; case CommandName.VideoZoomIncrease: x = 1; break; case CommandName.VideoZoomDecrease: x = -1; break; case CommandName.VideoResetAspectRatio: videoAspectRatioFactor = 1.0; break; case CommandName.VideoIncreaseAspectRatio: y = 1; break; case CommandName.VideoDecreaseAspectRatio: y = -1; break; case CommandName.VideoCenter: videoOffset = new PointF(0.5f, 0.5f); break; case CommandName.VideoMoveLeft: dx = -1; break; case CommandName.VideoMoveRight: dx = 1; break; case CommandName.VideoMoveUp: dy = -1; break; case CommandName.VideoMoveDown: dy = 1; break; default: break; } if (x > 0 && videoZoom < 3f) videoZoom *= 1.02f; if (x < 0 && videoZoom > 0.2f) videoZoom /= 1.02f; if (y > 0 && videoAspectRatioFactor < 3f) videoAspectRatioFactor *= 1.02f; if (y < 0 && videoAspectRatioFactor > 0.2f) videoAspectRatioFactor /= 1.02f; if (dx < 0 && videoOffset.X > 0f) videoOffset.X = (float)Math.Max((double)videoOffset.X - 0.005 * videoZoom, 0.0); if (dx > 0 && videoOffset.X < 1f) videoOffset.X = (float)Math.Min((double)videoOffset.X + 0.005 * videoZoom, 1.0); if (dy < 0 && videoOffset.Y > 0f) videoOffset.Y = (float)Math.Max((double)videoOffset.Y - 0.005 * videoZoom, 0.0); if (dy > 0 && videoOffset.Y < 1f) videoOffset.Y = (float)Math.Min((double)videoOffset.Y + 0.005 * videoZoom, 1.0); this.currentGraphBuilder.VideoOffset = videoOffset; this.currentGraphBuilder.VideoZoom = videoZoom; this.currentGraphBuilder.VideoAspectRatioFactor = videoAspectRatioFactor; this.currentGraphBuilder.VideoRefresh(); } break; case CommandName.VideoModeNormal: ChangeVideoMode(VideoMode.Normal); break; case CommandName.VideoModeTV: ChangeVideoMode(VideoMode.TV); break; case CommandName.VideoModeFullscreen: ChangeVideoMode(VideoMode.Fullscreen); break; case CommandName.SnapShot: IVMRWindowlessControl9 vmrWindowlessControl9 = null; if (this.currentGraphBuilder != null) vmrWindowlessControl9 = this.currentGraphBuilder.VideoRenderer as IVMRWindowlessControl9; if (vmrWindowlessControl9 != null) { IntPtr lpDib; int hr = vmrWindowlessControl9.GetCurrentImage(out lpDib); if (hr >= 0) { try { BitmapInfoHeader bih = new BitmapInfoHeader(); Marshal.PtrToStructure(lpDib, bih); Bitmap bitmap = new Bitmap(bih.Width, bih.Height, PixelFormat.Format32bppRgb); Rectangle rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height); BitmapData bmpData = bitmap.LockBits(rect, ImageLockMode.WriteOnly, bitmap.PixelFormat); int sourceBitsSize = bih.ImageSize; byte[] rgbValues = new byte[sourceBitsSize]; int ptrIntBits = (int)lpDib + bih.Size; IntPtr ptrBits = (IntPtr)ptrIntBits; Marshal.Copy(ptrBits, rgbValues, 0, sourceBitsSize); Marshal.Copy(rgbValues, 0, bmpData.Scan0, sourceBitsSize); //unsafe //{ // int* sourceBits = (int*)lpDib.ToPointer(); // int* destinationBits = (int*)bmpData.Scan0.ToPointer(); // sourceBits += Marshal.SizeOf(typeof(BitmapInfoHeader)) / 4; // for (int i = 0; i < bih.ImageSize; i += 4) // *destinationBits++ = *sourceBits++; //} bitmap.UnlockBits(bmpData); // If the image is upsidedown bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY); if (!Directory.Exists(Settings.SnapshotsFolder)) Directory.CreateDirectory(Settings.SnapshotsFolder); string path = Settings.SnapshotsFolder + '\\'; string filename = DateTime.Now.ToString(Properties.Resources.SnapShotTimeFormat); if (this.currentGraphBuilder is ITV) filename += " " + MakeCorrectFilename((this.currentGraphBuilder as ITV).CurrentChannel.Name); filename += ".png"; try { bitmap.Save(path + filename, ImageFormat.Png); toolStripStatusLabelVideoStatus.Text = string.Format(Properties.Resources.SnapshotSaved, filename); } catch(Exception) { MessageBox.Show(string.Format(Properties.Resources.SnapshotNotSaved, path + filename)); } } finally { Marshal.FreeCoTaskMem(lpDib); } } } break; } } }
public static IAppMessage PatternNotFound(CommandName name) => error("The pattern for the the @CommandName command could not be found", new { CommandName = name });
MCACommand(CommandName command, byte param1, byte param2) { Bytes = new byte[] { 0xA5, 0x5A, (byte)(((ushort)command >> 8) & 0xff), (byte)((ushort)command & 0xff), param1, 0x00, param2, 0x00, 0x00, 0x00, 0xB9, 0x9B }; }
public static IAppMessage StartingOrchestration(CommandName CommandName) => inform("Starting @CommandName command orchestration", new { CommandName });
public static string GetRemoteConfiguration(CommandName app) { switch (app) { case CommandName.PythonInstall: return Path.Combine(HDPDir, HdpInstallFiles, Path.GetFileName(Python)); case CommandName.VisualC_Install: return Path.Combine(HDPDir, HdpInstallFiles, Path.GetFileName(VisualC)); case CommandName.DotNetFrameworkInstal: return Path.Combine(HDPDir, HdpInstallFiles, Path.GetFileName(DotNetFramework)); case CommandName.JavaInstall: return Path.Combine(HDPDir, HdpInstallFiles, Path.GetFileName(Java)); case CommandName.HDP_Install: return Path.Combine(HDPDir, HdpInstallFiles, Path.GetFileName(HDP)); case CommandName.Powershell3: return Path.Combine(HDPDir, HdpInstallFiles, Path.GetFileName(Powershell3)); default: return "Unknown application installation!!"; } }
public int SendCommand(CommandName bCommand, byte[] option) { byte[] BufCommand; FormComand(bCommand, option, out BufCommand); if (UseFtdiChip.SendBuf(BufCommand) != 0) return 1; return 0; }
/// <summary> /// Send a string request and get a response from server. /// </summary> /// <param name="stringRequest">A string request for a certain command.</param> /// <param name="commandName">Commands choices.</param> /// <returns>A string response returned from the server.</returns> public SendStringResponse SendStringRequest(string stringRequest, CommandName commandName) { SendStringResponse response = this.activeSyncClient.SendStringRequest(commandName, null, stringRequest); Site.Assert.IsNotNull(response, "The string response should be returned."); return response; }
public void TaskCommand(CommandName Cn, EventHandler evHand = null) { CommandArr.Add( new CommandExch() { _com_name = Cn, evHand = evHand }); }
public Command(CommandName name, string body) : this() { Name = name; Body = body; }
public void TaskCommand( CommandName Cn, byte[][] BufOpt = null, EventHandler evHadler = null) { byte[] bufOpt = null; if (BufOpt != null) { int sizeData = 0; for (int i = 0; i < BufOpt.Length; i++) sizeData += BufOpt[i].Length; bufOpt = new byte[sizeData]; int Index = 0; for (int i = 0; i < BufOpt.Length; i++) for (int j = 0; j < BufOpt[i].Length; j++) bufOpt[Index++] = BufOpt[i][j]; } CommandArr.Add( new CommandExch { _com_name = Cn, _bufCom = bufOpt, evHand = evHadler }); }
public bool Is(CommandName command) { return Name == command; }
private void AnalizeRotCommand(CommandName CurCommand, byte[] bBuf) { int index = 0; switch (CurCommand) { case CommandName.GetStatus: { byte MainWrk = bBuf[index++]; if (_devStatus == null) _devStatus = new DevStatus(); _devStatus.MainWrk = MainWrk; if(bBuf.Length<=index) break; bool FlagWrk = ((bBuf[index++] != 0) ? true : false); DevStatus _curStatus = new DevStatus(); _curStatus.MainWrk = MainWrk; _curStatus.FlagWrk = FlagWrk; try { UInt32 iButton = bBuf[index++]; iButton <<= 8; iButton |= bBuf[index++]; iButton <<= 8; iButton |= bBuf[index++]; iButton <<= 8; iButton |= bBuf[index++]; for (int i = 0; i < 30; i++) _curStatus.bufRButton[i].IsActive = ((iButton & (1 << i)) != 0) ? true : false; iButton = bBuf[index++]; for (int i = 0; i < 4; i++) _curStatus.bufCButton[i].IsActive = ((iButton & (1 << i)) != 0) ? true : false; _curStatus.LightStatus = new byte[30+8]; for (int i = 0; i < 30;i++) { _curStatus.LightStatus[i] = (byte)(_curStatus.bufRButton[i].IsActive ? 1 : 0); } _curStatus.CancelButton = bBuf[index++]; uint tButton = bBuf[index++]; tButton <<= 8; tButton |= bBuf[index++]; tButton <<= 8; tButton |= bBuf[index++]; tButton <<= 8; tButton |= bBuf[index++]; _curStatus.TmpMaskRoomKey = tButton; _curStatus.TmpMaskConfKey = bBuf[index++]; } catch { } if (eStatus != null) eStatus(_curStatus); AnalizeChangeKey(_curStatus); _devStatus = _curStatus; } break; default: { string str = ""; byte[] bbb = new byte[4]; bbb[0] = bBuf[index++]; bbb[1] = bBuf[index++]; bbb[2] = bBuf[index++]; bbb[3] = bBuf[index++]; for (int i = 0; i < bbb.Length; i++) str += bbb[i].ToString() + " "; Console.WriteLine("Unknown com =" + CurCommand.ToString() + " " + str); } break; } if(lst_WaitCommand.Count!=0) { var x = lst_WaitCommand.Where(p => p._com_name == CurCommand).ToList(); foreach (var commandExch in x) { if (commandExch.evHand != null) commandExch.evHand(null, null); } lst_WaitCommand = lst_WaitCommand.Where(p => p._com_name != CurCommand).ToList(); } }
public Task<Command> PostWaiter(string userId, CommandName cmdName) { lock (_responceWaiters) { var taskSource = new TaskCompletionSource<Command>(); _responceWaiters[new Tuple<string, CommandName>(userId, cmdName)] = taskSource; return taskSource.Task; } }
/// <summary> /// Ф-ция формирования передаваемого буфера /// </summary> /// <param name="Comand">Комманда для формирования</param> /// <param name="option">Входные параметры формирования комманды</param> /// <param name="ObufComand">Выходной буфер сформированной комманды</param> private unsafe void FormComand(CommandName Comand, byte[] option, out byte[] ObufComand) { int SizeBuf = 0; //TODO: выделение массива для комманды необходимого размера в зависимости от типа отправляемой комманды. // можно через промежуточный буфер byte[] bufComand = new byte[300]; bufComand[SizeBuf++] = 0xCB; bufComand[SizeBuf++] = 0x34; int index_crc = SizeBuf++; //CRC bufComand[SizeBuf++] = (byte)Comand; //Eiiiaiaa int index_length = SizeBuf++; //Aeeia aaiiuo bufComand[SizeBuf++] = 0; //?aca?a int index_summ = SizeBuf++; //Eiaaen eiio?ieuiie noiiu SizeBuf++; int index_data = SizeBuf; byte[] BufFormC = null; CommandName CurCommand = (CommandName)Comand; if (DeviceToConnect == TypeDevice.Selector) BufFormC = FormCommandRot(Comand, option); else if (DeviceToConnect == TypeDevice.ElectricBarred) BufFormC = FormCommandElectricBarred(Comand, option); if (BufFormC!=null) { for (int i = 0; i < BufFormC.Length; i++) { bufComand[SizeBuf++] = BufFormC[i]; } } bufComand[index_length++] = (byte)((SizeBuf - index_data) >> 8); //Aeeia aaiiuo} bufComand[index_length++] = (byte)((SizeBuf - index_data) >> 0); int Summ; fixed (byte* CS = &bufComand[index_data]) { Summ = ControlSumm(CS, (SizeBuf - index_data)); } bufComand[index_summ++] = (byte)(Summ >> 8); //Eiio?ieuiay noiia bufComand[index_summ++] = (byte)(Summ >> 0); //Eiio?ieuiay noiia fixed (byte* IC = &bufComand[index_crc + 1]) { bufComand[index_crc] = CalcCRC(IC, 5); //CRC } ObufComand = new byte[SizeBuf]; for (int i = 0; i < SizeBuf; i++) ObufComand[i] = bufComand[i]; }
public ICommand Resolve(CommandName commandName) { return _container.TryGetInstance<ICommand>(commandName.Name); }
/// <summary> /// Поиск устройств доступных для подключения /// </summary> /// <returns> кол-во устройств доступных для подключения </returns> byte[] FormCommandRot(CommandName bCommand, byte[] option) { CommandName CurCommand = (CommandName)bCommand; int iSize = 0; byte[] bufComand = new byte[300]; switch (CurCommand) { case CommandName.GetStatus: default: if (CommandName.GetStatus != CurCommand) { } if(option!=null) foreach (byte i in option) { bufComand[iSize++] = i;// option[i]; } break; } bufComand[iSize++] = 0; bufComand[iSize++] = 0; byte[] tmpBuf = new byte[iSize]; for (int i = 0; i < tmpBuf.Length; i++) { tmpBuf[i] = bufComand[i]; } return tmpBuf; }
public CommandDescriptionGump(Mobile from, CommandName name) : base(125, 125) { from.CloseGump(typeof(CommandDescriptionGump)); AddPage(0); AddBackground(0, 0, 400, 200, 0x2436); AddHtml(10, 10, 390, 20, Color(Center(CommandHelper.m_CommandString[(int)name]), 0x52D017), false, false); AddHtml(10, 30, 390, 145, Color(CommandHelper.m_CommandDescription[(int)name], 0xFFFFFF), false, true); }
MCACommand(CommandName command, ushort param1) { Bytes = new byte[] { 0xA5, 0x5A, (byte)(((ushort)command >> 8) & 0xff), (byte)((ushort)command & 0xff), (byte)(param1 & 0xff), (byte)((param1 >> 8) & 0xff), 0x00, 0x00, 0x00, 0x00, 0xB9, 0x9B }; }
public CommandsGumpGroup(string name, CommandName[] commands) { m_Name = name; m_Commands = commands; //Array.Sort(m_Skills, new SkillNameComparer()); }
MCACommand(CommandName command, ushort param1, uint param2) { Bytes = new byte[] { 0xA5, 0x5A, (byte)(((ushort)command >> 8) & 0xff), (byte)((ushort)command & 0xff), (byte)(param1 & 0xff), (byte)((param1 >> 8) & 0xff), (byte)(param2 & 0xff), (byte)((param2 >> 8) & 0xff), (byte)((param2 >> 16) & 0xff), (byte)((param2 >> 24) & 0xff), 0xB9, 0x9B }; }
public static IAppMessage OrchestratorAlreadyRunning(CommandName CommandName) => inform("Orchestration for the @CommandName command is already underway", new { CommandName });