Exemplo n.º 1
1
 public Water(Map.Map map)
 {
     MainGraphic = new MetaModel
     {
         AlphaRef = 0,
         HasAlpha = true,
         IsWater = true,
         Texture = new TextureFromFile("Models/Props/Sky1.png"),
         SpecularTexture = new TextureFromFile("Models/Props/WaterSpecular1.png"),
         ReceivesAmbientLight = Priority.Never,
         ReceivesDiffuseLight = Priority.Never,
         ReceivesSpecular = Priority.Never,
         SpecularExponent = 3,
         TextureAddress = SlimDX.Direct3D9.TextureAddress.Wrap,
         XMesh = new MeshConcretize
         {
             MeshDescription = new Graphics.Software.Meshes.IndexedPlane
             {
                 Position = Common.Math.ToVector3(map.Settings.Position) +
                     Vector3.UnitZ * map.Settings.WaterHeight,
                 Size = new Vector2(map.Ground.Size.Width, map.Ground.Size.Height),
                 UVMin = Vector2.Zero,
                 UVMax = new Vector2(1, 1),
                 Facings = Facings.Frontside
             },
             Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance
         },
     };
     //VisibilityLocalBounding = new BoundingBox(new Vector3(-1000, -1000, -1000), new Vector3(1000, 1000, 1000))
     VisibilityLocalBounding = new Common.Bounding.NonfittableBounding(new BoundingBox(new Vector3(-1000, -1000, -1000), new Vector3(1000, 1000, 1000)), false, true);
 }
 public void Insert(Content.Model9 model, Entity e, MetaModel metaResource, string metaName)
 {
     RenderSplatMesh m;
     if (!SplatMeshes.TryGetValue(model.XMesh, out m))
         SplatMeshes[model.XMesh] = m = new RenderSplatMesh();
     m.Insert(model, e, metaResource, metaName);
 }
Exemplo n.º 3
0
 public BoxBlocker()
 {
     Vector3 minPoint = new Vector3(-1, -1, 0);
     Vector3 maxPoint = new Vector3(1, 1, 2);
     MainGraphic = new MetaModel
     {
         XMesh = new MeshConcretize
         {
             MeshDescription =
                 new global::Graphics.Software.Meshes.BoxMesh(minPoint, maxPoint, Facings.Frontside, false),
             Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance
         },
         HasAlpha = true,
         Texture = new TextureFromFile("Models/Effects/Blue1.png"),
         ReceivesAmbientLight = Priority.Never,
         ReceivesDiffuseLight = Priority.Never,
     };
     PickingLocalBounding = VisibilityLocalBounding = new MetaBoundingBox
     {
         Mesh = ((MetaModel)MainGraphic).XMesh,
         Transformation = ((MetaModel)MainGraphic).World
     };
     //PhysicsLocalBounding = CreatePhysicsMeshBounding((MetaModel)MainGraphic);
     PhysicsLocalBounding = new Common.Bounding.Box { LocalBoundingBox = new BoundingBox(minPoint, maxPoint) };
 }
Exemplo n.º 4
0
        public Commander()
        {
            HitPoints = MaxHitPoints = 240;
            SplatRequiredDamagePerc = 160 / (float)MaxHitPoints;
            SilverYield = 5;
            MainGraphic = new MetaModel
            {
                SkinnedMesh = new SkinnedMeshFromFile("Models/Units/Zombie1.x"),
                Texture = new TextureFromFile("Models/Units/Commander1.png"),
                SpecularTexture = new TextureFromFile("Models/Units/CommanderSpecular1.png"),
                World = SkinnedMesh.InitSkinnedMeshFromMaya * Matrix.Scaling(0.12f, 0.12f, 0.12f),
                AlphaRef = 254,
                CastShadows = global::Graphics.Content.Priority.High,
                ReceivesShadows = global::Graphics.Content.Priority.High,
                ReceivesSpecular = Priority.High,
                SpecularExponent = 6,
            };
            VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic);
            PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic);

            //AddAbility(new FrenzyScream());
            AddAbility(new GruntThrust());
            AddAbility(new FrenzyScreamAOE());
            //AddBuff(new FrenzyScreamAOE(), this, this);
        }
        public Projectile()
        {
            MainGraphic = new MetaModel
            {
                XMesh = new MeshConcretize
                {
                    MeshDescription = new Graphics.Software.Meshes.IndexedPlane
                    {
                        Position = Vector3.Zero,
                        Size = new Vector2(1, 1),
                        UVMin = new Vector2(0, 0),
                        UVMax = new Vector2(1, 1),
                        Facings = global::Graphics.Facings.Frontside
                    },
                    Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance,
                },
                World = Matrix.Translation(-0.5f, -1, 0) * Matrix.Scaling(0.08f, 1.0f, 1)
                    //* Matrix.RotationZ((float)Math.PI/2f)
                    * Matrix.RotationX(-(float)Math.PI/2f)
                    ,
                Texture = new TextureFromFile("Models/Effects/Trajectory1.png"),
                HasAlpha = true,
                Opacity = 0.5f
            };
            VisibilityLocalBounding = new Common.Bounding.NonfittableBounding(Vector3.Zero, false, true);
            PickingLocalBounding = new MetaBoundingBox
            {
                Mesh = ((MetaModel)MainGraphic).XMesh,
                Transformation = ((MetaModel)MainGraphic).World
            };
            PhysicsLocalBounding = Vector3.Zero;

            TimeToLive = 0.4f;
            Updateable = true;
        }
Exemplo n.º 6
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            MetaModel model = new MetaModel();
            model.RegisterContext(() => new YAWAMT.DataClassesDataContext(new Config().ConnectionString), new ContextConfiguration() { ScaffoldAllTables = false });

            routes.Add(new DynamicDataRoute("Data/{table}/ListDetails.aspx")
            {
                Action = PageAction.List,
                ViewName = "ListDetails",
                Model = model
            });
            routes.Add(new DynamicDataRoute("Data/{table}/ListDetails.aspx")
            {
                Action = PageAction.Details,
                ViewName = "ListDetails",
                Model = model
            });

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //routes.Add(new DynamicDataRoute("Data/{table}/{action}.aspx")
            //{
            //    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
            //    Model = model
            //});

            routes.MapRoute(
                "Default",                                              // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );
        }
Exemplo n.º 7
0
        public GroundSplatterDecal()
        {
            var size = new Vector2(5 * ((float)Game.Random.NextDouble() * 0.2f + 0.4f), 5 * ((float)Game.Random.NextDouble() * 0.2f + 0.4f));
            var gridPosition = Common.Math.ToVector3(-size / 2f);
            MainGraphic = new MetaModel
            {
                AlphaRef = 0,
                HasAlpha = true,
                Texture = new TextureFromFile("Models/Effects/Bloodsplatter3.png"),
                SpecularTexture = new TextureFromFile("Models/Effects/BloodsplatterSpecular3.png"),
                DontSort = true,
#if USE_OLD_GROUND_DECALS
                World = Matrix.Translation(0, 0, 0.01f),
#else
                World = Matrix.Scaling(size.X, size.Y, 1) * Matrix.Translation(gridPosition.X, gridPosition.Y, 0.01f),
#endif
                TextureAddress = SlimDX.Direct3D9.TextureAddress.Clamp,
                ReceivesSpecular = Priority.Medium,
                ReceivesShadows = Priority.High,
                SpecularExponent = 10,
            };
            RotateUV = true;
            Orientation = (float)Game.Random.NextDouble() *
                    (float)Math.PI * 2.0f;
            SnapPositionToHeightmap = DecalSnapping.SnapAndUVAntiSnap;
#if USE_OLD_GROUND_DECALS
            SnapSizeToHeightmap = true;
            Size = size;
            GridPosition = gridPosition;
#else
            SnapSizeToHeightmap = DecalSnapping.Snap;
#endif
            Dynamic = false;
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="metaModel"></param>
 /// <param name="modelContext"></param>
 public PropertiesOptimization(MetaModel metaModel, LibraryModelContext modelContext)
     : base(metaModel, modelContext)
 {
     InvolvedProperties = new List<DomainProperty>();
     this.CreateIntermediate = false;
     this.IsInheritance = false;
 }
Exemplo n.º 9
0
        public Rotten()
        {
            HitPoints = MaxHitPoints = 40;
            RunSpeed = MaxRunSpeed = 2.5f;
            HeadOverBarHeight = 1.25f;
            SilverYield = 1;
            SplatRequiredDamagePerc = 0;
            RageYield = 6f;

            MainGraphic = new MetaModel
            {
                SkinnedMesh = new SkinnedMeshFromFile("Models/Units/Rotten1.x"),
                Texture = new TextureFromFile("Models/Units/Rotten1.png"),
                SpecularTexture = new TextureFromFile("Models/Units/RottenSpecular1.png"),
                World = SkinnedMesh.InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                AlphaRef = 254,
                CastShadows = global::Graphics.Content.Priority.High,
                ReceivesShadows = global::Graphics.Content.Priority.High,
                ReceivesSpecular = global::Graphics.Content.Priority.High,
                SpecularExponent = 6,
            };
            VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic);
            PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic);

            AddAbility(new RottenThrust());
        }
Exemplo n.º 10
0
 public Point()
 {
     MainGraphic = new MetaModel
     {
         XMesh = new MeshConcretize
         {
             MeshDescription =
                 new global::Graphics.Software.Meshes.BoxMesh(new Vector3(-0.1f, -0.1f, 0), new Vector3(0.1f, 0.1f, 0.2f), Facings.Frontside, false),
             Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance
         },
         Texture = new TextureConcretizer
         {
             TextureDescription = new global::Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.Blue)
         },
         ReceivesAmbientLight = Priority.Never,
         ReceivesDiffuseLight = Priority.Never,
     };
     PickingLocalBounding = VisibilityLocalBounding = new MetaBoundingBox
     {
         Mesh = ((MetaModel)MainGraphic).XMesh,
         Transformation = ((MetaModel)MainGraphic).World
     };
     VisibleInGame = false;
     Dynamic = false;
 }
