コード例 #1
0
 public override void GCode_GenerateCode(ref string strDefinitionSegment, ref string strSegment, int nLayer, CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
 {
     if (InputLink.HasLink)
     {
         InputLink.GetLinkedObject(0, true).GCode_GenerateCode(ref strDefinitionSegment, ref strSegment, nLayer, element, context);
     }
 }
コード例 #2
0
        public override string GCode_GetTypeString(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (InputLink.HasLink)
            {
                return(InputLink.GetLinkedObject(0, true).GCode_GetTypeString(InputLink.GetLinkedPinControl(0, true), context));
            }

            return(base.GCode_GetTypeString(element, context));
        }
コード例 #3
0
        public override string GCode_GetValueName(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (InputLink.HasLink)
            {
                string strInputValueName = InputLink.GetLinkedObject(0, true).GCode_GetValueName(InputLink.GetLinkedPinControl(0, true), context);
                return("abs(" + strInputValueName + ")");
            }

            return(base.GCode_GetValueName(element, context));
        }
コード例 #4
0
ファイル: SequenceObjects.cs プロジェクト: Dybuk/ME3Explorer
        public void AddInputLink()
        {
            int count = InLinks.Count;
            InputLink l = new InputLink();
            l.node = PPath.CreateRectangle(0, -4, 10, 8);
            l.node.Brush = outputBrush;
            l.node.MouseEnter += new PInputEventHandler(OnMouseEnter);
            l.node.MouseLeave += new PInputEventHandler(OnMouseLeave);
            l.node.AddInputEventListener(new InputDragHandler());
            l.Desc = ":" + count;
            l.index = count;
            l.hasName = false;
            InLinks.Add(l);

            SText t2 = new SText(InLinks[count].Desc);
            t2.X = 0;
            if (count > 0)
            {
                t2.Y = InLinks[count - 1].node.Y + t2.Height;
                box.Height += t2.Height;
                bounds.Height += t2.Height;
                varLinkBox.TranslateBy(0, t2.Height);
            }
            else
            {
                t2.Y = 8;
                if (Outlinks.Count == 0)
                {
                    box.Height += t2.Height;
                    bounds.Height += t2.Height;
                    varLinkBox.TranslateBy(0, t2.Height);
                }
            }
            t2.Pickable = false;
            InLinks[count].node.X = -10;
            InLinks[count].node.Y = t2.Y + t2.Height / 2 - 5;
            t2.AddChild(InLinks[count].node);
            inputLinkBox.AddChild(t2);
            InvalidatePaint();
        }
コード例 #5
0
        internal static string ReadCommand(IModuleManager moduleManager)
        {
            var index        = 0;
            var input        = string.Empty;
            var autoComplete = string.Empty;

            var currentLink = _headInput;

            var reading = true;

            while (reading)
            {
                var newChar    = char.MinValue;
                var pressedKey = Console.ReadKey(true);
                switch (pressedKey.Key)
                {
                case ConsoleKey.UpArrow:
                    RemoveChars(input.Length);
                    currentLink = currentLink.Previous;
                    input       = currentLink.Input;
                    Console.Write(input);
                    break;

                case ConsoleKey.DownArrow:
                    RemoveChars(input.Length);
                    currentLink = currentLink.Next;
                    input       = currentLink.Input;
                    Console.Write(input);
                    break;

                case ConsoleKey.Backspace:
                    if (string.IsNullOrEmpty(input))
                    {
                        break;
                    }
                    if (string.IsNullOrEmpty(autoComplete))
                    {
                        RemoveChars(1);
                        input = input.Substring(0, input.Length - 1);
                    }
                    else
                    {
                        RemoveChars(autoComplete.Length);
                        autoComplete = string.Empty;
                    }
                    break;

                case ConsoleKey.Spacebar:
                    input       += autoComplete;
                    autoComplete = string.Empty;
                    newChar      = ' ';
                    break;

                case ConsoleKey.Tab:
                    // Get matches for current input
                    var current = input.Split(' ').Last();
                    var matches = MatchingNames(moduleManager, current);
                    if (!matches.Any())
                    {
                        break;
                    }

                    // Iterate through matches
                    if (index >= matches.Count)
                    {
                        index = 0;
                    }
                    var match = matches.ElementAt(index++);

                    // Move cursor to real position
                    RemoveChars(autoComplete.Length);
                    autoComplete = match.Remove(0, current.Length);
                    Console.Write(autoComplete);
                    break;

                case ConsoleKey.Enter:
                    if (!string.IsNullOrEmpty(autoComplete))
                    {
                        input += autoComplete;
                    }
                    reading = false;
                    break;

                default:
                    newChar = pressedKey.KeyChar;
                    index   = 0;
                    break;
                }
                if (newChar == char.MinValue)
                {
                    continue;
                }

                input += newChar;
                Console.Write(newChar);
            }
            Console.WriteLine();

            if (string.IsNullOrEmpty(input) || _headInput.Previous.Input == input)
            {
                return(input);
            }

            // Insert link into circular linked list
            var currentPrevious = _headInput.Previous;
            var newLink         = new InputLink(input)
            {
                Previous = currentPrevious,
                Next     = _headInput
            };

            currentPrevious.Next = newLink;
            _headInput.Previous  = newLink;
            return(input);
        }
コード例 #6
0
ファイル: SequenceObjects.cs プロジェクト: Dybuk/ME3Explorer
 private void GetInputLinks()
 {
     InLinks = new List<InputLink>();
     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 == "InputLinks")
         {
             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);
             InputLink l = new InputLink();
             l.Desc = p2[0].Value.StringValue;
             l.hasName = true;
             l.index = j;
             l.node = PPath.CreateRectangle(0, -4, 10, 8);
             l.node.Brush = outputBrush;
             l.node.MouseEnter += new PInputEventHandler(OnMouseEnter);
             l.node.MouseLeave += new PInputEventHandler(OnMouseLeave);
             l.node.AddInputEventListener(new InputDragHandler());
             InLinks.Add(l);
             for (int i = 0; i < p2.Count(); i++)
                 pos += p2[i].raw.Length;
         }
     }
     if(this.Tag != null)
     {
         int numInputs = InLinks.Count;
         int inputNum;
         foreach(PPath edge in ((ArrayList)this.Tag))
         {
             inputNum = (int)((ArrayList)edge.Tag)[2];
             if (inputNum + 1 > numInputs)
             {
                 for (int i = numInputs; i <= inputNum; i++)
                 {
                     InputLink l = new InputLink();
                     l.node = PPath.CreateRectangle(0, -4, 10, 8);
                     l.node.Brush = outputBrush;
                     l.node.MouseEnter += new PInputEventHandler(OnMouseEnter);
                     l.node.MouseLeave += new PInputEventHandler(OnMouseLeave);
                     l.node.AddInputEventListener(new InputDragHandler());
                     l.Desc = ":" + i;
                     l.hasName = false;
                     l.index = i;
                     InLinks.Add(l);
                 }
                 numInputs = inputNum + 1;
             }
             if(inputNum >= 0)
                 ((ArrayList)edge.Tag)[1] = InLinks[inputNum].node;
         }
     }
 }
