Exemple #1
0
 public PipeDisconnectedPacket(Guid clientId, PipeType pipeType, bool success)
 {
     ClientId = clientId;
     PipeType = pipeType;
     Success  = success;
     Type     = "PipeDisconnectedPacket";
 }
 public static NamedPipeHandle Create(
     FileAccess access,
     string fileName,
     PipeType type,
     int maximumInstances,
     long defaultTimeout
     )
 {
     return Create(
         access,
         fileName,
         ObjectFlags.CaseInsensitive,
         null,
         FileShareMode.ReadWrite,
         FileCreationDisposition.OpenIf,
         0,
         type,
         type,
         PipeCompletionMode.Queue,
         maximumInstances,
         0,
         0,
         defaultTimeout
         );
 }
 public static NamedPipeHandle Create(
     FileAccess access,
     string fileName,
     PipeType type,
     FileCreateOptions createOptions,
     int maximumInstances,
     int inboundQuota,
     int outboundQuota,
     long defaultTimeout
     )
 {
     return(Create(
                access,
                fileName,
                ObjectFlags.CaseInsensitive,
                null,
                FileShareMode.ReadWrite,
                FileCreationDisposition.OpenIf,
                createOptions,
                type,
                type,
                PipeCompletionMode.Queue,
                maximumInstances,
                inboundQuota,
                outboundQuota,
                defaultTimeout
                ));
 }
        /// <summary>
        ///     Opens a pipe request with the other side of the tunnel.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        private PipeBase OpenPipe(PipeType type, UInt32 id = 0)
        {
            //the connecting party doesn't care about the pipe ID.
            if (id == 0)
            {
                id = BitConverter.ToUInt32(SodiumCore.GetRandomBytes(4), 0);
            }
            IHasSerializationTag c    = new CreateAnonymousPipe(type.ToString(), id);
            PipeBase             pipe = null;

            switch (type)
            {
            case PipeType.Control:
                throw new NotSupportedException(
                          "Cannot create a new control pipe where on a tunnel that already has a control pipe");

            case PipeType.Duplex:
                pipe = new DuplexPipe(this.mTunnel, id);
                break;

            default:
                throw new ArgumentOutOfRangeException("type");
            }
            this.requestedPipes.Add(id, pipe);
            EncryptedPacket packet = new EncryptedPacket(this.mTunnel.ID, this.ID);

            packet.RPCs.Add(c);
            this.mTunnel.EncryptAndSendPacket(packet);
            return(pipe);
        }