Exemplo n.º 11
0
        public static void RegisterModelRoutes(RouteCollection routes, MetaModel model, string prefix, bool useSeperatePages) {
            if (useSeperatePages) {
                // The following statement supports separate-page mode, where the List, Detail, Insert, and 
                // Update tasks are performed by using separate pages. To enable this mode, uncomment the following 
                // route definition, and comment out the route definitions in the combined-page mode section that follows.
                routes.Add(new DynamicDataRoute(prefix + "/{table}/{action}.aspx") {
                    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                    Model = model
                });
            } else {

                // The following statements support combined-page mode, where the List, Detail, Insert, and
                // Update tasks are performed by using the same page. To enable this mode, uncomment the
                // following routes and comment out the route definition in the separate-page mode section above.
                routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx") {
                    Action = PageAction.List,
                    ViewName = "ListDetails",
                    Model = model
                });

                routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx") {
                    Action = PageAction.Details,
                    ViewName = "ListDetails",
                    Model = model
                });
            }
        }
Exemplo n.º 12
0
 public Item(MetaModel metaModel, MetaItem metaItem, Guid itemId, string itemName)
     : base(metaModel, itemId)
 {
     this.metaItem = metaItem;
     this.itemId = itemId;
     this.itemName = itemName;
 }
        public static CategorizedSelectionViewModel CreateCategorizedVMWithoutImported(MetaModel model, ViewModelStore store, SelectionHelperTarget target)
        {
            // categories for main meta model as well as imported ones
            List<CategorizedAdvSelectableViewModel> modelCategoryVMs = new List<CategorizedAdvSelectableViewModel>();
            CategorizedAdvSelectableViewModel modelCategoryVM = CreateCategorizedAdvSelectableVM(model, model.Name, store, target);
            modelCategoryVMs.Add(modelCategoryVM);

            return new CategorizedSelectionViewModel(store, modelCategoryVMs);
        }
        public static CategorizedSelectionViewModel CreateCategorizedVM(MetaModel model, ViewModelStore store, SelectionHelperTarget target)
        {
            // categories for main meta model as well as imported ones
            List<MetaModel> handledMetaModels = new List<MetaModel>();
            List<CategorizedAdvSelectableViewModel> modelCategoryVMs = new List<CategorizedAdvSelectableViewModel>();
            CreateCategorizedVM(model, store, target, handledMetaModels, modelCategoryVMs);

            return new CategorizedSelectionViewModel(store, modelCategoryVMs);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Throws YamlException
        /// </summary>
        /// <param name="metaModel"></param>
        /// <param name="textReader"></param>
        public void Deserialize(MetaModel.MetaModel metaModel, TextReader textReader)
        {
            Parser p = new Parser(textReader);
            EventReader r = new EventReader(p);

            r.Expect<StreamStart>();
            r.Expect<DocumentStart>();
            r.Expect<MappingStart>();

            Scalar section = r.Peek<Scalar>();
            if (section.Value.Equals(Icons))
            {
                r.Expect<Scalar>();
                DeserializeIcons(metaModel, r);
                section = r.Peek<Scalar>();
            }

            if (section != null && section.Value.Equals(RecentFiles))
            {
                r.Expect<Scalar>();
                DeserializeRecentFiles(metaModel, r);
                section = r.Peek<Scalar>();
            }

            if (section != null && section.Value.Equals(LastOpenedFile))
            {
                r.Expect<Scalar>();
                metaModel.LastOpenedFile = r.Expect<Scalar>().Value;
                section = r.Peek<Scalar>();
            }

            if (section != null && section.Value.Equals(MapBackColor))
            {
                r.Expect<Scalar>();
                metaModel.MapEditorBackColor = (Color)(new ColorConverter().ConvertFromString(r.Expect<Scalar>().Value));
                section = r.Peek<Scalar>();
            }

            if (section != null && section.Value.Equals(NoteBackColor))
            {
                r.Expect<Scalar>();
                metaModel.NoteEditorBackColor = (Color)(new ColorConverter().ConvertFromString(r.Expect<Scalar>().Value));
                section = r.Peek<Scalar>();
            }

            if (section != null && section.Value.Equals(NodeStyles))
            {
                r.Expect<Scalar>();
                DeserializeNodeStyles(metaModel, r);
                //section = r.Peek<Scalar>(); //uncomment when adding another section
            }

            r.Expect<MappingEnd>();
            r.Expect<DocumentEnd>();
            r.Expect<StreamEnd>();
        }
 public void Insert(Content.Model9 model, Entity e, MetaModel metaResource, string metaName)
 {
     if (model.Texture != null)
     {
         RenderLeaf r;
         if (!Textures.TryGetValue(model.Texture, out r))
             Textures[model.Texture] = r = new RenderLeaf();
         r.Insert(model, e, metaResource, metaName);
     }
 }
Exemplo n.º 17
0
        public ClericBoss()
        {
            HitPoints = MaxHitPoints = 5500;
            RunSpeed = MaxRunSpeed = 1;

            MainGraphic = new MetaModel
            {
                AlphaRef = 254,
                SkinnedMesh = new SkinnedMeshFromFile("Models/Units/VoodooPriest1.x"),
                Texture = new TextureConcretizer
                {
                    TextureDescription = new global::Graphics.Software.Textures.SingleColorTexture(
                        System.Drawing.Color.White)
                },
                World = SkinnedMesh.InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                IsBillboard = false,
                CastShadows = global::Graphics.Content.Priority.High,
                ReceivesShadows = global::Graphics.Content.Priority.High,
            };
            VisibilityLocalBounding = new MetaBoundingBox
            {
                Mesh = ((MetaModel)MainGraphic).SkinnedMesh,
                Transformation = ((MetaModel)MainGraphic).World
            };
            PickingLocalBounding = new Common.Bounding.Chain
            {
                Boundings = new object[]
                {
                    VisibilityLocalBounding,
                    new BoundingMetaMesh
                    {
                        SkinnedMeshInstance = MetaEntityAnimation,
                        Transformation = ((MetaModel)MainGraphic).World
                    }
                },
                Shallow = true
            };

            AddAbility(new ClericRaiseDead());
            AddAbility(new IceBreath());
            AddAbility(new BossIncinerateApplyBuff());
            //AddAbility(new ScourgedEarth());

            if (Program.Instance != null)
            {
                var sm = Program.Instance.SoundManager;
                var idleSound = sm.GetSoundResourceGroup(sm.GetSFX(SFX.ClericIdle1), sm.GetSFX(SFX.ClericIdle2), sm.GetSFX(SFX.ClericIdle3));
                idle = idleSound.PlayLoopedWithIntervals(5, 15, 3f + (float)Game.Random.NextDouble() * 3.0f, new Sound.PlayArgs
                {
                    GetPosition = () => { return Position; },
                    GetVelocity = () => { if (MotionNPC != null) return MotionNPC.Velocity; else return Vector3.Zero; }
                });
            }
        }
 private static CategorizedAdvSelectableViewModel CreateCategorizedAdvSelectableVM(MetaModel model, string categoryName, ViewModelStore store, SelectionHelperTarget target)
 {
     List<CategorizedSelectableViewModel> vms = new List<CategorizedSelectableViewModel>();
     foreach (BaseModelContext m in model.ModelContexts)
     {
         if (m is LibraryModelContext)
         {
             vms.Add(CreateCategorizedSelectableVM(m as LibraryModelContext, m.Name, store, target));
         }
     }
     return new CategorizedAdvSelectableViewModel(store, categoryName, vms);
 }
Exemplo n.º 19
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            MetaModel model = new MetaModel();

            
            model.RegisterContext(typeof(TrackerDataContext), new ContextConfiguration() { ScaffoldAllTables = false});

            routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model = model
            });
        }
Exemplo n.º 20
0
        public static void RegisterRoutes(RouteCollection routes) {
            L2Smodel = new MetaModel();
            L2Smodel.DynamicDataFolderVirtualPath = "~/DynamicDataL2S";
            L2Smodel.RegisterContext(typeof(NorthwindDataContext), new ContextConfiguration() { ScaffoldAllTables = true });
            L2Smodel.RegisterContext(typeof(InheritanceDataContext), new ContextConfiguration() { ScaffoldAllTables = true });
            RegisterModelRoutes(routes, L2Smodel, "L2S", true);

            EFmodel = new MetaModel();
            EFmodel.DynamicDataFolderVirtualPath = "~/DynamicDataEF";
            EFmodel.RegisterContext(typeof(DynamicDataEFProject.NORTHWNDEntities), new ContextConfiguration() { ScaffoldAllTables = true });
            EFmodel.RegisterContext(typeof(DynamicDataEFProject.InheritanceEntities), new ContextConfiguration() { ScaffoldAllTables = true });
            RegisterModelRoutes(routes, EFmodel, "EF", true);
        }
