Esempio n. 1
0
        public void Initialize()
        {
            Name      = NameProvider.GetCityName();
            Alignment = Alignment.Coalition;

            Startup();
        }
Esempio n. 2
0
        /// <summary>
        /// Adds global edit that will create instance of current type definition.
        /// </summary>
        /// <param name="editName">Name of the edit.</param>
        /// <param name="variableNameProvider">Provider of name of created instance.</param>
        /// <param name="argumentsProvider">Provider of arguments used in constructor.</param>
        /// <returns>Edit.</returns>
        protected Edit AddCreationEdit(string editName, NameProvider variableNameProvider, ArgumentsProvider argumentsProvider = null)
        {
            var creationTransformation = new AddCallTransformation((v) =>
            {
                var entryContext = v.EntryBlock.Call;
                var name         = variableNameProvider(this, entryContext);
                if (name == null)
                {
                    v.Abort("Name hasn't been selected");
                    return(null);
                }

                var args = argumentsProvider == null ? null : argumentsProvider(v);
                if (args == null)
                {
                    args = new object[0];
                }

                if (v.IsAborted)
                {
                    return(null);
                }

                var call        = new CallEditInfo(TypeInfo, Naming.CtorName, args);
                call.ReturnName = name;
                return(call);
            });

            var edit = new Edit(null, null, null, editName, creationTransformation);

            _globalEdits.Add(edit);

            return(edit);
        }
