コード例 #1
0
ファイル: DataListTO.cs プロジェクト: won21kr/Warewolf
        void MapForInputOutput(XElement rootEl)
        {
            if (rootEl == null)
            {
                return;
            }
            Inputs.AddRange(
                rootEl.Elements().Where(el =>
                {
                    var firstOrDefault = el.Attributes("ColumnIODirection").FirstOrDefault();
                    var removeCondition = firstOrDefault != null &&
                                          (firstOrDefault.Value == enDev2ColumnArgumentDirection.Input.ToString() ||
                                           firstOrDefault.Value == enDev2ColumnArgumentDirection.Both.ToString());
                    return removeCondition && !el.HasElements;
                }).Select(element => element.Name.ToString()));

            Outputs.AddRange(
                rootEl.Elements().Where(el =>
                {
                    var firstOrDefault = el.Attributes("ColumnIODirection").FirstOrDefault();
                    var removeCondition = firstOrDefault != null &&
                                          (firstOrDefault.Value == enDev2ColumnArgumentDirection.Output.ToString() ||
                                           firstOrDefault.Value == enDev2ColumnArgumentDirection.Both.ToString());
                    return removeCondition && !el.HasElements;
                }).Select(element => element.Name.ToString()));

            var xElements = rootEl.Elements().Where(el => el.HasElements);
            var enumerable = xElements as IList<XElement> ?? xElements.ToList();
            Inputs.AddRange(enumerable.Elements().Select(element =>
            {
                var xAttribute = element.Attributes("ColumnIODirection").FirstOrDefault();
                var include = xAttribute != null &&
                              (xAttribute.Value == enDev2ColumnArgumentDirection.Input.ToString() ||
                               xAttribute.Value == enDev2ColumnArgumentDirection.Both.ToString());
                if (include)
                {
                    if (element.Parent != null)
                    {
                        return DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(element.Parent.Name.ToString(), element.Name.ToString(), "*"));
                    }
                }
                return "";
            }));

            Outputs.AddRange(enumerable.Elements().Select(element =>
            {
                var xAttribute = element.Attributes("ColumnIODirection").FirstOrDefault();
                var include = xAttribute != null &&
                              (xAttribute.Value == enDev2ColumnArgumentDirection.Output.ToString() ||
                               xAttribute.Value == enDev2ColumnArgumentDirection.Both.ToString());
                if (include)
                {
                    if (element.Parent != null)
                    {
                        return DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(element.Parent.Name.ToString(), element.Name.ToString(), "*"));
                    }
                }
                return "";
            }));
        }
コード例 #2
0
ファイル: DataListTO.cs プロジェクト: kapiya/Warewolf
        private void SetInputAttributesContainingColumnIoDirectionAndIsJson(XElement rootEl)
        {
            var inputs = rootEl.Elements()
                         .Where(el =>
            {
                var ioDirection     = el.Attributes("ColumnIODirection").FirstOrDefault();
                var isJsonAttribute = el.Attribute("IsJson");
                var isJson          = false;
                if (isJsonAttribute != null)
                {
                    isJson = isJsonAttribute.Value.ToLower() == "true";
                }
                var removeCondition = ioDirection != null &&
                                      (ioDirection.Value == enDev2ColumnArgumentDirection.Input.ToString() ||
                                       ioDirection.Value == enDev2ColumnArgumentDirection.Both.ToString());
                return(removeCondition && (!el.HasElements || isJson));
            })
                         .Select(element =>
            {
                var name = element.Name.ToString();
                return(name);
            });

            Inputs.AddRange(inputs);
        }
コード例 #3
0
        public CodeSample(string title, string className, string methodName, string descriptionKey, Input [] inputs = null)
        {
            Title       = title;
            ClassName   = className;
            MethodName  = methodName;
            Description = "Code Sample Description";

            if (inputs != null)
            {
                Inputs.AddRange(inputs);
            }
        }
コード例 #4
0
        public ExtIOSet(string name, List <byte> inputs, List <byte> outputs)
        {
            if (inputs == null)
            {
                inputs = new List <byte>();
            }
            if (outputs == null)
            {
                outputs = new List <byte>();
            }

            Name = name;
            Inputs.AddRange(inputs);
            Outputs.AddRange(outputs);
        }
コード例 #5
0
ファイル: DataListTO.cs プロジェクト: won21kr/Warewolf
 void Map(XElement rootEl)
 {
     if (rootEl == null)
     {
         return;
     }
     Inputs.AddRange(rootEl.Elements().Where(element => !element.HasElements).Select(element => element.Name.ToString()));
     var xElements = rootEl.Elements().Where(el => el.HasElements);
     var enumerable = xElements as IList<XElement> ?? xElements.ToList();
     Inputs.AddRange(enumerable.Elements().Select(element =>
     {
         if (element.Parent != null)
         {
             return DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(element.Parent.Name.ToString(), element.Name.ToString(), "*"));
         }
         return "";
     }));
 }