Exemplo n.º 21
0
        public INode Deserialize(string nodePath)
        {
            string nodeName = Path.GetFileName(nodePath);

            INode node;
            using (var fs = _fileSystem.Open(Path.Combine(nodePath, "Properties.txt"), FileMode.Open, FileAccess.Read, FileShare.Read))
            using (var reader = new StreamReader(fs))
            {
                string type = reader.ReadLine().Split(':')[1].Trim();
                node = (INode)Activator.CreateInstance("Ghandi", type).Unwrap();
                node.Name = nodeName;

                while (!reader.EndOfStream)
                {
                    Parse(node, reader.ReadLine());
                }
            }

            var metaModel = new MetaModel(node, nodePath);

            foreach (var s in metaModel.Properties)
            {
                string path = Path.Combine(nodePath, s.Name.SanitizeUrl() + ".txt");
                using (var fs = _fileSystem.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
                using (var reader = new StreamReader(fs))
                {
                    s.Property.SetValue(node, Convert.ChangeType(reader.ReadToEnd(), s.Property.PropertyType), new object[0]);
                }
            }

            foreach (var s in metaModel.XmlProperties)
            {
                string path = Path.Combine(nodePath, s.Name.SanitizeUrl() + ".xml");
                s.Property.SetValue(node, XDocument.Load(path), new object[0]);
            }

            foreach (var s in metaModel.SerializableOfStringProperties)
            {
                string path = Path.Combine(nodePath, s.Name.SanitizeUrl() + "." + s.Property.PropertyType.Name);
                using (var fs = _fileSystem.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
                using (var reader = new StreamReader(fs))
                {
                    string stringValue = reader.ReadToEnd();
                    ISerializable<string> propertyValue = (ISerializable<string>)Activator.CreateInstance(s.Property.PropertyType);
                    propertyValue.Deserialize(stringValue);
                    s.Property.SetValue(node, propertyValue, new object[0]);
                }
            }

            return node;
        }
Exemplo n.º 22
0
		public ModelConverters(MetaModel model, SPFieldCollection fields)
		{
			Guard.ThrowIfArgumentNull(model, "model");
			Guard.ThrowIfArgumentNull(fields, "fields");

			Model = model;
			Converters = new Dictionary<string, IFieldConverter>();

			foreach (var metaProperty in model.MetaProperties)
			{
				var field = fields.GetField(metaProperty.SpFieldInternalName);
				Converters.Add(metaProperty.MemberName, InstantiateConverter(metaProperty, field));
			}
		}
        public void Insert(Content.Model9 model, Entity e, MetaModel metaResource, string metaName)
        {
            SplatTextureCombination stc = new SplatTextureCombination
            {
                BaseTexture = model.BaseTexture,
                MaterialTexture = model.MaterialTexture,
                SplatTexture = model.SplatTexture
            };

            RenderLeaf r;
            if (!TextureCombinations.TryGetValue(stc, out r))
                TextureCombinations[stc] = r = new RenderLeaf();
            r.Insert(model, e, metaResource, metaName);
        }
		public void QueryProjects() {
			var proxyProvider = new ProxyProvider(new Uri(ProxyPath), ProxyUsername, ProxyPassword);
			IAPIConnector metaConnector = new V1APIConnector(V1Path + "meta.v1/", V1Username, V1Password, false, proxyProvider);
			IMetaModel metaModel = new MetaModel(metaConnector);

			IAPIConnector dataConnector = new V1APIConnector(V1Path + "rest-1.v1/", V1Username, V1Password, false, proxyProvider);
			IServices services = new Services(metaModel, dataConnector);

			var projectType = metaModel.GetAssetType("Scope");
			var scopeQuery = new Query(projectType);
			var result = services.Retrieve(scopeQuery);

			Assert.IsTrue(result.Assets.Count > 0);
		}
Exemplo n.º 25
0
 public CritEffect1()
 {
     Duration = 0.5f;
     VisibilityLocalBounding = Vector3.Zero;
     MainGraphic = metaModel = new MetaModel
     {
         SkinnedMesh = new SkinnedMeshFromFile("Models/Effects/CriticalStrike1.x"),
         Texture = new TextureFromFile("Models/Effects/CriticalStrike1.png"),
         HasAlpha = true,
         ReceivesAmbientLight = Priority.Never,
         ReceivesDiffuseLight = Priority.Never,
         World = Matrix.Scaling(0.25f, 0.25f, 0.25f) * SkinnedMesh.InitSkinnedMeshFromMaya * Matrix.Translation(1.2f, 0f, 1f),
     };
 }
		public void TestFixtureSetUp()
		{
			V1APIConnector dataConnector = new V1APIConnector(v1Url + dataPath, username, password);
			V1APIConnector metaConnector = new V1APIConnector(v1Url + metaPath);
			V1APIConnector localConnector = new V1APIConnector(v1Url + localizationPath);
			
			localizer = new Localizer(localConnector);
			metaModel = new MetaModel(metaConnector);
			services = new Services(metaModel, dataConnector);

			timeboxType = metaModel.GetAssetType("Timebox");
			timeboxName = timeboxType.GetAttributeDefinition("Name");
			timeboxID = timeboxType.GetAttributeDefinition("ID");
		}
        public MainCharacter()
        {
            RunSpeed = MaxRunSpeed = 4;
            RunAnimationSpeed = 0.5f;
            BackingAnimationSpeed = 0.35f;
            Team = Team.Player;
            PhysicalWeight = 1;
            regenTickTime = 3f;
            regenTickHeal = 2;
            PistolAmmo = 0;
            TalismansCollected = 0;
            FootstepRelativePeriod = 1.5f;
            SplatRequiredDamagePerc = float.MaxValue;
            HeadOverBarHeight = 2.2f;
            Name = "MainCharacter";
            RageEnabled = true;

            MainGraphic = new MetaModel
            {
                SkinnedMesh = new SkinnedMeshFromFile("Models/Units/MainCharacter1.x"),
                Texture = new TextureFromFile("Models/Units/MainCharacter1.png"),
                SpecularTexture = new TextureFromFile("Models/Units/MainCharacterSpecular1.png"),
                World = SkinnedMesh.InitSkinnedMeshFromMaya * Matrix.Scaling(0.182f, 0.182f, 0.167f),
                CastShadows = Priority.High,
                ReceivesShadows = Priority.High,
                ReceivesSpecular = Priority.High
            };

            VisibilityLocalBounding = new MetaBoundingBox
            {
                Mesh = ((MetaModel)MainGraphic).SkinnedMesh,
                Transformation = ((MetaModel)MainGraphic).World
            };
            PickingLocalBounding = new Common.Bounding.Chain
            {
                Boundings = new object[]
                {
                    VisibilityLocalBounding,
                    new BoundingMetaMesh
                    {
                        SkinnedMeshInstance = MetaEntityAnimation,
                        Transformation = ((MetaModel)MainGraphic).World
                    }
                },
                Shallow = true
            };

            InitWeapons();
        }
Exemplo n.º 28
0
        public void Serialize(string rootPath, INode node, bool recursive = false)
        {
            string nodePath = Path.Combine(rootPath, node.Name.SanitizeUrl());

            if (!_fileSystem.DirectoryExists(nodePath))
                _fileSystem.CreateDirectory(nodePath);

            var metaModel = new MetaModel(node, nodePath);

            using (var fs = _fileSystem.Open(Path.Combine(nodePath, "Properties.txt"), FileMode.Create, FileAccess.Write, FileShare.None))
            using (var writer = new StreamWriter(fs))
            {
                writer.WriteLine("Type: {0}", node.GetType().FullName);
                writer.WriteLine("Urls: {0}", node.Uri);
                writer.WriteLine("Template: {0}", node.Template);
                writer.WriteLine("Publish: {0}", "Never");
                writer.WriteLine("Unpublish: {0}", "Never");
            }

            foreach (var s in metaModel.Properties)
            {
                string path = Path.Combine(nodePath, s.Name.SanitizeUrl() + ".txt");
                using (var fs = _fileSystem.Open(path, FileMode.Create, FileAccess.Write, FileShare.None))
                using (var writer = new StreamWriter(fs))
                {
                    writer.Write(s.Value.ToString());
                }
            }

            foreach (var prop in metaModel.XmlProperties)
            {
                string path = Path.Combine(nodePath, prop.Name.SanitizeUrl() + ".xml");
                using (var fs = _fileSystem.Open(path, FileMode.Create, FileAccess.Write, FileShare.None))
                using (var writer = new StreamWriter(fs))
                {
                    writer.Write(prop.Value.ToString());
                }
            }

            //  TODO
            //foreach (var collection in collections.Where(c => !ExcludedProperties.Contains(c.Name)))
            //{

            //}

            if (recursive)
                foreach (var child in node.Children)
                    Serialize(rootPath: nodePath, node: child, recursive: true);
        }
        public void SetDataObject(object dataObject, DetailsView detailsView) {

            DataObject = dataObject;
            TypeDescriptionProvider typeDescriptionProvider;

            CustomTypeDescriptor = dataObject as ICustomTypeDescriptor;
            Type dataObjectType;

            if (CustomTypeDescriptor == null) {
                dataObjectType = dataObject.GetType();
                typeDescriptionProvider = TypeDescriptor.GetProvider(DataObject);
                CustomTypeDescriptor = typeDescriptionProvider.GetTypeDescriptor(DataObject);
            }
            else {
                dataObjectType = GetEntityType();
                typeDescriptionProvider = new TrivialTypeDescriptionProvider(CustomTypeDescriptor);
            }

            // Set the context type and entity set name on ourselves. Note that in this scenario those
            // concepts are somewhat artificial, since we don't have a real context. 

            // Set the ContextType to the dataObjectType, which is a bit strange but harmless
            Type contextType = dataObjectType;

            ((IDynamicDataSource)this).ContextType = contextType;

            // We can set the entity set name to anything, but using the
            // DataObjectType makes some Dynamic Data error messages clearer.
            ((IDynamicDataSource)this).EntitySetName = dataObjectType.Name;

            MetaModel model = null;
            try {
                model = MetaModel.GetModel(contextType);
            }
            catch {
                model = new MetaModel();
                model.RegisterContext(
                    new SimpleModelProvider(contextType, dataObjectType, dataObject),
                    new ContextConfiguration() {
                        MetadataProviderFactory = (type => typeDescriptionProvider)
                    });
            }

            MetaTable table = model.GetTable(dataObjectType);

            if (detailsView != null) {
                detailsView.RowsGenerator = new AdvancedFieldGenerator(table, false);
            }
        }
Exemplo n.º 30
0
 public ExplodingRocksEffect()
 {
     MainGraphic = new MetaModel
     {
         SkinnedMesh = new SkinnedMeshFromFile("Models/Effects/RocksExplode1.x"),
         Texture = new TextureFromFile("Models/Props/Stone1.png"),
         World = SkinnedMesh.InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
         IsBillboard = false,
         AlphaRef = 254,
     };
     PickingLocalBounding = VisibilityLocalBounding = new MetaBoundingBox
     {
         Mesh = ((MetaModel)MainGraphic).SkinnedMesh,
         Transformation = ((MetaModel)MainGraphic).World
     };
 }
Exemplo n.º 31
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="metaModel"></param>
 /// <param name="modelContext"></param>
 protected BaseProcessor(MetaModel metaModel, LibraryModelContext modelContext)
 {
     this.MetaModel    = metaModel;
     this.ModelContext = modelContext;
 }
 public RealtimeViewModel()
 {
     _metaModel = new MetaModel();
 }
Exemplo n.º 33
0
 internal void SetModel(MetaModel model)
 {
     Model = model;
 }
Exemplo n.º 34
0
 // Methods
 internal SqlRetyper(ITypeSystemProvider typeProvider, MetaModel model)
 {
     this.visitor = new Visitor(typeProvider, model);
 }
 public ImportRegressionTests(SqlConnection sqlConn, MetaModel MetaAPI, Services DataAPI, MigrationConfiguration Configurations)
     : base(sqlConn, MetaAPI, DataAPI, Configurations)
 {
 }
 public ExportRequests(SqlConnection sqlConn, MetaModel MetaAPI, Services DataAPI, MigrationConfiguration Configurations)
     : base(sqlConn, MetaAPI, DataAPI, Configurations)
 {
 }
Exemplo n.º 37
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            MetaModel model = new MetaModel();

            //                    IMPORTANT: DATA MODEL REGISTRATION
            // Uncomment this line to register LINQ to SQL classes or an ADO.NET Entity Data
            // model for ASP.NET Dynamic Data. Set ScaffoldAllTables = true only if you are sure
            // that you want all tables in the data model to support a scaffold (i.e. templates)
            // view. To control scaffolding for individual tables, create a partial class for
            // the table and apply the [Scaffold(true)] attribute to the partial class.
            // Note: Make sure that you change "YourDataContextType" to the name of the data context
            // class in your application.
            model.RegisterContext(typeof(TRAVEL_WEBDataContext), new ContextConfiguration()
            {
                ScaffoldAllTables = true
            });

            // The following statement supports separate-page mode, where the List, Detail, Insert, and
            // Update tasks are performed by using separate pages. To enable this mode, uncomment the following
            // route definition, and comment out the route definitions in the combined-page mode section that follows.
            routes.Add(new DynamicDataRoute("TAI_KHOANs/ListDetails.aspx")
            {
                Action       = PageAction.List,
                ViewName     = "ListDetails",
                Model        = model,
                Table        = "TAI_KHOANs",
                RouteHandler = new CustomDynamicDataRouteHandler()
            });

            routes.Add(new DynamicDataRoute("TAI_KHOANs/ListDetails.aspx")
            {
                Action       = PageAction.Details,
                ViewName     = "ListDetails",
                Model        = model,
                Table        = "TAI_KHOANs",
                RouteHandler = new CustomDynamicDataRouteHandler()
            });

            routes.Add(new DynamicDataRoute("CHUYEN_XEs/PhanHoi.aspx")
            {
                Action   = "PhanHoi",
                ViewName = "PhanHoi",
                Model    = model,
                Table    = "CHUYEN_XEs"
            });

            routes.Add(new DynamicDataRoute("{table}/AnonymousList.aspx")
            {
                Action = "AnonymousList",
                Model  = model
            });

            //routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
            //{
            //    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
            //    Model = model
            //});

            routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
            {
                Constraints  = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model        = model,
                RouteHandler = new CustomDynamicDataRouteHandler()
            });

            // The following statements support combined-page mode, where the List, Detail, Insert, and
            // Update tasks are performed by using the same page. To enable this mode, uncomment the
            // following routes and comment out the route definition in the separate-page mode section above.
            //routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx") {
            //    Action = PageAction.List,
            //    ViewName = "ListDetails",
            //    Model = model
            //});

            //routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx") {
            //    Action = PageAction.Details,
            //    ViewName = "ListDetails",
            //    Model = model
            //});
        }
        public void GenerateViewModel(MetaModel dm)
        {
        #line default
        #line hidden

        #line 11 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write("namespace ");


        #line default
        #line hidden

        #line 12 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Namespace));


        #line default
        #line hidden

        #line 12 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(".ViewModel\r\n{\r\n\t/// <summary>\r\n\t/// Class to allow easy service registration.\r\n\t/" +
                       "// </summary>\r\n\tpublic partial class ");


        #line default
        #line hidden

        #line 17 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Name));


        #line default
        #line hidden

        #line 17 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write("ServiceRegistrar : ");


        #line default
        #line hidden

        #line 17 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Name));


        #line default
        #line hidden

        #line 17 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write("ServiceRegistrarBase\r\n    {\r\n\t\t#region Singleton Instance\r\n\t\tprivate static ");


        #line default
        #line hidden

        #line 20 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Name));


        #line default
        #line hidden

        #line 20 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write("ServiceRegistrar instance = null;\r\n\t\t\r\n\t\t/// <summary>\r\n\t\t/// Private constructor" +
                       ".\r\n\t\t/// </summary>\r\n\t\tprivate ");


        #line default
        #line hidden

        #line 25 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Name));


        #line default
        #line hidden

        #line 25 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write("ServiceRegistrar() : base()\r\n\t\t{\r\n\t\t}\r\n\t\r\n\t\t/// <summary>\r\n\t\t/// Singleton Instan" +
                       "ce.\r\n\t\t/// </summary>\r\n\t\tpublic static ");


        #line default
        #line hidden

        #line 32 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Name));


        #line default
        #line hidden

        #line 32 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write("ServiceRegistrar Instance\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tif( instance == null )\r\n\t\t\t\t\tin" +
                       "stance = new ");


        #line default
        #line hidden

        #line 37 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Name));


        #line default
        #line hidden

        #line 37 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write("ServiceRegistrar();\r\n\t\t\t\t\t\r\n\t\t\t\treturn instance;\r\n\t\t\t}\r\n\t\t}\t\t\t\r\n\t\t#endregion\r\n\t}\r" +
                       "\n\t\r\n\t/// <summary>\r\n\t/// Class to allow easy service registration.\r\n\t///\r\n\t/// T" +
                       "his is the base abstract class.\r\n\t/// </summary>\r\n\tpublic partial class ");


        #line default
        #line hidden

        #line 50 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Name));


        #line default
        #line hidden

        #line 50 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write("ServiceRegistrarBase : DslEditorViewModelData::ServiceRegistrar\r\n\t{\r\n\t\t/// <summa" +
                       "ry>\r\n\t\t/// Constructor.\r\n\t\t/// </summary>\r\n\t\tprotected ");


        #line default
        #line hidden

        #line 55 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(dm.Name));


        #line default
        #line hidden

        #line 55 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
            this.Write(@"ServiceRegistrarBase() : base()
		{
		}
		
        /// <summary>
	    /// Register services to the given store.
        /// </summary>
        /// <param name=""store"">ViewModelStore.</param>
        public override void RegisterServices(DslEditorViewModelData::ViewModelStore store)
		{
			
		}
	}
}
");


        #line default
        #line hidden

        #line 69 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\ServiceRegistrarGenerator.tt"
        }
        public void ParseWithTwoApplicationsAndOneOrchestration(BizTalkOrchestrationParser parser, ILogger logger, MigrationContext context, BizTalkApplication applicationOne, BizTalkApplication applicationTwo, MetaModel metaModel, AzureIntegrationServicesModel model, ParsedBizTalkApplicationGroup group, Exception e)
        {
            "Given a model"
            .x(() =>
            {
                model = new AzureIntegrationServicesModel();
                group = new ParsedBizTalkApplicationGroup();
                model.MigrationSource.MigrationSourceModel = group;
            });

            "And a logger"
            .x(() => logger = new Mock <ILogger>().Object);

            "And a context"
            .x(() => context = new MigrationContext());

            "And an application with one orchestration with a valid ODX"
            .x(() =>
            {
                metaModel = new MetaModel
                {
                    Core    = "Core",
                    Element = new Element[]
                    {
                        new Element {
                            Type = MetaModelConstants.ElementTypeModule
                        }
                    },
                    MajorVersion = "MajorVersion",
                    MinorVersion = "MinorVersion"
                };

                var msiContainer = new ResourceContainer()
                {
                    Key = "TestMsi.Key", Name = "TestMsi", Type = ModelConstants.ResourceContainerMsi, ContainerLocation = @"C:\Test\Test.msi"
                };
                model.MigrationSource.ResourceContainers.Add(msiContainer);

                var cabContainer = new ResourceContainer()
                {
                    Key = "TestCab.Key", Name = "TestCab", Type = ModelConstants.ResourceContainerCab, ContainerLocation = @"C:\Test\Test.CAB"
                };
                msiContainer.ResourceContainers.Add(cabContainer);

                var asmContainer = new ResourceContainer()
                {
                    Key = "TestAssembly.Key", Name = "TestAssembly", Type = ModelConstants.ResourceContainerAssembly, ContainerLocation = @"C:\Test\Test.dll"
                };
                cabContainer.ResourceContainers.Add(asmContainer);

                var orchestration = new ResourceDefinition()
                {
                    Key = "TestOrchestration.Key", Name = "TestOrchestration", Type = ModelConstants.ResourceDefinitionOrchestration, ResourceContent = SerializeToString(metaModel)
                };
                asmContainer.ResourceDefinitions.Add(orchestration);

                applicationOne = new BizTalkApplication()
                {
                    Name = "ApplicationOne"
                };
                applicationOne.Orchestrations.Add(new Orchestration(asmContainer.Key, orchestration.Key)
                {
                    Name = "OrchestrationOne"
                });
                applicationOne.ApplicationDefinition = new ApplicationDefinitionFile {
                    ResourceKey = "ResourceKey"
                };

                var parsedApplication = new ParsedBizTalkApplication
                {
                    Application = applicationOne
                };
                group.Applications.Add(parsedApplication);

                var container = new ResourceContainer();
                container.ResourceDefinitions.Add(new ResourceDefinition());
                container.ResourceDefinitions[0].Resources.Add(new ResourceItem {
                    Key = "ResourceKey"
                });
                model.MigrationSource.ResourceContainers.Add(container);
            });

            "And an application with no orchestrations"
            .x(() =>
            {
                applicationTwo = new BizTalkApplication()
                {
                    Name = "ApplicationTwo"
                };

                group.Applications.Add(
                    new ParsedBizTalkApplication
                {
                    Application = applicationTwo
                });
            });

            "And a BizTalk Orchestration Parser"
            .x(() => parser = new BizTalkOrchestrationParser(model, context, logger));

            "When parsing"
            .x(() => e = Record.Exception(() => parser.Parse()));

            "Then the parser should not throw an exception"
            .x(() => e.Should().BeNull());

            "And the error count should be 0"
            .x(() =>
            {
                context.Errors.Should().BeNullOrEmpty();
            });

            "And the model on the orchestration should be equivalent to the ODX for the first application"
            .x(() =>
            {
                // Validate the structure of the model.
                group.Applications[0].Application.Orchestrations.Should().NotBeNullOrEmpty().And.HaveCount(1);
                var orchestration = group.Applications[0].Application.Orchestrations[0];
                group.Applications[0].Application.Orchestrations[0].Model.Should().NotBeNull();

                // Validate the contents of the model.
                orchestration.Model.MajorVersion.Should().Be(metaModel.MajorVersion);
                orchestration.Model.MinorVersion.Should().Be(metaModel.MinorVersion);
                orchestration.Model.Core.Should().Be(metaModel.Core);
                orchestration.Model.Element.Should().NotBeNullOrEmpty();
                orchestration.Model.Element.Should().HaveCount(metaModel.Element.Length);
            });
        }
