Exemple #1
0
        private void CarregarCamposPesquisa()
        {
            List <ClassProperties.PropriedadeClasse> lstPropriedades = new List <ClassProperties.PropriedadeClasse>();

            lstPropriedades = new ClassProperties().RetornarPropriedadesClasse(new MultaOcorrencia());

            cbPesquisaCampo.DataSource    = lstPropriedades;
            cbPesquisaCampo.DisplayMember = "descricaoPropriedade";
            cbPesquisaCampo.ValueMember   = "nomePropriedade";
        }
Exemple #2
0
        private IList <QueueItem> _GetTokens(string parameter)
        {
            var hash   = ClassProperties.HashOfList().AndHash(parameter);
            var tokens = tokenizerCache.GetOrAdd(hash, () =>
            {
                return(new Tokenizer(ClassProperties).Tokenize(parameter).ToList());
            });

            return(tokens.Select(t => new QueueItem(new ParserVertex(t))).ToList());
        }
Exemple #3
0
        private static ArrayList GetFieldsForAllClass()
        {
            ClassProperties classProp = null;

            try
            {
                classProp = AssemblyInspectorObject.ClassProperties.GetClassProperties(Helper.ClassName);
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }

            return(classProp.FieldEntries);
        }
Exemple #4
0
        protected override string SqlDelete(object target)
        {
            string          idValue         = "";
            string          className       = klass.Name;
            ClassProperties classProperties = new ClassProperties();

            if (discovery.TryGetValue(className, out classProperties))
            {
                PropertyInfo classId = classProperties.id;
                idValue = getPropertyValue(classId, target);
            }
            string SQL_DELETE = String.Format(C_SQL_DELETE, tableName, idField, idValue);

            return(SQL_DELETE);
        }
Exemple #5
0
        public ReflectDataMapper(Type klass, string connStr) : base(connStr)
        {
            this.klass = klass;
            ClassProperties classproperties = new ClassProperties();

            TableAttribute att = (TableAttribute)klass.GetCustomAttribute(typeof(TableAttribute), false);

            tableName = att.Name;
            List <string> propertyList = new List <string>();

            foreach (var p in klass.GetProperties())
            {
                string propertyName = p.Name;

                PKAttribute pk = (PKAttribute)p.GetCustomAttribute(typeof(PKAttribute));

                if (pk == null)
                {
                    Type propertyType = p.PropertyType;
                    foreach (var property in propertyType.GetProperties())  //There should be an if to only iterate through non primitive nd string properties
                    {
                        PKAttribute propertyPk = (PKAttribute)property.GetCustomAttribute(typeof(PKAttribute));
                        if (propertyPk != null)
                        {
                            propertyName = property.Name;
                        }
                    }
                    propertyList.Add(propertyName);
                    //classproperties.otherProperties.Add(p);
                }
                else
                {
                    idField            = p.Name;
                    classproperties.id = p;
                }
            }
            columns = string.Join(",", propertyList);
            string className = klass.Name;

            if (!discovery.ContainsKey(className))
            {
                discovery.Add(className, classproperties);
            }
        }
Exemple #6
0
        public void ToolMouseDoubleClick(object sender, MouseEventArgs e)
        {
            this.xInitial = e.X;
            this.yInitial = e.Y;

            if (e.Button == MouseButtons.Left && canvas != null)
            {
                canvas.DeselectAllObjects();
                selectedObject = canvas.SelectObjectAt(e.X, e.Y);

                if (selectedObject != null)
                {
                    if (selectedObject is Vertex)
                    {
                        Vertex          objectTerpilih = (Vertex)selectedObject;
                        Form            main           = Form.ActiveForm;
                        ClassProperties fm             = new ClassProperties(canvas, objectTerpilih, main);
                        main.Enabled  = false;
                        fm.Text       = "Class Properties";
                        fm.ControlBox = false;
                        fm.Show();
                    }

                    else if (selectedObject is Edge)
                    {
                        Edge objectTerpilih       = (Edge)selectedObject;
                        Form main                 = Form.ActiveForm;
                        RelationshipProperties fm = new RelationshipProperties(canvas, objectTerpilih, main);
                        main.Enabled  = false;
                        fm.Text       = "Relationship Properties";
                        fm.ControlBox = false;
                        fm.Show();
                    }
                    id_object = selectedObject.ID;
                }
            }
        }