Exemple #5
0
        /// <summary>
        /// Create Xml from a PipeType
        /// </summary>
        /// <param name="pipeType"></param>
        /// <returns></returns>
        private static XElement CreateXmlFromPipeType(PipeType pipeType)
        {
            XElement xPipeType = new XElement(XName.Get("PipeType"));

            xPipeType.Add(new XAttribute(XName.Get("name"), pipeType.Name));
            return(xPipeType);
        }
        public async Task <IActionResult> GetOrganizationProjectServiceTemplates(Guid organizationId,
                                                                                 [FromQuery(Name = "cloudProviderType")] CloudProviderService cloudProviderType,
                                                                                 [FromQuery(Name = "pipeType")] PipeType pipeType)
        {
            if (!ModelState.IsValid)
            {
                return(this.BadRequest(ModelState));
            }

            var templates = await _organizationProjectServiceTemplateQueryService.GetOrganizationProjectServiceTemplates(organizationId, cloudProviderType, pipeType);

            if (_domainManagerService.HasNotFounds())
            {
                return(this.NotFound(_domainManagerService.GetForbidden()));
            }

            if (_domainManagerService.HasForbidden())
            {
                return(this.Forbidden(_domainManagerService.GetForbidden()));
            }

            if (_domainManagerService.HasConflicts())
            {
                return(this.Conflict(_domainManagerService.GetConflicts()));
            }

            return(this.Ok(templates));
        }
        public ActionResult Create(PipeType pipetype)
        {
            if (pipetype.FeatureID == 0)
            {
                ViewBag.FeatureID = new SelectList(db.Features, "FeatureID", "FeatureItem");
                return(View(pipetype));
            }
            if (pipetype.PipeTypeItem == null)
            {
                ModelState.AddModelError("PipeTypeItem", "Feature Type is required.");
                ViewBag.FeatureID = new SelectList(db.Features, "FeatureID", "FeatureItem");
                return(View(pipetype));
            }

            if (ModelState.IsValid)
            {
                db.PipeTypes.Add(pipetype);
                db.SaveChanges();
                if (Insert_CodeLookUp_Audit("Feature Type", "Create", "", pipetype.PipeTypeItem))
                {
                    //nothing to do at this point.
                }
                return(RedirectToAction("Index"));
            }


            return(View(pipetype));
        }
    private void OnTriggerStay(Collider other)
    {
        if ((Type != BlockType.Empty && Type != BlockType.AlwaysEmpty) || PipeObject != null) return;

        bool straight = other.CompareTag("StraightPipe");
        bool corner = other.CompareTag("CornerPipe");
        if (straight || corner)
        {
            PuzzlePipe pipe = other.GetComponent<PuzzlePipe>();
            if (!pipe.Placed && !pipe.Grabbed)
            {
                PipeObject = other.gameObject;
                PipeObject.transform.position = transform.position;
                PipeObject.transform.forward = transform.forward;
                Grabber.Instance.Release();
                pipe.PlacePipe(this);

                if (straight)
                {
                    Pipe = PipeType.Straight;
                    FlowDir = Flow.LeftRight;
                    Sides = new List<Side>( new Side[] { Side.Left, Side.Right });
                }
                else if (corner)
                {
                    Pipe = PipeType.Corner;
                    FlowDir = Flow.UpRight;
                    Sides = new List<Side>( new Side[] { Side.Up, Side.Right });
                }
                RelatedPuzzle.CheckCompletion();

            }
        }
    }
Exemple #9
0
        private void SetLispPipeType(PipeType type)
        {
            integratedToolStripMenuItem.Checked = false;
            seperatedToolStripMenuItem.Checked  = false;

            if (lispPipe != null)
            {
                lispPipe.Close();
            }

            switch (type)
            {
            case PipeType.Seperated:
                seperatedToolStripMenuItem.Checked = true;
                lispPipe = new SeperatedLispPipe();
                break;

            default:
                integratedToolStripMenuItem.Checked = true;
                lispPipe = new IntegratedLispPipe();
                break;
            }

            lispPipe.LispPath = ConfigurationManager.LispPath;
            lispPipe.Configure(this.scintillaConfig.PipeScintillaConfiguration);
            lispPipe.Show(this.dockPanel1, DockState.DockBottom);
            StartLisp();

            ConfigurationManager.PipeType = type;
        }
        //
        // GET: /PipeType/Delete/5

        public ActionResult Delete(int id = 0)
        {
            var featuretypes = (from ft in db.PipeTypes
                                join f in db.Features on ft.FeatureID equals f.FeatureID
                                where ft.PipeTypeID == id
                                select new
            {
                PipeType = ft,
                Feature = f
            }).FirstOrDefault();

            ViewBag.SelectedFeatureID = new SelectList(db.Features, "FeatureID", "FeatureItem", featuretypes.Feature.FeatureID);

            PipeType pipetype = db.PipeTypes.Find(id);

            var pipefeatures = (from vf in db.ValveSectionFeatures
                                where vf.TypeID == pipetype.PipeTypeID
                                select new
            {
                vf
            }).ToList();


            if (pipefeatures.Count > 0)
            {
                ModelState.AddModelError("PipeTypeItem", "This Feature Type is assigned to Circuit feature(s) and cannot be deleted.");
                ViewBag.HasError = "True";
            }

            if (pipetype == null)
            {
                return(HttpNotFound());
            }
            return(View(pipetype));
        }
        private static Pipe CreateTee(Document doc, XYZ iP, string direction, Pipe selectedPipe, double size, string PipeTypeName)
        {
            PipeType pipeType = fi.GetElements <PipeType, BuiltInParameter>(doc, BuiltInParameter.SYMBOL_NAME_PARAM, PipeTypeName).FirstOrDefault();

            if (pipeType == null)
            {
                throw new Exception(PipeTypeName + " does not exist in current project!");
            }

            ElementId curLvlId           = selectedPipe.ReferenceLevel.Id;
            ElementId curPipingSysTypeId = selectedPipe.MEPSystem.GetTypeId();
            ElementId curPipeTypeId      = pipeType.Id;

            XYZ dirPoint = CreateDummyDirectionPoint(iP, direction);

            if (dirPoint == null)
            {
                return(null);
            }

            Pipe dummyPipe = Pipe.Create(doc, curPipingSysTypeId, curPipeTypeId, curLvlId, iP, dirPoint);

            //Change size of the pipe
            Parameter par = dummyPipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM);

            par.Set(size.MmToFt());

            //Find the connector from the dummy pipe at intersection
            //var cons = mp.GetALLConnectorsFromElements(dummyPipe);
            //Connector con = cons.Where(c => c.Origin.Equalz(iP, Extensions._1mmTol)).FirstOrDefault();

            return(dummyPipe);
        }