Exemplo n.º 40
0
 public static MetaTable CreateTable(ICustomTypeDescriptor typeDescriptor)
 {
     return(MetaModel.CreateSimpleModel(typeDescriptor).Tables.First <MetaTable>());
 }
Exemplo n.º 41
0
 public CustomMetaModel(MetaModel model)
 {
     this.model = model;
 }
Exemplo n.º 42
0
 public ImportConversations(SqlConnection sqlConn, MetaModel MetaAPI, Services DataAPI, MigrationConfiguration Configurations)
     : base(sqlConn, MetaAPI, DataAPI, Configurations)
 {
 }
Exemplo n.º 43
0
 public CustomMetaModel(MetaModel orgmodel, Dictionary <Type, string> tableNames)
 {
     _orgmodel   = orgmodel;
     _tableNames = tableNames;
 }
Exemplo n.º 44
0
 public static MetaTable CreateTable(Type entityType)
 {
     return(MetaModel.CreateSimpleModel(entityType).Tables.First <MetaTable>());
 }
Exemplo n.º 45
0
        public ActionResult Index(string alias, string textSearch, int pageIndex = 1)
        {
            int cateId = 0;

            if (!string.IsNullOrEmpty(textSearch))
            {
                textSearch = textSearch.Replace('-', ' ');
                textSearch = StringUtils.UnicodeToUnsignChar(textSearch);
            }

            SearchArticle searchInfo = new SearchArticle()
            {
                CateId     = cateId,
                TextSearch = textSearch,
                OrderBy    = CookieManager.Instance.Get <int>(Const.ArrangeArticle).ToInt(0),
                PageIndex  = pageIndex,
                PageSize   = Const.PageSizeArticle
            };

            #region Redirect Permanent 301

            string standardUrl = _buildLinkBo.ParserArticleUrl(alias, ref searchInfo);

            string url301     = standardUrl;
            string currentUrl = Request.RawUrl;

            if (currentUrl.Contains("?utm_source"))
            {
                string strUtm = currentUrl.Substring(currentUrl.IndexOf("?utm_source"), currentUrl.Length - currentUrl.IndexOf("?utm_source"));
                url301 = string.Concat(url301, strUtm);
            }
            if (!currentUrl.Equals(url301))
            {
                return(Redirect301(url301));
            }

            #endregion

            ArticleListModel model = new ArticleListModel();
            int totalRows          = _articleBo.GetListCount(searchInfo);
            if (totalRows > 0)
            {
                model.ArticleList = _articleBo.GetList(searchInfo);

                #region paging

                Pagings pageModel = new Pagings
                {
                    PageIndex = pageIndex,
                    Count     = totalRows,
                    LinkSite  = Utils.GetCurrentURL(standardUrl, pageIndex),
                    PageSize  = Const.PageSizeArticle
                };
                model.PagingInfo       = pageModel;
                ViewBag.MetaPagination = SEO.MetaPagination(pageModel.Count, pageIndex, pageModel.PageSize, pageModel.LinkSite);

                #endregion
            }
            if (pageIndex > 1 && totalRows > 0 && (model.ArticleList == null || model.ArticleList.Count == 0))
            {
                return(Redirect(model.PagingInfo.LinkSite));
            }

            model.SearchInfo = searchInfo;

            #region Meta

            MetaModel metaTag  = _buildLinkBo.BuildMetaArticle(searchInfo);
            string    metaTags = SEO.Instance.BindingMeta(standardUrl, metaTag.MetaTitle, metaTag.MetaDescription, metaTag.MetaKeyword);

            model.TitlePage   = metaTag.TitlePage;
            ViewBag.MetaTitle = metaTag.MetaTitle;
            ViewBag.Meta      = metaTags;

            #endregion

            return(View(model));
        }