コード例 #6
0
ファイル: DataListTO.cs プロジェクト: kapiya/Warewolf
        private void SetInputAttributesContainingColumnIoDirection(IList <XElement> enumerable)
        {
            Inputs.AddRange(enumerable.Elements()
                            .Select(element =>
            {
                var xAttribute = element.Attributes("ColumnIODirection").FirstOrDefault();
                var include    = xAttribute != null &&
                                 (xAttribute.Value == enDev2ColumnArgumentDirection.Input.ToString() ||
                                  xAttribute.Value == enDev2ColumnArgumentDirection.Both.ToString());
                if (include && element.Parent != null)
                {
                    return(DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(element.Parent.Name.ToString(), element.Name.ToString(), "*")));
                }

                return("");
            })
                            .Where(o => !string.IsNullOrEmpty(o)));
        }
コード例 #7
0
        public MenuDropdown(int Xpostion, int Ypostion, List <MenuItem> menuItems, Window parentWindow)
            : base(Xpostion, Ypostion, 20, menuItems.Count() + 2, parentWindow)
        {
            for (var i = 0; i < menuItems.Count(); i++)
            {
                menuItems[i].ParentWindow = this;
                menuItems[i].Width        = this.Width - 2;
                menuItems[i].Xpostion     = Xpostion + i + 1;
                menuItems[i].Ypostion     = this.PostionY + 1;
            }

            MenuItems = menuItems;


            Inputs.AddRange(MenuItems);

            CurrentlySelected = MenuItems.FirstOrDefault();

            BackgroundColour = ConsoleColor.DarkGray;
            Draw();
            MainLoop();
        }
コード例 #8
0
        public DropdownSpread(int Xpostion, int Ypostion, List <String> options, Window parentWindow, Dropdown root)
            : base(Xpostion, Ypostion, 20, options.Count(), parentWindow)
        {
            for (var i = 0; i < options.Count(); i++)
            {
                var item = new DropdownItem(options[i], Xpostion + i, "option" + i, this);

                item.Action = delegate() {
                    root.Text = ((DropdownItem)CurrentlySelected).Text;
                    root.Draw();
                };

                DropdownItems.Add(item);
            }

            Inputs.AddRange(DropdownItems);

            CurrentlySelected = DropdownItems.FirstOrDefault(x => x.Text == root.Text);

            BackgroundColour = ConsoleColor.DarkGray;
            Draw();
            MainLoop();
        }