Exemple #7
0
        private static ICodeBlock GetLoadGlobalContentCode()
        {
            ICodeBlock codeBlock = new CodeDocument();

            if (ProjectManager.GlueProjectSave.GlobalContentSettingsSave.LoadAsynchronously)
            {
                codeBlock
                .Struct("", "NamedDelegate")
                .Line("public string Name;")
                .Line("public System.Action LoadMethod;")
                .End()
                ._()
                .Line("static List<NamedDelegate> LoadMethodList = new List<NamedDelegate>();")
                ._();
            }

            string className = "GlobalContent";

            #region Instantiate the ClassProperties
            ClassProperties classProperties = new ClassProperties();
            classProperties.Members        = new List <FlatRedBall.Instructions.Reflection.TypedMemberBase>();
            classProperties.UntypedMembers = new Dictionary <string, string>();
            #endregion

            classProperties.NamespaceName = ProjectManager.ProjectNamespace;
            classProperties.ClassName     = className;
            classProperties.IsStatic      = true;
            classProperties.Partial       = true;

            classProperties.UsingStatements = new List <string>();



            #region Add using statements

            // todo: remove these, we don't need them anymore and they could cause ambiguity
            classProperties.UsingStatements.Add("System.Collections.Generic");
            classProperties.UsingStatements.Add("System.Threading");
            classProperties.UsingStatements.Add("FlatRedBall");
            classProperties.UsingStatements.Add("FlatRedBall.Math.Geometry");
            classProperties.UsingStatements.Add("FlatRedBall.ManagedSpriteGroups");
            classProperties.UsingStatements.Add("FlatRedBall.Graphics.Animation");
            classProperties.UsingStatements.Add("FlatRedBall.Graphics.Particle");
            classProperties.UsingStatements.Add("FlatRedBall.AI.Pathfinding");
            classProperties.UsingStatements.Add("FlatRedBall.Utilities");
            classProperties.UsingStatements.Add("BitmapFont = FlatRedBall.Graphics.BitmapFont");
            classProperties.UsingStatements.Add("FlatRedBall.Localization");



            bool shouldAddUsingForDataTypes = false;

            for (int i = 0; i < ProjectManager.GlueProjectSave.GlobalFiles.Count; i++)
            {
                if (FileManager.GetExtension(ProjectManager.GlueProjectSave.GlobalFiles[i].Name) == "csv")
                {
                    shouldAddUsingForDataTypes = true;
                    break;
                }
            }

            if (shouldAddUsingForDataTypes)
            {
                classProperties.UsingStatements.Add(ProjectManager.ProjectNamespace + ".DataTypes");
                classProperties.UsingStatements.Add("FlatRedBall.IO.Csv");
            }

            #endregion

            var contents = GetGlobalContentFilesMethods();

            codeBlock.InsertBlock(contents);

            classProperties.MethodContent = codeBlock;

            var toReturn = CodeWriter.CreateClass(classProperties);

            var block = new CodeBlockBaseNoIndent(null);
            block.Line("#if ANDROID || IOS || DESKTOP_GL");
            block.Line("// Android doesn't allow background loading. iOS doesn't allow background rendering (which is used by converting textures to use premult alpha)");
            block.Line("#define REQUIRES_PRIMARY_THREAD_LOADING");
            block.Line("#endif");


            toReturn.PreCodeLines.Add(block);

            return(toReturn);
        }
Exemple #8
0
 public LineBreak()
 {
     m_defaultLineBreakProps = new DefaultLineBreakProperties();
 }
Exemple #9
0
        public override string GetCode()
        {
            string entityClassName = FileManager.RemovePath(FileManager.RemoveExtension(EntitySave.Name));

            string baseEntityName = null;

            if (!string.IsNullOrEmpty(EntitySave.BaseEntity))
            {
                EntitySave rootEntitySave = EntitySave.GetRootBaseEntitySave();

                // There could be an invalid inheritance chain.  We don't want Glue to bomb if so, so
                // we'll check for this.
                if (rootEntitySave != null && rootEntitySave != EntitySave)
                {
                    baseEntityName = rootEntitySave.Name;
                }
            }


            string factoryClassName = ClassName;

            ClassProperties classProperties = new ClassProperties();

            classProperties.NamespaceName = ProjectManager.ProjectNamespace + ".Factories";
            classProperties.ClassName     = factoryClassName + " : IEntityFactory";

            classProperties.Members = new List <FlatRedBall.Instructions.Reflection.TypedMemberBase>();

            classProperties.UntypedMembers = new Dictionary <string, string>();
            string positionedObjectListType = string.Format("FlatRedBall.Math.PositionedObjectList<{0}>", entityClassName);

            // Factories used to be always static but we're going to make them singletons instead
            //classProperties.IsStatic = true;

            classProperties.UsingStatements = new List <string>();
            classProperties.UsingStatements.Add(GlueCommands.Self.GenerateCodeCommands.GetNamespaceForElement(EntitySave));
            classProperties.UsingStatements.Add("System");

            if (!string.IsNullOrEmpty(baseEntityName))
            {
                EntitySave baseEntity = ObjectFinder.Self.GetEntitySave(baseEntityName);
                classProperties.UsingStatements.Add(GlueCommands.Self.GenerateCodeCommands.GetNamespaceForElement(baseEntity));
            }


            classProperties.UsingStatements.Add("FlatRedBall.Math");
            classProperties.UsingStatements.Add("FlatRedBall.Graphics");
            classProperties.UsingStatements.Add(ProjectManager.ProjectNamespace + ".Performance");


            ICodeBlock codeContent = CodeWriter.CreateClass(classProperties);

            const int numberOfInstancesToPool = 20;

            var methodTag = codeContent.GetTag("Methods")[0];

            var methodBlock = GetAllFactoryMethods(factoryClassName, baseEntityName, numberOfInstancesToPool,
                                                   ShouldPoolObjects);

            methodTag.InsertBlock(methodBlock);

            var codeBlock = new CodeBlockBase(null);

            codeBlock.Line("static string mContentManagerName;");
            codeBlock.Line("static System.Collections.Generic.List<System.Collections.IList> ListsToAddTo = new System.Collections.Generic.List<System.Collections.IList>();");

            codeBlock.Line(string.Format("static PoolList<{0}> mPool = new PoolList<{0}>();", entityClassName));

            codeBlock.Line(string.Format("public static Action<{0}> EntitySpawned;", entityClassName));

            ImplementIEntityFactory(factoryClassName, codeBlock);

            #region Self and mSelf
            codeBlock.Line("static " + factoryClassName + " mSelf;");

            var selfProperty = codeBlock.Property("public static " + factoryClassName, "Self");
            var selfGet      = selfProperty.Get();
            selfGet.If("mSelf == null")
            .Line("mSelf = new " + entityClassName + "Factory" + "();");
            selfGet.Line("return mSelf;");
            #endregion

            ((codeContent.BodyCodeLines.Last() as CodeBlockBase).BodyCodeLines.Last() as CodeBlockBase).InsertBlock(codeBlock);
            return(codeContent.ToString());
        }
 private void CancelAllEdits()
 {
     ClassProperties.CancelEdit();
 }