コード例 #1
0
ファイル: ConsolePainter.cs プロジェクト: CatSkald/Roguelike
        private static char GetImage(XType type)
        {
            var image = ' ';

            switch (type)
            {
                case XType.Wall:
                    image = '#';
                    break;
                case XType.Empty:
                    image = '.';
                    break;
                case XType.DoorClosed:
                    image = '+';
                    break;
                case XType.DoorOpened:
                    image = '\'';
                    break;
                case XType.StairsUp:
                    image = '>';
                    break;
                case XType.StairsDown:
                    image = '<';
                    break;
                case XType.Character:
                    image = '@';
                    break;
                default:
                    throw new ArgumentOutOfRangeException(
                        $"{type} is not mapped.");
            }

            return image;
        }
コード例 #2
0
 public static string Parse(string input, XType elementType)
 {
     switch (elementType)
     {
         case XType.Int:
             return "" + ParseInt(input);
         case XType.BigInt:
             return "" + ParseBigInt(input);
         case XType.TinyInt:
             return "" + ParseTinyInt(input);
         case XType.Decimal:
             return "" + ParseDecimal(input);
         case XType.Money:
             return "" + ParseMoney(input);
         case XType.Float:
             return "" + ParseFloat(input);
         case XType.Real:
             return "" + ParseReal(input);
         case XType.Numeric:
             return "" + ParseNumeric(input);
         case XType.Bit:
             return "" + ParseBit(input);
         case XType.Binary:
             return "" + ParseBinary(input);
         case XType.Char:
             return ParseChar(input);
         case XType.VarChar:
             return ParseVarChar(input);
         default:
             return null;
     }
 }
コード例 #3
0
ファイル: CellTests.cs プロジェクト: CatSkald/Roguelike
        public void IEquatableMembers_WorksCorrect_IfIsVisitedDiffers(
            XType type1, XType type2)
        {
            var cell = new Cell
            {
                Type = type1
            };
            var other = new Cell
            {
                Type = type2
            };

            CustomAssert.IEquatableMembersWorkForDifferentObjects(cell, other);
        }
コード例 #4
0
 public static float getTimePosition_basedOn(System.DateTime dt, XType xtype_)
 {
     switch (xtype_) {
     case XType.Daily:
         return MyTimeUtil.getTimePosition_daily (dt);
     case XType.Weekly:
         return MyTimeUtil.getTimePosition_weekly(dt);
     case XType.Monthly:
         return MyTimeUtil.getTimePosition_monthly(dt);
     case XType.Yearly:
         return MyTimeUtil.getTimePosition_yearly(dt);
     default:
         return MyTimeUtil.getTimePosition_daily (dt);
     }
 }
コード例 #5
0
ファイル: CellTests.cs プロジェクト: CatSkald/Roguelike
        public void IEquatableMembers_WorksCorrect_IfCellsEqual(
            XType type, int x, int y)
        {
            var cell = new Cell
            {
                Type = type,
                Location = new Point(x, y)
            };

            var other = new Cell
            {
                Type = type,
                Location = new Point(x, y)
            };

            CustomAssert.IEqualityMembersWorkForEqualObjects(cell, other);
        }
コード例 #6
0
ファイル: ConsolePainter.cs プロジェクト: CatSkald/Roguelike
 private static ConsoleColor SetColor(XType type)
 {
     switch (type)
     {
         case XType.DoorClosed:
         case XType.DoorOpened:
         case XType.StairsUp:
         case XType.StairsDown:
             return ConsoleColor.DarkYellow;
         case XType.Character:
             return ConsoleColor.White;
         case XType.Wall:
         case XType.Empty:
             return ConsoleColor.Gray;
         default:
             throw new ArgumentOutOfRangeException(
                 $"{type} is not mapped.");
     }
 }
コード例 #7
0
ファイル: XTypeData.cs プロジェクト: kimduquan/xproject
 public bool XIsSubclassOf(XType xtype)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
ファイル: XTypeData.cs プロジェクト: kimduquan/xproject
 public bool XEqual(XType xtype)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
 internal XObjectGen(XType type, XValue[] fields, XObject[] embeds)
     : base(type)
 {
     this.fields = fields;
     this.embeds = embeds;
 }
