private TextFileLogConfiguration ParseLogFileConfigXml(XmlNode logFileConfigXml) { XPathNavigator nav = logFileConfigXml.CreateNavigator(); MoveNavigatorToChildNode(ref nav, "Level"); LogLevel level = (LogLevel)Enum.Parse(typeof(LogLevel), nav.Value); MoveNavigatorToSiblingNode(ref nav, "FilePath"); string logFilePath = nav.Value; MoveNavigatorToSiblingNode(ref nav, "RotateOption"); RotateOptions logRotateOption = (RotateOptions)Enum.Parse(typeof(RotateOptions), nav.Value); MoveNavigatorToSiblingNode(ref nav, "RotateLimit"); uint logRotateLimit = uint.Parse(nav.Value); MoveNavigatorToSiblingNode(ref nav, "MaxFiles"); uint logMaxFiles = uint.Parse(nav.Value); return(new TextFileLogConfiguration() { Level = level, FilePath = logFilePath, RotateOption = logRotateOption, MaxFiles = logMaxFiles, RotateLimit = logRotateLimit }); }
public static void Run() { var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new PagesApi(configuration); try { var fileInfo = new FileInfo { FilePath = "Pdf/ten-pages.pdf" }; var options = new RotateOptions { FileInfo = fileInfo, OutputPath = "Output/rotate-pages.pdf", Pages = new List <int?> { 2, 4 }, Mode = RotateOptions.ModeEnum.Rotate90 }; var request = new RotateRequest(options); var response = apiInstance.Rotate(request); Console.WriteLine("Output file path: " + response.Path); } catch (Exception e) { Console.WriteLine("Exception while calling api: " + e.Message); } }
public static void Start(RotateOptions options) { RotateList[options.GameObject] = options; options.OnFinished += (sender, e) => { RotateTo.RotateList.Remove((sender as RotateTo.RotateOptions).GameObject); }; }
public static void Run() { string filePath = Constants.SAMPLE_PDF_2; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); RotateOptions rotateOptions = new RotateOptions(RotateMode.Rotate180, new int[] { 1 }); using (Merger merger = new Merger(filePath)) { merger.RotatePages(rotateOptions); merger.Save(filePathOut); } Console.WriteLine("Source document was rotated successfully."); Console.WriteLine($"Check output {filePathOut}."); }
/// <summary> /// Rotate pages of known formatted docs /// </summary> /// <param name="fileName">source file name</param> public static void RotatePagesOfProtectedKnownFormatDoc(string fileName) { //ExStart:ChangePageOrientationOfProtectedKnownFormatDoc string sourceFile = CommonUtilities.sourcePath + fileName; //Set password, as document is password protected string password = "******"; RotateOptions pagesOptions = new RotateOptions(FileFormat.Pdf, password, RotateMode.Rotate180, new List <int> { 1, 2 }); Stream documentExample = new FileStream(sourceFile, FileMode.Open); // Main method. DocumentResult result = new DocumentHandler().RotatePages(documentExample, pagesOptions); Stream documentStream = result.Stream; var fileStream = File.Create(CommonUtilities.outputPath + "OutPut." + result.FileFormat); documentStream.CopyTo(fileStream); documentStream.Close(); //ExEnd:ChangePageOrientationOfProtectedKnownFormatDoc }
/// <summary> /// Rotates the robot 1 cardinal point to the left or right. /// </summary> /// <param name="opt">Direction to rotate the robot</param> public void RotateRobo(RotateOptions opt) { if(opt.Equals(RotateOptions.Left)) { RoboImg.RotateFlip(RotateFlipType.Rotate90FlipNone); if ((int)FaceDirection > 0) { FaceDirection -= 1; } else { FaceDirection = (Direction)Enum.GetValues(typeof(Direction)).Length - 1; } } else { RoboImg.RotateFlip(RotateFlipType.Rotate270FlipNone); if ((int)FaceDirection < Enum.GetValues(typeof(Direction)).Length - 1) { FaceDirection += 1; } else { FaceDirection = (Direction)0; } } }