コード例 #1
0
 public Class()
 {
     SubClasses.Add("SubClass");
     SubClasses.Add("Property");
     Properties.Add("Name");
     Properties.Add("Inheritance");
 }
コード例 #2
0
        public bool Promote(SubClasses sClass)
        {
            ISubclass iClass;

            if (!Professions.TryGetValue(sClass, out iClass) || iClass.Promotion >= iClass.Level)
            {
                return(false);
            }

            if (iClass.Promotion + 1 > 9)
            {
                return(false);                          // max level
            }
            iClass.Promotion += 1;
            if (!Save(iClass))
            {
                return(false);
            }

            var sPacket = new MsgSubPro();

            sPacket.Action   = SubClassActions.MARTIAL_PROMOTED;
            sPacket.Subclass = sClass;
            sPacket.WriteByte(iClass.Promotion, 7);
            m_pOwner.Send(sPacket);
            m_pOwner.RecalculateAttributes();
            return(true);
        }
コード例 #3
0
 public CodesDefinition(GenDataBase genDataBase)
 {
     GenDataBase = genDataBase;
     Classes.Add("CodesTable");
     Classes.Add("Code");
     SubClasses.Add("CodesTable");
     base.GenObject = genDataBase.Root;
 }
コード例 #4
0
        public void Append(SubClasses sClass, byte level, byte phase)
        {
            Amount += 1;
            var offset = (ushort)(26 + (Amount - 1) * 3);

            WriteByte((byte)sClass, offset++);
            WriteByte(level, offset++);
            WriteByte(phase, offset);
        }
コード例 #5
0
 public ForeignKey()
 {
     SubClasses.Add("ForeignKeyColumn");
     Properties.Add("Name");
     Properties.Add("ReferenceSchema");
     Properties.Add("ReferenceTable");
     Properties.Add("DeleteAction");
     Properties.Add("UpdateAction");
 }
コード例 #6
0
ファイル: Definition.cs プロジェクト: JamieO53/xpangen.old
 public Definition(GenDataBase genDataBase)
 {
     GenDataBase = genDataBase;
     Classes.Add("Class");
     Classes.Add("SubClass");
     Classes.Add("Property");
     SubClasses.Add("Class");
     base.GenObject = genDataBase.Root;
 }
コード例 #7
0
 public BaseFile()
 {
     SubClasses.Add("Profile");
     Properties.Add("Name");
     Properties.Add("FileName");
     Properties.Add("FilePath");
     Properties.Add("Title");
     Properties.Add("FileExtension");
 }
コード例 #8
0
 public GeneratorEditor(GenDataBase genDataBase)
 {
     GenDataBase = genDataBase;
     Classes.Add("GenSettings");
     Classes.Add("FileGroup");
     Classes.Add("BaseFile");
     Classes.Add("Profile");
     SubClasses.Add("GenSettings");
     base.GenObject = genDataBase.Root;
 }
コード例 #9
0
ファイル: Object.cs プロジェクト: JamieO53/xpangen.old
 public Object()
 {
     SubClasses.Add("Table");
     SubClasses.Add("View");
     SubClasses.Add("Procedure");
     SubClasses.Add("Function");
     SubClasses.Add("Column");
     SubClasses.Add("Index");
     SubClasses.Add("ForeignKey");
     SubClasses.Add("Parameter");
     Properties.Add("Name");
 }
コード例 #10
0
 public ContainerFragment()
 {
     SubClasses.Add("Profile");
     SubClasses.Add("Segment");
     SubClasses.Add("Block");
     SubClasses.Add("Lookup");
     SubClasses.Add("Condition");
     SubClasses.Add("Function");
     SubClasses.Add("TextBlock");
     SubClasses.Add("Annotation");
     Properties.Add("Name");
     Properties.Add("Primary");
     Properties.Add("Secondary");
 }
コード例 #11
0
        public Fragment()
        {
            SubClasses.Add("Null");
            SubClasses.Add("Text");
            SubClasses.Add("Placeholder");
            SubClasses.Add("ContainerFragment");
            Properties.Add("Name");
            FragmentType ft;

            if (!Enum.TryParse(GetType().Name, out ft))
            {
                throw new GeneratorException("Unknown fragment type", GenErrorType.Assertion);
            }
            FragmentType = ft;
        }