Exemplo n.º 46
0
 internal Lifter(TypeSystemProvider typeProvider, MetaModel model)
 {
     this.sql = new SqlFactory(typeProvider, model);
     this.aggregateChecker = new SqlAggregateChecker();
     this.rowNumberChecker = new SqlRowNumberChecker();
 }
Exemplo n.º 47
0
 internal void SetModel(MetaModel model)
 {
     this.metaModel = model;
 }
Exemplo n.º 48
0
 internal static SqlNode Lift(SqlNode node, TypeSystemProvider typeProvider, MetaModel model)
 {
     return(new Lifter(typeProvider, model).Visit(node));
 }
Exemplo n.º 49
0
 internal override SqlFactory CreateSqlFactory(ITypeSystemProvider typeProvider, MetaModel metaModel)
 {
     return(new EfzSqlFactory(typeProvider, metaModel));
 }
Exemplo n.º 50
0
 internal MySqlFactory(ITypeSystemProvider typeProvider, MetaModel model)
     : base(typeProvider, model)
 {
 }
Exemplo n.º 51
0
 // Methods
 internal Visitor(ITypeSystemProvider typeProvider, MetaModel model)
 {
     this.sql          = new SqlFactory(typeProvider, model);
     this.typeProvider = typeProvider;
 }
 public string GenerateCodeExampleForDiagram(MetaModel dm)
 {
     this.GenerationEnvironment = null;
     this.GenerateCodeExampleForDiagramInternal(dm);
     return(this.GenerationEnvironment.ToString());
 }