コード例 #9
0
        private void FromCurrentFormat(byte[] bytes, int offset = 0)
        {
            Signature = bytes.GetString(0, 2);
            Version   = bytes.ToByte(2);
            Length    = bytes.Length;

            offset += 3;
            int parts = 1;

            this.parentClass?.PassMessage(parts, $"PRG Header 1 - Offset {offset}");


            //Get all inputs
            Inputs.AddRange(GetArray(bytes,
                                     InputPoint.GetCount(FileVersion),
                                     InputPoint.GetSize(FileVersion), ref offset)
                            .Select(i => new InputPoint(i, 0, FileVersion)));

            parts += Inputs.Count;
            this.parentClass?.PassMessage(parts, $"InputPoints {Inputs.Count} - Offset {offset}");


            //Get all outputs
            Outputs.AddRange(GetArray(bytes,
                                      OutputPoint.GetCount(FileVersion),
                                      OutputPoint.GetSize(FileVersion), ref offset)
                             .Select(i => new OutputPoint(i, 0, FileVersion)));

            parts += Outputs.Count;
            this.parentClass?.PassMessage(parts, $"OutputPoints {Outputs.Count} - Offset {offset}");


            //Get all variables
            Variables.AddRange(GetArray(bytes,
                                        VariablePoint.GetCount(FileVersion),
                                        VariablePoint.GetSize(FileVersion), ref offset)
                               .Select(i => new VariablePoint(i, 0, FileVersion)));
            parts += Variables.Count;
            this.parentClass?.PassMessage(parts, $"VariablePoints {Variables.Count} - Offset {offset}");

            //Get all programs
            Programs.AddRange(GetArray(bytes,
                                       ProgramPoint.GetCount(FileVersion),
                                       ProgramPoint.GetSize(FileVersion), ref offset)
                              .Select(i => new ProgramPoint(i, 0, FileVersion)));

            parts += Programs.Count;
            this.parentClass?.PassMessage(parts, $"ProgramPoints {Programs.Count} - Offset {offset}");

            //Get all controllers
            Controllers.AddRange(GetArray(bytes,
                                          ControllerPoint.GetCount(FileVersion),
                                          ControllerPoint.GetSize(FileVersion), ref offset)
                                 .Select(i => new ControllerPoint(i, 0, FileVersion)));

            parts += Controllers.Count;
            this.parentClass?.PassMessage(parts, $"ControllerPoints {Controllers.Count} - Offset {offset}");

            //Get all screens
            Screens.AddRange(GetArray(bytes,
                                      ScreenPoint.GetCount(FileVersion),
                                      ScreenPoint.GetSize(FileVersion), ref offset)
                             .Select(i => new ScreenPoint(i, 0, FileVersion)));

            parts += Screens.Count;
            this.parentClass?.PassMessage(parts, $"ScreenPoints {Screens.Count} - Offset {offset}");

            //Get all graphics

            //TODO: NOT MINE: Constants to object static Size(FileVersion) Count(FileVersion)

            Graphics.AddRange(GetArray(bytes,
                                       GraphicPoint.GetCount(FileVersion),
                                       GraphicPoint.GetSize(FileVersion), ref offset)
                              .Select(i => new GraphicPoint(i, 0, FileVersion)));

            parts += Graphics.Count;
            this.parentClass?.PassMessage(parts, $"GraphicPoints {Graphics.Count} - Offset {offset}");

            Users.AddRange(GetArray(bytes,
                                    UserPoint.GetCount(FileVersion),
                                    UserPoint.GetSize(FileVersion), ref offset)
                           .Select(i => new UserPoint(i, 0, FileVersion)));

            parts += Users.Count;
            this.parentClass?.PassMessage(parts, $"UserPoints {Users.Count} - Offset {offset}");

            CustomUnits.Digital.AddRange(GetArray(bytes,
                                                  CustomDigitalUnitsPoint.GetCount(FileVersion),
                                                  CustomDigitalUnitsPoint.GetSize(FileVersion), ref offset)
                                         .Select(i => new CustomDigitalUnitsPoint(i, 0, FileVersion)));

            parts += CustomUnits.Digital.Count;
            this.parentClass?.PassMessage(parts, $"CustomUnits.DigitalPoints {CustomUnits.Digital.Count} - Offset {offset}");

            Tables.AddRange(GetArray(bytes,
                                     TablePoint.GetCount(FileVersion),
                                     TablePoint.GetSize(FileVersion), ref offset)
                            .Select(i => new TablePoint(i, 0, FileVersion)));

            parts += Tables.Count;
            this.parentClass?.PassMessage(parts, $"TablePoints {Tables.Count} - Offset {offset}");

            Settings = new Settings(
                GetObject(bytes, Settings.GetSize(FileVersion), ref offset), 0, FileVersion);

            parts += 1;
            this.parentClass?.PassMessage(parts, $"Settings 1 - Offset {offset}");

            Schedules.AddRange(GetArray(bytes,
                                        SchedulePoint.GetCount(FileVersion),
                                        SchedulePoint.GetSize(FileVersion), ref offset)
                               .Select(i => new SchedulePoint(i, 0, FileVersion)));

            parts += Schedules.Count;
            this.parentClass?.PassMessage(parts, $"SchedulePoints {Schedules.Count} - Offset {offset}");

            Holidays.AddRange(GetArray(bytes,
                                       HolidayPoint.GetCount(FileVersion),
                                       HolidayPoint.GetSize(FileVersion), ref offset)
                              .Select(i => new HolidayPoint(i, 0, FileVersion)));

            parts += Holidays.Count;
            this.parentClass?.PassMessage(parts, $"HolidayPoints {Holidays.Count} - Offset {offset}");

            Monitors.AddRange(GetArray(bytes,
                                       MonitorPoint.GetCount(FileVersion),
                                       MonitorPoint.GetSize(FileVersion), ref offset)
                              .Select(i => new MonitorPoint(i, 0, FileVersion)));

            parts += Monitors.Count;
            this.parentClass?.PassMessage(parts, $"MonitorPoints {Monitors.Count} - Offset {offset}");

            ScheduleCodes.AddRange(GetArray(bytes,
                                            ScheduleCode.GetCount(FileVersion),
                                            ScheduleCode.GetSize(FileVersion), ref offset)
                                   .Select(i => new ScheduleCode(i, 0, FileVersion)));

            parts += ScheduleCodes.Count;
            this.parentClass?.PassMessage(parts, $"ScheduleCodes {ScheduleCodes.Count} - Offset {offset}");

            HolidayCodes.AddRange(GetArray(bytes,
                                           HolidayCode.GetCount(FileVersion),
                                           HolidayCode.GetSize(FileVersion), ref offset)
                                  .Select(i => new HolidayCode(i, 0, FileVersion)));

            parts += HolidayCodes.Count;
            this.parentClass?.PassMessage(parts, $"HolidayCodes {HolidayCodes.Count} - Offset {offset}");


            int pcode_offset     = offset;
            var ProgramCodeBytes = bytes.ToBytes(offset, ProgramCode.GetSize(FileVersion));

            ProgramCodes.AddRange(GetArray(bytes,
                                           ProgramCode.GetCount(FileVersion),
                                           ProgramCode.GetSize(FileVersion), ref offset)
                                  //.Select(i => new ProgramCode(i, this, 0, FileVersion)));
                                  .Select(i => new ProgramCode()));

            ProgramCodes[0] = new ProgramCode(ProgramCodeBytes, this, 0, FileVersion);

            parts += 1;
            this.parentClass?.PassMessage(parts, $"ProgramCodes 1 - Offset {pcode_offset+2000}");


            for (int i = 1; i < ProgramCode.GetCount(FileVersion); i++)
            {
                pcode_offset    += ProgramCode.GetSize(FileVersion);
                ProgramCodeBytes = bytes.ToBytes(pcode_offset, ProgramCode.GetSize(FileVersion));
                ProgramCodes[i]  = new ProgramCode(ProgramCodeBytes, this, 0, FileVersion);

                parts += 1;
                this.parentClass?.PassMessage(parts, $"ProgramCodes {i+1} - Offset {pcode_offset+2000}");

                //Debug.WriteLine($"Leído ProgramCode[{i}]");
            }



            CustomUnits.Analog.AddRange(GetArray(bytes,
                                                 CustomAnalogUnitsPoint.GetCount(FileVersion),
                                                 CustomAnalogUnitsPoint.GetSize(FileVersion), ref offset)
                                        .Select(i => new CustomAnalogUnitsPoint(i, 0, FileVersion)));

            parts += CustomUnits.Analog.Count;
            this.parentClass?.PassMessage(parts, $"CustomUnits.AnalogPoints {CustomUnits.Analog.Count} - Offset {offset}");

            CheckOffset(offset, Length);

            UpdateCustomUnits();
        }