コード例 #10
0
ファイル: HeatMapGl.cs プロジェクト: pmvqbridge/Plotly.Blazor
        /// <inheritdoc />
        public bool Equals([AllowNull] HeatMapGl other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Visible == other.Visible ||
                     Visible != null &&
                     Visible.Equals(other.Visible)
                 ) &&
                 (
                     Opacity == other.Opacity ||
                     Opacity != null &&
                     Opacity.Equals(other.Opacity)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     UId == other.UId ||
                     UId != null &&
                     UId.Equals(other.UId)
                 ) &&
                 (
                     Equals(Ids, other.Ids) ||
                     Ids != null && other.Ids != null &&
                     Ids.SequenceEqual(other.Ids)
                 ) &&
                 (
                     Equals(CustomData, other.CustomData) ||
                     CustomData != null && other.CustomData != null &&
                     CustomData.SequenceEqual(other.CustomData)
                 ) &&
                 (
                     Meta == other.Meta ||
                     Meta != null &&
                     Meta.Equals(other.Meta)
                 ) &&
                 (
                     Equals(MetaArray, other.MetaArray) ||
                     MetaArray != null && other.MetaArray != null &&
                     MetaArray.SequenceEqual(other.MetaArray)
                 ) &&
                 (
                     HoverInfo == other.HoverInfo ||
                     HoverInfo != null &&
                     HoverInfo.Equals(other.HoverInfo)
                 ) &&
                 (
                     Equals(HoverInfoArray, other.HoverInfoArray) ||
                     HoverInfoArray != null && other.HoverInfoArray != null &&
                     HoverInfoArray.SequenceEqual(other.HoverInfoArray)
                 ) &&
                 (
                     HoverLabel == other.HoverLabel ||
                     HoverLabel != null &&
                     HoverLabel.Equals(other.HoverLabel)
                 ) &&
                 (
                     Stream == other.Stream ||
                     Stream != null &&
                     Stream.Equals(other.Stream)
                 ) &&
                 (
                     Equals(Transforms, other.Transforms) ||
                     Transforms != null && other.Transforms != null &&
                     Transforms.SequenceEqual(other.Transforms)
                 ) &&
                 (
                     UiRevision == other.UiRevision ||
                     UiRevision != null &&
                     UiRevision.Equals(other.UiRevision)
                 ) &&
                 (
                     Equals(Z, other.Z) ||
                     Z != null && other.Z != null &&
                     Z.SequenceEqual(other.Z)
                 ) &&
                 (
                     Equals(X, other.X) ||
                     X != null && other.X != null &&
                     X.SequenceEqual(other.X)
                 ) &&
                 (
                     X0 == other.X0 ||
                     X0 != null &&
                     X0.Equals(other.X0)
                 ) &&
                 (
                     DX == other.DX ||
                     DX != null &&
                     DX.Equals(other.DX)
                 ) &&
                 (
                     Equals(Y, other.Y) ||
                     Y != null && other.Y != null &&
                     Y.SequenceEqual(other.Y)
                 ) &&
                 (
                     Y0 == other.Y0 ||
                     Y0 != null &&
                     Y0.Equals(other.Y0)
                 ) &&
                 (
                     Dy == other.Dy ||
                     Dy != null &&
                     Dy.Equals(other.Dy)
                 ) &&
                 (
                     Equals(Text, other.Text) ||
                     Text != null && other.Text != null &&
                     Text.SequenceEqual(other.Text)
                 ) &&
                 (
                     Transpose == other.Transpose ||
                     Transpose != null &&
                     Transpose.Equals(other.Transpose)
                 ) &&
                 (
                     XType == other.XType ||
                     XType != null &&
                     XType.Equals(other.XType)
                 ) &&
                 (
                     YType == other.YType ||
                     YType != null &&
                     YType.Equals(other.YType)
                 ) &&
                 (
                     ZSmooth == other.ZSmooth ||
                     ZSmooth != null &&
                     ZSmooth.Equals(other.ZSmooth)
                 ) &&
                 (
                     ZAuto == other.ZAuto ||
                     ZAuto != null &&
                     ZAuto.Equals(other.ZAuto)
                 ) &&
                 (
                     ZMin == other.ZMin ||
                     ZMin != null &&
                     ZMin.Equals(other.ZMin)
                 ) &&
                 (
                     ZMax == other.ZMax ||
                     ZMax != null &&
                     ZMax.Equals(other.ZMax)
                 ) &&
                 (
                     ZMid == other.ZMid ||
                     ZMid != null &&
                     ZMid.Equals(other.ZMid)
                 ) &&
                 (
                     ColorScale == other.ColorScale ||
                     ColorScale != null &&
                     ColorScale.Equals(other.ColorScale)
                 ) &&
                 (
                     AutoColorScale == other.AutoColorScale ||
                     AutoColorScale != null &&
                     AutoColorScale.Equals(other.AutoColorScale)
                 ) &&
                 (
                     ReverseScale == other.ReverseScale ||
                     ReverseScale != null &&
                     ReverseScale.Equals(other.ReverseScale)
                 ) &&
                 (
                     ShowScale == other.ShowScale ||
                     ShowScale != null &&
                     ShowScale.Equals(other.ShowScale)
                 ) &&
                 (
                     ColorBar == other.ColorBar ||
                     ColorBar != null &&
                     ColorBar.Equals(other.ColorBar)
                 ) &&
                 (
                     ColorAxis == other.ColorAxis ||
                     ColorAxis != null &&
                     ColorAxis.Equals(other.ColorAxis)
                 ) &&
                 (
                     XAxis == other.XAxis ||
                     XAxis != null &&
                     XAxis.Equals(other.XAxis)
                 ) &&
                 (
                     YAxis == other.YAxis ||
                     YAxis != null &&
                     YAxis.Equals(other.YAxis)
                 ) &&
                 (
                     IdsSrc == other.IdsSrc ||
                     IdsSrc != null &&
                     IdsSrc.Equals(other.IdsSrc)
                 ) &&
                 (
                     CustomDataSrc == other.CustomDataSrc ||
                     CustomDataSrc != null &&
                     CustomDataSrc.Equals(other.CustomDataSrc)
                 ) &&
                 (
                     MetaSrc == other.MetaSrc ||
                     MetaSrc != null &&
                     MetaSrc.Equals(other.MetaSrc)
                 ) &&
                 (
                     HoverInfoSrc == other.HoverInfoSrc ||
                     HoverInfoSrc != null &&
                     HoverInfoSrc.Equals(other.HoverInfoSrc)
                 ) &&
                 (
                     ZSrc == other.ZSrc ||
                     ZSrc != null &&
                     ZSrc.Equals(other.ZSrc)
                 ) &&
                 (
                     XSrc == other.XSrc ||
                     XSrc != null &&
                     XSrc.Equals(other.XSrc)
                 ) &&
                 (
                     YSrc == other.YSrc ||
                     YSrc != null &&
                     YSrc.Equals(other.YSrc)
                 ) &&
                 (
                     TextSrc == other.TextSrc ||
                     TextSrc != null &&
                     TextSrc.Equals(other.TextSrc)
                 ));
        }
