public Console(IInput input, IViewer viewer) { Command = new Command(); _Filter = LogFilter.All; _Commands = new Dictionary<string, string>(); _Initial(input, viewer); }
public PollKey(EmuKeys oldKey, string message, string inputMode) { InitializeComponent(); switch (inputMode) { default: case "Win": input = new WinInput(this, this); break; #if !NO_DX case "DX": input = new DXInput(this); break; case "XIn": input = new XInInput(); break; #endif case "Null": input = new NullInput(); break; } lblMessage.Text = message; input.Create(); input.InputEvent += new InputHandler(input_InputEvent); input.InputScalerEvent += new InputScalerHandler(input_InputScalerEvent); this.oldKey = this.newKey = oldKey; tmrPoll.Enabled = true; }
/// <summary> /// DebugState update event /// </summary> /// <param name="input">Input</param> /// <param name="deltaTime">Time since the last update</param> private static void DebugStateUpdate(IInput input, float deltaTime) { if (input[Gamepad.Instance.Quit]) { GameEngine.Instance.Quit(); } }
void Awake() { _input = new Input(transform); _movement = new Movement(GetComponent<Rigidbody2D>()); _state = State.Idle; _animator = GetComponentInChildren<Animator>(); }
public AGSSliderComponent(IGameState state, IInput input, IGameEvents gameEvents) { _state = state; _input = input; _gameEvents = gameEvents; OnValueChanged = new AGSEvent<SliderValueEventArgs> (); }
public override void Update(GameTime gameTime, IInput input) { if (input != null) { if (input.IsKeyDown(Keys.Left) && direction != Direction.Right) { Direction = Direction.Left; return; } if (input.IsKeyDown(Keys.Right) && direction != Direction.Left) { Direction = Direction.Right; return; } if (input.IsKeyDown(Keys.Up) && direction != Direction.Bottom) { Direction = Direction.Top; return; } if (input.IsKeyDown(Keys.Down) && direction != Direction.Top) { Direction = Direction.Bottom; return; } } }
public AGSDraggableComponent(IInput input, IGameEvents gameEvents) { _input = input; _gameEvents = gameEvents; _gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute); IsDragEnabled = true; }
protected override void ExecuteOverride(IInput input, IConnection connection, ResponseMessage response) { if (connection.User == null) { response.Invalidate(CommonResources.LoginRequired); return; } var username = input.Get<string>("username"); var login = connection.User.Logins.FirstOrDefault(l => l.UserName.ToLower() == username); if (login != null) { response.Invalidate(CommonResources.LoginAlreadyExists); return; } if (!Game.Current.Users.TryCreateLogin(input, out login)) { response.Invalidate(CommonResources.LoginAlreadyExists); return; } connection.User.Logins.Add(login); Game.Current.Repository.SaveUser(connection.User); }
private static IInputObservable CreateFakeInput(IInput[] inputEvents) { var input = A.Fake<IInputObservable>(); var inputObs = Observable.Interval(TimeSpan.FromSeconds(0.1)).Take(inputEvents.Length).Select(i => inputEvents[i]); // spaces out the input by 1/10 of a second A.CallTo(() => input.InputEvents).Returns(inputObs); return input; }
// ------------ Input Channels ------------ public void AddInputChannel(IInput input) { if (InputChannels.Contains(input)) return; InputChannels.Add(input); }
public GrammerRuleHandler(IInput input) { this.input = input; this.identifierMap = new Dictionary<string, object>(); ContextProvider.GetContext().SetContexts(identifierMap); functionsIdentified = 0; }
private void Flush(IInput input) { if (input != null) { input.Flush(); } }
public Console(IInput input, IViewer viewer) { Command = new Command(); _Filter = LogFilter.All; _Initial(input , viewer); }
protected override void ExecuteOverride(IInput input, IConnection connection, ResponseMessage response) { User user; if (Game.Current.Users.TryGetUser(input, out user)) { // User already exits. response.Invalidate(CommonResources.LoginAlreadyExists); return; } // Otherwise, create a user account and add a login. user = new User(); Login login; if (!Game.Current.Users.TryCreateLogin(input, out login)) { // User already exits. response.Invalidate(CommonResources.LoginAlreadyExists); return; } user.Logins.Add(login); Game.Current.Repository.SaveUser(user); response.Data = user.Id; connection.User = user; }
/// <summary> /// Constructor (throws ArgumentException on invalid input) /// </summary> /// <param name="input">input object</param> /// <param name="caseSensitive">flag whether find matches with case sensitive or not (default to case insensitive)</param> public Algorithm(IInput input, IOverlapCalculator Table, bool caseSensitive = false) { try { if (input == null) { throw new ArgumentNullException(Errors.InputWasNull); } if (!input.IsValid) { throw new ArgumentException(Errors.InputWasInvalid); } if (Table == null) { throw new ArgumentNullException(Errors.OvelapCalculatorWasNull); } this.Text = input.Text; this.SubText = input.SubText; this.PrefixTable = Table.Compute(); this.IsCaseSensitive = caseSensitive; } catch (Exception e) { Logger.Push("Error received while initializing the KMPAlgorithm class object : " + e.Message); throw; } }
public TestableInput(TestableGameObject obj, IInput input, Sphere sphere) : base(obj) { this.sphere = sphere; this.input = input; }
public Cpu(IMemory memory, IInput input, IOutput output) { _memory = memory; In = input; Out = output; Registers = new byte[16]; Commands = new Dictionary<byte, Command> { {0x01, new IncCommand(this)}, {0x02, new DecCommand(this)}, {0x03, new MovCommand(this)}, {0x04, new MovcCommand(this)}, {0x05, new LslCommand(this)}, {0x06, new LsrCommand(this)}, {0x07, new JmpCommand(this)}, {0x0A, new JfeCommand(this)}, {0x0B, new RetCommand(this)}, {0x0C, new AddCommand(this)}, {0x0D, new SubCommand(this)}, {0x0E, new XorCommand(this)}, {0x0F, new OrCommand(this)}, {0x10, new InCommand(this)}, {0x11, new OutCommand(this)} }; }
/// <summary> /// Executes the specified command for the specified connection. /// </summary> /// <param name="input">The IInput containing the command information to execute.</param> /// <param name="connection">The IConnection executing the command.</param> public void Execute(IInput input, IConnection connection) { // Find the command from the input. var cmd = FindCommandInternal(input.CommandName); if (cmd == null) { InvalidateResponse(input, connection, CommonResources.CommandInvalidFormat, input.CommandName); return; } string errorMessage; if (!cmd.Value.ValidateArguments(input, out errorMessage)) { InvalidateResponse(input, connection, errorMessage); return; } if (cmd.Value.RequiresUser && connection.User == null) { InvalidateResponse(input, connection, CommonResources.CommandRequiresUser); return; } if (cmd.Value.RequiresCharacter && connection.Character == null) { InvalidateResponse(input, connection, CommonResources.CommandRequiresCharacter); return; } var response = cmd.Value.Execute(input, connection); connection.Write(response); }
public CPlayer(IGameObjectManager pObjMan, IEngineCore pEngineCore) : base(pObjMan, pEngineCore) { _fVelocity = 0f; uiShotPause = 15; ObjType = EGameObjectType.GotPlayer; _stPos = new TPoint2(Res.GameVpWidth / 2f, Res.GameVpHeight / 2f); _fSize = 150f; _fColScale = 0.6f; dimPl = new TPoint3(_fSize, _fSize, _fSize); IResourceManager pResMan; IEngineSubSystem pSubSys; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys); pInput = (IInput)pSubSys; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys); pResMan = (IResourceManager)pSubSys; IEngineBaseObject pBaseObj; pResMan.GetResourceByName(Res.MeshShip, out pBaseObj); pMesh = (IMesh)pBaseObj; pResMan.GetResourceByName(Res.TexShip, out pBaseObj); pTex = (ITexture)pBaseObj; pResMan.GetResourceByName(Res.TexSpark, out pBaseObj); pTexSpark = (ITexture)pBaseObj; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(Window.FEATURE_NO_TITLE); GetWindow().SetFlags(IWindowManager_LayoutParams.FLAG_FULLSCREEN, IWindowManager_LayoutParams.FLAG_FULLSCREEN); bool isPortrait = GetResources().GetConfiguration().Orientation == Configuration.ORIENTATION_PORTRAIT; int frameBufferWidth = isPortrait ? 480 : 800; int frameBufferHeight = isPortrait ? 800 : 480; Bitmap frameBuffer = Bitmap.CreateBitmap(frameBufferWidth, frameBufferHeight, Bitmap.Config.RGB_565); float scaleX = (float)frameBufferWidth / GetWindowManager().GetDefaultDisplay().GetWidth(); float scaleY = (float)frameBufferHeight / GetWindowManager().GetDefaultDisplay().GetHeight(); renderView = new AndroidFastRenderView(this, frameBuffer); graphics = new AndroidGraphics(GetAssets(), GetAssetsPrefix(), frameBuffer); fileIO = new AndroidFileIO(this); audio = new AndroidAudio(this); input = new AndroidInput(this, renderView, scaleX, scaleY); screen = getInitScreen(); SetContentView(renderView); PowerManager powerManager = (PowerManager)GetSystemService(Context.POWER_SERVICE); wakeLock = powerManager.NewWakeLock(PowerManager.FULL_WAKE_LOCK, "MyGame"); }
public TaskPresenter(ITaskRepo taskRepo, IInput input, IPrompt prompt, IFileHistoryRepo fileHistoryRepo) { _taskRepo = taskRepo; _input = input; _prompt = prompt; _fileHistoryRepo = fileHistoryRepo; }
protected bool OnHooked(IInput e) { var handler = Hooked; if (handler != null) return handler(e); else return true; }
public BuildStarter(ICmdArguments cmdArguments, IApp app, IOutput output, IBuildEnvironment buildEnvironment, IInput input) { _cmdArguments = cmdArguments; _app = app; _output = output; _buildEnvironment = buildEnvironment; _input = input; }
public void OnLoginSuccess(User user, Login login, IInput input) { var fbLogin = login as FacebookLogin; if (fbLogin == null) return; fbLogin.AccessToken = input.Get<string>("access_token"); }
/// <summary> /// Constructor for initialization of plyers. /// </summary> /// <param name="name">Name of the player.</param> /// <param name="field">The player's playfield.</param> /// <param name="input">Input object for receiving commands.</param> public Player(string name, IField field, IInput input) { this.Name = name; this.Field = field; this.input = input; this.NumberOfBombs = field.NumberOfBombs; this.ShotCount = 0; }
public FileReverser(IOutputter outputter, IInput input, IInputValidator inputValidator, IOutputValidator outputValidator, IReverserImplementation reverserImplementation) { _outputter = outputter; _input = input; _inputValidator = inputValidator; _outputValidator = outputValidator; _reverserImplementation = reverserImplementation; }
static InputManager() { ; if(Input.GetJoystickNames()[0] == string.Empty) input = new Keyboard(); else input = new GamePad(); }
public Game(IRenderer renderer, IRenderItemFactory factory, IInput input, int targetFramerate) { this.targetFramerate = targetFramerate; this.renderer = renderer; this.input = input; this.factory = factory; Start(); }
public HotspotLabel(IGame game, ILabel label) { _label = label; _events = game.Events; _input = game.Input; _state = game.State; _game = game; }
public void Setup() { _memory = Substitute.For<IMemory>(); _input = Substitute.For<IInput>(); _output = Substitute.For<IOutput>(); _cpu = new Cpu(_memory, _input, _output); }
protected virtual bool AllowRotateAction() { IInput input = m_component.Editor.Input; return(input.GetPointer(SwapLRMB ? 1 : 0)); }
protected virtual bool FocusAction() { IInput input = m_component.Editor.Input; return(input.GetKeyDown(FocusKey)); }
/// <summary> XMLCursor from <see cref="IInput"/>. </summary> /// <param name="input"> XNode to make XML from </param> public XMLCursor(IInput input, Encoding encoding) : this( new TextOf(input, encoding) ) { }
public ButtonStateChangeEvent(InputState state, IInput input, TButton button, ButtonStateChangeKind kind) : base(state, input) { Button = button; Kind = kind; }
public static ParserResult <TToken, TValue> Failure(IInput <TToken> rest, string description) => Failure(rest, new string[] {}, description);
public static ImmutableArray <long> ParseInts(this IInput input) => input.Content.AsString().Split(",").Select(long.Parse).ToImmutableArray();
/// <summary> /// A brix which has been transported as raw data. /// </summary> public BxRebuilt(IInput data) : this(() => XDocument.Parse(new TextOf(data).AsString()), true) { }
protected override void LateUpdate() { if (!m_component.IsWindowActive) { return; } bool isPointerOverAndSelected = m_component.Window.IsPointerOver;// && m_component.IsUISelected; IInput input = m_component.Editor.Input; RuntimeTools tools = m_component.Editor.Tools; bool canRotate = AllowRotateAction(); bool rotate = RotateAction(); bool pan = PanAction(); bool freeMove = FreeMoveAction(); if (pan && tools.Current != RuntimeTool.View) { rotate = false; } bool beginRotate = m_rotate != rotate && rotate; if (beginRotate && !isPointerOverAndSelected) { rotate = false; beginRotate = false; } bool endRotate = m_rotate != rotate && !rotate; m_rotate = rotate; bool beginPan = m_pan != pan && pan; if (beginPan && !isPointerOverAndSelected) { pan = false; } bool endPan = m_pan != pan && !pan; m_pan = pan; bool beginFreeMove = m_freeMove != freeMove && freeMove; if (beginFreeMove && !isPointerOverAndSelected) { freeMove = false; } bool endFreeMove = m_freeMove != freeMove && !freeMove; m_freeMove = freeMove; if (!m_freeMove) { m_freeMoveActive = false; } Vector3 pointerPosition = input.GetPointerXY(0); tools.IsViewing = m_rotate || m_pan || m_freeMove; if (beginPan || endPan || beginRotate || endRotate || beginFreeMove && m_beginFreeMoveImmediately || endFreeMove) { SceneComponent.UpdateCursorState(true, m_pan, m_rotate, beginFreeMove && m_beginFreeMoveImmediately); } if (m_freeMove) { Vector2 rotateAxes = RotateAxes() * FreeRotateSensitivity; Vector3 moveAxes = MoveAxes() * FreeMoveSensitivity; float zoomAxis = ZoomAxis(); SceneComponent.FreeMove(rotateAxes, moveAxes, zoomAxis); if (!m_freeMoveActive && (rotateAxes != Vector2.zero || moveAxes != Vector3.zero || zoomAxis != 0)) { SceneComponent.UpdateCursorState(true, m_pan, m_rotate, m_freeMove); m_freeMoveActive = true; } } else if (m_rotate) { if (canRotate) { Vector2 orbitAxes = RotateAxes(); SceneComponent.Orbit(orbitAxes.x * RotateXSensitivity, orbitAxes.y * RotateYSensitivity, ZoomAxis() * MoveZSensitivity); } else { Transform camTransform = m_component.Window.Camera.transform; Ray pointer = m_component.Window.Pointer; SceneComponent.Zoom(ZoomAxis() * MoveZSensitivity, Quaternion.FromToRotation(Vector3.forward, (camTransform.InverseTransformVector(pointer.direction)).normalized)); } SceneComponent.FreeMove(Vector2.zero, Vector3.zero, 0); } else if (m_pan) { if (beginPan) { SceneComponent.BeginPan(pointerPosition); } SceneComponent.Pan(pointerPosition); } else { SceneComponent.FreeMove(Vector2.zero, Vector3.zero, 0); if (isPointerOverAndSelected) { SceneComponent.Zoom(ZoomAxis() * MoveZSensitivity, Quaternion.identity); if (SelectAction()) { SelectGO(); } if (SnapToGridAction()) { SceneComponent.SnapToGrid(); } if (FocusAction()) { SceneComponent.Focus(); } if (SelectAllAction()) { SceneComponent.SelectAll(); } } } }
public static DataSet GetReportData(IInput input) { var report = GetReportTemplate(input.EntityType); return(report.GetData(input.EntityId)); }
/// <summary> /// Executes the function. If it does not complete within the specified time frame, /// returns a timeout error. /// </summary> private async Task <object> RunFunctionAsync(IServiceProvider services, IContext fnContext, IInput input) { var tokenSource = new CancellationTokenSource(); fnContext.TimedOut = tokenSource.Token; var timeUntilTimeout = GetTimeUntilTimeout(fnContext); if (timeUntilTimeout == null) { // No timeout, just run the function directly return(await _function.InvokeAsync(fnContext, input, services)); } var functionTask = _function.InvokeAsync(fnContext, input, services); var resultOrCancellation = await Task.WhenAny( functionTask, Task.Delay(timeUntilTimeout.Value, tokenSource.Token) ); // Cancel the `Task.Delay` if the function completed, or the function itself if it // didn't complete in the allotted time. tokenSource.Cancel(); if (resultOrCancellation == functionTask) { // Function completed before the timeout return(functionTask.Result); } // Function didn't complete before the timeout _logger.LogWarning("Function timed out after {timeUntilTimeout}", timeUntilTimeout); return(new RawResult(string.Empty) { HttpStatus = StatusCodes.Status504GatewayTimeout, }); }
public async Task ConnectInternalAsync(IInput input, IBrowserProfile browserProfile) { var cc = GetCookieContainer(browserProfile); _cc = cc; string vid; if (input is LivePageUrl livePageUrl) { vid = livePageUrl.LiveId; } else if (input is ChannelUrl channelUrl) { vid = await GetChannelLiveId(channelUrl); } else if (input is CommunityUrl communityUrl) { vid = await GetCommunityLiveId(communityUrl, cc); } else { throw new InvalidOperationException("bug"); } var url = "https://live2.nicovideo.jp/watch/" + vid; var liveHtml = await _server.GetAsync(url, cc); _dataProps = ExtractDataProps(liveHtml); if (_dataProps == null) { throw new SpecChangedException("data-propsが無い"); } if (_dataProps.Status == "ENDED") { SendSystemInfo("この番組は終了しました", InfoType.Notice); if (input is LivePageUrl)//チャンネルやコミュニティのURLを入力した場合は次の配信が始まるまで待機する { _isDisconnectedExpected = true; } return; } _vposBaseTime = Common.UnixTimeConverter.FromUnixTime(_dataProps.VposBaseTime); _localTime = DateTime.Now; RaiseMetadataUpdated(new TestMetadata { Title = _dataProps.Title, }); var metaTask = _metaProvider.ReceiveAsync(_dataProps.WebsocketUrl); _tasks.Add(metaTask); _mainLooptcs = new TaskCompletionSource <object>(); _tasks.Add(_mainLooptcs.Task); while (_tasks.Count > 1)//1の場合は_mainLooptcs.Taskだからループを終了する { var t = await Task.WhenAny(_tasks); if (t == _mainLooptcs.Task) { _tasks.Remove(_mainLooptcs.Task); _tasks.AddRange(_toAdd); _toAdd.Clear(); _mainLooptcs = new TaskCompletionSource <object>(); _tasks.Add(_mainLooptcs.Task); } else if (t == metaTask) { try { await metaTask; } catch (Exception ex) { _logger.LogException(ex); } _tasks.Remove(metaTask); } else//roomTask { _metaProvider?.Disconnect(); try { await metaTask; } catch (Exception ex) { _logger.LogException(ex); } _tasks.Remove(metaTask); try { await t; } catch (Exception ex) { _logger.LogException(ex); } _tasks.Clear();//本当はchatのTaskだけ取り除きたいけど、変数に取ってなくて無理だから全部消しちゃう } } return; }
public static (long CardPublicKey, long DevicePublicKey) Parse(this IInput input) { var lines = input.Lines.AsMemory().ToArray(); return(long.Parse(lines[0].Span), long.Parse(lines[1].Span)); }
public GameEngineBuilder WithInput(InputDouble input) { _input = input; return(this); }
public IdleState(IInput input) { this.input = input; }
/// <summary> /// Try to execute the replacement action. /// </summary> /// <param name="input">stream input</param> /// <param name="context">Input context</param> /// <returns> /// <para> /// A <see cref="ReplaceResult"/> reference that contains the result of the operation, to check if the operation is correct, the <b>Success</b> /// property will be <b>true</b> and the <b>Value</b> property will contain the value; Otherwise, the the <b>Success</b> property /// will be false and the <b>Errors</b> property will contain the errors associated with the operation, if they have been filled in. /// </para> /// <para> /// The type of the return value is <see cref="ReplaceResultData"/>, which contains the operation result /// </para> /// </returns> public ReplaceResult Apply(Stream input, IInput context) => ReplacementObject.Apply(input, context);
public override void PartTwo(IInput input, IOutput output) { output.WriteProperty("There is none! We finished it!", string.Empty); }
/// <summary> /// Try to execute the replacement action. /// </summary> /// <param name="file">file input</param> /// <param name="context">Input context</param> /// <returns> /// <para> /// A <see cref="ReplaceResult"/> reference that contains the result of the operation, to check if the operation is correct, the <b>Success</b> /// property will be <b>true</b> and the <b>Value</b> property will contain the value; Otherwise, the the <b>Success</b> property /// will be false and the <b>Errors</b> property will contain the errors associated with the operation, if they have been filled in. /// </para> /// <para> /// The type of the return value is <see cref="ReplaceResultData"/>, which contains the operation result /// </para> /// </returns> public ReplaceResult Apply(string file, IInput context) => Apply(StreamHelper.TextFileToStream(file), context);
private static ReplaceResult ReplaceImpl(IInput context, Stream input, string oldText, ReplaceTextOptions options, PdfTable table, float fixedWidth, PointF tableOffset, PdfTableStyle style, YesNo useTestMode) { var outputStream = new MemoryStream(); try { using (var reader = new PdfReader(input)) using (var stamper = new PdfStamper(reader, outputStream)) { var pages = reader.NumberOfPages; for (var page = 1; page <= pages; page++) { var strategy = new CustomLocationTextExtractionStrategy(); var cb = stamper.GetOverContent(page); // Send some data contained in PdfContentByte, looks like the first is always cero for me and the second 100, // but i'm not sure if this could change in some cases. strategy.UndercontentCharacterSpacing = cb.CharacterSpacing; strategy.UndercontentHorizontalScaling = cb.HorizontalScaling; // It's not really needed to get the text back, but we have to call this line ALWAYS, // because it triggers the process that will get all chunks from PDF into our strategy Object var allStrings = PdfTextExtractor.GetTextFromPage(reader, page, strategy); var stringsArray = allStrings.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); // The real getter process starts in the following line var textMatchesFound = strategy.GetExtendedTextLocations(oldText, options).ToList(); // MatchesFound contains all text with locations foreach (var match in textMatchesFound) { // Delete tag var bColor = BaseColor.WHITE; cb.SetColorFill(bColor); cb.Rectangle(match.Rect.Left, match.Rect.Bottom, match.Rect.Width, match.Rect.Height); cb.Fill(); // Calculates new rectangle var deltaY = CalculatesVerticalDelta(options, match.Rect); var cellHeight = CalculatesCellHeight(match, oldText, strategy, cb, (string[])stringsArray.Clone(), options, deltaY); var r = BuildRectangleByStrategies(match, oldText, strategy, cb, (string[])stringsArray.Clone(), options); // Width strategy to use var safeFixedWidth = fixedWidth; var useFixedWidth = !fixedWidth.Equals(DefaultFixedWidth); if (useFixedWidth) { if (fixedWidth > r.Width) { safeFixedWidth = r.Width; } } else { safeFixedWidth = r.Width; } // Creates aligned table by horizontal alignment value (this table contains the user table parameter) var outerBorderTable = new PdfPTable(1) { TotalWidth = safeFixedWidth, HorizontalAlignment = Element.ALIGN_LEFT }; var outerCell = PdfHelper.CreateEmptyWithBorderCell(style.Borders); outerCell.MinimumHeight = cellHeight; outerCell.VerticalAlignment = style.Alignment.Vertical.ToVerticalTableAlignment(); outerCell.BackgroundColor = new BaseColor(ColorHelper.GetColorFromString(style.Content.Color)); //table.Table.HorizontalAlignment = Element.ALIGN_LEFT; table.Table.TotalWidth = safeFixedWidth - (outerCell.EffectivePaddingRight + outerCell.EffectivePaddingLeft) * 2; table.Table.LockedWidth = true; // options.StartStrategy.Equals(StartLocationStrategy.LeftMargin) && options.EndStrategy.Equals(EndLocationStrategy.RightMargin); outerCell.AddElement(table.Table); outerBorderTable.AddCell(outerCell); // Creates strategy table (for shows testmode rectangle) var useTestModeTable = new PdfPTable(1) { TotalWidth = safeFixedWidth }; var useTestCell = PdfHelper.CreateEmptyCell(useTestMode); if (table.Configuration.HeightStrategy == TableHeightStrategy.Exact) { useTestCell.FixedHeight = table.Table.TotalHeight; } useTestCell.AddElement(outerBorderTable); useTestModeTable.AddCell(useTestCell); useTestModeTable.WriteSelectedRows(-1, -1, r.X + tableOffset.X, r.Y - tableOffset.Y - deltaY, cb); cb.Fill(); } cb.Stroke(); } stamper.Close(); reader.Close(); } return(ReplaceResult.CreateSuccessResult(new ReplaceResultData { Context = context, InputStream = input, OutputStream = new MemoryStream(outputStream.GetBuffer()) })); } catch (Exception ex) { return(ReplaceResult.FromException( ex, new ReplaceResultData { Context = context, InputStream = input, OutputStream = input })); } }
private static InsertResult InsertImpl(IInput context, Stream input, string sheetName, XlsxBaseRange location, XlsxChart chart) { var outputStream = new MemoryStream(); try { using (var excel = new ExcelPackage(input)) { ExcelWorksheet ws = excel.Workbook.Worksheets.FirstOrDefault(worksheet => worksheet.Name.Equals(sheetName, StringComparison.OrdinalIgnoreCase)); if (ws == null) { return(InsertResult.CreateErroResult( $"Sheet '{sheetName}' not found", new InsertResultData { Context = context, InputStream = input, OutputStream = input })); } // Create Chart ExcelChart mainchart = null; var plots = chart.Plots; foreach (var plot in plots) { var series = plot.Series; foreach (var serie in series) { // Create chart ExcelChart workchart; if (plot.UseSecondaryAxis.Equals(YesNo.No)) { if (mainchart == null) { mainchart = ws.Drawings.AddChart(serie.Name, serie.ChartType.ToEppChartType()); mainchart.Name = plot.Name; } workchart = mainchart; } else { workchart = mainchart.PlotArea.ChartTypes.Add(serie.ChartType.ToEppChartType()); workchart.UseSecondaryAxis = true; workchart.XAxis.Deleted = false; } var sr = workchart.Series.Add(serie.FieldRange.ToString(), serie.AxisRange.ToString()); sr.Header = serie.Name; } } if (mainchart != null) { var writer = new OfficeOpenChartWriter(mainchart); writer.SetSize(chart.Size); writer.SetPosition(location); writer.SetContent(chart); writer.SetBorder(chart.Border); writer.SetTitle(chart.Title); writer.SetLegend(chart.Legend); writer.SetAxes(chart.Axes); writer.SetPlotArea(chart.Plots); writer.SetShapeEffects(chart.Effects); } excel.SaveAs(outputStream); return(InsertResult.CreateSuccessResult(new InsertResultData { Context = context, InputStream = input, OutputStream = outputStream })); } } catch (Exception ex) { return(InsertResult.FromException( ex, new InsertResultData { Context = context, InputStream = input, OutputStream = input })); } }
private ParserResult(IInput <TToken> rest, TValue value) { Rest = rest; Value = value; }
public void Run(IInput input, IOutput output) { bool readLines = true; while (readLines) { var line = input.ReadLine <string>(); if (TrySetCurrentUtil(output, line)) { continue; } var getCommandReturnValue = GetCommand(line); if (getCommandReturnValue.IsSuccess) { CommandDetails data = getCommandReturnValue.Data; var initReturnValue = data.Command.Init(data.Args); if (initReturnValue.IsSuccess) { bool runActions = true; while (runActions) { var executeReturnValue = data.Command.ExecuteFunc(); if (executeReturnValue.ErrorType == ErrorType.EndOfList) { break; } switch (executeReturnValue.ReturnValueType) { case ReturnValueType.Clear: output.Clear(); break; case ReturnValueType.ExitApplication: readLines = false; break; case ReturnValueType.RunProcess: RunProcess(executeReturnValue); break; case ReturnValueType.WriteFiles: WriteFiles(executeReturnValue); break; case ReturnValueType.If: runActions = If(output, executeReturnValue); break; case ReturnValueType.IfThen: IfThen(output, executeReturnValue); break; case ReturnValueType.IfSelectOption: SelectOption(input, output, executeReturnValue); break; case ReturnValueType.SelectOption: runActions = IfSelectOption(input, output, executeReturnValue); break; case ReturnValueType.WriteOutput: WriteOutput(output, executeReturnValue); break; case ReturnValueType.LoadAssembly: runActions = LoadAssembly(executeReturnValue); break; case ReturnValueType.GetProcesses: GetProcesses(executeReturnValue); break; default: output.WriteReturnValue(executeReturnValue); break; } } } else { output.WriteReturnValue(initReturnValue); } } else { output.WriteLines($"Util or Command {line} not recognised"); } } }
public static ParserResult <TToken, TValue> Success(IInput <TToken> rest, TValue v) => new ParserResult <TToken, TValue>(rest, v) { IsSuccess = true };
public void Update(IInput content) { this.update(content); }
public App(ITrafficLight trafficLight, IInput input) { _trafficLight = trafficLight; _input = input; }
private void enqueueJoystickEvent(IInput evt) { PendingInputs.Enqueue(evt); FrameStatistics.Increment(StatisticsCounterType.JoystickEvents); }
/// <summary> /// Initializes a new instance of the <see cref="Entity"/> class. /// </summary> internal Entity(IInput input, IGraphic graphics, Microsoft.Xna.Framework.Game game) : base(input, graphics, game) { Position = new Vector2(0, 0); }
public AGSSplitPanelComponent(IInput input, IGameState state, IGameFactory factory) { _input = input; _state = state; _factory = factory; }
protected virtual bool SnapToGridAction() { IInput input = m_component.Editor.Input; return(input.GetKeyDown(SnapToGridKey) && input.GetKey(ModifierKey)); }
public void Interface(IInput input) { }
/// <summary> XMLCursor from <see cref="IInput"/>. </summary> /// <param name="input"> XNode to make XML from </param> public XMLCursor(IInput input) : this(input, Encoding.Default) { }