コード例 #10
0
ファイル: Prg.cs プロジェクト: Fance/T3000_CrossPlatform
        private void FromCurrentFormat(byte[] bytes, int offset = 0)
        {
            Signature = bytes.GetString(0, 2);
            Version   = bytes.ToByte(2);
            Length    = bytes.Length;

            offset += 3;

            //Get all inputs
            Inputs.AddRange(GetArray(bytes,
                                     InputPoint.GetCount(FileVersion),
                                     InputPoint.GetSize(FileVersion), ref offset)
                            .Select(i => new InputPoint(i, 0, FileVersion)));

            //Get all outputs
            Outputs.AddRange(GetArray(bytes,
                                      OutputPoint.GetCount(FileVersion),
                                      OutputPoint.GetSize(FileVersion), ref offset)
                             .Select(i => new OutputPoint(i, 0, FileVersion)));

            //Get all variables
            Variables.AddRange(GetArray(bytes,
                                        VariablePoint.GetCount(FileVersion),
                                        VariablePoint.GetSize(FileVersion), ref offset)
                               .Select(i => new VariablePoint(i, 0, FileVersion)));

            //Get all programs
            Programs.AddRange(GetArray(bytes,
                                       ProgramPoint.GetCount(FileVersion),
                                       ProgramPoint.GetSize(FileVersion), ref offset)
                              .Select(i => new ProgramPoint(i, 0, FileVersion)));

            //Get all controllers
            Controllers.AddRange(GetArray(bytes,
                                          ControllerPoint.GetCount(FileVersion),
                                          ControllerPoint.GetSize(FileVersion), ref offset)
                                 .Select(i => new ControllerPoint(i, 0, FileVersion)));

            //Get all screens
            Screens.AddRange(GetArray(bytes,
                                      ScreenPoint.GetCount(FileVersion),
                                      ScreenPoint.GetSize(FileVersion), ref offset)
                             .Select(i => new ScreenPoint(i, 0, FileVersion)));

            //Get all graphics

            //TODO: Constants to object static Size(FileVersion) Count(FileVersion)

            Graphics.AddRange(GetArray(bytes,
                                       GraphicPoint.GetCount(FileVersion),
                                       GraphicPoint.GetSize(FileVersion), ref offset)
                              .Select(i => new GraphicPoint(i, 0, FileVersion)));

            Users.AddRange(GetArray(bytes,
                                    UserPoint.GetCount(FileVersion),
                                    UserPoint.GetSize(FileVersion), ref offset)
                           .Select(i => new UserPoint(i, 0, FileVersion)));

            CustomUnits.Digital.AddRange(GetArray(bytes,
                                                  CustomDigitalUnitsPoint.GetCount(FileVersion),
                                                  CustomDigitalUnitsPoint.GetSize(FileVersion), ref offset)
                                         .Select(i => new CustomDigitalUnitsPoint(i, 0, FileVersion)));

            Tables.AddRange(GetArray(bytes,
                                     TablePoint.GetCount(FileVersion),
                                     TablePoint.GetSize(FileVersion), ref offset)
                            .Select(i => new TablePoint(i, 0, FileVersion)));

            Settings = new Settings(
                GetObject(bytes, Settings.GetSize(FileVersion), ref offset), 0, FileVersion);

            Schedules.AddRange(GetArray(bytes,
                                        SchedulePoint.GetCount(FileVersion),
                                        SchedulePoint.GetSize(FileVersion), ref offset)
                               .Select(i => new SchedulePoint(i, 0, FileVersion)));

            Holidays.AddRange(GetArray(bytes,
                                       HolidayPoint.GetCount(FileVersion),
                                       HolidayPoint.GetSize(FileVersion), ref offset)
                              .Select(i => new HolidayPoint(i, 0, FileVersion)));

            Monitors.AddRange(GetArray(bytes,
                                       MonitorPoint.GetCount(FileVersion),
                                       MonitorPoint.GetSize(FileVersion), ref offset)
                              .Select(i => new MonitorPoint(i, 0, FileVersion)));

            ScheduleCodes.AddRange(GetArray(bytes,
                                            ScheduleCode.GetCount(FileVersion),
                                            ScheduleCode.GetSize(FileVersion), ref offset)
                                   .Select(i => new ScheduleCode(i, 0, FileVersion)));

            HolidayCodes.AddRange(GetArray(bytes,
                                           HolidayCode.GetCount(FileVersion),
                                           HolidayCode.GetSize(FileVersion), ref offset)
                                  .Select(i => new HolidayCode(i, 0, FileVersion)));


            int pcode_offset     = offset;
            var ProgramCodeBytes = bytes.ToBytes(offset, ProgramCode.GetSize(FileVersion));

            ProgramCodes.AddRange(GetArray(bytes,
                                           ProgramCode.GetCount(FileVersion),
                                           ProgramCode.GetSize(FileVersion), ref offset)
                                  //.Select(i => new ProgramCode(i, this, 0, FileVersion)));
                                  .Select(i => new ProgramCode()));

            ProgramCodes[0] = new ProgramCode(ProgramCodeBytes, this, 0, FileVersion);


            for (int i = 1; i < ProgramCode.GetCount(FileVersion); i++)
            {
                pcode_offset    += ProgramCode.GetSize(FileVersion);
                ProgramCodeBytes = bytes.ToBytes(pcode_offset, ProgramCode.GetSize(FileVersion));
                ProgramCodes[i]  = new ProgramCode(ProgramCodeBytes, this, 0, FileVersion);
                Debug.WriteLine($"Leído ProgramCode[{i}]");
            }



            CustomUnits.Analog.AddRange(GetArray(bytes,
                                                 CustomAnalogUnitsPoint.GetCount(FileVersion),
                                                 CustomAnalogUnitsPoint.GetSize(FileVersion), ref offset)
                                        .Select(i => new CustomAnalogUnitsPoint(i, 0, FileVersion)));

            CheckOffset(offset, Length);

            UpdateCustomUnits();
        }
コード例 #11
0
 public UnionNode(params Node[] children)
     : base(1, int.MaxValue)
 {
     Inputs.AddRange(children);
 }
コード例 #12
0
 public SubtractionNode(Node body, params Node[] toSub)
     : base(1, int.MaxValue)
 {
     Inputs.Add(body);
     Inputs.AddRange(toSub);
 }
コード例 #13
0
 public void AddData(InputsOutputsData inputsOutputsData)
 {
     Inputs.AddRange(inputsOutputsData.Inputs);
     Outputs.AddRange(inputsOutputsData.Outputs);
 }
コード例 #14
0
 protected internal ZipCompressOption(params string[] filesOrDirectories)
 {
     Inputs.AddRange(filesOrDirectories);
 }