コード例 #12
0
ファイル: DataObjectBase.cs プロジェクト: jithuin/infogeezer
        public static DataObjectBase GetDataObjectWrapper(IDataObject object_in)
        {
            DataObjectBase ret = SubClasses.FirstOrDefault(dataObj => dataObj.IsDataObjectCompatible(object_in));

            if (ret != null)
            {
                return((DataObjectBase)ret.GetType()
                       .GetConstructor(new Type[] { typeof(IDataObject) })
                       .Invoke(new object[] { object_in }));
            }
            else
            {
                return(null);
            }
        }
コード例 #13
0
 public GenAttributes(GenDataDef genDataDef, int classId) : this()
 {
     ClassId = classId;
     foreach (var c in genDataDef.Classes)
     {
         Classes.Add(c.Name);
     }
     foreach (var property in genDataDef.GetClassProperties(ClassId))
     {
         Properties.Add(property);
     }
     foreach (var sc in genDataDef.GetClassSubClasses(ClassId))
     {
         SubClasses.Add(sc.SubClass.Name);
     }
 }
コード例 #14
0
        public bool Create(SubClasses pType)
        {
            if (Professions.ContainsKey(pType))
            {
                return(false);
            }

            var dbClass = new DbSubclass
            {
                Class     = (byte)pType,
                Level     = 1,
                Promotion = 1,
                Userid    = m_pOwner.Identity
            };

            if (!Database.SubclassRepository.SaveOrUpdate(dbClass))
            {
                return(false);
            }

            var pClass = new ISubclass
            {
                Database  = dbClass,
                Class     = pType,
                Level     = 1,
                Promotion = 1
            };

            if (!Professions.TryAdd(pClass.Class, pClass))
            {
                return(false);
            }

            var pMsg = new MsgSubPro
            {
                Action   = SubClassActions.LEARN,
                Subclass = pType
            };

            m_pOwner.Send(pMsg);
            return(true);
        }
コード例 #15
0
 public ProfileDefinition(GenDataBase genDataBase)
 {
     GenDataBase = genDataBase;
     Classes.Add("ProfileRoot");
     Classes.Add("FragmentBody");
     Classes.Add("Fragment");
     Classes.Add("Text");
     Classes.Add("Placeholder");
     Classes.Add("ContainerFragment");
     Classes.Add("Profile");
     Classes.Add("Segment");
     Classes.Add("Block");
     Classes.Add("Lookup");
     Classes.Add("Condition");
     Classes.Add("Function");
     Classes.Add("TextBlock");
     Classes.Add("Annotation");
     SubClasses.Add("ProfileRoot");
     base.GenObject = genDataBase.Root;
 }
コード例 #16
0
                public A21MobileSubscriptionInformation Decode(BitArrayInputStream input)
                {
                    A21MobileSubscriptionInformation information = new A21MobileSubscriptionInformation {
                        A21ElementIdentifier = input.readOctetString(1),
                        Length                 = input.ReadBits(8),
                        RecordIdentifier       = input.readOctetString(1),
                        RecordLength           = input.ReadBits(8),
                        AllBandClassesIncluded = input.ReadBits(1),
                        CurrentBandSubclass    = input.ReadBits(7),
                        BandClassList          = new List <BandClass>()
                    };

                    for (int i = 1; i < information.RecordLength; i++)
                    {
                        BandClass item = new BandClass {
                            BandClassValue         = input.ReadBits(8),
                            AllBandClassesIncluded = input.ReadBits(1)
                        };
                        input.ReadBits(3);
                        item.BandSubclassLength = input.ReadBits(4);
                        i += 2;
                        item.SubClassesList = new List <SubClasses>();
                        for (int j = 0; j < item.BandSubclassLength; j++)
                        {
                            SubClasses classes = new SubClasses {
                                SC7 = input.ReadBit(),
                                SC6 = input.ReadBit(),
                                SC5 = input.ReadBit(),
                                SC4 = input.ReadBit(),
                                SC3 = input.ReadBit(),
                                SC2 = input.ReadBit(),
                                SC1 = input.ReadBit(),
                                SC0 = input.ReadBit()
                            };
                            item.SubClassesList.Add(classes);
                            i++;
                        }
                        information.BandClassList.Add(item);
                    }
                    return(information);
                }
