public static void Run() { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new PagesApi(configuration); try { var fileInfo = new FileInfo { FilePath = "WordProcessing/four-pages.docx" }; var options = new OrientationOptions { FileInfo = fileInfo, OutputPath = "Output/change-page-orientation.docx", Pages = new List <int?> { 2, 4 }, Mode = OrientationOptions.ModeEnum.Landscape }; var request = new OrientationRequest(options); var response = apiInstance.Orientation(request); Console.WriteLine("Output file path: " + response.Path); } catch (Exception e) { Console.WriteLine("Exception while calling api: " + e.Message); } }
// 5: GetHitters private static EventSubject <GameEntityModel> .GetSubjectsDelegate GetHitters(Storage.GenericParameter parameter) { // Read orientation options, types options, list of types, collision ids options, collision ids list OrientationOptions orientationOptions = (OrientationOptions)parameter.SafeInt(1); AnyOrAllOptions typesOptions = (AnyOrAllOptions)parameter.SafeInt(2); int[] types = parameter.SafeIntsList(0); AnyOrAllOptions collisionIdsOptions = (AnyOrAllOptions)parameter.SafeInt(3); int[] collisionIds = parameter.SafeIntsList(1); int subjectId = parameter.SafeInt(0); return(DefaultDelegation(subjectId, delegate(GameEntityModel model, List <GameEntityModel> subjects){ GameEntityController controller = model.Controller() as GameEntityController; List <HitInformation> hurts = controller.lastHurts; GameEntityModel subject; foreach (HitInformation hitInformation in hurts) { if (isHitConformingType(hitInformation, typesOptions, types) && isHitConformingCollisionId(hitInformation, collisionIdsOptions, collisionIds) ) { subject = getHitEntityIfConformingOrientationOptions(hitInformation, orientationOptions, model); if (subject != null) { subjects.Add(subject); } } } })); }
public iOSVideoRecorder(VideoRecorder CrossPlatformRecorder, CameraOptions cameraOption, OrientationOptions orientationOption) { //Store references of recorder and options for later use XamRecorder = CrossPlatformRecorder; CameraOption = cameraOption; OrientationOption = orientationOption; //register for rotation events rotationNotifation = NSNotificationCenter.DefaultCenter.AddObserver(UIDevice.OrientationDidChangeNotification, RotationCallback); //Init the camera InitCamera(); }
public static void Run() { string filePath = Constants.SAMPLE_DOCX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); OrientationOptions orientationOptions = new OrientationOptions(OrientationMode.Landscape, new int[] { 3, 4 }); using (Merger merger = new Merger(filePath)) { merger.ChangeOrientation(orientationOptions); merger.Save(filePathOut); } Console.WriteLine("Source document changed orientation successfully."); Console.WriteLine($"Check output {filePathOut}."); }
/// <summary> /// Change page orientation of known formatted docs /// </summary> /// <param name="fileName">source file name</param> public static void ChangePageOrientationOfProtectedKnownFormatDoc(string fileName) { //ExStart:ChangePageOrientationOfProtectedKnownFormatDoc string sourceFile = CommonUtilities.sourcePath + fileName; //Set password, as document is password protected string password = "******"; OrientationOptions pagesOptions = new OrientationOptions(OrientationMode.Landscape, FileFormat.Docx, password, new[] { 1, 2 }); Stream documentExample = new FileStream(sourceFile, FileMode.Open); // Main method. DocumentResult result = new DocumentHandler().ChangeOrientation(documentExample, pagesOptions); Stream documentStream = result.Stream; var fileStream = File.Create(CommonUtilities.outputPath + "OutPut." + result.FileFormat); documentStream.CopyTo(fileStream); documentStream.Close(); //ExEnd:ChangePageOrientationOfProtectedKnownFormatDoc }
public AndroidVideoRecorder(Context context, VideoRecorder CrossPlatformRecorder, CameraOptions cameraOption, OrientationOptions orientationOption) : base(context) { //Store references of recorder and options for later use XamRecorder = CrossPlatformRecorder; CameraOption = cameraOption; OrientationOption = orientationOption; if (IsCameraAvailable) { //Create the surface for drawing on surfaceView = new SurfaceView(context); AddView(surfaceView); holder = surfaceView.Holder; holder.AddCallback(this); windowManager = Context.GetSystemService(Context.WindowService).JavaCast <IWindowManager>(); InitCamera(); XamRecorder.IsPreviewing = false; XamRecorder.IsRecording = false; } }
// Filter hit by hitter entity location private static GameEntityModel getHitEntityIfConformingOrientationOptions(HitInformation hit, OrientationOptions orientationOptions, GameEntityModel model) { GameEntityModel hitterModel = StateManager.state.GetModel(hit.entityId) as GameEntityModel; if (orientationOptions == OrientationOptions.any) { return(hitterModel); } PhysicPointModel modelPoint = GameEntityController.GetPointModel(model); PhysicPointModel hitterPoint = GameEntityController.GetPointModel(hitterModel); bool isFrontal; if (model.IsFacingRight()) { isFrontal = hitterPoint.position.X >= modelPoint.position.X; } else { isFrontal = hitterPoint.position.X <= modelPoint.position.X; } if (isFrontal == (orientationOptions == OrientationOptions.fromFront)) { return(hitterModel); } return(null); }