Esempio n. 3
0
        void Start()
        {
            var islandLevel = StaticPersistence.GameState != null
                ? StaticPersistence.GameState.Mission.MissionIsland.Level
                : RandomService.GetRandom(1, 10);

            var islandName = StaticPersistence.GameState != null
                ? StaticPersistence.GameState.Mission.MissionIsland.Name
                : NameProvider.GetIslandName();

            StatusUI.Initialize(islandName, islandLevel);
            DefensePlacer.Initialize(islandLevel);
            DefensePlacer.PlaceDrones();
            DefensePlacer.PlaceTurrets();
            DefensePlacer.PlaceSAMTurrets();
            DefensePlacer.PlaceDefenses();

            buildings      = BuildingContainer.GetComponentsInChildren <Building>();
            hitPoints      = buildings.Count();
            TargetProvider = new CoalitionTargetProvider();

            foreach (var b in buildings)
            {
                var healthBar = IslandStatus.AddBuilding(b.Name);
                healthBar.Initialize(b.Health.BaseHitPoints);
                b.Initialize(this, VehicleContainer, TurretContainer, Patrols, healthBar.UpdateHp);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Performs initialization of this action and
        /// also registers all the UI elements required by the action, e.g.: menus / menu groups / toolbars.
        /// </summary>
        public void Initialize(IPackageEnvironment env, IMenuCreator mc)
        {
            MenuCommand nameMenu = ObjectFactory.CreateCommand(GuidList.guidCmdSet, ID, Execute, BeforeExecute);

            parent = env;

            // -------------------------------------------------------
            mc.AddCommand(nameMenu, "InsertClassName", "Insert Class &Name...", 0, null, null, false);
            mc.Customizator.AddInsertionItem(nameMenu, true, -1, null);

            // -------------------------------------------------------
            string[] pre = new string[]
            {
                "Byte", "String", "Object", "Thread", "Int", "Custom", "Type", "Editor",
                "Environment", "Code", "File", "Socket", "Handle", "Image", "Picture", "Icon", "Bitmap", "Color",
                "Smart", "Stupid", "Secure", "Custom", "Client", "Server", "Remote", "Random",
                "MultiByte", "Shared", "Box", "Static", "Dynamic"
            };
            string[] body = new string[]
            {
                "Provider", "Executor", "Factory", "Locator", "Helper", "Util", "Record",
                "Randomizer", "Modeler", "Listener", "Serializer", "Generator", "Consumer"
            };
            string[] post = new string[]
            {
                "Info", "Ext", "Extension", "Param", "Event", "Args", "Contract", "Annotation",
                "Attribute", "Action", "Array", "Mode", "Comparer", "Metadata", "Data",
            };

            // and create random-names-generator:
            nameGenerator = new NameProvider(pre, 0.8, body, 1, post, 0.5);
        }
Esempio n. 5
0
        /// <summary>
        /// Create a new entity, naked and squirming
        /// Created with no equipment, knowledge, family, etc
        /// </summary>
        /// <param name="template"></param>
        /// <param name="needs"></param>
        /// <param name="level"></param>
        /// <param name="job"></param>
        /// <param name="sex"></param>
        /// <param name="sexuality"></param>
        /// <param name="position"></param>
        /// <param name="icons"></param>
        /// <param name="world"></param>
        public Entity(EntityTemplate template, Dictionary <NeedIndex, EntityNeed> needs, int level, JobType job, Sex sex, Sexuality sexuality,
                      Vector2Int position, List <Sprite> sprites, WorldInstance world) :
            base(NameProvider.GetRandomName(template.CreatureType, sex), template.Statistics[StatisticIndex.Endurance].Value * 2, position, sprites, template.JoyType, true)
        {
            this.CreatureType = template.CreatureType;

            this.m_Size = template.Size;
            this.Slots  = template.Slots;

            this.m_JobLevels       = new Dictionary <string, int>();
            this.m_Sexuality       = sexuality;
            this.m_IdentifiedItems = new List <string>();
            this.m_Statistics      = template.Statistics;

            if (template.Skills.Count == 0)
            {
                this.m_Skills = EntitySkillHandler.GetSkillBlock(needs);
            }
            else
            {
                this.m_Skills = template.Skills;
            }
            this.m_Needs     = needs;
            this.m_Abilities = template.Abilities;
            this.m_Level     = level;
            for (int i = 1; i < level; i++)
            {
                this.LevelUp();
            }
            this.m_Experience     = 0;
            this.m_CurrentJob     = job;
            this.m_Sentient       = template.Sentient;
            this.m_NaturalWeapons = NaturalWeaponHelper.MakeNaturalWeapon(template.Size);
            this.m_Equipment      = new Dictionary <string, ItemInstance>();
            this.m_Backpack       = new List <ItemInstance>();
            this.m_Relationships  = new Dictionary <long, int>();
            this.Sex          = sex;
            this.m_Family     = new Dictionary <long, RelationshipStatus>();
            this.m_VisionType = template.VisionType;

            this.m_Tileset = template.Tileset;

            this.CalculateDerivatives();

            this.m_Vision = new bool[1, 1];

            this.m_Pathfinder      = new Pathfinder();
            this.m_PathfindingData = new Queue <Vector2Int>();

            this.m_FulfillingNeed    = (NeedIndex)(-1);
            this.m_FulfilmentCounter = 0;

            this.RegenTicker = RNG.Roll(0, REGEN_TICK_TIME - 1);

            this.MyWorld = world;

            SetFOVHandler();
            SetCurrentTarget();
        }
Esempio n. 6
0
 private void EnsureName(IDesignableControl dc)
 {
     if (string.IsNullOrEmpty(dc.DesignTimeName))
     {
         string name = NameProvider.GetUniqueName(this, ((DesignSite)dc).HostedContent);
         dc.DesignTimeName = name;
     }
 }
Esempio n. 7
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public ArtifactSchema()
 {
     Names        = new NameProvider("Artifact", "Artifacts", "a");
     GetAccess    = Access.All;
     CreateAccess = Access.Custom;
     DeleteAccess = Access.Custom;
     IsAbstract   = true;
 }
Esempio n. 8
0
        public void Initialize()
        {
            Name      = NameProvider.GetIslandName();
            Alignment = Alignment.Coalition;
            level     = RandomService.GetRandom(1, 10);

            Startup();
        }
Esempio n. 9
0
 public void Should_parse_name()
 {
     var(success, logName) = new NameProvider().ParseName(sampleFilename);
     success.Should().BeTrue();
     logName.Timestamp.Should().Be(sampleDate);
     logName.Name.Should().Be("some-name");
     logName.Filename.Should().Be(sampleFilename);
 }
Esempio n. 10
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public ClassSchema()
        {
            Names        = new NameProvider("Class", "Classes", "c");
            GetAccess    = Access.All;
            CreateAccess = Access.All;
            DeleteAccess = Access.CreatorUserAndApp;
            IsAbstract   = false;
            CustomCreate = true;

            ////

            Name           = new DomainProperty <string>("Name", "c_na");
            Name.IsElastic = true;

            NameKey             = new DomainProperty <string>("NameKey", "c_nk");
            NameKey.ToLowerCase = true;
            NameKey.IsIndexed   = true;
            Name.ExactIndexVia  = NameKey;

            Disamb            = new DomainProperty <string>("Disamb", "c_di");
            Disamb.IsNullable = true;
            Disamb.IsElastic  = true;

            Note            = new DomainProperty <string>("Note", "c_no");
            Note.IsNullable = true;

            ////

            FabName = new ApiProperty <string>("Name");
            FabName.SetOpenAccess();
            FabName.LenMin       = 1;
            FabName.LenMax       = 128;
            FabName.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabName.TraversalHas = Matching.None;

            FabDisamb = new ApiProperty <string>("Disamb");
            FabDisamb.SetOpenAccess();
            FabDisamb.IsNullable   = true;
            FabDisamb.LenMin       = 1;
            FabDisamb.LenMax       = 128;
            FabDisamb.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabDisamb.TraversalHas = Matching.None;

            FabNote = new ApiProperty <string>("Note");
            FabNote.SetOpenAccess();
            FabNote.IsNullable   = true;
            FabNote.LenMin       = 1;
            FabNote.LenMax       = 256;
            FabNote.TraversalHas = Matching.None;

            ////

            FabNameMap = new PropertyMapping <string, string>(Name, FabName, CustomDir.ApiToDomain);
            FabNameMap.ApiToDomainNote = "Set Domain.NameKey = Api.Name.ToLower()";

            FabDisambMap = new PropertyMapping <string, string>(Disamb, FabDisamb);
            FabNoteMap   = new PropertyMapping <string, string>(Note, FabNote);
        }
Esempio n. 11
0
			private Property(Column column, string type, bool isReferenceType, string name, EntityConfig referenceEntityConfig)
			{
				this.Column = column;
				this.ReferenceEntityConfig = referenceEntityConfig;
				this.Type = type;
				this.IsReferenceType = isReferenceType;
				this.Name = name;
				this.VariableName = NameProvider.GetVariableName(name);
			}
Esempio n. 12
0
        public void Should_encode_decode_all_chars_string()
        {
            var str = new string(Enumerable.Range(0, ushort.MaxValue + 1)
                                 .Select(x => (char)x).ToArray());
            var encoded = new NameProvider().PathEncode(str);
            var decoded = new NameProvider().PathDecode(encoded);

            decoded.Should().Be(str);
        }
Esempio n. 13
0
        public void Run()
        {
            var cc = new CommonClass();

            MessageBox.Show(cc.GetLocation(), "ChildAddin Loaded");
            var np = new NameProvider();

            MessageBox.Show(np.GetName("ChildAddin"));
        }
Esempio n. 14
0
        public void gets_property_name()
        {
            var names = new Dictionary<MemberInfo, string>();

            var sut = new NameProvider(names, "Anon");
            var propertyInfo = typeof (Simple).GetProperties().First();

            Assert.Equal(propertyInfo.Name, sut.Get(propertyInfo));
        }
Esempio n. 15
0
        public void gets_type_name()
        {
            var names = new Dictionary<MemberInfo, string>();

            var sut = new NameProvider(names, "Anon");
            var type = typeof (Simple);

            Assert.Equal(type.Name, sut.Get(type));
        }
Esempio n. 16
0
		private static string GetCreator(string className, IEnumerable<Property> properties)
		{
			var buffer = new StringBuilder();
			var args = new StringBuilder();

			var index = 0;
			foreach (var property in properties)
			{
				if (buffer.Length > 0)
				{
					buffer.AppendLine();
				}
				if (args.Length > 0)
				{
					args.Append(@",");
					args.Append(@" ");
				}

				var variableName = property.VariableName;

				buffer.Append(@"var");
				buffer.Append(@" ");
				buffer.Append(variableName);
				buffer.Append(@" = ");
				var referenceEntityConfig = property.ReferenceEntityConfig;
				if (referenceEntityConfig != null)
				{
					buffer.Append(NameProvider.GetVariableName(referenceEntityConfig.ClassPluralName));
					buffer.Append(@"[");
				}
				ReadDbValue(buffer, property.Column, index++);
				if (referenceEntityConfig != null)
				{
					buffer.Append(@"]");
				}
				buffer.Append(@";");

				args.Append(variableName);
			}

			buffer.AppendLine();
			buffer.AppendLine();

			buffer.Append(@"return");
			buffer.Append(@" ");
			buffer.Append(@"new");
			buffer.Append(@" ");
			buffer.Append(className);
			buffer.Append(@"(");
			buffer.Append(args);
			buffer.Append(@")");
			buffer.Append(@";");

			return buffer.ToString();
		}
Esempio n. 17
0
        public EntityConfig(string tableName, string className = null, string classPluralName = null)
        {
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }

            this.TableName       = tableName;
            this.ClassName       = className ?? NameProvider.GetClassName(tableName);
            this.ClassPluralName = classPluralName ?? this.ClassName + @"s";
        }
Esempio n. 18
0
 internal POXSerializer(
     NameProvider nameProvider,
     NameProvider itemNameProvider,
     FormatterProvider formatterProvider,
     SerializerSettings settings)
 {
     _nameProvider = nameProvider;
     _itemNameProvider = itemNameProvider;
     _formatterProvider = formatterProvider;
     _settings = settings;
 }
Esempio n. 19
0
			public Property(Column column, KeyValuePair<string, bool> type, string name, EntityConfig referenceEntityConfig, bool isCaption = false, bool generateField = true)
			{
				this.Column = column;
				this.ReferenceEntityConfig = referenceEntityConfig;
				this.Type = type.Key;
				this.IsReferenceType = type.Value;
				this.Name = name;
				this.VariableName = NameProvider.GetVariableName(name);
				this.IsCaption = isCaption;
				this.GenerateField = generateField;
			}
Esempio n. 20
0
        public static DbQueryParameter[] GetParameters(DbColumn[] columns)
        {
            var parameters = new DbQueryParameter[columns.Length];

            for (var i = 0; i < columns.Length; i++)
            {
                parameters[i] = new DbQueryParameter(@"@" + NameProvider.ToParameterName(columns[i].Name));
            }

            return(parameters);
        }
Esempio n. 21
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public InstanceSchema()
        {
            Names        = new NameProvider("Instance", "Instances", "i");
            GetAccess    = Access.All;
            CreateAccess = Access.All;
            DeleteAccess = Access.CreatorUserAndApp;
            IsAbstract   = false;
            CustomCreate = true;

            ////

            Name            = new DomainProperty <string>("Name", "i_na");
            Name.IsNullable = true;
            Name.IsElastic  = true;

            Disamb            = new DomainProperty <string>("Disamb", "i_di");
            Disamb.IsNullable = true;
            Disamb.IsElastic  = true;

            Note            = new DomainProperty <string>("Note", "i_no");
            Note.IsNullable = true;

            ////

            FabName = new ApiProperty <string>("Name");
            FabName.SetOpenAccess();
            FabName.IsNullable   = true;
            FabName.LenMin       = 1;
            FabName.LenMax       = 128;
            FabName.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabName.TraversalHas = Matching.None;

            FabDisamb = new ApiProperty <string>("Disamb");
            FabDisamb.SetOpenAccess();
            FabDisamb.IsNullable   = true;
            FabDisamb.LenMin       = 1;
            FabDisamb.LenMax       = 128;
            FabDisamb.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabDisamb.TraversalHas = Matching.None;

            FabNote = new ApiProperty <string>("Note");
            FabNote.SetOpenAccess();
            FabNote.IsNullable   = true;
            FabNote.LenMin       = 1;
            FabNote.LenMax       = 256;
            FabNote.TraversalHas = Matching.None;

            ////

            FabNameMap   = new PropertyMapping <string, string>(Name, FabName);
            FabDisambMap = new PropertyMapping <string, string>(Disamb, FabDisamb);
            FabNoteMap   = new PropertyMapping <string, string>(Note, FabNote);
        }
Esempio n. 22
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public AppSchema()
        {
            Names        = new NameProvider("App", "Apps", "p");
            GetAccess    = Access.All;
            CreateAccess = Access.Internal;
            DeleteAccess = Access.Internal;
            IsAbstract   = false;

            ////

            Name           = new DomainProperty <string>("Name", "p_na");
            Name.IsUnique  = true;
            Name.IsElastic = true;

            NameKey = new DomainProperty <string>("NameKey", "p_nk");
            NameKey.EnforceUnique = true;
            NameKey.ToLowerCase   = true;
            NameKey.IsIndexed     = true;
            Name.ExactIndexVia    = NameKey;

            Secret = new DomainProperty <string>("Secret", "p_se");

            OauthDomains            = new DomainProperty <string>("OauthDomains", "p_od");
            OauthDomains.IsNullable = true;

            ////

            FabName              = new ApiProperty <string>("Name");
            FabName.GetAccess    = Access.All;
            FabName.IsUnique     = true;
            FabName.LenMin       = 3;
            FabName.LenMax       = 64;
            FabName.ValidRegex   = ApiProperty.ValidTitleRegex;
            FabName.TraversalHas = Matching.None;

            FabSecret            = new ApiProperty <string>("Secret");
            FabSecret.LenMin     = 32;
            FabSecret.LenMax     = 32;
            FabSecret.ValidRegex = ApiProperty.ValidCodeRegex;

            FabOauthDomains                  = new ApiProperty <string>("OauthDomains");
            FabOauthDomains.IsNullable       = true;
            FabOauthDomains.CustomValidation = true;

            ////

            FabNameMap = new PropertyMapping <string, string>(Name, FabName, CustomDir.ApiToDomain);
            FabNameMap.ApiToDomainNote = "Set Domain.NameKey = Api.Name.ToLower()";

            FabSecretMap = new PropertyMapping <string, string>(Secret, FabSecret);

            FabOauthDomainsMap = new PropertyMapping <string, string>(OauthDomains, FabOauthDomains);
        }
Esempio n. 23
0
        public void overrides_type_name()
        {
            const string expectedName = "Egg";
            var names = new Dictionary<MemberInfo, string>
                            {
                                {typeof (Simple), expectedName}
                            };

            var sut = new NameProvider(names, "Anon");

            Assert.Equal(expectedName, sut.Get(typeof (Simple)));
        }
Esempio n. 24
0
        static void Main(string[] args)
        {
            var prov1 = new NameProvider("james", x => x > 2);
            var prov2 = new NameProvider("naess", x => x > 3);

            var providerContainer = new ProviderContainer <INameProvider, int>();

            providerContainer.AddProvider(prov1);
            providerContainer.AddProvider(prov2);

            var providerResolver = new ProviderResolver <INameProvider, int>(providerContainer);
            var providers        = providerResolver.GetProvider(3);
        }
Esempio n. 25
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public VertexSchema()
        {
            Names        = new NameProvider("Vertex", "Vertices", "v");
            GetAccess    = Access.All;
            CreateAccess = Access.Custom;
            DeleteAccess = Access.Custom;
            IsAbstract   = true;

            ////

            VertexId           = new DomainProperty <long>("VertexId", "v_id");
            VertexId.IsUnique  = true;
            VertexId.IsIndexed = true;

            Timestamp           = new DomainProperty <long>("Timestamp", "v_ts");
            Timestamp.IsElastic = true;

            VertexType = new DomainProperty <byte>("VertexType", "v_t");

            ////

            FabId              = new ApiProperty <long>("Id");
            FabId.GetAccess    = Access.All;
            FabId.CreateAccess = Access.None;
            FabId.ModifyAccess = Access.None;
            FabId.IsUnique     = true;
            FabId.TraversalHas = Matching.Exact;

            FabTimestamp              = new ApiProperty <long>("Timestamp");
            FabTimestamp.GetAccess    = Access.All;
            FabTimestamp.CreateAccess = Access.None;
            FabTimestamp.ModifyAccess = Access.None;
            FabTimestamp.TraversalHas = Matching.Custom;

            FabVertexType              = new ApiProperty <byte>("VertexType");
            FabVertexType.GetAccess    = Access.All;
            FabVertexType.CreateAccess = Access.None;
            FabVertexType.ModifyAccess = Access.None;
            FabVertexType.TraversalHas = Matching.Exact;
            FabVertexType.FromEnum     = "VertexType";

            ////

            FabIdMap = new PropertyMapping <long, long>(VertexId, FabId);

            FabTimestampMap = new PropertyMapping <long, long>(Timestamp, FabTimestamp, CustomDir.Both);
            FabTimestampMap.ApiToDomainNote = "Convert Api.Timestamp from Unix-based seconds.";
            FabTimestampMap.DomainToApiNote = "Convert Domain.Timestamp to Unix-based seconds.";

            FabVertexTypeMap = new PropertyMapping <byte, byte>(VertexType, FabVertexType);
        }
Esempio n. 26
0
        public ClrProperty(ClrType type, string name)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            this.Type = type;
            this.Name = NameProvider.ToPropertyName(name);
        }
