/// <summary>
            /// 释放 TCP 服务端套接字输出信息
            /// </summary>
            /// <returns></returns>
            internal override OutputLink TryFreeBuildQueue()
            {
                OutputLink next = LinkNext;

                LinkNext = null;
                return(next);
            }
 public async Task <ActionResult> Details(OutputLink outputLink)
 {
     if (outputLink == null)
     {
         return(HttpNotFound());
     }
     return(PartialView(outputLink));
 }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            OutputLink outputLink = await db.OutputLinks.FindAsync(id);

            db.OutputLinks.Remove(outputLink);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index", "UserSelections"));
        }
        public async Task <ActionResult> Edit([Bind(Include = "Id,Link,UserSelectionId")] OutputLink outputLink)
        {
            if (ModelState.IsValid)
            {
                db.Entry(outputLink).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.UserSelectionId = new SelectList(db.UserSelections, "Id", "UserId", outputLink.UserSelectionId);
            return(View(outputLink));
        }
Beispiel #5
0
        protected void GetOutputLinks()
        {
            Outlinks = new List <OutputLink>();

            OutputLink l = new OutputLink();

            l.Link = new Tuple <char, int>('s', conv.StartingList[index]);
            l.Desc = Convert.ToString(l.Link);
            l.node = PPath.CreateRectangle(-4, 0, 8, 10);
            //l.node.Brush = outputBrush;
            l.node.Pickable = false;
            Outlinks.Add(l);
        }
        // GET: OutputLinks/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OutputLink outputLink = await db.OutputLinks.FindAsync(id);

            if (outputLink == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(outputLink));
        }
        // GET: OutputLinks/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OutputLink outputLink = await db.OutputLinks.FindAsync(id);

            if (outputLink == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserSelectionId = new SelectList(db.UserSelections, "Id", "UserId", outputLink.UserSelectionId);
            return(View(outputLink));
        }
