예제 #1
0
        private void btnSaveDefinition_Click(object sender, EventArgs e)
        {
            try
            {
                using (SaveFileDialog d = new SaveFileDialog())
                {
                    d.Title           = "Save Definition to ...";
                    d.DefaultExt      = "xml";
                    d.OverwritePrompt = true;
                    d.Filter          = "All XML Files (*.xml)|*.xml";
                    if (d.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    if (string.IsNullOrEmpty(RelationshipTable.TableName))
                    {
                        RelationshipTable.TableName = "Relation";
                    }

                    using (var ds = new DataSet("DataColumnMapper"))
                    {
                        ds.Tables.Add(RelationshipTable.Copy());
                        ds.WriteXml(d.FileName, XmlWriteMode.IgnoreSchema);
                    }
                }
            }
            catch (Exception ex)
            {
                FormUtil.WinException(ex);
            }
        }
예제 #2
0
        private void btnLoadDefinition_Click(object sender, EventArgs e)
        {
            try
            {
                using (OpenFileDialog d = new OpenFileDialog())
                {
                    d.Title           = "Load Definition from ...";
                    d.DefaultExt      = "xml";
                    d.CheckFileExists = true;
                    d.Filter          = "All XML Files (*.xml)|*.xml";
                    if (d.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    RelationshipTable.Clear();
                    RelationshipTable.ReadXml(d.FileName);

                    RefreshParentChildTables();
                }
            }
            catch (Exception ex)
            {
                FormUtil.WinException(ex);
            }
        }
예제 #3
0
        internal void SetRelaletionshipTab(RelationshipTable table)
        {
            this.table = table;
            Dictionary <string, List <string> > typeDepencies    = table.GetTypeDependency();
            Dictionary <string, List <string> > packageDepencies = table.GetPackageDependecy();

            ShowTypeDependency(typeDepencies);
            ShowPackageDependency(packageDepencies);
        }
예제 #4
0
        private void LoadXML_Click(object sender, RoutedEventArgs e)
        {
            string currentXMLPath = XMLPAth.Text;
            string xmlFilePath    = Path.Combine(currentXMLPath, "TypeDependecies.xml");

            if (File.Exists(xmlFilePath))
            {
                RelationshipTable _typeTable = RelationshipTable.loadFromXMLFile(xmlFilePath);
                All_Radio.IsChecked = true;
                SetRelaletionshipTab(_typeTable);
            }
        }
예제 #5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow dr = RelationshipTable.NewRow();
                MapRelation(dr);
                RelationshipTable.Rows.Add(dr);

                // select new row.
                cmRelationship.Position = RelationshipTable.Rows.Count;
                RefreshParentChildTables();
            }
            catch (Exception ex)
            {
                FormUtil.WinException(ex);
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            List <string> solutionFilePaths = new List <string>();

            solutionFilePaths.Add("E:DependencyAnalyzer");
            GetTypeTableOfAProject handler = new GetTypeTableOfAProject(solutionFilePaths);

            handler.Analyzer();
            TypeTable typeTable = handler.Results;

            string rootPath = "E://DependencyAnalyzer";
            GetTypeTableOfAllProjects getAllTypes = new GetTypeTableOfAllProjects(rootPath);

            getAllTypes.Analyzer();
            TypeTable allTypes = getAllTypes.Results;

            GetRelationshipTable getDependencies = new GetRelationshipTable(rootPath, typeTable, allTypes);

            getDependencies.Analyzer();
            RelationshipTable results = getDependencies.relationshipResults();

            Console.WriteLine(results.ToXMLString());
        }
예제 #7
0
 public void ReadDBColumn(string dBase)
 {
     List<string> tableNames = new List<string>();
     OpenSqlConnection();
     IDbCommand dbCommand = dbConnection.CreateCommand();
     dbCommand.CommandText = "SELECT TABLE_NAME FROM "+dBase+".INFORMATION_SCHEMA.TABLES";
     IDataReader reader = dbCommand.ExecuteReader();
     reader.Read();
     if(DataContainer.testTable == null) DataContainer.testTable = new List<RelationshipTable>();
     DataTable tempSQLTable = reader.GetSchemaTable();
     for(int i=0; i<reader.FieldCount;i++){
         tableNames.Add(reader.GetName(i));
         Debug.Log("name: "+reader.GetName(i));
         Debug.Log("byte: "+reader.GetByte(i));
         Debug.Log("char: "+reader.GetChar(i));
         Debug.Log("datatypename: "+reader.GetDataTypeName(i));
         Debug.Log("datetime: "+reader.GetDateTime(i));
         Debug.Log("fieldtype: "+reader.GetFieldType(i));
         Debug.Log("string: "+reader.GetString(i));
         Debug.Log("type: "+reader.GetType());
         Debug.Log("val: "+reader.GetValue(i));
         Debug.Log("schemanamespace: "+tempSQLTable.Namespace);
         Debug.Log("schematablename: "+tempSQLTable.TableName);
         Debug.Log("schemacolumname: "+tempSQLTable.Columns[i].ColumnName);
         Debug.Log("schemaconstraintname: "+tempSQLTable.Constraints[i].ConstraintName);
         Debug.Log("schemacontainer: "+tempSQLTable.Container.ToString());
         Debug.Log("schemadataset: "+tempSQLTable.DataSet.DataSetName);
         Debug.Log("schemarows: "+tempSQLTable.Rows[0].ItemArray[0].ToString());
     }
     reader.Close();
     reader = null;
     dbCommand.Dispose();
     dbCommand = null;
     for(int i=0; i< tableNames.Count; i++){
         RelationshipTable tempTable = new RelationshipTable();
         tempTable.column = new List<TableSQL>();
         tempTable.name = tableNames[i];
         dbCommand = dbConnection.CreateCommand();
         dbCommand.CommandText = "SELECT * FROM "+tableNames[i];
         reader = dbCommand.ExecuteReader();
         reader.Read();
         tempSQLTable = reader.GetSchemaTable();
         for(int j=0; j<reader.FieldCount;j++){
             TableSQL tempColumn = new TableSQL();
             tempColumn.name = reader.GetName(j);
             tempTable.column.Add(tempColumn);
             Debug.Log(DataContainer.currData[i].name);
             Debug.Log("name: "+reader.GetName(i));
             Debug.Log("byte: "+reader.GetByte(i));
             Debug.Log("char: "+reader.GetChar(i));
             Debug.Log("datatypename: "+reader.GetDataTypeName(i));
             Debug.Log("datetime: "+reader.GetDateTime(i));
             Debug.Log("fieldtype: "+reader.GetFieldType(i));
             Debug.Log("string: "+reader.GetString(i));
             Debug.Log("type: "+reader.GetType());
             Debug.Log("val: "+reader.GetValue(i));
             Debug.Log("schemanamespace: "+tempSQLTable.Namespace);
             Debug.Log("schematablename: "+tempSQLTable.TableName);
             Debug.Log("schemacolumname: "+tempSQLTable.Columns[i].ColumnName);
             Debug.Log("schemaconstraintname: "+tempSQLTable.Constraints[i].ConstraintName);
             Debug.Log("schemacontainer: "+tempSQLTable.Container.ToString());
             Debug.Log("schemadataset: "+tempSQLTable.DataSet.DataSetName);
             Debug.Log("schemarows: "+tempSQLTable.Rows[0].ItemArray[0].ToString());
         }
         reader.Close();
         reader = null;
         dbCommand.Dispose();
         dbCommand = null;
         DataContainer.testTable.Add(tempTable);
         CloseSqlConnection();
     }
     Data.AllocateData();
 }
예제 #8
0
        protected override void UpdateResults(string fileName)
        {
            RelationshipTable _results = Repository.getInstance().relationshipTable;

            relationshipTable.Merge(_results);
        }
예제 #9
0
        // Parses the files to extract the user defined types

        public TypeRelationshipAnalyzer(TypeTable _interestedTypes, TypeTable _allTypes)
        {
            interestedTypes   = _interestedTypes;
            allTypes          = _allTypes;
            relationshipTable = new RelationshipTable();
        }