Esempio n. 27
0
 private void InitialiseEverything()
 {
     RNG.SetSeed(DateTime.Now.Millisecond);
     ScriptingEngine.Initialise();
     ObjectIcons.Load();
     NeedHandler.Initialise();
     AbilityHandler.Initialise();
     JobHandler.Initialise();
     CultureHandler.Initialise();
     MaterialHandler.Initialise();
     ItemHandler.LoadItems();
     NameProvider.Initialise();
     EntityTemplateHandler.Initialise();
 }
Esempio n. 28
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public UserSchema()
        {
            Names        = new NameProvider("User", "Users", "u");
            GetAccess    = Access.All;
            CreateAccess = Access.Internal;
            DeleteAccess = Access.Internal;
            IsAbstract   = false;

            ////

            Name           = new DomainProperty <string>("Name", "u_na");
            Name.IsUnique  = true;
            Name.IsElastic = true;

            NameKey = new DomainProperty <string>("NameKey", "u_nk");
            NameKey.EnforceUnique = true;
            NameKey.ToLowerCase   = true;
            NameKey.IsIndexed     = true;
            Name.ExactIndexVia    = NameKey;

            Password = new DomainProperty <string>("Password", "u_pa");

            ////

            FabName              = new ApiProperty <string>("Name");
            FabName.GetAccess    = Access.All;
            FabName.IsUnique     = true;
            FabName.LenMin       = 3;
            FabName.LenMax       = 64;
            FabName.ValidRegex   = ApiProperty.ValidUserRegex;
            FabName.TraversalHas = Matching.None;

            FabPassword            = new ApiProperty <string>("Password");
            FabPassword.LenMin     = 8;
            FabPassword.LenMax     = 128;
            FabPassword.ValidRegex = ApiProperty.ValidCodeRegex;

            ////

            FabNameMap = new PropertyMapping <string, string>(Name, FabName, CustomDir.ApiToDomain);
            FabNameMap.ApiToDomainNote = "Set Domain.NameKey = Api.Name.ToLower()";
            FabNameMap.DomainToApiNote = "Direct mapping.";

            FabPasswordMap = new PropertyMapping <string, string>(Password, FabPassword, CustomDir.Both);
            FabPasswordMap.ApiToDomainNote = "Encrypt Api.Password.";
            FabPasswordMap.DomainToApiNote = "Direct mapping.";
        }