コード例 #17
0
 public DatabaseDefinition(GenDataBase genDataBase)
 {
     GenDataBase = genDataBase;
     Classes.Add("Database");
     Classes.Add("Schema");
     Classes.Add("Object");
     Classes.Add("Table");
     Classes.Add("View");
     Classes.Add("Procedure");
     Classes.Add("Function");
     Classes.Add("Column");
     Classes.Add("Default");
     Classes.Add("Index");
     Classes.Add("KeyColumn");
     Classes.Add("DataColumn");
     Classes.Add("ForeignKey");
     Classes.Add("ForeignKeyColumn");
     Classes.Add("Parameter");
     SubClasses.Add("Database");
     base.GenObject = genDataBase.Root;
 }
コード例 #18
0
        public bool Active(SubClasses sClass)
        {
            if (sClass == SubClasses.NONE)
            {
                var nsPacket = new MsgSubPro();
                nsPacket.Action   = SubClassActions.ACTIVATE;
                nsPacket.Subclass = 0;
                m_pOwner.Send(nsPacket);
                return(true);
            }

            if (!Professions.ContainsKey(sClass))
            {
                return(false);
            }

            m_pOwner.ActiveSubclass = sClass;
            var sPacket = new MsgSubPro();

            sPacket.Action   = SubClassActions.ACTIVATE;
            sPacket.Subclass = sClass;
            m_pOwner.Send(sPacket);
            return(true);
        }
コード例 #19
0
        public bool Uplev(SubClasses sClass)
        {
            ISubclass iclass;

            if (!Professions.TryGetValue(sClass, out iclass))
            {
                return(false);
            }

            if (iclass.Level + 1 > 10)
            {
                return(false);                       // max level
            }
            switch (sClass)
            {
            case SubClasses.APOTHECARY:
            {
                if (!SpendStudy(LEVEL_STUDY_APOTHECARY[iclass.Level]))
                {
                    return(false);
                }
                break;
            }

            case SubClasses.CHI_MASTER:
            {
                if (!SpendStudy(LEVEL_STUDY_CHI_MASTER[iclass.Level]))
                {
                    return(false);
                }
                break;
            }

            case SubClasses.MARTIAL_ARTIST:
            {
                if (!SpendStudy(LEVEL_STUDY_MARTIAL_ARTIST[iclass.Level]))
                {
                    return(false);
                }
                break;
            }

            case SubClasses.PERFORMER:
            {
                if (!SpendStudy(LEVEL_STUDY_PERFORMER[iclass.Level]))
                {
                    return(false);
                }
                break;
            }

            case SubClasses.SAGE:
            {
                if (!SpendStudy(LEVEL_STUDY_SAGE[iclass.Level]))
                {
                    return(false);
                }
                break;
            }

            case SubClasses.WARLOCK:
            {
                if (!SpendStudy(LEVEL_STUDY_WARLOCK[iclass.Level]))
                {
                    return(false);
                }
                break;
            }

            case SubClasses.WRANGLER:
            {
                if (!SpendStudy(LEVEL_STUDY_WRANGLER[iclass.Level]))
                {
                    return(false);
                }
                break;
            }

            default:
                return(false);
            }

            iclass.Level += 1;
            if (!Save(iclass))
            {
                return(false);
            }
            var sPacket = new MsgSubPro();

            sPacket.Action   = SubClassActions.MARTIAL_UPLEV;
            sPacket.Subclass = sClass;
            m_pOwner.Send(sPacket);
            return(true);
        }
コード例 #20
0
 public ProfileRoot()
 {
     SubClasses.Add("FragmentBody");
     Properties.Add("Name");
     Properties.Add("Title");
 }
コード例 #21
0
ファイル: FragmentBody.cs プロジェクト: JamieO53/xpangen.old
 public FragmentBody()
 {
     SubClasses.Add("Fragment");
     Properties.Add("Name");
 }
コード例 #22
0
ファイル: GenSettings.cs プロジェクト: JamieO53/xpangen.old
 public GenSettings()
 {
     SubClasses.Add("FileGroup");
     SubClasses.Add("BaseFile");
     Properties.Add("HomeDir");
 }
コード例 #23
0
 public ISubclass this[SubClasses sub]
 {
     get { return(Professions.Values.FirstOrDefault(x => x.Class == sub)); }
 }
コード例 #24
0
 public void AddSubClass(SubClass subClass)
 {
     SubClasses.Add(subClass);
 }