コード例 #11
0
 public static void SetXType(int xtype_)
 {
     myXtype = (XType)xtype_;
 }
コード例 #12
0
 public object EndCall(Mailbox mb, XType responseType)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #13
0
 internal XCodeTypeReference(System.Type type) : base(type)
 {
     Type  = type;
     XType = null;
 }
コード例 #14
0
        public async Task <IViewComponentResult> InvokeAsync(XType xtype, _XThisCache xthis)
        {
            _XTypeModel xmodel = new _XTypeModel(xtype, xthis);

            xmodel.XConstructors = xtype.XGetConstructors();

            xmodel.XFields     = new Dictionary <string, List <XFieldInfo> >();
            xmodel.XFieldTypes = new List <XType>();
            foreach (XFieldInfo xfield in xtype.XGetFields())
            {
                if (xfield.XIsStatic)
                {
                    XType  xfieldType = xfield.XDeclaringType;
                    string fieldKey   = xfieldType.XFullName;
                    if (xmodel.XFields.ContainsKey(fieldKey))
                    {
                        xmodel.XFields[fieldKey].Add(xfield);
                    }
                    else
                    {
                        xmodel.XFieldTypes.Add(xfieldType);
                        List <XFieldInfo> xfields = new List <XFieldInfo>();
                        xfields.Add(xfield);
                        xmodel.XFields.Add(fieldKey, xfields);
                    }
                }
            }

            xmodel.XProperties    = new Dictionary <string, List <XPropertyInfo> >();
            xmodel.XPropertyTypes = new List <XType>();
            foreach (XPropertyInfo xprop in xtype.XGetProperties())
            {
                if (xprop.XIsStatic)
                {
                    XType  xpropType = xprop.XDeclaringType;
                    string propKey   = xpropType.XFullName;
                    if (xmodel.XProperties.ContainsKey(propKey))
                    {
                        xmodel.XProperties[propKey].Add(xprop);
                    }
                    else
                    {
                        xmodel.XPropertyTypes.Add(xpropType);
                        List <XPropertyInfo> xprops = new List <XPropertyInfo>();
                        xprops.Add(xprop);
                        xmodel.XProperties.Add(propKey, xprops);
                    }
                }
            }

            List <XMethodInfo> xmethods = new List <XMethodInfo>();

            foreach (XMethodInfo xmethod in xtype.XGetMethods())
            {
                if (xmethod.XIsStatic)
                {
                    xmethods.Add(xmethod);
                }
            }
            xmodel.XMethods = xmethods.ToArray();

            Dictionary <string, char> accessKeyMap = new Dictionary <string, char>();
            List <char> accessKeys = new List <char>();

            _XTypeModel.XToAccessKeyMap(xmodel.XFields, xmodel.XProperties, out accessKeyMap, out accessKeys);
            xmodel.XAccessKeys = accessKeyMap;

            return(View(xmodel));
        }
