public static void Main(string[] args) { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); Document doc = new Document(dataDir + "input.pdf"); Page page = doc.Pages[2]; OperatorCollection oc = page.Contents; // used path-painting operators Operator[] operators = new Operator[] { new Operator.Stroke(), new Operator.ClosePathStroke(), new Operator.Fill() }; ArrayList list = new ArrayList(); foreach (Operator op in operators) { OperatorSelector os = new OperatorSelector(op); oc.Accept(os); list.AddRange(os.Selected); } oc.Delete(list); doc.Save(dataDir + "No_Graphics.pdf"); }
public void SetUp() { testee = new OperatorCollection(); testee.Add(new CustomOperator("xxx")); items = testee.GetType().GetField("items", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(testee) as List <FidelyOperator>; }
void Initialize() { _operators = new OperatorCollection { { ".", new MethodOperator(".", 12, true, OperatorCustomExpressions.MemberAccess) }, { "!", new UnaryOperator("!", 11, false, Expression.Not) }, { "*", new BinaryOperator("*", 10, true, Expression.Multiply) }, { "/", new BinaryOperator("/", 10, true, Expression.Divide) }, { "%", new BinaryOperator("%", 10, true, Expression.Modulo) }, { "+", new BinaryOperator("+", 9, true, OperatorCustomExpressions.Add) }, { "-", new BinaryOperator("-", 9, true, Expression.Subtract) }, { "<<", new BinaryOperator("<<", 8, true, Expression.LeftShift) }, { ">>", new BinaryOperator(">>", 8, true, Expression.RightShift) }, { "<", new BinaryOperator("<", 7, true, Expression.LessThan) }, { ">", new BinaryOperator(">", 7, true, Expression.GreaterThan) }, { "<=", new BinaryOperator("<=", 7, true, Expression.LessThanOrEqual) }, { ">=", new BinaryOperator(">=", 7, true, Expression.GreaterThanOrEqual) }, { "==", new BinaryOperator("==", 6, true, Expression.Equal) }, { "!=", new BinaryOperator("!=", 6, true, Expression.NotEqual) }, { "&", new BinaryOperator("&", 5, true, Expression.And) }, { "^", new BinaryOperator("^", 4, true, Expression.ExclusiveOr) }, { "|", new BinaryOperator("|", 3, true, Expression.Or) }, { "&&", new BinaryOperator("&&", 2, true, Expression.AndAlso) }, { "||", new BinaryOperator("||", 1, true, Expression.OrElse) } }; //operators.Add("^", new BinaryOperator("^", 11, false, Expression.Power)); //operators.Add("[", new IndexOperator("[", 0, true, OperatorCustomExpressions.ArrayAccess)); }
public void SetUp() { testee = new OperatorCollection(); testee.Add(new CustomOperator("xxx")); items = testee.GetType().GetField("items", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(testee) as List<FidelyOperator>; }
private void Initialize() { _operators = new OperatorCollection { { ".", new MethodOperator(".", 12, true, OperatorCustomExpressions.MemberAccess) }, { "!", new UnaryOperator("!", 11, false, Expression.Not, ExpressionType.Not) }, { "*", new BinaryOperator("*", 10, true, Expression.Multiply, ExpressionType.Multiply) }, { "/", new BinaryOperator("/", 10, true, Expression.Divide, ExpressionType.Divide) }, { "%", new BinaryOperator("%", 10, true, Expression.Modulo, ExpressionType.Modulo) }, { "+", new BinaryOperator("+", 9, true, OperatorCustomExpressions.Add, ExpressionType.Add) }, { "-", new BinaryOperator("-", 9, true, Expression.Subtract, ExpressionType.Subtract) }, { "<<", new BinaryOperator("<<", 8, true, Expression.LeftShift, ExpressionType.LeftShift) }, { ">>", new BinaryOperator(">>", 8, true, Expression.RightShift, ExpressionType.RightShift) }, { "<", new BinaryOperator("<", 7, true, Expression.LessThan, ExpressionType.LessThan) }, { ">", new BinaryOperator(">", 7, true, Expression.GreaterThan, ExpressionType.GreaterThan) }, { "<=", new BinaryOperator("<=", 7, true, Expression.LessThanOrEqual, ExpressionType.LessThanOrEqual) }, { ">=", new BinaryOperator(">=", 7, true, Expression.GreaterThanOrEqual, ExpressionType.GreaterThanOrEqual) }, { "==", new BinaryOperator("==", 6, true, Expression.Equal, ExpressionType.Equal) }, { "!=", new BinaryOperator("!=", 6, true, Expression.NotEqual, ExpressionType.NotEqual) }, { "&", new BinaryOperator("&", 5, true, Expression.And, ExpressionType.And) }, { "^", new BinaryOperator("^", 4, true, Expression.ExclusiveOr, ExpressionType.ExclusiveOr) }, { "|", new BinaryOperator("|", 3, true, Expression.Or, ExpressionType.Or) }, { "&&", new BinaryOperator("&&", 2, true, Expression.AndAlso, ExpressionType.AndAlso) }, { "||", new BinaryOperator("||", 1, true, Expression.OrElse, ExpressionType.OrElse) }, { ":", new TernarySeparatorOperator(":", 2, false, OperatorCustomExpressions.TernarySeparator) }, { "=", new BinaryOperator("=", 1, false, Expression.Assign, ExpressionType.Assign) }, { "?", new TernaryOperator("?", 1, false, Expression.Condition) } }; }
public static void Run() { // ExStart:RemoveGraphicsObjects // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Operators(); Document doc = new Document(dataDir + "RemoveGraphicsObjects.pdf"); Page page = doc.Pages[2]; OperatorCollection oc = page.Contents; // Used path-painting operators Operator[] operators = new Operator[] { new Operator.Stroke(), new Operator.ClosePathStroke(), new Operator.Fill() }; ArrayList list = new ArrayList(); foreach (Operator op in operators) { OperatorSelector os = new OperatorSelector(op); oc.Accept(os); list.AddRange(os.Selected); } oc.Delete(list); doc.Save(dataDir + "No_Graphics_out.pdf"); // ExEnd:RemoveGraphicsObjects }
/* * Реализация */ /// <summary> /// Возвращает информацию о компьютере, на котором вылетела ошибка /// </summary> /// <returns></returns> private static string GetSpecificInformation() { StringBuilder builder = new StringBuilder(); try { OperatorCollection collection = GlobalObjects.CasEnvironment.Operators; foreach (Operator @operator in collection) { builder.AppendFormat("Company : {0}", @operator.Name); builder.AppendLine(); break; } } catch { } try { GlobalTermsProvider globalTermsProvider = new GlobalTermsProvider(); builder.AppendFormat( "Version : {0}.{1}", globalTermsProvider["ProductVersion"], globalTermsProvider["ProductBuild"]); builder.AppendLine(); } catch { } try { builder.AppendFormat( "User Name : {0}", GlobalObjects.CasEnvironment.IdentityUser.Login); builder.AppendLine(); } catch (Exception) { } try { builder.AppendFormat( "Machine Name : {0}", Environment.MachineName); builder.AppendLine(); } catch (Exception) { } // TODO: // Дата установки программы CAS // Используется ли ключ return(builder.ToString()); }
public static BoundType BindType(string moduleName, string localName, string description, Type runtimeType, OperatorCollection allowedPrefixOperators, OperatorCollection allowedSuffixOperators, Dictionary <string, IMethodInvokeFactory> allowedMethods, Dictionary <string, IFieldAccessFactory> allowedFields) { return(new BoundType(moduleName, localName, description, runtimeType, allowedPrefixOperators, allowedSuffixOperators, allowedMethods.Select(m => (m.Key, m.Value)), allowedFields.Select(f => (f.Key, f.Value)))); }
private void ArgumentsCreation(object sender, EventArgs e) { OperatorCollection operators = OperatorCollection.Instance; int count = operators.Count; DirectiveConditionState condition = DirectiveConditionState.Notify; for (int i = 0; i < count; i++) { Operator operator_ = operators[i]; AircraftCollection aircrafts = operator_.AircraftCollection; int aircraftCount = aircrafts.Count; for (int j = 0; j < aircraftCount; j++) { condition = aircrafts[j].ConditionState; } } }
public static void Run() { // ExStart:RemoveGraphicsObjects // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Operators(); Document doc = new Document(dataDir + "RemoveGraphicsObjects.pdf"); Page page = doc.Pages[2]; OperatorCollection oc = page.Contents; // Used path-painting operators Operator[] operators = new Operator[] { new Aspose.Pdf.Operators.Stroke(), new Aspose.Pdf.Operators.ClosePathStroke(), new Aspose.Pdf.Operators.Fill() }; oc.Delete(operators); doc.Save(dataDir + "No_Graphics_out.pdf"); // ExEnd:RemoveGraphicsObjects }
/// <summary> /// Создает элемент управления для отображеия списка эксплуатантов /// </summary> public OperatorCollectionControl() { operatorCollection = OperatorCollection.Instance; operatorCollection.Changed += operatorCollection_Changed; operatorsListStatistics = new ObjectsListStatistics(); flowLayoutPanelOperators = new FlowLayoutPanel(); // // operatorsListStatistics // operatorsListStatistics.Amount = 0; operatorsListStatistics.ObjectsAmountText = "Operator"; operatorsListStatistics.AutoSize = true; operatorsListStatistics.AutoSizeMode = AutoSizeMode.GrowAndShrink; operatorsListStatistics.Caption = "Operators"; operatorsListStatistics.DescriptionTextColor = Color.DimGray; operatorsListStatistics.Location = new Point(0, 60); operatorsListStatistics.Name = "operatorsListStatistics"; operatorsListStatistics.Size = new Size(145, 70); operatorsListStatistics.UpperLeftIcon = icons.GrayArrow; // // flowLayoutPanelOperators // flowLayoutPanelOperators.AutoSize = true; flowLayoutPanelOperators.AutoSizeMode = AutoSizeMode.GrowAndShrink; flowLayoutPanelOperators.Location = new Point(0, 136); flowLayoutPanelOperators.MinimumSize = new Size(100, 100); DisplayerRequested += OperatorCollectionControl_DisplayerRequested; // // OperatorCollectionControl // AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; Controls.Add(flowLayoutPanelOperators); Controls.Add(operatorsListStatistics); Size = new Size(494, 259); UpdateOperators(false); }
/// <summary> /// Осуществляет заполнение пользовательских элементов управления на основе данных бизнес коллекции /// </summary> public override void FillUIElementsFromCollection() { if (!(Collection is OperatorCollection)) { return; } OperatorCollection operatorCollection = Collection as OperatorCollection; if (operatorCollection == null) { return; } buttons.Clear(); OperatorsControls.Clear(); for (int i = 0; i < operatorCollection.Count; i++) { //ReferenceButton tempButton = new ReferenceButton(); ReferenceOperatorListItem tempButton = new ReferenceOperatorListItem(); tempButton.Text = operatorCollection[i].Name; tempButton.Icon = operatorCollection[i].LogoType; tempButton.SecondText = operatorCollection[i].Address; //tempButton.Margin = new Padding(BUTTONS_INTERVAL); tempButton.Margin = new Padding(0); Css.AvalonButtonMStyle.Adjust(tempButton); buttons.Add(tempButton); buttons[i].DisplayerText = operatorCollection[i].Name; buttons[i].Tag = operatorCollection[i].ID; //buttons[i].Entity = new SampleStartPage(); buttons[i].DisplayerRequested += UIOperators_DisplayerRequested; buttons[i].ReflectionType = ReflectionTypes.DisplayInNew; } buttons.Sort(new OperatorListItemComparer()); OperatorsControls.AddRange(buttons.ToArray()); }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Operators(); string imageFile = dataDir + "aspose-logo.jpg"; string inFile = dataDir + "DrawXFormOnPage.pdf"; string outFile = dataDir + "blank-sample2-out.pdf"; using (Document doc = new Document(inFile)) { OperatorCollection pageContents = doc.Pages[1].Contents; // the sample demonstrates // GSave/GRestore operators usage // ContatenateMatrix operator usage to position xForm // Do operator usage to draw xForm on page // wrap existing contents with GSave/GRestore operators pair // this is to get initial graphics state at the and of existing contents // otherwise there might remain some undesirable transformations at the end of existing operators chain pageContents.Insert(1, new Operator.GSave()); pageContents.Add(new Operator.GRestore()); // add save graphics state operator to properly clear graphics state after new commands pageContents.Add(new Operator.GSave()); #region create xForm // create xForm XForm form = XForm.CreateNewForm(doc.Pages[1], doc); doc.Pages[1].Resources.Forms.Add(form); form.Contents.Add(new Operator.GSave()); // define image width and heigh form.Contents.Add(new Operator.ConcatenateMatrix(200, 0, 0, 200, 0, 0)); // load image into stream Stream imageStream = new FileStream(imageFile, FileMode.Open); // add image to Images collection of the XForm Resources form.Resources.Images.Add(imageStream); XImage ximage = form.Resources.Images[form.Resources.Images.Count]; // using Do operator: this operator draws image form.Contents.Add(new Operator.Do(ximage.Name)); form.Contents.Add(new Operator.GRestore()); #endregion pageContents.Add(new Operator.GSave()); // place form to the x=100 y=500 coordinates pageContents.Add(new Operator.ConcatenateMatrix(1, 0, 0, 1, 100, 500)); // draw form with Do operator pageContents.Add(new Operator.Do(form.Name)); pageContents.Add(new Operator.GRestore()); pageContents.Add(new Operator.GSave()); // place form to the x=100 y=300 coordinates pageContents.Add(new Operator.ConcatenateMatrix(1, 0, 0, 1, 100, 300)); // draw form with Do operator pageContents.Add(new Operator.Do(form.Name)); pageContents.Add(new Operator.GRestore()); // restore grahics state with GRestore after the GSave pageContents.Add(new Operator.GRestore()); doc.Save(outFile); } }
public void InitAsync(BackgroundWorker backgroundWorker, LoadingState loadingState) { if (backgroundWorker == null) { return; } if (loadingState == null) { loadingState = new LoadingState(); } loadingState.MaxPersentage = 10; //Загрузка всех пользователей loadingState.CurrentPersentage = 0; loadingState.CurrentPersentageDescription = "Loading Users"; backgroundWorker.ReportProgress(1, loadingState); var users = ApiProvider.GetAllUsersAsync(); Users = new Dictionary <int, string>(); foreach (var user in users) { Users.Add(user.ItemId, user.ToString()); } if (backgroundWorker.CancellationPending) { return; } loadingState.CurrentPersentage = 1; loadingState.CurrentPersentageDescription = "Loading Operators"; backgroundWorker.ReportProgress(1, loadingState); Operators = new OperatorCollection(_newLoader.GetObjectList <OperatorDTO, Operator>().ToArray()); AllOperators = new List <AllOperators>(_newLoader.GetObjectList <AllOperatorsDTO, AllOperators>().ToArray()); if (backgroundWorker.CancellationPending) { return; } loadingState.CurrentPersentage = 2; loadingState.CurrentPersentageDescription = "Loading Aircrafts"; backgroundWorker.ReportProgress(1, loadingState); Aircraft = new AircraftCollection(_newLoader.GetObjectList <CAAAircraftDTO, Aircraft>().ToArray()); if (backgroundWorker.CancellationPending) { return; } //Загрузка всех словарей loadingState.CurrentPersentage = 3; loadingState.CurrentPersentageDescription = "Loading Dictionaries"; backgroundWorker.ReportProgress(1, loadingState); GetDictionaries(); if (backgroundWorker.CancellationPending) { return; } }
void Initialize() { _operators = new OperatorCollection { {".", new MethodOperator(".", 12, true, OperatorCustomExpressions.MemberAccess)}, {"!", new UnaryOperator("!", 11, false, Expression.Not, ExpressionType.Not)}, {"*", new BinaryOperator("*", 10, true, Expression.Multiply, ExpressionType.Multiply)}, {"/", new BinaryOperator("/", 10, true, Expression.Divide, ExpressionType.Divide)}, {"%", new BinaryOperator("%", 10, true, Expression.Modulo, ExpressionType.Modulo)}, {"+", new BinaryOperator("+", 9, true, OperatorCustomExpressions.Add, ExpressionType.Add)}, {"-", new BinaryOperator("-", 9, true, Expression.Subtract, ExpressionType.Subtract)}, {"<<", new BinaryOperator("<<", 8, true, Expression.LeftShift, ExpressionType.LeftShift)}, {">>", new BinaryOperator(">>", 8, true, Expression.RightShift, ExpressionType.RightShift)}, {"<", new BinaryOperator("<", 7, true, Expression.LessThan, ExpressionType.LessThan)}, {">", new BinaryOperator(">", 7, true, Expression.GreaterThan, ExpressionType.GreaterThan)}, {"<=", new BinaryOperator("<=", 7, true, Expression.LessThanOrEqual, ExpressionType.LessThanOrEqual)}, {">=", new BinaryOperator(">=", 7, true, Expression.GreaterThanOrEqual, ExpressionType.GreaterThanOrEqual)}, {"==", new BinaryOperator("==", 6, true, Expression.Equal, ExpressionType.Equal)}, {"!=", new BinaryOperator("!=", 6, true, Expression.NotEqual, ExpressionType.NotEqual)}, {"&", new BinaryOperator("&", 5, true, Expression.And, ExpressionType.And)}, {"^", new BinaryOperator("^", 4, true, Expression.ExclusiveOr, ExpressionType.ExclusiveOr)}, {"|", new BinaryOperator("|", 3, true, Expression.Or, ExpressionType.Or)}, {"&&", new BinaryOperator("&&", 2, true, Expression.AndAlso, ExpressionType.AndAlso)}, {"||", new BinaryOperator("||", 1, true, Expression.OrElse, ExpressionType.OrElse)}, {":", new TernarySeparatorOperator(":", 2, false, OperatorCustomExpressions.TernarySeparator)}, {"=", new BinaryOperator("=", 1, false, Expression.Assign, ExpressionType.Assign)}, {"?", new TernaryOperator("?", 1, false, Expression.Condition)} }; //operators.Add("^", new BinaryOperator("^", 11, false, Expression.Power)); //operators.Add("[", new IndexOperator("[", 0, true, OperatorCustomExpressions.ArrayAccess)); }