コード例 #25
0
 public A21MobileSubscriptionInformation Decode(BitArrayInputStream input)
 {
     A21MobileSubscriptionInformation information = new A21MobileSubscriptionInformation {
         A21ElementIdentifier = input.readOctetString(1),
         Length = input.ReadBits(8),
         RecordIdentifier = input.readOctetString(1),
         RecordLength = input.ReadBits(8),
         AllBandClassesIncluded = input.ReadBits(1),
         CurrentBandSubclass = input.ReadBits(7),
         BandClassList = new List<BandClass>()
     };
     for (int i = 1; i < information.RecordLength; i++)
     {
         BandClass item = new BandClass {
             BandClassValue = input.ReadBits(8),
             AllBandClassesIncluded = input.ReadBits(1)
         };
         input.ReadBits(3);
         item.BandSubclassLength = input.ReadBits(4);
         i += 2;
         item.SubClassesList = new List<SubClasses>();
         for (int j = 0; j < item.BandSubclassLength; j++)
         {
             SubClasses classes = new SubClasses {
                 SC7 = input.ReadBit(),
                 SC6 = input.ReadBit(),
                 SC5 = input.ReadBit(),
                 SC4 = input.ReadBit(),
                 SC3 = input.ReadBit(),
                 SC2 = input.ReadBit(),
                 SC1 = input.ReadBit(),
                 SC0 = input.ReadBit()
             };
             item.SubClassesList.Add(classes);
             i++;
         }
         information.BandClassList.Add(item);
     }
     return information;
 }
コード例 #26
0
ファイル: CodesTable.cs プロジェクト: JamieO53/xpangen.old
 public CodesTable()
 {
     SubClasses.Add("Code");
     Properties.Add("Name");
     Properties.Add("Title");
 }
コード例 #27
0
ファイル: Database.cs プロジェクト: JamieO53/xpangen.old
 public Database()
 {
     SubClasses.Add("Schema");
     Properties.Add("Name");
 }
コード例 #28
0
ファイル: Schema.cs プロジェクト: JamieO53/xpangen.old
 public Schema()
 {
     SubClasses.Add("Object");
     Properties.Add("Name");
     Properties.Add("SchemaName");
 }
コード例 #29
0
        public override string ToString()
        {
            var props = Properties?.Cast <CSharpProperty>();

            var sb        = new StringBuilder();
            var className = string.IsNullOrWhiteSpace(Name)
                          ? ExtractNameFromFirstProperty(props)
                          : Name;

            // Top level can get and set override, but subclasses need their given name.
            if (!IsSubClass && Settings != null)
            {
                if (!string.IsNullOrWhiteSpace(Settings.ClassName))
                {
                    className = Settings.ClassName;
                }
                else
                {
                    Settings.ClassName = className;
                    Settings.Name      = className;
                }
            }

            // Set our class name.
            Name = className;

            if ((Settings != null) && string.IsNullOrWhiteSpace(Settings?.ClassName))
            {
                Settings.ClassName = Name;
            }

            var name = Name; //.ToPascalCase();

            if (SettingsSingleton.Settings.AddDTOSuffix)
            {
                name = $"{name}DTO";
            }

            var tableTypeNumber = 0;

            sb.AppendLine($"public class {name}");

            if (props != null)
            {
                sb.AppendLine("{");
                if (SettingsSingleton.Settings.IsSortProperties)
                {
                    props = props.OrderBy(nm => nm.Name).ThenBy(prp => prp.IsId());
                }

                var propsList = props.ToList();

                if (SettingsSingleton.Settings.AddTableTypeConstraint)
                {
                    propsList.ForEach(prp => prp.TableTypeNumber = ++tableTypeNumber);
                }

                //      [TableType(1)]
                sb.AppendLine(string.Join(Environment.NewLine, propsList.Select(prp => prp.ToString())));

                sb.AppendLine($"}}{Environment.NewLine}");

                if (SubClasses?.Any() ?? false)
                {
                    sb.Append(string.Join($"{Environment.NewLine}", SubClasses.Select(sbc => sbc.ToString())));
                }
            }
            else // Empty Array at source, unknown objects.
            {
                sb.AppendLine("{ /* Empty Array Encountered in Source */ }");
            }

            return(sb.ToString());
        }