コード例 #15
0
        public override bool OnSynchronizeDropdowns(
            Microsoft.VisualStudio.Package.LanguageService languageService,
            IVsTextView textView,
            int line,
            int col,
            ArrayList dropDownTypes,
            ArrayList dropDownMembers,
            ref int selectedType,
            ref int selectedMember)
        {
            //
            var package         = XSharp.Project.XSharpProjectPackage.Instance;
            var optionsPage     = package.GetIntellisenseOptionsPage();
            var sortItems       = optionsPage.SortNavigationBars;
            var includeFields   = optionsPage.IncludeFieldsInNavigationBars;
            var currentTypeOnly = optionsPage.ShowMembersOfCurrentTypeOnly;

            if (optionsPage.DisableEditorDropdowns)
            {
                dropDownTypes.Clear();
                dropDownMembers.Clear();
                selectedType = selectedMember = -1;
                return(true);
            }
            // when the line did not change, we do nothing for performance reasons
            // this speeds up typing  for buffers with lots of entities
            if (line == lastLine)
            {
                // same line, no changes
                return(false);
            }
            lastLine = line;

            Source src     = languageService.GetSource(textView);
            string srcFile = src.GetFilePath();
            //
            XFile file = XSolution.FindFullPath(srcFile);

            if (file == null || file.TypeList == null)
            {
                return(false);
            }
            XElement selectedElement = file.FindMemberAtRow(line);

            if (selectedElement == _lastSelected && selectedElement != null)
            {
                // Same element, no changes
                return(false);
            }
            // check if we are on the same type. When not then we need to reload the members.
            // Note that the first item in the members combo can also be a type (Classname)
            XElement parentType = null;

            if (selectedElement is XTypeMember)
            {
                parentType = selectedElement.Parent;
            }
            else if (selectedElement is XType)
            {
                parentType = selectedElement as XType;
            }
            bool newType = true;

            if (parentType != null && _lastType != null && parentType.FullName == _lastType.FullName)
            {
                newType = false;
            }
            // when we are on the same type and there are no new methods then we can
            // select the element in the members combo and we do not have to rebuild the members
            // list. We must set the selectedType and selectedMember
            if (!newType && file.ContentHashCode == _lastHashCode && lastIncludeFields == includeFields && lastCurrentTypeOnly == currentTypeOnly)
            {
                // no need to rebuild the list. Just focus to another element
                // locate item in members collection
                selectedMember = -1;
                selectedType   = -1;
                for (int i = 0; i < dropDownMembers.Count; i++)
                {
                    var member = (XDropDownMember)dropDownMembers[i];
                    if (member.Element.ComboPrototype == selectedElement.ComboPrototype)
                    {
                        selectedMember = i;
                        break;
                    }
                }
                // find the parentType in the types combo
                if (selectedMember != -1 && parentType != null) // should never be null
                {
                    for (int i = 0; i < dropDownTypes.Count; i++)
                    {
                        var member = (XDropDownMember)dropDownTypes[i];
                        var type   = member.Element as XType;
                        if (type.FullName == parentType.FullName)
                        {
                            selectedType = i;
                            break;
                        }
                    }
                }
                // normally we should always find it. But if it fails then we simply build the list below.
                if (selectedMember != -1 && selectedType != -1)
                {
                    // remember for later. No need to remember the type because it has not changed
                    _lastSelected = selectedElement;
                    return(true);
                }
            }
            dropDownTypes.Clear();
            dropDownMembers.Clear();
            int nSelType = -1;
            int nSelMbr  = -1;
            //int distanceM = int.MaxValue;
            DROPDOWNFONTATTR ft;

            //
            //
            if (file.TypeList.Count > 0)
            {
                nSelType = 0;
            }

            List <XType> xList = file.TypeList.Values.ToList <XType>();

            if (sortItems)
            {
                xList.Sort(delegate(XType elt1, XType elt2)
                {
                    return(elt1.Name.CompareTo(elt2.Name));
                });
            }
            XType typeGlobal = null;
            int   nSelect    = 0;

            XElement currentMember = null;
            XType    currentType   = null;

            if (selectedElement is XTypeMember)
            {
                currentMember = selectedElement as XTypeMember;
                currentType   = ((XTypeMember)currentMember).Parent;
            }
            else if (selectedElement is XType)
            {
                currentType   = selectedElement as XType;
                currentMember = null;
            }
            nSelect = 0;
            XDropDownMember elt;

            // C# shows all items PLAIN
            // but when the selection is not really on an item, but for example on a comment
            // between methods, or on the comments between the namespace and the first class
            // then the next method/class is selected and displayed in GRAY
            // C# also includes members (for partial classes) that are defined in other source files
            // these are colored GRAY
            foreach (XType eltType in xList)
            {
                if (eltType.Kind == Kind.Namespace)
                {
                    continue;
                }
                //
                if (XType.IsGlobalType(eltType))
                {
                    typeGlobal = eltType;
                }
                TextSpan sp = this.TextRangeToTextSpan(eltType.Range);
                ft = DROPDOWNFONTATTR.FONTATTR_PLAIN;
                string name = eltType.Name;
                if (string.IsNullOrEmpty(name))
                {
                    name = "?";
                }
                elt         = new XDropDownMember(name, sp, eltType.Glyph, ft);
                elt.Element = eltType;
                nSelect     = dropDownTypes.Add(elt);
                if (eltType?.FullName == currentType?.FullName)
                {
                    nSelType = nSelect;
                }
            }

            if (currentType == null)
            {
                currentType = typeGlobal;
            }
            bool hasPartial = false;

            if (currentType != null)    // should not happen since all files have a global type
            {
                nSelMbr = 0;
                var members = new List <XElement>();
                if (currentTypeOnly)
                {
                    if (currentType != typeGlobal && currentType.IsPartial)
                    {
                        // retrieve members from other files ?
                        var fullType = file.Project.Lookup(currentType.FullName, true);
                        hasPartial = true;
                        members.AddRange(fullType.Members);
                    }
                    else
                    {
                        members.AddRange(currentType.Members);
                    }
                }
                else
                {
                    members.AddRange(file.EntityList.Where(member => includeFields || (member.Kind != Kind.Field && member.Kind != Kind.VODefine)));
                    foreach (var ent in file.EntityList)
                    {
                        if (ent is XType)
                        {
                            var xType = ent as XType;
                            if (xType.IsPartial)
                            {
                                // load methods from other files
                                var fullType = file.Project.Lookup(xType.FullName, true);
                                hasPartial = true;
                                foreach (var member in fullType.Members)
                                {
                                    if (!members.Contains(member))
                                    {
                                        if (includeFields || (member.Kind != Kind.Field && member.Kind != Kind.VODefine))
                                        {
                                            members.Add(member);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (sortItems)
                {
                    members = members.OrderBy(x => x.FullName).ToList();
                }
                // Add member for class declaration. This also makes sure that there at least one
                // element in the members list, which is convenient.
                TextSpan spM = this.TextRangeToTextSpan(currentType.Range);
                ft = DROPDOWNFONTATTR.FONTATTR_PLAIN;
                if (currentTypeOnly)
                {
                    // Add a 'root' element for the type.
                    if (currentType != typeGlobal)
                    {
                        if (currentType.Kind != Kind.Delegate)
                        {
                            elt         = new XDropDownMember("(" + currentType.Name + ")", spM, currentType.Glyph, ft);
                            elt.Element = currentType;
                            dropDownMembers.Add(elt);
                        }
                    }
                    else
                    {
                        elt         = new XDropDownMember(currentType.Name, spM, currentType.Glyph, ft);
                        elt.Element = currentType;
                        dropDownMembers.Add(elt);
                    }
                }
                foreach (XElement member in members)
                {
                    bool otherFile;
                    if (includeFields || (member.Kind != Kind.Field && member.Kind != Kind.VODefine))
                    {
                        spM       = this.TextRangeToTextSpan(member.Range);
                        otherFile = false;
                        ft        = DROPDOWNFONTATTR.FONTATTR_PLAIN;
                        if (hasPartial)
                        {
                            otherFile = member.File != file;
                        }

                        string prototype = member.ComboPrototype;
                        if (!currentTypeOnly && member.Parent != null && member.Parent != typeGlobal)
                        {
                            if (member.Modifiers.HasFlag(Modifiers.Static))
                            {
                                prototype = member.Parent.Name + "." + prototype;
                            }
                            else
                            {
                                prototype = member.Parent.Name + ":" + prototype;
                            }
                        }

                        if (otherFile)
                        {
                            ft         = DROPDOWNFONTATTR.FONTATTR_GRAY;
                            prototype += " (" + System.IO.Path.GetFileName(member.File.SourcePath) + ")";
                        }
                        elt         = new XDropDownMember(prototype, spM, member.Glyph, ft);
                        nSelect     = dropDownMembers.Add(elt);
                        elt.Element = member;
                        if (member == currentMember)
                        {
                            nSelMbr = nSelect;
                        }
                    }
                }
            }
            // save the info so we can optimize the next call.
            _members            = dropDownMembers;
            _file               = file;
            _lastSelected       = selectedElement;
            _lastType           = currentType;
            _lastHashCode       = file.ContentHashCode;
            selectedType        = nSelType;
            selectedMember      = nSelMbr;
            lastIncludeFields   = includeFields;
            lastCurrentTypeOnly = currentTypeOnly;
            return(true);
        }
コード例 #16
0
ファイル: XQueue.cs プロジェクト: Adam-Miettinen/XMachine
 public XQueue(XType <TQueue> xType) : base(xType)
 {
 }
コード例 #17
0
 public XIDictionary(XType <TDictionary> xType) : base(xType)
 {
 }
コード例 #18
0
 ///<summary>Constructs the Message.</summary>
 ///<param name="type">type of the message (command).</param>
 ///<param name="vf">vf the value factory.</param>
 ///<param name="length"> the expected number of name/value pairs</param>
 public Message(XType type, ValueFactory vf, int length)
     : base(type, vf, length)
 {
     this.vf = vf;
 }
コード例 #19
0
 ///<summary>Constructs the Message.</summary>
 ///<param name="type">type of the message (command).</param>
 ///<param name="vf"> vf the value factory.</param>
 public Message(XType type, ValueFactory vf)
     : this(type, vf, 0)
 {
     // nothing to do.
 }
コード例 #20
0
 public TestBinaryTaggedDataInOut()
 {
     vf     = new MyValueFactory();
     mt_foo = vf.GetType("foo");
     mf_x   = new Field("x");
 }
コード例 #21
0
 internal XCodeTypeReference(XType type) : base(type.FullName)
 {
     XType = type;
     Type  = null;
 }
コード例 #22
0
 // Constructor
 public RotationElement(XType _xType)
 {
     rotationType = _xType;
     elementType  = ElementType.Rotation;
 }
コード例 #23
0
ファイル: XTexter.cs プロジェクト: Adam-Miettinen/XMachine
 /// <summary>
 /// Create a new <see cref="XTexter{T}"/> using the given delegates.
 /// </summary>
 /// <param name="xType">The <see cref="XType{T}"/> object to which this <see cref="XTypeComponent{T}"/> belongs.</param>
 /// <param name="reader">A delegate that creates a <typeparamref name="T"/> from a <see cref="string"/>.</param>
 /// <param name="writer">A delegate that creates a <see cref="string"/> from a <typeparamref name="T"/>.</param>
 public XTexter(XType <T> xType, Func <string, T> reader, Func <T, string> writer = null) : base(xType)
 {
     Reader = reader;
     Writer = writer;
 }
コード例 #24
0
 public static bool IsZ(this XType type)
 {
     return(((int)type & (int)XType.Z) != 0 && type != XType.Quaternion);
 }
コード例 #25
0
 public XReadOnlyDictionary(XType <ReadOnlyDictionary <TKey, TValue> > xType) : base(xType)
 {
 }
コード例 #26
0
 public static bool IsQuat(this XType type)
 {
     return(type == XType.Quaternion);
 }
コード例 #27
0
 public DateSerializer(XType type, Field field)
 {
     this.type  = type;
     this.field = field;
 }
コード例 #28
0
ファイル: CellTests.cs プロジェクト: CatSkald/Roguelike
        public void Type_GetReturnsSameValue_AsWasSet(XType type)
        {
            var cell = new Cell
            {
                Type = type
            };

            Assert.That(cell.Type, Is.EqualTo(type));
        }
コード例 #29
0
ファイル: HeatMapGl.cs プロジェクト: pmvqbridge/Plotly.Blazor
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (Opacity != null)
         {
             hashCode = hashCode * 59 + Opacity.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (UId != null)
         {
             hashCode = hashCode * 59 + UId.GetHashCode();
         }
         if (Ids != null)
         {
             hashCode = hashCode * 59 + Ids.GetHashCode();
         }
         if (CustomData != null)
         {
             hashCode = hashCode * 59 + CustomData.GetHashCode();
         }
         if (Meta != null)
         {
             hashCode = hashCode * 59 + Meta.GetHashCode();
         }
         if (MetaArray != null)
         {
             hashCode = hashCode * 59 + MetaArray.GetHashCode();
         }
         if (HoverInfo != null)
         {
             hashCode = hashCode * 59 + HoverInfo.GetHashCode();
         }
         if (HoverInfoArray != null)
         {
             hashCode = hashCode * 59 + HoverInfoArray.GetHashCode();
         }
         if (HoverLabel != null)
         {
             hashCode = hashCode * 59 + HoverLabel.GetHashCode();
         }
         if (Stream != null)
         {
             hashCode = hashCode * 59 + Stream.GetHashCode();
         }
         if (Transforms != null)
         {
             hashCode = hashCode * 59 + Transforms.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         if (Z != null)
         {
             hashCode = hashCode * 59 + Z.GetHashCode();
         }
         if (X != null)
         {
             hashCode = hashCode * 59 + X.GetHashCode();
         }
         if (X0 != null)
         {
             hashCode = hashCode * 59 + X0.GetHashCode();
         }
         if (DX != null)
         {
             hashCode = hashCode * 59 + DX.GetHashCode();
         }
         if (Y != null)
         {
             hashCode = hashCode * 59 + Y.GetHashCode();
         }
         if (Y0 != null)
         {
             hashCode = hashCode * 59 + Y0.GetHashCode();
         }
         if (Dy != null)
         {
             hashCode = hashCode * 59 + Dy.GetHashCode();
         }
         if (Text != null)
         {
             hashCode = hashCode * 59 + Text.GetHashCode();
         }
         if (Transpose != null)
         {
             hashCode = hashCode * 59 + Transpose.GetHashCode();
         }
         if (XType != null)
         {
             hashCode = hashCode * 59 + XType.GetHashCode();
         }
         if (YType != null)
         {
             hashCode = hashCode * 59 + YType.GetHashCode();
         }
         if (ZSmooth != null)
         {
             hashCode = hashCode * 59 + ZSmooth.GetHashCode();
         }
         if (ZAuto != null)
         {
             hashCode = hashCode * 59 + ZAuto.GetHashCode();
         }
         if (ZMin != null)
         {
             hashCode = hashCode * 59 + ZMin.GetHashCode();
         }
         if (ZMax != null)
         {
             hashCode = hashCode * 59 + ZMax.GetHashCode();
         }
         if (ZMid != null)
         {
             hashCode = hashCode * 59 + ZMid.GetHashCode();
         }
         if (ColorScale != null)
         {
             hashCode = hashCode * 59 + ColorScale.GetHashCode();
         }
         if (AutoColorScale != null)
         {
             hashCode = hashCode * 59 + AutoColorScale.GetHashCode();
         }
         if (ReverseScale != null)
         {
             hashCode = hashCode * 59 + ReverseScale.GetHashCode();
         }
         if (ShowScale != null)
         {
             hashCode = hashCode * 59 + ShowScale.GetHashCode();
         }
         if (ColorBar != null)
         {
             hashCode = hashCode * 59 + ColorBar.GetHashCode();
         }
         if (ColorAxis != null)
         {
             hashCode = hashCode * 59 + ColorAxis.GetHashCode();
         }
         if (XAxis != null)
         {
             hashCode = hashCode * 59 + XAxis.GetHashCode();
         }
         if (YAxis != null)
         {
             hashCode = hashCode * 59 + YAxis.GetHashCode();
         }
         if (IdsSrc != null)
         {
             hashCode = hashCode * 59 + IdsSrc.GetHashCode();
         }
         if (CustomDataSrc != null)
         {
             hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
         }
         if (MetaSrc != null)
         {
             hashCode = hashCode * 59 + MetaSrc.GetHashCode();
         }
         if (HoverInfoSrc != null)
         {
             hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode();
         }
         if (ZSrc != null)
         {
             hashCode = hashCode * 59 + ZSrc.GetHashCode();
         }
         if (XSrc != null)
         {
             hashCode = hashCode * 59 + XSrc.GetHashCode();
         }
         if (YSrc != null)
         {
             hashCode = hashCode * 59 + YSrc.GetHashCode();
         }
         if (TextSrc != null)
         {
             hashCode = hashCode * 59 + TextSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #30
0
 internal CCNodeNativeFieldArrayTest(Function accessor,
                                     XType owner, CCNode next)
     : base(accessor, owner, next)
 {
 }
コード例 #31
0
ファイル: XTypeData.cs プロジェクト: kimduquan/xproject
 public bool Equals(XType other)
 {
     throw new NotImplementedException();
 }
コード例 #32
0
 internal CCNodeNativeArrayMakeEmbed(Function accessor,
                                     XType owner, CCNode next)
     : base(accessor, owner, next)
 {
 }
コード例 #33
0
ファイル: XTypeData.cs プロジェクト: kimduquan/xproject
 public bool XIsAssignableFrom(XType xtype)
 {
     throw new NotImplementedException();
 }
コード例 #34
0
ファイル: TileTests.cs プロジェクト: CatSkald/Roguelike
        public void Constructor_SetsCorrectType(XType type)
        {
            var tile = new Tile(type);

            Assert.That(tile.Type, Is.EqualTo(type));
        }
コード例 #35
0
 internal CCNodeNativeFieldArrayPut(Function accessor,
                                    XType owner, int off, CCNode next)
     : base(accessor, owner, next)
 {
     this.off = off;
 }
コード例 #36
0
        public void test_add_in()
        {
            XType add = vf.GetType("add");

            Field x = new Field("x");

            add.PutValidator(x, Validator_int.Get(0));

            Field y = new Field("y");

            add.PutValidator(y, Validator_int.Get(0));

            Field _mf__messageId = DefaultValueFactory._mf__messageId;

            add.PutValidator(_mf__messageId, Validator_long.Get(0));

            long msgid = 0x0123456789abcdefL;

            //sbyte[] _buf = { 1, -9, -100, -73, -23, 39, -9, 104, -76, 6, 99, -13, -17, -51, -85, -119, 103, 69, 35, 1, -9, -76, 44, 10, 21, 66, -9, -77, 44, 10, 21, 65, -22 } ;
            sbyte[] _buf = { 3,                   // version
                             -122,                // INT (Type)
                             39,   -23, -73,-100, // add
                             3,                   // length
                             -122,
                             99,     6, -76, 104,
                             -121,                // LONG (value)
                             1,     35,  69, 103,-119, -85, -51, -17,
                             -122,                // INT (key)
                             21,    10,  44, -76, // y
                             2,                   // tiny int = 2 (value)
                             -122,                // INT (key)
                             21,    10,  44, -77, // x
                             1,                   // tiny int =1
                             -127                 // NONE
            };
            byte[]  buf = new byte[_buf.Length];
            Buffer.BlockCopy(_buf, 0, buf, 0, _buf.Length);

            Message msg = Bytes2msg(buf);

            msg.CheckType(add);
            Assert.AreEqual(3, msg.Count);
            Assert.AreEqual(1, msg[x]);
            Assert.AreEqual(2, msg[y]);
            Assert.AreEqual(msgid, msg[_mf__messageId]);

            //_buf = new sbyte[] { 1, -9, -100, -73, -23, 39, -9, 104, -76, 6, 99, -13, -17, -51, -85, -119, 103, 69, 35, 1, -9, -76, 44, 10, 21, -9, 0, -108, 53, 119, -9, -77, 44, 10, 21, -9, 0, -54, -102, 59, -22 };
            // _buf = new sbyte[] { 3, -9, 39, -23, -73, -100, -9, 99, 6, -76, 104, -13, 1, 35, 69, 103, -119, -85, -51, -17, -9, 21, 10, 44, -76, -9, 119, 53, -108, 0, -9, 21, 10, 44, -77, -9, 59, -102, -54, 0, -22 };
            _buf = new sbyte[]
            {
                3,                  // version
                -122,               // INT (type)
                39, -23, -73, -100, // add
                3,                  // length
                -122,               // INT (key)
                99, 6, -76, 104,
                -121,               // LONG (value)
                1, 35, 69, 103, -119, -85, -51, -17,
                -122,               // INT (key)
                21, 10, 44, -76,    // y
                -122,               // INT (value)
                119, 53, -108, 0,
                -122,               // INT (key)
                21, 10, 44, -77,    // x
                -122,               // INT (value)
                59, -102, -54, 0,
                -127                // NONE
            };

            buf = new byte[_buf.Length];
            Buffer.BlockCopy(_buf, 0, buf, 0, _buf.Length);

            msg = Bytes2msg(buf);
            msg.CheckType(add);
            Assert.AreEqual(3, msg.Count);
            Assert.AreEqual(1000000000, msg[x]);
            Assert.AreEqual(2000000000, msg[y]);
            Assert.AreEqual(msgid, msg[_mf__messageId]);
        }
コード例 #37
0
 internal CCNodeNativeEmbedArrayRef(Function accessor,
                                    XType owner, XType eltType, CCNode next)
     : base(accessor, owner, next)
 {
     this.eltType = eltType;
 }
コード例 #38
0
 internal XCodeTypeReference(string typeName) : base(typeName)
 {
     Type  = null;
     XType = null;
 }
コード例 #39
0
 internal CCNodeNativeArrayClear(Function accessor,
                                 XType owner, CCNode next)
     : base(accessor, owner, next)
 {
 }
コード例 #40
0
ファイル: Tile.cs プロジェクト: CatSkald/Roguelike
 public Tile(XType type)
 {
     Type = type;
 }