Exemplo n.º 53
0
 public ImportAttachments(SqlConnection sqlConn, MetaModel MetaAPI, Services DataAPI, V1APIConnector ImageConnector, MigrationConfiguration Configurations)
     : base(sqlConn, MetaAPI, DataAPI, Configurations)
 {
     _imageConnector = ImageConnector;
 }
        private void GenerateCodeExampleForDiagramInternal(MetaModel dm)
        {
        #line default
        #line hidden

        #line 19 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\CodeExamplesGeneratorHelper.tt"
            this.Write("    /// <summary>\r\n    /// This diagram was generated to illustrate some concepts" +
                       " of PDE, especially when working with views.\r\n    /// </summary>\r\n    public cla" +
                       "ss CodeExamplesDiagram : DslEditorViewDiagrams::DiagramSurfaceViewModel\r\n    {\r\n" +
                       "        /// <summary>\r\n        /// Constuctor.\r\n        /// </summary>\r\n        " +
                       "/// <param name=\"viewModelStore\">View model store containing this view model.</p" +
                       "aram>\r\n\t\t/// <param name=\"diagram\">Diagram.</param>\r\n\t\t/// <param name=\"modelCon" +
                       "text\">Model context.</param>\r\n        public CodeExamplesDiagram(VModellXTViewMo" +
                       "delStore viewModelStore, DslEditorDiagrams::Diagram diagram, DslEditorModeling::" +
                       "ModelContext modelContext)\r\n            : base(viewModelStore, diagram, modelCon" +
                       "text)\r\n        {\r\n\t\t\t\r\n        }\r\n\r\n        #region 1. Messaging\r\n        /*****" +
                       "**********************\r\n           For the purpose of messaging PDE consists of " +
                       "an EventManager allowing the subscription or unsubscption to events.\r\n          " +
                       " Every event can either be published or be subscribed to (see example below). Th" +
                       "e concept of messaging in PDE follows the \r\n           EventAggregator pattern (" +
                       "see PRISM for more details).\r\n         \r\n           The following events might b" +
                       "e of interest when working with views:\r\n            * ActiveViewChangedEvent    " +
                       "(You can also override the \'IsActiveView\' method)\r\n            * BringToFrontVie" +
                       "wModelRequestEvent\r\n            * CloseViewModelRequestEvent\r\n            * Open" +
                       "ViewModelEvent\r\n            * ResetViewModelEvent   (You can also override the \'" +
                       "Reset\' method)\r\n            * SelectionChangedEvent   (You can also override the" +
                       " \'ReactOnViewSelection\' method)\r\n            * ShowViewModelRequestEvent\r\n      " +
                       "      \r\n           PDE also has evets for model-based changes:\r\n            * Mo" +
                       "delElementAddedEvent\r\n            * ModelElementCustomEvent\r\n            * Model" +
                       "ElementDeletedEvent\r\n            * ModelElementEvent\r\n            * ModelElement" +
                       "LinkAddedEvent\r\n            * ModelElementLinkDeletedEvent\r\n            * ModelE" +
                       "lementPropertyChangedEvent\r\n            * ModelRolePlayerChangedEvent\r\n         " +
                       "   * ModelRolePlayerMovedEvent\r\n           \r\n            (See Tum.PDE.ToolFramew" +
                       "ork.Modeling.Visualization.ViewModel.Messaging.Events for more details.)\r\n      " +
                       "   \r\n            Examle 1: Subscribe to model element creation and deletion even" +
                       "ts for a specific element.\r\n            Examle 2: Subscribe to relationship crea" +
                       "tion, deletion and role player changes for a specific relationship.\r\n          \r" +
                       "\n           HINT: Keep in mind that there you can have specific element view mod" +
                       "els generated for every element of your model.\r\n                 To do so, selec" +
                       "t an element in the LanguageDSL-Designer and set the property \"Generate Specific" +
                       " View Model\" to true.\r\n        ***************************/\r\n        protected o" +
                       "verride void Subscribe()\r\n        {\r\n            base.Subscribe();\r\n\r\n          " +
                       "  // HINT: keep in mind that there are multiple overloads for the Subscribe/Unsu" +
                       "bscribe methods\r\n\r\n            // Example 1: Vorgehensbaustein\r\n            this" +
                       ".EventManager.GetEvent<DslEditorEvents::ModelElementAddedEvent>().Subscribe(\r\n  " +
                       "              this.Store.DomainDataDirectory.FindDomainClass(Tum.VModellXT.Stati" +
                       "k.Vorgehensbaustein.DomainClassId), OnVorgehensbausteinAdded);\r\n            this" +
                       ".EventManager.GetEvent<DslEditorEvents::ModelElementDeletedEvent>().Subscribe(\r\n" +
                       "                this.Store.DomainDataDirectory.FindDomainClass(Tum.VModellXT.Sta" +
                       "tik.Vorgehensbaustein.DomainClassId), OnVorgehensbausteinDeleted);\r\n\r\n          " +
                       "  /*\r\n             *  1. Every model element has a unique DomainClassID\r\n       " +
                       "      *  2. The metamodel to the generated model is available through domain dat" +
                       "a reflection.\r\n             *     This is the DomainDataDirectory contained in t" +
                       "he Store.\r\n             *  3. The method FindDomainClass returns a DomainClassIn" +
                       "fo class, which basically is\r\n             *     equal to the Vorgehensbaustein-" +
                       "DomainClass in the LanguageDSL (see DomainMetaModel.lngdsl).\r\n             *    " +
                       " This DomainClassInfo allows to lookup certain properties of the metamodel class" +
                       " at runtime.\r\n            */\r\n\r\n\r\n            // Example 2: VorgehensbausteinBas" +
                       "iertAufVorgehensbaustein, assume we have a Vorgehensbaustein present.\r\n         " +
                       "   this.EventManager.GetEvent<DslEditorEvents::ModelElementLinkAddedEvent>().Sub" +
                       "scribe(this.Store.DomainDataDirectory.GetDomainRelationship(Tum.VModellXT.Statik" +
                       ".VorgehensbausteinBasiertAufVorgehensbaustein.DomainClassId),\r\n                t" +
                       "rue, vorgehensbaustein.Id, new System.Action<DslModeling::ElementAddedEventArgs>" +
                       "(OnReferenceAdded));\r\n\r\n            this.EventManager.GetEvent<DslEditorEvents::" +
                       "ModelElementLinkDeletedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDoma" +
                       "inRelationship(Tum.VModellXT.Statik.VorgehensbausteinBasiertAufVorgehensbaustein" +
                       ".DomainClassId),\r\n                true, vorgehensbaustein.Id, new System.Action<" +
                       "DslModeling::ElementDeletedEventArgs>(OnReferenceRemoved));\r\n\r\n            // Ge" +
                       "t a notification whenever the source Vorgehensbaustein changes for a referenced " +
                       "Vorgehensbaustein\r\n            this.EventManager.GetEvent<DslEditorEvents::Model" +
                       "RolePlayerChangedEvent>().Subscribe(this.Store.DomainDataDirectory.GetDomainRole" +
                       "(Tum.VModellXT.Statik.VorgehensbausteinBasiertAufVorgehensbaustein.Vorgehensbaus" +
                       "teinSourceDomainRoleId),\r\n                new System.Action<DslModeling::RolePla" +
                       "yerChangedEventArgs>(OnReferenceChanged));\r\n\r\n            // Get a notification " +
                       "whenever the referenced Vorgehensbaustein of a Vorgehensbaustein changes\r\n      " +
                       "      this.EventManager.GetEvent<DslEditorEvents::ModelRolePlayerChangedEvent>()" +
                       ".Subscribe(this.Store.DomainDataDirectory.GetDomainRole(Tum.VModellXT.Statik.Vor" +
                       "gehensbausteinBasiertAufVorgehensbaustein.VorgehensbausteinTargetDomainRoleId),\r" +
                       "\n                new System.Action<DslModeling::RolePlayerChangedEventArgs>(OnRe" +
                       "ferenceChanged));\r\n        }\r\n\r\n        protected override void Unsubscribe()\r\n " +
                       "       {\r\n            base.Unsubscribe();\r\n\r\n            // Example 1:\r\n        " +
                       "    this.EventManager.GetEvent<DslEditorEvents::ModelElementAddedEvent>().Unsubs" +
                       "cribe(\r\n                this.Store.DomainDataDirectory.FindDomainClass(Tum.VMode" +
                       "llXT.Statik.Vorgehensbaustein.DomainClassId), OnVorgehensbausteinAdded);\r\n      " +
                       "      this.EventManager.GetEvent<DslEditorEvents::ModelElementDeletedEvent>().Un" +
                       "subscribe(\r\n                this.Store.DomainDataDirectory.FindDomainClass(Tum.V" +
                       "ModellXT.Statik.Vorgehensbaustein.DomainClassId), OnVorgehensbausteinDeleted);\r\n" +
                       "\r\n            // Example 2: VorgehensbausteinBasiertAufVorgehensbaustein, assume" +
                       " we have a Vorgehensbaustein present.\r\n            this.EventManager.GetEvent<Ds" +
                       "lEditorEvents::ModelElementLinkAddedEvent>().Unsubscribe(this.Store.DomainDataDi" +
                       "rectory.GetDomainRelationship(Tum.VModellXT.Statik.VorgehensbausteinBasiertAufVo" +
                       "rgehensbaustein.DomainClassId),\r\n                true, vorgehensbaustein.Id, new" +
                       " System.Action<DslModeling::ElementAddedEventArgs>(OnReferenceAdded));\r\n        " +
                       "    this.EventManager.GetEvent<DslEditorEvents::ModelElementLinkDeletedEvent>()." +
                       "Unsubscribe(this.Store.DomainDataDirectory.GetDomainRelationship(Tum.VModellXT.S" +
                       "tatik.VorgehensbausteinBasiertAufVorgehensbaustein.DomainClassId),\r\n            " +
                       "    true, vorgehensbaustein.Id, new System.Action<DslModeling::ElementDeletedEve" +
                       "ntArgs>(OnReferenceRemoved));\r\n            this.EventManager.GetEvent<DslEditorE" +
                       "vents::ModelRolePlayerChangedEvent>().Unsubscribe(this.Store.DomainDataDirectory" +
                       ".GetDomainRole(Tum.VModellXT.Statik.VorgehensbausteinBasiertAufVorgehensbaustein" +
                       ".VorgehensbausteinSourceDomainRoleId),\r\n                new System.Action<DslMod" +
                       "eling::RolePlayerChangedEventArgs>(OnReferenceChanged));\r\n        }\r\n\r\n        /" +
                       "/ Example 1:\r\n        private void OnVorgehensbausteinAdded(DslModeling::Element" +
                       "AddedEventArgs args)\r\n        {\r\n            Tum.VModellXT.Statik.Vorgehensbaust" +
                       "ein element = args.ModelElement as Tum.VModellXT.Statik.Vorgehensbaustein;\r\n    " +
                       "        this.VorgehensbausteinVM = new DslEditorViewModels::BaseModelElementView" +
                       "Model(this.ViewModelStore, element, true);\r\n        }\r\n        private void OnVo" +
                       "rgehensbausteinDeleted(DslModeling::ElementDeletedEventArgs args)\r\n        {\r\n  " +
                       "          Tum.VModellXT.Statik.Vorgehensbaustein element = args.ModelElement as " +
                       "Tum.VModellXT.Statik.Vorgehensbaustein;\r\n\t\t\tif( this.VorgehensbausteinVM != null" +
                       " )\r\n\t\t\t\tif( this.VorgehensbausteinVM.Element == element )\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.Vorg" +
                       "ehensbausteinVM.Dispose();\r\n\t\t\t\t\tthis.VorgehensbausteinVM = null;\r\n\t\t\t\t}\r\n      " +
                       "  }\r\n\t\tprivate DslEditorViewModels::BaseModelElementViewModel vorgehensbausteinV" +
                       "M = null;\r\n\t\tprivate DslEditorViewModels::BaseModelElementViewModel Vorgehensbau" +
                       "steinVM\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\treturn this.vorgehensbausteinVM;\r\n\t\t\t}\r\n\t\t\tpriva" +
                       "te set\r\n\t\t\t{\r\n\t\t\t\tthis.vorgehensbausteinVM = value;\r\n\t\t\t\tOnPropertyChanged(\"Vorg" +
                       "ehensbausteinVM\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n        // Example 2:\r\n        private void Add" +
                       "Reference(Tum.VModellXT.Statik.Vorgehensbaustein node)\r\n        {\r\n\t\t\t// ..\r\n   " +
                       "     }\r\n        private void RemoveReference(Tum.VModellXT.Statik.Vorgehensbaust" +
                       "ein node)\r\n        {\r\n\t\t\t// ..\r\n\t    }\r\n\r\n        private void OnReferenceAdded(" +
                       "DslModeling::ElementAddedEventArgs args)\r\n        {\r\n            Tum.VModellXT.S" +
                       "tatik.VorgehensbausteinBasiertAufVorgehensbaustein con\r\n                = args.M" +
                       "odelElement as Tum.VModellXT.Statik.VorgehensbausteinBasiertAufVorgehensbaustein" +
                       ";\r\n            if (con != null)\r\n            {\r\n                AddReference(con" +
                       ".VorgehensbausteinTarget);\r\n            }\r\n        }\r\n        private void OnRef" +
                       "erenceRemoved(DslModeling::ElementDeletedEventArgs args)\r\n        {\r\n           " +
                       " Tum.VModellXT.Statik.VorgehensbausteinBasiertAufVorgehensbaustein con\r\n        " +
                       "        = args.ModelElement as Tum.VModellXT.Statik.VorgehensbausteinBasiertAufV" +
                       "orgehensbaustein;\r\n            if (con != null)\r\n            {\r\n                " +
                       "RemoveReference(con.VorgehensbausteinTarget);\r\n            }\r\n\r\n        }\r\n     " +
                       "   private void OnReferenceChanged(DslModeling::RolePlayerChangedEventArgs args)" +
                       "\r\n        {\r\n            Tum.VModellXT.Statik.VorgehensbausteinBasiertAufVorgehe" +
                       "nsbaustein con\r\n                = args.ElementLink as Tum.VModellXT.Statik.Vorge" +
                       "hensbausteinBasiertAufVorgehensbaustein;\r\n            if (con != null)\r\n        " +
                       "    {\r\n                if (args.DomainRole.Id == Tum.VModellXT.Statik.Vorgehensb" +
                       "austeinBasiertAufVorgehensbaustein.VorgehensbausteinSourceDomainRoleId)\r\n       " +
                       "         {\r\n                    if (args.OldRolePlayerId == vorgehensbaustein.Id" +
                       ")\r\n                        RemoveReference(con.VorgehensbausteinTarget);\r\n\r\n    " +
                       "                if (args.NewRolePlayerId == vorgehensbaustein.Id)\r\n             " +
                       "           AddReference(con.VorgehensbausteinTarget);\r\n                }\r\n      " +
                       "          else if (args.DomainRole.Id == global::Tum.VModellXT.Statik.Vorgehensb" +
                       "austeinBasiertAufVorgehensbaustein.VorgehensbausteinTargetDomainRoleId)\r\n       " +
                       "         {\r\n                    if (args.OldRolePlayer != null)\r\n               " +
                       "         RemoveReference(args.OldRolePlayer as global::Tum.VModellXT.Statik.Vorg" +
                       "ehensbaustein);\r\n\r\n                    if (args.NewRolePlayer != null)\r\n        " +
                       "                AddReference(args.NewRolePlayer as global::Tum.VModellXT.Statik." +
                       "Vorgehensbaustein);\r\n                }\r\n            }\r\n        }  \r\n        #end" +
                       "region\r\n    \r\n\t\t#region 2. Xaml\r\n\t\t// This Xaml represents a possible view defin" +
                       "ition for the code examples diagram\r\n\t\txmlns:vm=\"clr-namespace:Tum.VModellXT.Vie" +
                       "wModel\"\r\n\t\t\r\n\t\t// 1. RessourceDictionary (Resources.xaml)\r\n\t\t<DataTemplate DataT" +
                       "ype=\"{x:Type vm:CodeExamplesDiagram}\">\r\n        \t<ctrl:CodeExamplesDiagram Horiz" +
                       "ontalAlignment=\"Stretch\" VerticalAlignment=\"Stretch\"/>\r\n    \t</DataTemplate>\r\n\t\t" +
                       "\r\n\t\t// 2. CodeExamplesDiagram User-Control\r\n\t\t<Grid>\r\n        \t<Grid Margin=\"10\"" +
                       ">\r\n            \t<Grid.RowDefinitions>\r\n                \t<RowDefinition Height=\"2" +
                       "4\"></RowDefinition>\r\n                \t<RowDefinition Height=\"34\"></RowDefinition" +
                       ">\r\n                \t<RowDefinition Height=\"3\"></RowDefinition>\r\n            \t</G" +
                       "rid.RowDefinitions>\r\n\r\n            \t<TextBlock Text=\"Current element: \" Grid.Row" +
                       "=\"0\" VerticalAlignment=\"Center\"/>\r\n            \t<TextBlock Text=\"{Binding Path=V" +
                       "orgehensbausteinVM.DomainElementFullName, Mode=OneTime}\" Grid.Row=\"1\" VerticalAl" +
                       "ignment=\"Center\" FontSize=\"16\"/>\r\n            \t<Border Grid.Row=\"2\" Height=\"1\" B" +
                       "orderThickness=\"1\" BorderBrush=\"DodgerBlue\"/>\r\n        \t</Grid>\r\n    \t</Grid>\r\n\t" +
                       "\t#endregion\r\n\t\r\n\t\t#region 3. Commanding\r\n\t\t// 1. Code:\t\t\r\n\t\tprivate DslEditorCom" +
                       "mands::DelegateCommand navigateToElementCommand;\r\n        public DslEditorComman" +
                       "ds::DelegateCommand NavigateToElementCommand\r\n        {\r\n            get\r\n      " +
                       "      {\r\n                return this.navigateToElementCommand;\r\n            }\r\n " +
                       "       }\r\n\t\t\r\n\t\t/// <summary>\r\n        /// Initialize.\r\n        /// </summary>\r\n" +
                       "        protected override void Initialize()\r\n        {\r\n            base.Initia" +
                       "lize();\r\n\r\n            this.navigateToElementCommand = new DslEditorCommands::De" +
                       "legateCommand(NavigateToElementCommandExecuted);\r\n        }\r\n\t\t\r\n\t\tprivate void " +
                       "NavigateToElementCommandExecuted()\r\n        {\r\n            BaseModelElementViewM" +
                       "odel vm = some selected view model.\r\n            if (vm != null)\r\n            {\r" +
                       "\n                if (vm.Element != null)\r\n                {\r\n                   " +
                       " SelectedItemsCollection col = new SelectedItemsCollection();\r\n                 " +
                       "   col.Add(vm.Element);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Publish event notifying that the selecte" +
                       "d element has changed.\r\n                    EventManager.GetEvent<SelectionChang" +
                       "edEvent>().Publish(new SelectionChangedEventArgs(this, col));\r\n                }" +
                       "\r\n            }\r\n\t\t}\r\n\t\t\r\n\t\t// 2. Xaml (in the data template e.g.:):\r\n\t\t<Button " +
                       "Command=\"{Binding Path=NavigateToElementCommand}\">\r\n            ... content\r\n   " +
                       "     </Button>\r\n\t\t#endregion\r\n\t\r\n\t\t#region 4. Drag&Drop\r\n\t\t// 1. Code:\r\n        " +
                       "public override void DragOver(DropInfo dropInfo)\r\n        {\r\n\t\t\t// ..\r\n        }" +
                       "\r\n        public override void Drop(DropInfo dropInfo)\r\n\t\t{\r\n\t\t\t// ..\r\n        }" +
                       "\r\n\t\t\r\n\t\t// 2. Xaml:\r\n\t\txmlns:dd=\"clr-namespace:Tum.PDE.ToolFramework.Modeling.Vi" +
                       "sualization.Controls.Attached.DragDrop\"\r\n\t\t\r\n\t\t<Border HorizontalAlignment=\"Stre" +
                       "tch\" VerticalAlignment=\"Stretch\" \r\n\t\t\tBackground=\"Transparent\" dd:DragDrop.IsDro" +
                       "pTarget=\"True\" dd:DragDrop.DropHandler=\"{Binding}\"/>\r\n\t\t#endregion\r\n\t\t\r\n\t\t#regio" +
                       "n 5. Transactions\r\n\t\t// Use Transaction to create, modify or delete model elemen" +
                       "ts/relationships.\r\n\t\tusing(Transaction t = this.Store.TransactionManager.BeginTr" +
                       "ansaction(\"Description\") )\r\n\t\t{\r\n\t\t\tt.Commit();\r\n\t\t}\r\n\t\t\r\n\t\t// HINT: Transaction" +
                       " can be nested as well.\r\n\t\t#endregion\r\n\t\t\r\n\t\t#region 6. Domain Model Services\r\n\t" +
                       "\t// Every PDE-based DSL has a set of domain model services:\r\n\t\t// * ModelElement" +
                       "NameProvider\r\n\t\t// * ModelElementTypeProvider\r\n\t\t// * ModelElementParentProvider" +
                       "\r\n\t\t// * ModelElementChildrenProvider\r\n\t\t// * ModelElementParentProvider\r\n\t\t// *" +
                       " ...\r\n\t\t// \r\n\t\t// The domain model services can also be accessed from every mode" +
                       "l element (element.GetDomainModelServices()).\r\n\t\t#endregion\r\n\t}\r\n\r\n");


        #line default
        #line hidden

        #line 322 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\ViewModel\CodeExamplesGeneratorHelper.tt"
        }