Esempio n. 29
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public OauthAccessSchema()
        {
            Names        = new NameProvider("OauthAccess", "OauthAccesses", "oa");
            GetAccess    = Access.Internal;
            CreateAccess = Access.Internal;
            DeleteAccess = Access.Internal;
            IsAbstract   = false;

            ////

            Token            = new DomainProperty <string>("Token", "oa_to");
            Token.IsUnique   = true;
            Token.IsNullable = true;
            Token.IsIndexed  = true;

            Refresh            = new DomainProperty <string>("Refresh", "oa_re");
            Refresh.IsUnique   = true;
            Refresh.IsNullable = true;
            Refresh.IsIndexed  = true;

            Expires = new DomainProperty <long>("Expires", "oa_ex");

            ////

            FabToken            = new ApiProperty <string>("Token");
            FabToken.IsNullable = true;
            FabToken.IsUnique   = true;
            FabToken.LenMin     = 32;
            FabToken.LenMax     = 32;
            FabToken.ValidRegex = ApiProperty.ValidCodeRegex;

            FabRefresh            = new ApiProperty <string>("Refresh");
            FabRefresh.IsNullable = true;
            FabRefresh.IsUnique   = true;
            FabRefresh.LenMin     = 32;
            FabRefresh.LenMax     = 32;
            FabRefresh.ValidRegex = ApiProperty.ValidCodeRegex;

            FabExpires = new ApiProperty <long>("Expires");

            ////

            FabTokenMap   = new PropertyMapping <string, string>(Token, FabToken);
            FabRefreshMap = new PropertyMapping <string, string>(Refresh, FabRefresh);
            FabExpiresMap = new PropertyMapping <long, long>(Expires, FabExpires);
        }
