예제 #1
0
        internal ContractHandler AddContract(string ContractName, ExtendType extend)
        {
            XmlHelper req = new XmlHelper("<Request/>");

            req.AddElement(".", "ContractName", ContractName);

            req.AddElement(".", "Definition");
            XmlElement authElement = req.AddElement("Definition", "Authentication");

            if (extend == ExtendType.open)
            {
                XmlElement e = req.AddElement("Definition/Authentication", "Public");
                e.SetAttribute("Enabled", "true");
            }
            else
            {
                if (extend != ExtendType.none && extend != ExtendType.open)
                {
                    authElement.SetAttribute("Extends", extend.ToString());
                }
            }

            Parent.SendRequest("UDSManagerService.CreateContract", new Envelope(req));

            ContractHandler contract = ContractHandler.CreateNew(ContractName, extend);

            JoinProject(contract);
            return(contract);
        }
예제 #2
0
        internal ContractHandler AddContract(string ContractName, ExtendType extend)
        {
            XmlHelper req = new XmlHelper("<Request/>");
            req.AddElement(".", "ContractName", ContractName);

            req.AddElement(".", "Definition");
            XmlElement authElement = req.AddElement("Definition", "Authentication");

            if (extend == ExtendType.open)
            {
                XmlElement e = req.AddElement("Definition/Authentication", "Public");
                e.SetAttribute("Enabled", "true");
            }
            else
            {
                if (extend != ExtendType.none && extend != ExtendType.open)
                    authElement.SetAttribute("Extends", extend.ToString());
            }

            Parent.SendRequest("UDSManagerService.CreateContract", new Envelope(req));

            ContractHandler contract = ContractHandler.CreateNew(ContractName, extend);
            JoinProject(contract);
            return contract;
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExtendSiteSetting" /> class.
 /// </summary>
 /// <param name="extendType">extendType.</param>
 /// <param name="duration">duration.</param>
 /// <param name="durationType">durationType.</param>
 /// <param name="constantDuration">constantDuration.</param>
 /// <param name="constantDurationType">constantDurationType.</param>
 /// <param name="extendBasedTime">extendBasedTime.</param>
 public ExtendSiteSetting(ExtendType extendType = default(ExtendType), int duration = default(int), ApiDurationType durationType = default(ApiDurationType), int constantDuration = default(int), ApiDurationType constantDurationType = default(ApiDurationType), DateTime extendBasedTime = default(DateTime))
 {
     this.ExtendType           = extendType;
     this.Duration             = duration;
     this.DurationType         = durationType;
     this.ConstantDuration     = constantDuration;
     this.ConstantDurationType = constantDurationType;
     this.ExtendBasedTime      = extendBasedTime;
 }
예제 #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            err.Clear();

            if (string.IsNullOrWhiteSpace(txtName.Text))
            {
                err.SetError(txtName, "名稱不可空白");
                return;
            }

            if (UDSNodeHandler.UDSHandler.ContainContract(txtName.Text))
            {
                err.SetError(txtName, "此名稱已被其它 Contract 使用");
            }


            ContractName = txtName.Text;

            ExtendType extend = ExtendType.open;

            if (rbAdmin.Checked)
            {
                extend = ExtendType.admin;
            }

            if (rbSA.Checked)
            {
                extend = ExtendType.sa;
            }

            if (rbOther.Checked)
            {
                extend = ExtendType.none;
            }

            if (rbTA.Checked)
            {
                extend = ExtendType.ta;
            }

            try
            {
                UDSNodeHandler.UDSHandler.AddContract(ContractName, extend);

                if (Added != null)
                {
                    Added.Invoke(this, EventArgs.Empty);
                }

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("新增失敗 :\n" + ex.Message, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        public IntersectionInfo(ObjectId sourceId, ExtendType sourceExtendType, ObjectId targetId, ExtendType targetExtendType, Point3d intersectPoint)
        {
            SourceId          = sourceId;
            _sourceExtendType = sourceExtendType;

            TargetId          = targetId;
            _targetExtendType = targetExtendType;

            _intersectPoint = intersectPoint;
        }
예제 #6
0
        /* #impl-aarch64.ExtendReg.3 */
        public static Bits ExtendReg(int N, int reg, ExtendType type, int shift)
        {
            /* assert shift >= 0 && shift <= 4; */

            Bits val = X(N, reg);
            bool unsigned;
            int  len;

            switch (type)
            {
            default:
            case ExtendType.ExtendType_SXTB:
                unsigned = false; len = 8;
                break;

            case ExtendType.ExtendType_SXTH:
                unsigned = false; len = 16;
                break;

            case ExtendType.ExtendType_SXTW:
                unsigned = false; len = 32;
                break;

            case ExtendType.ExtendType_SXTX:
                unsigned = false; len = 64;
                break;

            case ExtendType.ExtendType_UXTB:
                unsigned = true;  len = 8;
                break;

            case ExtendType.ExtendType_UXTH:
                unsigned = true;  len = 16;
                break;

            case ExtendType.ExtendType_UXTW:
                unsigned = true;  len = 32;
                break;

            case ExtendType.ExtendType_UXTX:
                unsigned = true;  len = 64;
                break;
            }

            // Note the extended width of the intermediate value and
            // that sign extension occurs from bit <len+shift-1>, not
            // from bit <len-1>. This is equivalent to the instruction
            //   [SU]BFIZ Rtmp, Rreg, #shift, #len
            // It may also be seen as a sign/zero extend followed by a shift:
            //   LSL(Extend(val<len-1:0>, N, unsigned), shift);

            len = Min(len, N - shift);
            return(Extend(Bits.Concat(val[len - 1, 0], Zeros(shift)), N, unsigned));
        }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExtendGroupSetting" /> class.
 /// </summary>
 /// <param name="extendType">extendType.</param>
 /// <param name="constantDuration">constantDuration.</param>
 /// <param name="constantDurationType">constantDurationType.</param>
 /// <param name="maxDuration">maxDuration.</param>
 /// <param name="maxDurationType">maxDurationType.</param>
 /// <param name="enabled">enabled.</param>
 /// <param name="approvalProcess">approvalProcess.</param>
 /// <param name="isUsedDefaultProcess">isUsedDefaultProcess.</param>
 public ExtendGroupSetting(ExtendType extendType = default(ExtendType), int constantDuration = default(int), ApiDurationType constantDurationType = default(ApiDurationType), int maxDuration = default(int), ApiDurationType maxDurationType = default(ApiDurationType), bool enabled = default(bool), GuidModel approvalProcess = default(GuidModel), bool isUsedDefaultProcess = default(bool))
 {
     this.ExtendType           = extendType;
     this.ConstantDuration     = constantDuration;
     this.ConstantDurationType = constantDurationType;
     this.MaxDuration          = maxDuration;
     this.MaxDurationType      = maxDurationType;
     this.Enabled              = enabled;
     this.ApprovalProcess      = approvalProcess;
     this.IsUsedDefaultProcess = isUsedDefaultProcess;
 }
예제 #8
0
        private ContractHandler(string name, ExtendType extend)
        {
            Name       = name;
            ExtendType = extend;

            //List<string> files = new List<string>();
            //Parallel.ForEach(files, file =>
            //{

            //});
            //Parallel.For(0, 10, i =>
            //{

            //});
            //
        }
        private ContractHandler(string name, ExtendType extend)
        {
            Name = name;
            ExtendType = extend;

            //List<string> files = new List<string>();
            //Parallel.ForEach(files, file =>
            //{
                
            //});
            //Parallel.For(0, 10, i =>
            //{
                
            //});
            //
        }
예제 #10
0
        private void ChangeType(ExtendType type)
        {
            IContractEditor editor = null;

            if (type == ExtendType.open)
            {
                rbPublic.Checked = true;
                editor           = new PublicAuthEditor();
            }
            else if (type == ExtendType.ta)
            {
                rbTA.Checked = true;
                editor       = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.sa)
            {
                rbSA.Checked = true;
                editor       = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.admin)
            {
                rbAdmin.Checked = true;
                editor          = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.none)
            {
                rbOther.Checked = true;
                editor          = new AdvAuthEditor();
            }
            else if (type == ExtendType.parent)
            {
                rbParent.Checked = true;
                editor           = new ExtendAuthEditor(type);
            }

            DockControl(editor);
            editor.DataChanged     += new EventHandler(editor_DataChanged);
            editor.ChangeRecovered += new EventHandler(editor_ChangeRecovered);
        }
예제 #11
0
        private bool CheckIntersectionInfo(IntersectionInfo info, ExtendType desiredSourceExtendType, Point3d sourcePoint,
                                           ExtendType desiredTargetExtendType, Point3d targetPoint, double tolerance)
        {
            if (info.SourceExtendType != desiredSourceExtendType)
            {
                return(false);
            }
            if (info.TargetExtendType != desiredTargetExtendType)
            {
                return(false);
            }
            var dist = (sourcePoint - info.IntersectPoint).Length;

            if (dist.Larger(tolerance))
            {
                return(false);
            }
            dist = (targetPoint - info.IntersectPoint).Length;
            if (dist.Larger(tolerance))
            {
                return(false);
            }
            return(true);
        }
 internal ExtendAuthEditor(ExtendType type)
 {
     InitializeComponent();
     this.Type = type;
 }
예제 #13
0
파일: Curve.cs 프로젝트: yzwbrian/SimpleCad
 public virtual bool IntersectWith(Curve other, ExtendType extend, out Point2D[] points)
 {
     points = new Point2D[0];
     return(false);
 }
 internal static ContractHandler CreateNew(string name, ExtendType extend)
 {
     return new ContractHandler(name, extend);
 }
예제 #15
0
        private void ChangeType(ExtendType type)
        {
            IContractEditor editor = null;
            if (type == ExtendType.open)
            {
                rbPublic.Checked = true;
                editor = new PublicAuthEditor();
            }
            else if (type == ExtendType.ta)
            {
                rbTA.Checked = true;
                editor = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.sa)
            {
                rbSA.Checked = true;
                editor = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.admin)
            {
                rbAdmin.Checked = true;
                editor = new ExtendAuthEditor(type);
            }
            else if (type == ExtendType.none)
            {
                rbOther.Checked = true;
                editor = new AdvAuthEditor();
            }
            else if (type == ExtendType.parent)
            {
                rbParent.Checked = true;
                editor = new ExtendAuthEditor(type);
            }

            DockControl(editor);
            editor.DataChanged += new EventHandler(editor_DataChanged);
            editor.ChangeRecovered += new EventHandler(editor_ChangeRecovered);
        }
예제 #16
0
        private IntersectionInfo IntersectLineAndCurve(Line line, Curve curve, Point3d sorucePoint, ExtendType desireExtendType)
        {
            var points = new Point3dCollection();

            line.IntersectWith(curve, Intersect.ExtendThis, points, IntPtr.Zero, IntPtr.Zero);
            if (points.Count == 0)
            {
                return(null);
            }

            // NOTE: Use Line's GetParameterAtPoint will throw exception if the intersect point is
            // on the line's extension, but LineSegment3d.GetParameterOf is available, so I convert
            // the Line to LineSegment3d here.
            var     lineSegment  = new LineSegment3d(line.StartPoint, line.EndPoint);
            Point3d?nearestPoint = null;
            double? nearestDist  = null;

            foreach (Point3d point in points)
            {
                var param      = lineSegment.GetParameterOf(point);
                var extendType = CurveIntersectUtils.ParamToExtendTypeForLine(param);
                if (extendType != desireExtendType)
                {
                    continue;
                }

                var dist = (point - sorucePoint).LengthSqrd;
                if (nearestDist == null || dist < nearestDist.Value)
                {
                    nearestDist  = dist;
                    nearestPoint = point;
                }
            }

            IntersectionInfo result = null;

            if (nearestPoint != null)
            {
                result = new IntersectionInfo(desireExtendType, ExtendType.None, nearestPoint.Value);
            }
            return(result);
        }
예제 #17
0
 internal static ContractHandler CreateNew(string name, ExtendType extend)
 {
     return(new ContractHandler(name, extend));
 }
예제 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExtendGroupResult" /> class.
 /// </summary>
 /// <param name="extendType">extendType.</param>
 /// <param name="duration">duration.</param>
 /// <param name="durationType">durationType.</param>
 public ExtendGroupResult(ExtendType extendType = default(ExtendType), int duration = default(int), ApiDurationType durationType = default(ApiDurationType))
 {
     this.ExtendType   = extendType;
     this.Duration     = duration;
     this.DurationType = durationType;
 }
예제 #19
0
 public IntersectionInfo(ExtendType sourceExtendType, ExtendType targetExtendType, Point3d intersectPoint)
 {
     _sourceExtendType = sourceExtendType;
     _targetExtendType = targetExtendType;
     _intersectPoint   = intersectPoint;
 }
 internal ExtendAuthEditor(ExtendType type)
 {
     InitializeComponent();
     this.Type = type;
 }