Exemplo n.º 55
0
 public NorthwindDatabase(string connectionString, MetaModel mapping)
     : base(connectionString, mapping)
 {
 }
Exemplo n.º 56
0
 public MetaTable(MetaModel metaModel, TableProvider tableProvider)
 {
     this._tableProvider = tableProvider;
     this.Model          = metaModel;
 }
Exemplo n.º 57
0
        private void GenerateResourceAttributesInternal(ModelElement domainObj, string genResourceName)
        {
            if (domainObj == null)
            {
                return;
            }

            string resourceKey         = "";
            string domainModelType     = "";
            string className           = "";
            bool   generateCategory    = false;
            bool   generateDisplayName = false;

            MetaModel dm = null;

            if (domainObj is DomainClass)
            {
                generateDisplayName = true;
                DomainClass c = (DomainClass)domainObj;
                resourceKey = c.GetFullName(false);
                dm          = c.GetMetaModel();
                className   = CodeGenerationUtilities.GetGenerationClassName(c);
            }
            else if (domainObj is DomainRelationship)
            {
                generateDisplayName = true;
                DomainRelationship c = (DomainRelationship)domainObj;
                resourceKey = c.GetFullName(false);
                dm          = c.GetMetaModel();
                className   = CodeGenerationUtilities.GetGenerationClassName(c);
            }
            else if (domainObj is DomainProperty)
            {
                generateDisplayName = true;
                DomainProperty          p = (DomainProperty)domainObj;
                AttributedDomainElement c = p.Element;
                resourceKey      = c.GetFullName(false) + "/" + p.Name;
                generateCategory = !String.IsNullOrEmpty(p.Category);

                dm = c.GetMetaModel();

                //if( c is DomainClass )
                //	dm = (c as DomainClass).GetMetaModel();
                //else
                //	dm = (c as DomainRelationship).GetMetaModel();
            }
            else if (domainObj is DomainRole)
            {
                generateDisplayName = true;
                DomainRole r = (DomainRole)domainObj;
                generateCategory = !String.IsNullOrEmpty(r.Category);
                DomainRelationship rel = r.Relationship;
                resourceKey = rel.GetFullName(false) + "/" + r.Name;
                dm          = rel.GetMetaModel();
            }
            else if (domainObj is EnumerationLiteral)
            {
                //generateDisplayName = true;
                EnumerationLiteral literal    = (EnumerationLiteral)domainObj;
                DomainEnumeration  domainEnum = literal.DomainEnumeration;
                dm          = domainEnum.MetaModel;
                resourceKey = domainEnum.GetFullName(false) + "/" + literal.Name;
            }
            else if (domainObj is MetaModel)
            {
                generateDisplayName = true;
                dm          = (MetaModel)domainObj;
                resourceKey = dm.GetFullName(false) + "DomainModel";
            }
            domainModelType = dm.GetFullName(true) + "DomainModel";

            // If no resource name specified for DslLibrary, don't generate any resource attributes.
            if (String.IsNullOrEmpty(dm.GeneratedResourceName))
            {
                return;
            }

            if (generateDisplayName)
            {
        #line default
        #line hidden

        #line 179 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write("[DslDesign::DisplayNameResource(\"");


        #line default
        #line hidden

        #line 180 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(resourceKey));


        #line default
        #line hidden

        #line 180 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(".DisplayName\", typeof(");


        #line default
        #line hidden

        #line 180 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(domainModelType));


        #line default
        #line hidden

        #line 180 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write("), \"");


        #line default
        #line hidden

        #line 180 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(genResourceName));


        #line default
        #line hidden

        #line 180 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write("\")]\r\n");


        #line default
        #line hidden

        #line 181 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            }
            if (generateCategory)
            {
        #line default
        #line hidden

        #line 185 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write("[DslDesign::CategoryResource(\"");


        #line default
        #line hidden

        #line 186 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(resourceKey));


        #line default
        #line hidden

        #line 186 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(".Category\", typeof(");


        #line default
        #line hidden

        #line 186 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(domainModelType));


        #line default
        #line hidden

        #line 186 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write("), \"");


        #line default
        #line hidden

        #line 186 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(genResourceName));


        #line default
        #line hidden

        #line 186 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write("\")]\r\n");


        #line default
        #line hidden

        #line 187 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            }


        #line default
        #line hidden

        #line 189 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            this.Write("[DslDesign::DescriptionResource(\"");


        #line default
        #line hidden

        #line 190 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(resourceKey));


        #line default
        #line hidden

        #line 190 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            this.Write(".Description\", typeof(");


        #line default
        #line hidden

        #line 190 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(domainModelType));


        #line default
        #line hidden

        #line 190 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            this.Write("), \"");


        #line default
        #line hidden

        #line 190 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(genResourceName));


        #line default
        #line hidden

        #line 190 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            this.Write("\")]\r\n");


        #line default
        #line hidden

        #line 191 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"

            if (domainObj is DomainClass)
            {
        #line default
        #line hidden

        #line 194 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write("[DslModeling::DomainModelOwner(typeof(");


        #line default
        #line hidden

        #line 195 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(domainModelType));


        #line default
        #line hidden

        #line 195 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
                this.Write("))]\r\n");


        #line default
        #line hidden

        #line 196 "J:\Uni\CC Processes\Werkzeuge\PDE 2\Tum.PDE.ToolFramework\Tum.PDE.ToolFramework.Templates\Utilities.tt"
            }
        }
Exemplo n.º 58
0
 public string GenerateExtendsAttributes(MetaModel library)
 {
     this.GenerationEnvironment = null;
     this.GenerateExtendsAttributesInternal(library);
     return(this.GenerationEnvironment.ToString());
 }
Exemplo n.º 59
0
 public CustomMetaType(MetaType orgtype, MetaModel metamodel)
 {
     _orgtype   = orgtype;
     _metamodel = metamodel;
 }
Exemplo n.º 60
0
        public void CreateDatabase()
        {
            if (DatabaseExists())
            {
                throw SqlClient.Error.CreateDatabaseFailedBecauseSqlCEDatabaseAlreadyExists(dbName);
            }
            if (string.IsNullOrEmpty(dbName))
            {
                throw Error.ArgumentNull("Database Name");
            }

            //创建数据库文件
            var conn        = conManager.UseConnection(this);
            var transaction = conn.BeginTransaction();

            OracleSqlBuilder = new OracleSqlBuilder(this);
            try
            {
                Execute(conn, transaction, OracleSqlBuilder.GetCreateDatabaseCommand(dbName, passowrd));
                var commandText = "GRANT DBA TO " + dbName;
                Execute(conn, transaction, commandText);
            }
            catch (Exception)
            {
                transaction.Rollback();
                throw;
            }
            finally
            {
                conManager.ReleaseConnection(this);
            }

            DbConnectionStringBuilder builder = new OracleConnectionStringBuilder()
            {
                DataSource = conn.DataSource,
                UserID     = dbName,
                Password   = passowrd,
            };

            conn = new OracleConnection(builder.ToString());
            conn.Open();
            transaction = conn.BeginTransaction();
            try
            {
                MetaModel model = services.Model;
                foreach (MetaTable table in model.GetTables())
                {
                    //string createTableCommand = OracleSqlBuilder.GetCreateTableCommand(table);
                    //if (!string.IsNullOrEmpty(createTableCommand))
                    //    Execute(conn, transaction, createTableCommand);

                    //string createPrimaryKey = OracleSqlBuilder.GetPrimaryKeyCommand(table);
                    //if (!string.IsNullOrEmpty(createPrimaryKey))
                    //    Execute(conn, transaction, createPrimaryKey);
                    var commands = OracleSqlBuilder.GetCreateTableCommands(table);
                    foreach (var command in commands)
                    {
                        Execute(conn, transaction, command);
                    }
                }

                //创建外建
                foreach (MetaTable table in model.GetTables())
                {
                    foreach (string commandText in OracleSqlBuilder.GetCreateForeignKeyCommands(table))
                    {
                        if (!string.IsNullOrEmpty(commandText))
                        {
                            Execute(conn, transaction, commandText);
                        }
                    }
                }
                ////创建自动编号列
                //foreach (MetaTable table in model.GetTables())
                //{
                //    var create = OracleSqlBuilder.GetCreateSquenceCommand(table);
                //    if (!string.IsNullOrEmpty(create))
                //        Execute(conn, transaction, create);
                //}
                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
                throw;
            }
            finally
            {
                conManager.ReleaseConnection(this);
            }
        }