Esempio n. 30
0
        public DbColumn(DbColumnType type, string name, bool allowNull = false, bool isPrimaryKey = false)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            this.Name         = NameProvider.ToColumnName(name);
            this.Type         = type;
            this.AllowNull    = allowNull;
            this.IsPrimaryKey = isPrimaryKey;
            this.DbForeignKey = null;
        }
Esempio n. 31
0
        public static EditPaneViewModel CreateOutput(OutputPaneModel f, int n)
        {
            var outputName =
                f.Name.Length != 0
                    ? f.Name
                    : NameProvider.IndexedOutput(n);

            return(new EditPaneViewModel
            {
                Format = f.Format,
                LinkedPath = f.Path,
                ScribanName = outputName,
                AvailableFormats = MonacoResourceFetcher.Instance.GetSupportedFormats().ToArray(),
                PaneType = PaneType.Output,
                FileLinkage = FileLinkageTypes.SaveAndClipboard
            });
        }
Esempio n. 32
0
        public static EditPaneViewModel CreateModel(ModelText model, int n)
        {
            var modelName =
                model.Name.Length != 0
                    ? model.Name
                    : NameProvider.IndexedModel(n);

            return(new EditPaneViewModel
            {
                Format = model.Format.ToString(),
                Text = model.Text,
                ScribanName = modelName,
                LinkedPath = model.Path,
                AvailableFormats = Enum.GetNames(typeof(ModelFormat)),
                PaneType = PaneType.Model,
                FileLinkage = FileLinkageTypes.LoadSave
            });
        }