Exemple #12
0
        //Rotates the pipe one move
        public void Rotate()
        {
            switch (type)
            {
            case PipeType.pVert:
                type = PipeType.pHoriz;
                break;

            case PipeType.pHoriz:
                type = PipeType.pVert;
                break;

            case PipeType.pBottomLeftCorner:
                type = PipeType.pTopLeftCorner;
                break;

            case PipeType.pBottomRightCorner:
                type = PipeType.pBottomLeftCorner;
                break;

            case PipeType.pTopLeftCorner:
                type = PipeType.pTopRightCorner;
                break;

            case PipeType.pTopRightCorner:
                type = PipeType.pBottomRightCorner;
                break;
            }
        }
Exemple #13
0
            public static ProjectService Create(string name, string repositoryName, string description,
                                                Guid projectServiceTemplateId, PipeType pipeType, Guid projectId, Guid organizationCMSId, string agentPoolId, string createdby)
            {
                var entity = new ProjectService()
                {
                    OrganizationCMSId = organizationCMSId,
                    ProjectId         = projectId,
                    Name                     = name,
                    InternalName             = repositoryName,
                    Description              = description,
                    ProjectServiceTemplateId = projectServiceTemplateId,
                    PipeType                 = pipeType,
                    AgentPoolId              = agentPoolId,
                    CreatedBy                = createdby
                };

                var validationResult = new DataValidatorManager <ProjectService>().Build().Validate(entity);

                if (!validationResult.IsValid)
                {
                    throw new ApplicationException(validationResult.Errors);
                }

                //add activities
                entity.AddActivity(projectId, nameof(DomainConstants.Activities.PSPRRQ), DomainConstants.Activities.PSPRRQ);
                entity.AddActivity(projectId, nameof(DomainConstants.Activities.PSCRRP), DomainConstants.Activities.PSCRRP);
                entity.AddActivity(projectId, nameof(DomainConstants.Activities.PSCRBD), DomainConstants.Activities.PSCRBD);
                entity.AddActivity(projectId, nameof(DomainConstants.Activities.PSCRRD), DomainConstants.Activities.PSCRRD);
                entity.AddActivity(projectId, nameof(DomainConstants.Activities.PSQUDB), DomainConstants.Activities.PSQUDB);
                entity.AddActivity(projectId, nameof(DomainConstants.Activities.PSACBA), DomainConstants.Activities.PSACBA);

                return(entity);
            }
        public async Task <IActionResult> GetProjectServiceTemplates([FromQuery(Name = "gitProviderType")] ConfigurationManagementService gitProviderType,
                                                                     [FromQuery(Name = "cloudProviderType")] CloudProviderService cloudProviderType,
                                                                     [FromQuery(Name = "pipeType")] PipeType pipeType)
        {
            var serviceTemplates = await _projectServiceTemplateQueryService.GetProjectServiceTemplates(gitProviderType, cloudProviderType, pipeType);

            return(this.Ok(serviceTemplates));
        }
Exemple #15
0
 public override string CompInspectStringExtra()
 {
     if (DebugSettings.godMode)
     {
         return(PipeType.ToString() + "_ID:" + GasManager.PipeAt(parent.Position, PipeType));
     }
     return(null);
 }