コード例 #7
0
ファイル: AmqpTransportChannel.cs プロジェクト: tonyli71/qpid
        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;
            }
        }
コード例 #8
0
 private void GetInputLinks()
 {
     InLinks = new List<InputLink>();
     var inputLinksProp = export.GetProperty<ArrayProperty<StructProperty>>("InputLinks");
     if (export.ClassName == "SequenceReference")
     {
         var oSequenceReference = export.GetProperty<ObjectProperty>("oSequenceReference");
         if (oSequenceReference != null)
         {
             inputLinksProp = pcc.getExport(oSequenceReference.Value - 1).GetProperty<ArrayProperty<StructProperty>>("InputLinks");
         }
     }
     if (inputLinksProp != null)
     {
         for (int i = 0; i < inputLinksProp.Count; i++)
         {
             InputLink l = new InputLink();
             l.Desc = inputLinksProp[i].GetProp<StrProperty>("LinkDesc");
             l.hasName = true;
             l.index = i;
             l.node = PPath.CreateRectangle(0, -4, 10, 8);
             l.node.Brush = outputBrush;
             l.node.MouseEnter += OnMouseEnter;
             l.node.MouseLeave += OnMouseLeave;
             l.node.AddInputEventListener(new InputDragHandler());
             InLinks.Add(l);
         }
     }
     else if (pcc.Game == MEGame.ME3)
     {
         try
         {
             List<string> inputLinks = ME3UnrealObjectInfo.getSequenceObjectInfo(export.ClassName)?.inputLinks;
             if (inputLinks != null)
             {
                 for (int i = 0; i < inputLinks.Count; i++)
                 {
                     InputLink l = new InputLink();
                     l.Desc = inputLinks[i];
                     l.hasName = true;
                     l.index = i;
                     l.node = PPath.CreateRectangle(0, -4, 10, 8);
                     l.node.Brush = outputBrush;
                     l.node.MouseEnter += OnMouseEnter;
                     l.node.MouseLeave += OnMouseLeave;
                     l.node.AddInputEventListener(new InputDragHandler());
                     InLinks.Add(l);
                 }
             }
         }
         catch (Exception)
         {
             InLinks.Clear();
         }
     }
     if(this.Tag != null)
     {
         int numInputs = InLinks.Count;
         int inputNum;
         foreach(PPath edge in ((ArrayList)this.Tag))
         {
             inputNum = (int)((ArrayList)edge.Tag)[2];
             //if there are inputs with an index greater than is accounted for by
             //the current number of inputs, create enough inputs to fill up to that index
             if (inputNum + 1 > numInputs)
             {
                 for (int i = numInputs; i <= inputNum; i++)
                 {
                     InputLink l = new InputLink();
                     l.node = PPath.CreateRectangle(0, -4, 10, 8);
                     l.node.Brush = outputBrush;
                     l.node.MouseEnter += OnMouseEnter;
                     l.node.MouseLeave += OnMouseLeave;
                     l.node.AddInputEventListener(new InputDragHandler());
                     l.Desc = ":" + i;
                     l.hasName = false;
                     l.index = i;
                     InLinks.Add(l);
                 }
                 numInputs = inputNum + 1;
             }
             if(inputNum >= 0)
                 ((ArrayList)edge.Tag)[1] = InLinks[inputNum].node;
         }
     }
 }