Esempio n. 33
0
        public ClrClass(string name, ClrProperty[] properties)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (properties == null)
            {
                throw new ArgumentNullException("properties");
            }
            if (properties.Length == 0)
            {
                throw new ArgumentOutOfRangeException("properties");
            }

            this.Name       = NameProvider.ToClassName(name);
            this.Properties = properties;
        }
Esempio n. 34
0
        public static DbColumn ForeignKey(DbTable table, bool allowNull = false, string foreignKeyName = null)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }

            foreach (var column in table.Columns)
            {
                if (column.IsPrimaryKey)
                {
                    return(new DbColumn(DbColumnType.Integer, foreignKeyName ?? NameProvider.GetDbForeignKeyName(table.ClassName), allowNull)
                    {
                        DbForeignKey = new DbForeignKey(table.Name, column.Name)
                    });
                }
            }
            throw new Exception(@"No Primary Key column.");
        }
 /// <summary>
 /// Initializes a new instance of the ActiveRecordTestGenerator class.
 /// </summary>
 /// <param name="nameProvider">The name provider to use when generating code.</param>
 /// <param name="valueProvider">The value provider to use when generating test values.</param>
 public ActiveRecordTestGenerator(NameProvider nameProvider, IValueProvider valueProvider)
 {
     _nameProvider = nameProvider;
     _valueProvider = valueProvider;
 }
 /// <summary>
 /// Initializes a new instance of the ActiveRecordTestGenerator class.
 /// </summary>
 /// <param name="nameProvider">The name provider to use when generating code.</param>
 public ActiveRecordTestGenerator(NameProvider nameProvider)
     : this(nameProvider, new ValueProviderImpl())
 {
 }
Esempio n. 37
0
 public EnumerationGenerator(IDbProvider dbProvider, IConfigurationOptions configOptions, NameProvider nameProvider)
 {
     _dbProvider = dbProvider;
     _configOptions = configOptions;
     _nameProvider = nameProvider;
 }