Exemple #16
0
        public PuzzlePiece(Color color, PipeType pipeType)
        {
            this.color = color;
            this.type  = pipeType;

            initialColor = color;
            initialType  = type;
        }
Exemple #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pipe"/> class.
 /// </summary>
 /// <param name="identity">The identity.</param>
 /// <param name="pipeType">Type of the pipe.</param>
 /// <param name="title">The title.</param>
 public Pipe(Identity identity, PipeType pipeType, Title title = null)
 {
     Id    = identity;
     Title = title;
     Name  = new Name(Id.Value);
     Type  = pipeType;
     Href  = new Uri(string.Format(PIPE_URI_FORMAT, Globals.HostName, identity.Value));
 }
Exemple #18
0
 public void Reset()
 {
     ClientID      = "";
     TargetID      = "";
     Bounty        = 0;
     Progress      = 0.0f;
     TotalProgress = 0.0f;
     Pipe          = PipeType.NONE;
 }
Exemple #19
0
        public static string GetPipeKey(this string name, PipeType pipeType)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            return($"{name}/{pipeType}");
        }
    private void Swap(GameObject swappingPipe)
    {
        PipeType temp = swappingPipe.GetComponent <PipeBehavior>().pipeType;

        swappingPipe.GetComponent <PipeBehavior>().SetType(pipeToSwap.GetComponent <PipeBehavior>().pipeType);
        pipeToSwap.GetComponent <PipeBehavior>().SetType(temp);

        CheckPath();
    }
        /// <summary>
        /// 根据pipeType的name,获取对应的pipeType
        /// </summary>
        /// <param name="pipeTypeName"></param>
        /// <returns></returns>
        public PipeType SelectPipeType(string pipeTypeName)
        {
            FilteredElementCollector collector = new FilteredElementCollector(doc);
            PipeType pipeType = collector.OfClass(typeof(PipeType)).
                                Cast <PipeType>().
                                First(x => x.Name == pipeTypeName);

            return(pipeType);
        }
        public static NamedPipeHandle Create(
            FileAccess access,
            string fileName,
            ObjectFlags objectFlags,
            NativeHandle rootDirectory,
            FileShareMode shareMode,
            FileCreationDisposition creationDisposition,
            FileCreateOptions createOptions,
            PipeType type,
            PipeType readMode,
            PipeCompletionMode completionMode,
            int maximumInstances,
            int inboundQuota,
            int outboundQuota,
            long defaultTimeout
            )
        {
            NtStatus         status;
            ObjectAttributes oa = new ObjectAttributes(fileName, objectFlags, rootDirectory);
            IoStatusBlock    isb;
            IntPtr           handle;

            // If a timeout wasn't specified, use a default value.
            if (defaultTimeout == 0)
            {
                defaultTimeout = -50 * Win32.TimeMsTo100Ns; // 50 milliseconds
            }
            try
            {
                if ((status = Win32.NtCreateNamedPipeFile(
                         out handle,
                         access,
                         ref oa,
                         out isb,
                         shareMode,
                         creationDisposition,
                         createOptions,
                         type,
                         readMode,
                         completionMode,
                         maximumInstances,
                         inboundQuota,
                         outboundQuota,
                         ref defaultTimeout
                         )) >= NtStatus.Error)
                {
                    Win32.Throw(status);
                }
            }
            finally
            {
                oa.Dispose();
            }

            return(new NamedPipeHandle(handle, true));
        }
Exemple #23
0
    //this is the function thats spawns in pipes
    public GamePipe SpawnNewPipe(int x, int y, PipeType type)
    {
        GameObject newPipe = (GameObject)Instantiate(pipePrefabDict[type], GetWorldPosition(x, y), Quaternion.identity);

        newPipe.transform.parent = transform;
        newPipe.name             = "(" + x + ", " + y + ")";
        pipes[x, y] = newPipe.GetComponent <GamePipe>();
        pipes[x, y].Init(x, y, this, type);
        return(pipes[x, y]);
    }