Beispiel #8
0
 public void RemoveOutlink(DiagEdEdge edge)
 {
     for (int i = 0; i < Outlinks.Count; i++)
     {
         OutputLink outLink = Outlinks[i];
         for (int j = 0; j < outLink.Edges.Count; j++)
         {
             DiagEdEdge DiagEdEdge = outLink.Edges[j];
             if (DiagEdEdge == edge)
             {
                 RemoveOutlink(i, j);
                 return;
             }
         }
     }
 }
        public async Task <ActionResult> Create([Bind(Include = "Id,Name,UserSelectionId")] OutputLink outputLink,
                                                List <string> selected)
        {
            if (ModelState.IsValid && selected.Count > 0)
            {
                GetCurrentUserInfo();
                GetUserSelection();

                try
                {
                    outputLink.Selected = string.Join(";", selected.ToArray());

                    var parser = new Parser(db);
                    var output = parser.SelectCategories(outputLink.SelectedLookup);

                    var file = parser.SaveFile(output);

                    outputLink.UserSelection = CurrentUserSelection;
                    outputLink.File          = file;
                    outputLink.Name          = outputLink.Name.Contains("_") ? outputLink.Name.Replace("_", string.Empty) : outputLink.Name;
                    db.OutputLinks.Add(outputLink);

                    await db.SaveChangesAsync();//получаем для ссылки id

                    outputLink.Link            = this.Url.Action("Link", "OutputLinks", new { id = outputLink.Id + "_" + outputLink.Name }, Request.Url.Scheme);
                    db.Entry(outputLink).State = EntityState.Modified;
                    CurrentUserSelection.ExistingLinks.Add(outputLink);
                    await db.SaveChangesAsync();

                    return(PartialView("Details", outputLink));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }

            ViewBag.UserSelectionId = new SelectList(db.UserSelections, "Id", "UserId", outputLink.UserSelectionId);
            return(HttpNotFound());
        }
Beispiel #10
0
        protected void GetOutputLinks()
        {
            Outlinks = new List<OutputLink>();
            byte[] buff = pcc.Exports[index].Data;
            List<SaltPropertyReader.Property> p = SaltPropertyReader.getPropList(pcc, buff);
            int f = -1;
            for (int i = 0; i < p.Count(); i++)
                if (p[i].Name == "OutputLinks")
                {
                    f = i;
                    break;
                }
            if (f != -1)
            {
                int pos = 28;
                byte[] global = p[f].raw;
                BitConverter.IsLittleEndian = true;
                int count = BitConverter.ToInt32(global, 24);
                for (int j = 0; j < count; j++)
                {
                    List<SaltPropertyReader.Property> p2 = SaltPropertyReader.ReadProp(pcc, global, pos);
                    for (int i = 0; i < p2.Count(); i++)
                    {
                        pos += p2[i].raw.Length;
                        string nm = p2[i].Name;
                        if (nm == "Links")
                        {
                            int count2 = BitConverter.ToInt32(p2[i].raw, 24);
                            if (count2 != 0)
                            {
                                OutputLink l = new OutputLink();
                                l.Links = new List<int>();
                                l.InputIndices = new List<int>();
                                l.offsets = new List<int>();
                                l.Desc = p2[i + 1].Value.StringValue;
                                if (l.Desc.EndsWith("\0"))
                                    l.Desc = l.Desc.Substring(0, l.Desc.Length - 1);
                                for (int k = 0; k < count2; k += 1)
                                {
                                    List<SaltPropertyReader.Property> p3 = SaltPropertyReader.ReadProp(pcc, p2[i].raw, 28 + k * 64);
                                    l.Links.Add(p3[0].Value.IntValue - 1);
                                    l.InputIndices.Add(p3[1].Value.IntValue);
                                    l.offsets.Add(pos + p3[0].offsetval - p2[i].raw.Length);
                                    if(OutputNumbers)
                                        l.Desc = l.Desc + (k > 0 ? "," : ": ") + "#" + (p3[0].Value.IntValue - 1);
                                }
                                l.node = PPath.CreateRectangle(0, -4, 10, 8);
                                l.node.Brush = outputBrush;
                                l.node.Pickable = false;
                                l.node.AddChild(PPath.CreateRectangle(0, -4, 10, 8));
                                l.node[0].Brush = new SolidBrush(Color.FromArgb(1,255,255,255));
                                l.node[0].X = l.node.X;
                                l.node[0].Y = l.node.Y;
                                l.node[0].AddInputEventListener(new OutputDragHandler());
                                Outlinks.Add(l);
                            }
                            else
                            {
                                OutputLink l = new OutputLink();
                                l.Links = new List<int>();
                                l.InputIndices = new List<int>();
                                l.offsets = new List<int>();
                                l.Desc = p2[i + 1].Value.StringValue;
                                l.Links.Add(-1);
                                l.InputIndices.Add(0);
                                if (l.Desc.EndsWith("\0"))
                                    l.Desc = l.Desc.Substring(0, l.Desc.Length - 1);
                                if (OutputNumbers)
                                    l.Desc = l.Desc + ": #-1";
                                l.offsets.Add(-1);
                                l.node = PPath.CreateRectangle(0, -4, 10, 8);
                                l.node.Brush = outputBrush;
                                l.node.Pickable = false;
                                l.node.AddChild(PPath.CreateRectangle(0, -4, 10, 8));
                                l.node[0].Brush = new SolidBrush(Color.FromArgb(1, 255, 255, 255));
                                l.node[0].X = l.node.X;
                                l.node[0].Y = l.node.Y;
                                l.node[0].AddInputEventListener(new OutputDragHandler());
                                Outlinks.Add(l);
                            }

                        }
                    }
                }
            }
        }
Beispiel #11
0
        public void CreateOutlink(PNode n1, PNode n2)
        {
            SBox start = (SBox)n1.Parent.Parent.Parent;
            SAction end = (SAction)n2.Parent.Parent.Parent;
            byte[] buff = this.pcc.Exports[start.Index].Data;
            List<byte> ListBuff = new List<byte>(buff);
            OutputLink link = new OutputLink();
            bool firstLink = false;
            foreach (OutputLink l in start.Outlinks)
            {
                if (l.node == n1)
                {
                    if (l.Links.Contains(end.Index))
                        return;
                    if (l.Links[0] == -1)
                    {
                        firstLink = true;
                        l.Links.RemoveAt(0);
                        l.offsets.RemoveAt(0);
                        l.InputIndices.RemoveAt(0);
                    }
                    else
                    {
                        l.offsets.Add(l.offsets[l.offsets.Count - 1] + 64);
                    }
                    l.Links.Add(end.Index);
                    link = l;
                    break;
                }
            }
            if (link.Links == null)
                return;
            int inputIndex = -1;
            foreach (InputLink l in end.InLinks)
            {
                if (l.node == n2)
                {
                    inputIndex = l.index;
                    link.InputIndices.Add(inputIndex);
                }
            }
            if (inputIndex == -1)
                return;
            BitConverter.IsLittleEndian = true;
            List<SaltPropertyReader.Property> p = SaltPropertyReader.getPropList(pcc, buff);
            int f = -1;
            for (int i = 0; i < p.Count(); i++)
            {
                if (p[i].Name == "OutputLinks")
                {

                    byte[] sizebuff = BitConverter.GetBytes(BitConverter.ToInt32(p[i].raw, 16) + 64);
                    for (int j = 0; j < 4; j++)
                    {
                        ListBuff[p[i].offsetval - 8 + j] = sizebuff[j];
                    }
                    f = i;
                    break;
                }
            }
            if (f != -1)
            {
                int pos = 28;
                byte[] global = p[f].raw;
                int count = BitConverter.ToInt32(global, 24);
                for (int j = 0; j < count; j++)
                {
                    List<SaltPropertyReader.Property> p2 = SaltPropertyReader.ReadProp(pcc, global, pos);
                    for (int i = 0; i < p2.Count(); i++)
                    {
                        if (p2[i].Name == "Links" && p2[i + 1].Value.StringValue + (p2[i + 1].Value.StringValue.Length == 0 ? "\0" : "" ) == (OutputNumbers ? link.Desc.Substring(0, link.Desc.LastIndexOf(":")) : link.Desc) + '\0')
                        {
                            if (firstLink)
                                link.offsets.Add(pos + 52);
                            int count2 = BitConverter.ToInt32(p2[i].raw, 24);
                            byte[] countbuff = BitConverter.GetBytes(count2 + 1);
                            byte[] sizebuff = BitConverter.GetBytes(BitConverter.ToInt32(p2[i].raw, 16) + 64);
                            for (int k = 0; k < 4; k++)
                            {
                                ListBuff[p[f].offsetval + pos + k] = countbuff[k];
                                ListBuff[p[f].offsetval + pos - 8 + k] = sizebuff[k];
                            }
                            MemoryStream m = new MemoryStream();
                            m.Write(BitConverter.GetBytes(pcc.findName("LinkedOp")), 0, 4); //name: LinkedOp
                            m.Write(BitConverter.GetBytes((int)0), 0, 4);
                            m.Write(BitConverter.GetBytes(pcc.findName("ObjectProperty")), 0, 4); //type: ObjectProperty
                            m.Write(BitConverter.GetBytes((int)0), 0, 4);
                            m.Write(BitConverter.GetBytes((int)4), 0, 4); //size
                            m.Write(BitConverter.GetBytes((int)0), 0, 4);
                            m.Write(BitConverter.GetBytes(end.Index + 1), 0, 4);//value
                            m.Write(BitConverter.GetBytes(pcc.findName("InputLinkIdx")), 0, 4); //name: InputLinkIdx
                            m.Write(BitConverter.GetBytes((int)0), 0, 4);
                            m.Write(BitConverter.GetBytes(pcc.findName("IntProperty")), 0, 4); //type: IntProperty
                            m.Write(BitConverter.GetBytes((int)0), 0, 4);
                            m.Write(BitConverter.GetBytes((int)4), 0, 4); //size
                            m.Write(BitConverter.GetBytes((int)0), 0, 4);
                            m.Write(BitConverter.GetBytes(inputIndex), 0, 4);//value
                            m.Write(BitConverter.GetBytes(pcc.findName("None")), 0, 4); //name: None
                            m.Write(BitConverter.GetBytes((int)0), 0, 4);
                            ListBuff.InsertRange(p[f].offsetval + pos + 4 + count2 * 64, m.ToArray());
                            pcc.Exports[start.Index].Data = ListBuff.ToArray();
                            j = count; //break outer loop
                            break;
                        }
                        pos += p2[i].raw.Length;
                    }
                }
            }
            refreshView();
        }
Beispiel #12
0
        public DStart(DialogueEditorWPF editor, int orderKey, int StartNbr, float x, float y, ConvGraphEditor ConvGraphEditor)
            : base(ConvGraphEditor)
        {
            NodeUID = 2000 + StartNbr;
            Editor  = editor;
            Order   = orderKey;
            string ordinal = DialogueEditorWPF.AddOrdinal(orderKey + 1);

            StartNumber = StartNbr;
            outlinePen  = new Pen(EventColor);
            listname    = $"{ordinal} Start Node: {StartNbr}";;

            float starty = 0;
            float w      = 15;
            float midW   = 50;

            GetTitleBox(listname, 20);

            w += titleBox.Width;
            OutputLink l = new OutputLink
            {
                Links        = new List <int>(StartNbr),
                InputIndices = new int(),
                Edges        = new List <DiagEdEdge>(),
                Desc         = $"Out {StartNbr}",
                RCat         = EReplyCategory.REPLY_CATEGORY_DEFAULT
            };
            int linkedOp = StartNbr;

            l.Links.Add(linkedOp);
            l.InputIndices  = 0;
            l.node          = CreateActionLinkBox();
            l.node.Brush    = outputBrush;
            l.node.Pickable = false;

            PPath dragger = CreateActionLinkBox();

            dragger.Brush = mostlyTransparentBrush;
            dragger.X     = l.node.X;
            dragger.Y     = l.node.Y;
            dragger.AddInputEventListener(outputDragHandler);
            l.node.AddChild(dragger);
            Outlinks.Add(l);
            outLinkBox = new PPath();
            DText t2 = new DText($"{StartNbr} :");

            if (t2.Width + 10 > midW)
            {
                midW = t2.Width + 10;
            }
            t2.X        = 0 - t2.Width;
            t2.Y        = starty - 10;
            t2.Pickable = false;
            t2.AddChild(l.node);
            outLinkBox.AddChild(t2);
            outLinkBox.AddPolygon(new[] { new PointF(0, 0), new PointF(0, starty), new PointF(-0.5f * midW, starty + 30), new PointF(0 - midW, starty), new PointF(0 - midW, 0), new PointF(midW / -2, -30) });
            outLinkBox.Pickable = false;
            outLinkBox.Pen      = outlinePen;
            outLinkBox.Brush    = nodeBrush;
            float h = titleBox.Height + 1;

            outLinkBox.TranslateBy(titleBox.Width / 2 + midW / 2, h + 30);

            h     += outLinkBox.Height + 1;
            bounds = new RectangleF(0, 0, w, h);
            AddChild(titleBox);
            AddChild(outLinkBox);
            Pickable = true;
            SetOffset(x, y);
            MouseEnter += OnMouseEnter;
            MouseLeave += OnMouseLeave;
        }
Beispiel #13
0
        internal AmqpTransportChannel(ChannelManagerBase factory, AmqpChannelProperties channelProperties, EndpointAddress remoteAddress, MessageEncoder msgEncoder, long maxBufferPoolSize, bool sharedConnection, int prefetchLimit)
            : base(factory)
        {
            this.isInputChannel = (factory is ChannelListenerBase) || (factory is AmqpChannelFactory <IInputChannel>);

            if (remoteAddress == null)
            {
                throw new ArgumentException("Null Endpoint Address");
            }

            this.factoryChannelProperties = channelProperties;
            this.shared        = sharedConnection;
            this.prefetchLimit = prefetchLimit;
            this.remoteAddress = remoteAddress;

            // pull out host, port, queue, and connection arguments
            string qpidAddress = this.UriToQpidAddress(remoteAddress.Uri, out subject);

            this.encoder = msgEncoder;
            string ct = String.Empty;

            if (this.encoder != null)
            {
                ct = this.encoder.ContentType;
                if (ct != null)
                {
                    int pos = ct.IndexOf(';');
                    if (pos != -1)
                    {
                        ct = ct.Substring(0, pos).Trim();
                    }
                }
                else
                {
                    ct = "application/octet-stream";
                }
            }

            this.encoderContentType = ct;

            if (this.factoryChannelProperties.TransferMode == TransferMode.Streamed)
            {
                this.streamed = true;
            }
            else
            {
                if (!(this.factoryChannelProperties.TransferMode == TransferMode.Buffered))
                {
                    throw new ArgumentException("TransferMode mode must be \"Streamed\" or \"Buffered\"");
                }

                this.streamed = false;
            }

            this.bufferManager = BufferManager.CreateBufferManager(maxBufferPoolSize, int.MaxValue);

            this.asyncOpenCaller  = new AsyncTimeSpanCaller(this.OnOpen);
            this.asyncCloseCaller = new AsyncTimeSpanCaller(this.OnClose);

            if (this.isInputChannel)
            {
                this.inputLink = ConnectionManager.GetInputLink(this.factoryChannelProperties, shared, false, qpidAddress);
                this.inputLink.PrefetchLimit = this.prefetchLimit;
            }
            else
            {
                this.outputLink  = ConnectionManager.GetOutputLink(this.factoryChannelProperties, shared, false, qpidAddress);
                this.subject     = this.outputLink.DefaultSubject;
                this.qpidSubject = this.outputLink.QpidSubject;
            }
        }
        protected void GetOutputLinks()
        {
            Outlinks = new List<OutputLink>();

            OutputLink l = new OutputLink();
            l.Link = new Tuple<char, int>('s', conv.StartingList[index]);
            l.Desc = Convert.ToString(l.Link);
            l.node = PPath.CreateRectangle(-4, 0, 8, 10);
            //l.node.Brush = outputBrush;
            l.node.Pickable = false;
            Outlinks.Add(l);
        }
 protected void GetOutputLinks()
 {
     Outlinks = new List<OutputLink>();
     var outLinksProp = export.GetProperty<ArrayProperty<StructProperty>>("OutputLinks");
     if (outLinksProp != null)
     {
         foreach (var prop in outLinksProp)
         {
             PropertyCollection props = prop.Properties;
             var linksProp = props.GetProp<ArrayProperty<StructProperty>>("Links");
             if (linksProp != null)
             {
                 OutputLink l = new OutputLink();
                 l.Links = new List<int>();
                 l.InputIndices = new List<int>();
                 l.Desc = props.GetProp<StrProperty>("LinkDesc");
                 if (linksProp.Count != 0)
                 {
                     for (int i = 0; i < linksProp.Count; i += 1)
                     {
                         int linkedOp = linksProp[i].GetProp<ObjectProperty>("LinkedOp").Value - 1;
                         l.Links.Add(linkedOp);
                         l.InputIndices.Add(linksProp[i].GetProp<IntProperty>("InputLinkIdx"));
                         if (OutputNumbers)
                             l.Desc = l.Desc + (i > 0 ? "," : ": ") + "#" + (linkedOp);
                     }
                 }
                 else
                 {
                     l.Links.Add(-1);
                     l.InputIndices.Add(0);
                     if (OutputNumbers)
                         l.Desc = l.Desc + ": #-1";
                 }
                 l.node = PPath.CreateRectangle(0, -4, 10, 8);
                 l.node.Brush = outputBrush;
                 l.node.Pickable = false;
                 l.node.AddChild(PPath.CreateRectangle(0, -4, 10, 8));
                 l.node[0].Brush = mostlyTransparentBrush;
                 l.node[0].X = l.node.X;
                 l.node[0].Y = l.node.Y;
                 l.node[0].AddInputEventListener(new OutputDragHandler());
                 Outlinks.Add(l);
             }
         }
     }
 }