Exemple #24
0
        public InterCommunication(string pipeName, PipeType pipeType)
        {
            _pipeName = pipeName;
            _pipeType = pipeType;

            var pipedServerThread = new Thread(Initialize);

            pipedServerThread.IsBackground = true;
            pipedServerThread.Start();
        }
Exemple #25
0
 public Pipe(string name, PipeType type, AsyncCallback callback)
 {
     if (type == PipeType.CLIENT)
     {
         stream = new System.IO.Pipes.NamedPipeClientStream(name);
     }
     else
     {
         stream = new System.IO.Pipes.NamedPipeServerStream(name, System.IO.Pipes.PipeDirection.InOut);
     }
 }
Exemple #26
0
 public void TryDestroyPipeNet(IntVec3 cell, PipeType matchingType)
 {
     if (cell.InBounds(map))
     {
         var pipeNet = PipeNetAt(cell);
         if (pipeNet != null && pipeNet.NetType == matchingType)
         {
             DeletePipeNet(pipeNet);
         }
     }
 }
Exemple #27
0
        /**public void SetSprite()
         * {
         *  if (pipeType == PipeType.TOP)
         *      choosenSprite = new Sprite("pipe_top");
         *  else
         *      choosenSprite = new Sprite("pipe_bot");
         * }**/

        // CONSTRUCTOR
        public Pipe(int x, int y, PipeType type)
            : base(x, y, GetSprite(type))
        {
            this.pipeType = type;
            this.timer    = 0;
            this.toDelete = false;
            this.isPassed = false;

            /**if (type == PipeType.BOT)
             *  this.sprite.SetOrientation(SpriteEffects.FlipVertically);**/
        }
Exemple #28
0
 /// <summary>
 /// Clear all routing preferences in a PipeType
 /// </summary>
 /// <param name="pipeType"></param>
 private static void ClearRoutingPreferenceRules(PipeType pipeType)
 {
     foreach (RoutingPreferenceRuleGroupType group in System.Enum.GetValues(typeof(RoutingPreferenceRuleGroupType)))
     {
         int ruleCount = pipeType.RoutingPreferenceManager.GetNumberOfRules(group);
         for (int index = 0; index != ruleCount; ++index)
         {
             pipeType.RoutingPreferenceManager.RemoveRule(group, 0);
         }
     }
 }
Exemple #29
0
        /// <summary>
        /// Greate a PipeType from xml
        /// </summary>
        /// <param name="pipetypeXElement"></param>
        private void ParsePipeTypeFromXml(XElement pipetypeXElement)
        {
            XAttribute xaName = pipetypeXElement.Attribute(XName.Get("name"));

            ElementId pipeTypeId = GetPipeTypeByName(xaName.Value);

            if (pipeTypeId == ElementId.InvalidElementId) //If the pipe type does not exist, create it.
            {
                PipeType newPipeType = m_pipeTypes.First().Duplicate(xaName.Value) as PipeType;
                ClearRoutingPreferenceRules(newPipeType);
            }
        }
        public static NamedPipeHandle Create(
            FileAccess access,
            string fileName,
            ObjectFlags objectFlags,
            NativeHandle rootDirectory,
            FileShareMode shareMode,
            FileCreationDisposition creationDisposition,
            FileCreateOptions createOptions,
            PipeType type,
            PipeType readMode,
            PipeCompletionMode completionMode,
            int maximumInstances,
            int inboundQuota,
            int outboundQuota,
            long defaultTimeout
            )
        {
            NtStatus status;
            ObjectAttributes oa = new ObjectAttributes(fileName, objectFlags, rootDirectory);
            IoStatusBlock isb;
            IntPtr handle;

            // If a timeout wasn't specified, use a default value.
            if (defaultTimeout == 0)
                defaultTimeout = -50 * Win32.TimeMsTo100Ns; // 50 milliseconds

            try
            {
                if ((status = Win32.NtCreateNamedPipeFile(
                    out handle,
                    access,
                    ref oa,
                    out isb,
                    shareMode,
                    creationDisposition,
                    createOptions,
                    type,
                    readMode,
                    completionMode,
                    maximumInstances,
                    inboundQuota,
                    outboundQuota,
                    ref defaultTimeout
                    )) >= NtStatus.Error)
                    Win32.Throw(status);
            }
            finally
            {
                oa.Dispose();
            }

            return new NamedPipeHandle(handle, true);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            PipeType pipetype = db.PipeTypes.Find(id);

            db.PipeTypes.Remove(pipetype);
            db.SaveChanges();
            if (Insert_CodeLookUp_Audit("Feature Type", "Delete", pipetype.PipeTypeItem, ""))
            {
                //nothing to do at this point.
            }
            return(RedirectToAction("Index"));
        }
Exemple #32
0
        /// <summary>
        /// Resolve one obstruction of Pipe.
        /// </summary>
        /// <param name="pipe">Pipe to resolve</param>
        /// <param name="section">One pipe's obstruction</param>
        private void Resolve(Pipe pipe, Section section)
        {
            // Find out a parallel line of pipe centerline, which can avoid the obstruction.
            Line offset = FindRoute(pipe, section);

            // Construct a section line according to the given section.
            Line sectionLine = Line.CreateBound(section.Start, section.End);

            // Construct two side lines, which can avoid the obstruction too.
            Line side1 = Line.CreateBound(sectionLine.GetEndPoint(0), offset.GetEndPoint(0));
            Line side2 = Line.CreateBound(offset.GetEndPoint(1), sectionLine.GetEndPoint(1));

            //
            // Create an "U" shape, which connected with three pipes and two elbows, to round the obstruction.
            //
            PipeType pipeType = pipe.PipeType;

            Autodesk.Revit.DB.XYZ start       = side1.GetEndPoint(0);
            Autodesk.Revit.DB.XYZ startOffset = offset.GetEndPoint(0);
            Autodesk.Revit.DB.XYZ endOffset   = offset.GetEndPoint(1);
            Autodesk.Revit.DB.XYZ end         = side2.GetEndPoint(1);

            var parameter = pipe.get_Parameter(BuiltInParameter.RBS_START_LEVEL_PARAM);
            var levelId   = parameter.AsElementId();
            // Create three side pipes of "U" shape.
            var  systemTypeId = m_pipingSystemType.Id;
            Pipe pipe1        = Pipe.Create(m_rvtDoc, systemTypeId, pipeType.Id, levelId, start, startOffset);
            Pipe pipe2        = Pipe.Create(m_rvtDoc, systemTypeId, pipeType.Id, levelId, startOffset, endOffset);
            Pipe pipe3        = Pipe.Create(m_rvtDoc, systemTypeId, pipeType.Id, levelId, endOffset, end);

            // Copy parameters from pipe to other three created pipes.
            CopyParameters(pipe, pipe1);
            CopyParameters(pipe, pipe2);
            CopyParameters(pipe, pipe3);

            // Add the created three pipes to current section.
            section.Pipes.Add(pipe1);
            section.Pipes.Add(pipe2);
            section.Pipes.Add(pipe3);

            // Create the first elbow to connect two neighbor pipes of "U" shape.
            Connector conn1 = FindConnector(pipe1, startOffset);
            Connector conn2 = FindConnector(pipe2, startOffset);

            m_rvtDoc.Create.NewElbowFitting(conn1, conn2);

            // Create the second elbow to connect another two neighbor pipes of "U" shape.
            Connector conn3 = FindConnector(pipe2, endOffset);
            Connector conn4 = FindConnector(pipe3, endOffset);

            m_rvtDoc.Create.NewElbowFitting(conn3, conn4);
        }
        private void Stream(ArrayList data, PipeType pipeType)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(PipeType)));

             data.Add(new Snoop.Data.Object("Class", pipeType.Class));
        }
Exemple #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pipe"/> class.
 /// </summary>
 /// <param name="identity">The identity.</param>
 /// <param name="pipeType">Type of the pipe.</param>
 /// <param name="title">The title.</param>
 public Pipe(Identity identity, PipeType pipeType, Title title = null)
 {
     Id = identity;
     Title = title;
     Name = new Name(Id.Value);
     Type = pipeType;
     Href = new Uri(string.Format(PIPE_URI_FORMAT, Globals.HostName, identity.Value));
 }