protected override void AddCompositeIdGenerator(XmlDocument xmldoc, XmlElement idElement, List<ColumnDetail> compositeKey, ApplicationPreferences applicationPreferences)
        {
            foreach (ColumnDetail column in compositeKey)
            {
                var keyElement = xmldoc.CreateElement("key-property");
                string propertyName =
                    column.ColumnName.GetPreferenceFormattedText(applicationPreferences);

                if (applicationPreferences.FieldGenerationConvention == FieldGenerationConvention.Property)
                {
                    idElement.SetAttribute("name", propertyName.MakeFirstCharLowerCase());
                }
                else
                {
                    if (applicationPreferences.FieldGenerationConvention == FieldGenerationConvention.AutoProperty)
                    {
                        propertyName = column.ColumnName.GetFormattedText();
                    }

                    keyElement.SetAttribute("name", propertyName);
                }
                var mapper = new DataTypeMapper();
                Type mapFromDbType = mapper.MapFromDBType(column.DataType, column.DataLength,
                                                          column.DataPrecision,
                                                          column.DataScale);
                keyElement.SetAttribute("type", mapFromDbType.Name);
                keyElement.SetAttribute("column", column.ColumnName);
                if (applicationPreferences.FieldGenerationConvention != FieldGenerationConvention.AutoProperty)
                {
                    keyElement.SetAttribute("access", "field");
                }
                idElement.AppendChild(keyElement);
            }
        }
Beispiel #2
0
 protected MappingGenerator(ApplicationPreferences applicationPreferences, ColumnDetails columnDetails)
     : base(applicationPreferences.FolderPath, applicationPreferences.TableName, applicationPreferences.NameSpace, applicationPreferences.AssemblyName, applicationPreferences.Sequence, columnDetails)
 {
     this.applicationPreferences = applicationPreferences;
     IsAssigned = applicationPreferences.PrimaryKeyType == PrimaryKeyType.Assigned;
     this._tableReferences = applicationPreferences.TableReferences;
 }
        public void ShouldGenerateMappingForOracleTable()
        {
            const string generatedXML = "<?xml version=\"1.0\"?><hibernate-mapping assembly=\"myAssemblyName\" namespace=\"myNameSpace\" xmlns=\"urn:nhibernate-mapping-2.2\"><class name=\"Customer\" table=\"Customer\" lazy=\"true\" xmlns=\"\"><id name=\"Id\" column=\"Id\" /></class></hibernate-mapping>";
            var          preferences  = new ApplicationPreferences
            {
                FolderPath   = "\\",
                TableName    = "Customer",
                AssemblyName = "myAssemblyName",
                NameSpace    = "myNameSpace",
                Sequence     = "mySequenceNumber",
            };
            var pkColumn = new Column {
                Name = "Id", IsPrimaryKey = true, DataType = "Int"
            };
            var primaryKey = new PrimaryKey {
                Columns = new List <Column> {
                    pkColumn
                }
            };
            var generator = new OracleMappingGenerator(preferences, new Table {
                PrimaryKey = primaryKey, Columns = new List <Column> {
                    pkColumn
                }
            });
            var document = generator.CreateMappingDocument();

            Assert.AreEqual(generatedXML, document.InnerXml);
        }
 public CodeGenerator(ApplicationPreferences appPrefs, Table table)
     : base(appPrefs.DomainFolderPath, "Domain", appPrefs.TableName, appPrefs.NameSpace, appPrefs.AssemblyName, appPrefs.Sequence, table, appPrefs)
 {
     this.appPrefs = appPrefs;
     language      = appPrefs.Language;
     Inflector.EnableInflection = appPrefs.EnableInflections;
 }
Beispiel #5
0
 public CodeGenerator(ApplicationPreferences appPrefs, Table table)
     : base(appPrefs.DomainFolderPath, "Domain", appPrefs.TableName, appPrefs.NameSpace, appPrefs.AssemblyName, appPrefs.Sequence, table, appPrefs)
 {
     this.appPrefs = appPrefs;
     language = appPrefs.Language;
     Inflector.EnableInflection = appPrefs.EnableInflections;
 }
Beispiel #6
0
        private void Generate(Table table, bool generateAll, ApplicationSettings appSettings)
        {
            ApplicationPreferences applicationPreferences = GetApplicationPreferences(table, generateAll, appSettings);
            var applicationController = new ApplicationController(applicationPreferences, table);

            applicationController.Generate();
        }
        public static ITextFormatter GetTextFormatter(ApplicationPreferences applicationPreferences)
        {
            ITextFormatter formatter;

            switch (applicationPreferences.FieldNamingConvention)
            {
            case FieldNamingConvention.SameAsDatabase:
                formatter = new UnformattedTextFormatter();
                break;

            case FieldNamingConvention.CamelCase:
                formatter = new CamelCaseTextFormatter();
                break;

            case FieldNamingConvention.PascalCase:
                formatter = new PascalCaseTextFormatter();
                break;

            case FieldNamingConvention.Prefixed:
                formatter = new PrefixedTextFormatter(applicationPreferences.Prefix);
                break;

            default:
                throw new Exception("Invalid or unsupported field naming convention.");
            }

            formatter.PrefixRemovalList = applicationPreferences.FieldPrefixRemovalList;

            return(formatter);
        }
 public T2TiERPNHibernateGen(ApplicationPreferences applicationPreferences, Table table)
     : base(applicationPreferences, table)
 {
     serviceGenerator = new T2TiERPServiceGen(applicationPreferences.FolderPath, "Mapping", applicationPreferences.TableName, applicationPreferences.NameSpace, applicationPreferences.AssemblyName, applicationPreferences.Sequence, table, applicationPreferences);
     clientGenerator  = new T2TiERPClientGen(applicationPreferences.FolderPath, "Mapping", applicationPreferences.TableName, applicationPreferences.NameSpace, applicationPreferences.AssemblyName, applicationPreferences.Sequence, table, applicationPreferences);
     NamespaceCliente = applicationPreferences.NamespaceCliente;
     AssemblyCliente  = applicationPreferences.AssemblyCliente;
 }
Beispiel #9
0
 public CodeGenerator(ApplicationPreferences applicationPreferences, ColumnDetails columnDetails)
     : base(applicationPreferences.FolderPath, applicationPreferences.TableName, applicationPreferences.NameSpace,
         applicationPreferences.AssemblyName, applicationPreferences.Sequence, columnDetails)
 {
     this.applicationPreferences = applicationPreferences;
     language = applicationPreferences.Language;
     this.tableReferences = applicationPreferences.TableReferences;
 }
        private static CodeSnippetStatement GetIdMapCodeSnippetStatement(ApplicationPreferences appPrefs, string pkColumnName, string pkColumnType, ITextFormatter formatter)
        {
            var    dataTypeMapper   = new DataTypeMapper();
            bool   isPkTypeIntegral = (dataTypeMapper.MapFromDBType(appPrefs.ServerType, pkColumnType, null, null, null)).IsTypeIntegral();
            string idGeneratorType  = (isPkTypeIntegral ? "GeneratedBy.Identity()" : "GeneratedBy.Assigned()");

            return(new CodeSnippetStatement(string.Format(TABS + "Id(x => x.{0}).{1}.Column(\"{2}\");", formatter.FormatText(pkColumnName), idGeneratorType, pkColumnName)));
        }
Beispiel #11
0
 public static string GetPreferenceFormattedText(this string text, ApplicationPreferences applicationPreferences)
 {
     if (applicationPreferences.FieldNamingConvention.Equals(FieldNamingConvention.SameAsDatabase))
         return text;
     string formattedText = text.Replace('_', ' ');
     formattedText = formattedText.MakeTitleCase();
     formattedText = formattedText.Replace(" ", "");
     if (applicationPreferences.FieldNamingConvention.Equals(FieldNamingConvention.Prefixed))
         return applicationPreferences.Prefix + formattedText;
     return applicationPreferences.FieldNamingConvention.Equals(FieldNamingConvention.CamelCase) ? formattedText.MakeFirstCharLowerCase() : formattedText;
 }
        private static CodeSnippetStatement GetIdMapCodeSnippetStatement(ApplicationPreferences appPrefs, Table table, string pkColumnName, string propertyName, string pkColumnType, ITextFormatter formatter)
        {
            var  dataTypeMapper   = new DataTypeMapper();
            bool isPkTypeIntegral = (dataTypeMapper.MapFromDBType(appPrefs.ServerType, pkColumnType, null, null, null)).IsTypeIntegral();

            string idGeneratorType = (isPkTypeIntegral ? "GeneratedBy.Identity()" : "GeneratedBy.Assigned()");
            var    fieldName       = FixPropertyWithSameClassName(propertyName, table.Name);
            var    pkAlsoFkQty     = (from fk in table.ForeignKeys.Where(fk => fk.UniquePropertyName == pkColumnName) select fk).Count();

            //if (pkAlsoFkQty > 0) fieldName = fieldName + "Id";
            return(new CodeSnippetStatement(string.Format(TABS + "Id(x => x.{0}).Column(\"{1}\").{2};",
                                                          formatter.FormatText(fieldName),
                                                          pkColumnName,
                                                          idGeneratorType)));
        }
Beispiel #13
0
        private ApplicationPreferences GetApplicationPreferences(Table tableName, bool all, Connection appSettings)
        {
            var applicationPreferences = new ApplicationPreferences
            {
                ServerType                = appSettings.Type,
                DomainFolderPath          = appSettings.Domainfolderpath,
                TableName                 = tableName.Name,
                NameSpace                 = appSettings.EntityName,
                FieldNamingConvention     = FieldNamingConvention.SameAsDatabase,
                FieldGenerationConvention = FieldGenerationConvention.AutoProperty,
                ConnectionString          = appSettings.ConnectionString,
            };

            return(applicationPreferences);
        }
Beispiel #14
0
        public void GenerateAndDisplayCode(Table table)
        {
            SetCodeControlFormatting(applicationSettings);

            // Refresh the primary key relationships.
            table.PrimaryKey  = metadataReader.DeterminePrimaryKeys(table);
            table.ForeignKeys = metadataReader.DetermineForeignKeyReferences(table);

            // Show map and domain code preview
            ApplicationPreferences applicationPreferences = GetApplicationPreferences(table, false, applicationSettings);
            var applicationController = new ApplicationController(applicationPreferences, table);

            applicationController.Generate(writeToFile: false);
            mapCodeFastColoredTextBox.Text    = applicationController.GeneratedMapCode;
            domainCodeFastColoredTextBox.Text = applicationController.GeneratedDomainCode;
        }
 public ApplicationController(ApplicationPreferences applicationPreferences, Table table)
 {
     this.applicationPreferences = applicationPreferences;
     codeGenerator     = new CodeGenerator(applicationPreferences, table);
     fluentGenerator   = new FluentGenerator(applicationPreferences, table);
     castleGenerator   = new CastleGenerator(applicationPreferences, table);
     contractGenerator = new ContractGenerator(applicationPreferences, table);
     byCodeGenerator   = new ByCodeGenerator(applicationPreferences, table);
     if (applicationPreferences.ServerType == ServerType.Oracle)
     {
         mappingGenerator = new OracleMappingGenerator(applicationPreferences, table);
     }
     else
     {
         mappingGenerator = new SqlMappingGenerator(applicationPreferences, table);
     }
 }
    // Use this for initialization
    void Start()
    {
        ApplicationPreferences.LoadSavedPreferences();

        //if (false && (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.LinuxPlayer))
        //{
        //    gameObject.AddComponent<SteamManager>();
        //}
        MakeMenus();

        //Demo.ConvertToHexString("Ahmed");
        //VPKParser vpkTest = new VPKParser(new FileStream("D:/Steam/SteamApps/common/Counter-Strike Global Offensive/csgo/pak01_dir.vpk", FileMode.Open));
        //Debug.Log(vpkTest.Parse());
        //ParseMDL();
        //ParseVVD();
        //ParseModel("ctm_fbi", "C:/Users/oxter/Documents/csgo/models/player/");
    }
Beispiel #17
0
 protected AbstractGenerator(string filePath, string specificFolder, string tableName, string nameSpace, string assemblyName, string sequenceName, Table table, ApplicationPreferences appPrefs)
 {
     this.filePath = filePath;
     if(appPrefs.GenerateInFolders)
     {
         this.filePath = Path.Combine(filePath, specificFolder);
         if(!this.filePath.EndsWith(Path.DirectorySeparatorChar.ToString()))
         {
             this.filePath = this.filePath + Path.DirectorySeparatorChar;
         }
     }
     this.tableName = tableName;
     this.nameSpace = nameSpace;
     this.assemblyName = assemblyName;
     this.sequenceName = sequenceName;
     Table = table;
     Formatter = TextFormatterFactory.GetTextFormatter(appPrefs);
 }
Beispiel #18
0
 public void ShouldCreateCompleteCompileUnit()
 {
     var applicationPreferences = new ApplicationPreferences
     {
         NameSpace = "someNamespace",
         TableName = "someTableName"
     };
     //var codeGenerator = new CodeGenerator(applicationPreferences, new ColumnDetails());
     //var codeCompileUnit = codeGenerator.GetCompileUnit();
     //var cSharpCodeProvider = new CSharpCodeProvider();
     //var stringBuilder = new StringBuilder();
     //cSharpCodeProvider.GenerateCodeFromCompileUnit(codeCompileUnit, new StringWriter(stringBuilder), new CodeGeneratorOptions());
     //// TODO: Put each assert in its own function. Since if one of the asserts fails, they all fail.
     //// Thus, harder to find what the bug is.
     //Assert.IsTrue(stringBuilder.ToString().Contains("namespace someNamespace"), "namespace failed" + stringBuilder.ToString());
     //Assert.IsTrue(stringBuilder.ToString().Contains("public class Sometablename"), "public class failed" + stringBuilder.ToString());
     //Assert.IsTrue(stringBuilder.ToString().Contains("public Sometablename()"), "public failed" + stringBuilder.ToString());
 }
Beispiel #19
0
 protected AbstractGenerator(string filePath, string specificFolder, string tableName, string nameSpace, string assemblyName, string sequenceName, Table table, ApplicationPreferences appPrefs)
 {
     this.filePath = filePath;
     if (appPrefs.GenerateInFolders)
     {
         this.filePath = Path.Combine(filePath, specificFolder);
         if (!this.filePath.EndsWith(Path.DirectorySeparatorChar.ToString()))
         {
             this.filePath = this.filePath + Path.DirectorySeparatorChar;
         }
     }
     this.tableName              = tableName;
     this.nameSpace              = nameSpace;
     this.assemblyName           = assemblyName;
     this.sequenceName           = sequenceName;
     Table                       = table;
     Formatter                   = TextFormatterFactory.GetTextFormatter(appPrefs);
     this.applicationPreferences = appPrefs;
 }
Beispiel #20
0
        public static void Main(string[] args)
        {
//Debug.Active = true;
//Debug.DevelopmentInfo = true;
//Debug.Level = 10;
            ConsoleDebug.Connect();
            ApplicationPreferences.AddMasterConfiguration(typeof(TestPreferences), true);
            ConfigFile aFile = ApplicationPreferences.GetMasterConfiguration();

            aFile.Load();

            Application.Init();
            MainWindow win = new MainWindow();

            win.Show();
            Application.Run();

            aFile.Save();
        }
Beispiel #21
0
        public static ITextFormatter GetTextFormatter(ApplicationPreferences applicationPreferences)
        {
            switch (applicationPreferences.FieldNamingConvention)
            {
            case FieldNamingConvention.SameAsDatabase:
                return(new UnformattedTextFormatter());

            case FieldNamingConvention.CamelCase:
                return(new CamelCaseTextFormatter());

            case FieldNamingConvention.PascalCase:
                return(new PascalCaseTextFormatter());

            case FieldNamingConvention.Prefixed:
                return(new PrefixedTextFormatter(applicationPreferences.Prefix));

            default:
                throw new Exception("Invalid or unsupported field naming convention.");
            }
        }
Beispiel #22
0
        public static string GetPreferenceFormattedText(this string text, ApplicationPreferences applicationPreferences, bool pluralize)
        {
            if (applicationPreferences.FieldNamingConvention.Equals(FieldNamingConvention.SameAsDatabase))
            {
                return(text);
            }
            string formattedText = text.Replace('_', ' ');

            formattedText = formattedText.MakeTitleCase();
            formattedText = formattedText.Replace(" ", "");

            if (applicationPreferences.FieldNamingConvention.Equals(FieldNamingConvention.Prefixed))
            {
                return(applicationPreferences.Prefix + formattedText);
            }

            return(applicationPreferences.FieldNamingConvention.Equals(FieldNamingConvention.CamelCase)
                       ? formattedText.MakeFirstCharLowerCase()
                       : formattedText);
        }
Beispiel #23
0
        private void SetPreMapData(ApplicationPreferences s)
        {
            var    d   = new Dictionary <string, string>();
            string txt = txtPreMap.Text;

            using (TextReader sr = new StringReader(txt))
                using (CsvReader csv = new CsvReader(sr, false))
                {
                    while (csv.ReadNextRecord())
                    {
                        string v;
                        if (!d.TryGetValue(csv[1], out v))
                        {
                            string property     = csv[0];                  //.Replace("Property(x => x.", "").Trim();
                            string dbColumnName = csv[1].Trim().ToLower(); /*.Replace("map => map.Column(\"", "").Replace("\"));", "")*/
                            d.Add(dbColumnName, property);
                        }
                    }
                }
            s.PreMap = d;
        }
 public T2TiERPClientGen(string filePath, string specificFolder, string tableName, string nameSpace, string assemblyName, string sequenceName, Table table, ApplicationPreferences appPrefs)
 {
     this.filePath = filePath;
     if (appPrefs.GenerateInFolders)
     {
         this.filePath = Path.Combine(filePath, specificFolder);
         if (!this.filePath.EndsWith(Path.DirectorySeparatorChar.ToString()))
         {
             this.filePath = this.filePath + Path.DirectorySeparatorChar;
         }
     }
     this.tableName    = tableName;
     this.nameSpace    = nameSpace;
     this.assemblyName = assemblyName;
     this.sequenceName = sequenceName;
     Table             = table;
     Formatter         = TextFormatterFactory.GetTextFormatter(appPrefs);
     nomeTabela        = Formatter.FormatSingular(tableName);
     tipoDTO           = nomeTabela + "DTO";
     appPref           = appPrefs;
 }
Beispiel #25
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        ApplicationPreferences.AddMasterConfiguration(typeof(TimerList), false);
        configFile = ApplicationPreferences.GetMasterConfiguration();
        configFile.Load();

        Build();
        Timers.ItemsDataSource = list;
        selection.Target       = Timers.CurrentSelection;
        cntActive = new ActionController(selection, "", "",
                                         new ActionMonitor(ActionMonitorType.Sensitivity, removeAction,
                                                           new ActionMonitorDefaults(ActionMonitorDefaultsType.NotNullTarget)),
                                         new ActionMonitor(ActionMonitorType.Sensitivity, propertiesAction,
                                                           new ActionMonitorDefaults(ActionMonitorDefaultsType.NotNullTarget))
                                         );
        for (int i = 1; i <= 25; i++)
        {
            Timer tim = new Timer("Timer " + i, 0, 1, i);
            list.Add(tim);
            tim.Active = true;
        }
    }
        private static CodeSnippetStatement GetIdMapCodeSnippetStatement(ApplicationPreferences appPrefs, Table table, string pkColumnName, string propertyName, string pkColumnType, ITextFormatter formatter)
        {
            var  dataTypeMapper   = new DataTypeMapper();
            bool isPkTypeIntegral = (dataTypeMapper.MapFromDBType(appPrefs.ServerType, pkColumnType, null, null, null)).IsTypeIntegral();

            string fieldName = FixPropertyWithSameClassName(propertyName, table.Name);

            int pkAlsoFkQty = (from fk in table.ForeignKeys.Where(fk => fk.UniquePropertyName == pkColumnName) select fk).Count();

            if (pkAlsoFkQty > 0)
            {
                fieldName = fieldName + "Id";
            }

            string snippet = TABS + $".Property(x => x.{formatter.FormatText(fieldName)}).IsPrimaryKey()";

            if (isPkTypeIntegral)
            {
                snippet += Environment.NewLine + TABS + $".Property(x => x.{formatter.FormatText(fieldName)}).IsIdentity()";
            }

            return(new CodeSnippetStatement(snippet));
        }
        private ApplicationPreferences GetApplicationPreferences(Table tableName, bool all, ApplicationSettings appSettings)
        {
            string sequence     = string.Empty;
            object sequenceName = null;

            if (sequencesComboBox.InvokeRequired)
            {
                sequencesComboBox.Invoke(new MethodInvoker(delegate
                {
                    sequenceName = sequencesComboBox.SelectedItem;
                }));
            }
            else
            {
                sequenceName = sequencesComboBox.SelectedItem;
            }
            if (sequenceName != null && !all)
            {
                sequence = sequenceName.ToString();
            }

            var applicationPreferences = new ApplicationPreferences
            {
                ServerType = _currentConnection.Type,

                TableName = tableName.Name,

                Sequence = sequence,

                FieldNamingConvention     = GetFieldNamingConvention(),
                FieldGenerationConvention = GetFieldGenerationConvention(),

                ConnectionString = _currentConnection.ConnectionString,
            };

            return(applicationPreferences);
        }
Beispiel #28
0
 public FluentGenerator(ApplicationPreferences appPrefs, Table table)
     : base(appPrefs.FolderPath, "Mapping", appPrefs.TableName, appPrefs.NameSpaceMap, appPrefs.AssemblyName, appPrefs.Sequence, table, appPrefs)
 {
     this.appPrefs = appPrefs;
     language = this.appPrefs.Language;
 }
Beispiel #29
0
 protected abstract void AddCompositeIdGenerator(XmlDocument xmldoc, XmlElement idElement, List<ColumnDetail> compositeKey, ApplicationPreferences applicationPreferences);
Beispiel #30
0
 public ContractGenerator(ApplicationPreferences appPrefs, Table table)
     : base(appPrefs.FolderPath, "Contract", appPrefs.TableName, appPrefs.NameSpace, appPrefs.AssemblyName, appPrefs.Sequence, table, appPrefs)
 {
     this.appPrefs = appPrefs;
     this.table = table;
 }
Beispiel #31
0
        private static CodeSnippetStatement GetIdMapCodeSnippetStatement(ApplicationPreferences appPrefs, Table table, string pkColumnName, string propertyName, string pkColumnType, ITextFormatter formatter)
        {
            var dataTypeMapper = new DataTypeMapper();
            bool isPkTypeIntegral = (dataTypeMapper.MapFromDBType(appPrefs.ServerType, pkColumnType, null, null, null)).IsTypeIntegral();

            string idGeneratorType = (isPkTypeIntegral ? "GeneratedBy.Identity()" : "GeneratedBy.Assigned()");
            var fieldName = FixPropertyWithSameClassName(propertyName, table.Name);
            var pkAlsoFkQty = (from fk in table.ForeignKeys.Where(fk => fk.UniquePropertyName == pkColumnName) select fk).Count();
            if (pkAlsoFkQty > 0) fieldName = fieldName + "Id";
             return new CodeSnippetStatement(string.Format(TABS + "Id(x => x.{0}).{1}.Column(\"{2}\");",
                                                       formatter.FormatText(fieldName),
                                                       idGeneratorType,
                                                       pkColumnName));
        }
Beispiel #32
0
        public static ITextFormatter GetTextFormatter(ApplicationPreferences applicationPreferences)
        {
            ITextFormatter formatter;
            switch(applicationPreferences.FieldNamingConvention)
            {
                case FieldNamingConvention.SameAsDatabase:
                    formatter = new UnformattedTextFormatter();
                    break;
                case FieldNamingConvention.CamelCase:
                    formatter = new CamelCaseTextFormatter();
                    break;
                case FieldNamingConvention.PascalCase:
                    formatter = new PascalCaseTextFormatter();
                    break;
                case FieldNamingConvention.Prefixed:
                    formatter = new PrefixedTextFormatter(applicationPreferences.Prefix);
                    break;
                default:
                    throw new Exception("Invalid or unsupported field naming convention.");
            }

            formatter.PrefixRemovalList = applicationPreferences.FieldPrefixRemovalList;

            return formatter;
        }
 public ContractGenerator(ApplicationPreferences appPrefs, Table table)  : base(appPrefs.FolderPath, "Contract", appPrefs.TableName, appPrefs.NameSpace, appPrefs.AssemblyName, appPrefs.Sequence, table, appPrefs)
 {
     this.appPrefs = appPrefs;
     this.table    = table;
 }
		private void StartProcessing()
		{
			SetCurrentState(STATE_CONNECTING);
			String verificationCode = confCodeInput.Text;
			bool quitloop = false;

			InvokeInBackground(delegate {
				while (STATE != STATE_GO_TO_CHATVIEW) {
					switch (STATE) {
					default:
					case STATE_CONNECTING:
						Thread.Sleep(NAP_TIME);
						break;
					case STATE_SMS_VERIFICATION:
						STextConfig cfg = STextConfig.GetInstance();
						String signalingKey = cfg.AccountAttributes.SignalingKey;
						int registrationId = cfg.AccountAttributes.RegistrationId;
						try{
							MessageManager.VerifyAccount(verificationCode, signalingKey, true, registrationId);
						}catch(WebException we){
							InvokeOnMainThread(delegate {
								UIAlertView alert = new UIAlertView("Error!", "Invalid verification code!", null, "Ok");
								alert.Show();
								appDelegate.GoToView(appDelegate.verificationView);
								quitloop = true;
							});
						}
						break;
					case STATE_GENERATING_KEYS:
						//MasterSecretUtil masterSecretUtil = new MasterSecretUtil();
						//MasterSecret masterSecret = masterSecretUtil.GenerateMasterSecret("the passphase"); //TODO: make this into a user input
						//TODO: also need to generate asymmetricMasterSecrect as in the Java implementation.
						//IdentityKeyUtil identityKeyUtil = new IdentityKeyUtil();
						//identityKeyUtil.GenerateIdentityKeys(masterSecret);
						STextConfig st = STextConfig.GetInstance();
						MessageManager.RegisterPreKeys(st.IdentityKey, st.LastResortKey, st.Keys);
						break;
					case STATE_REGISTERING_WITH_SERVER:
						//set up for push notification
						String dt = appDelegate.DeviceToken;
						dt = dt.Replace("<", String.Empty).Replace(">", String.Empty).Replace(" ", String.Empty);
						MessageManager.RegisterApnId(dt);
						InvokeOnMainThread(delegate {
							ApplicationPreferences preference = new ApplicationPreferences();
							preference.LocalNumber = this.appDelegate.registrationView.PhPhoneNumberInput.Text;
						});

						// Do Directory sync
						try{
							StextUtil.RefreshPushDirectory();
						}catch(Exception e){
							Console.WriteLine("Exception Thrown At "+e.ToString());
						}
						break;
					}
					if(quitloop){
						break;
					}
					STATE++;
					InvokeOnMainThread(delegate {
						SetCurrentState(STATE);
					});
				}
			});
		}
 public CUBRIDMappingGenerator(ApplicationPreferences applicationPreferences, Table table)
     : base(applicationPreferences, table)
 {
 }
Beispiel #36
0
        private ApplicationPreferences GetApplicationPreferences(Table tableName, bool all, ApplicationSettings appSettings)
        {
            string sequence     = string.Empty;
            object sequenceName = null;

            if (sequencesComboBox.InvokeRequired)
            {
                sequencesComboBox.Invoke(new MethodInvoker(delegate {
                    sequenceName = sequencesComboBox.SelectedItem;
                }));
            }
            else
            {
                sequenceName = sequencesComboBox.SelectedItem;
            }
            if (sequenceName != null && !all)
            {
                sequence = sequenceName.ToString();
            }

            var folderPath = AddSlashToFolderPath(folderTextBox.Text);

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }
            var domainFolderPath = AddSlashToFolderPath(domainFolderTextBox.Text);

            if (appSettings.GenerateInFolders)
            {
                Directory.CreateDirectory(folderPath + "Contract");
                Directory.CreateDirectory(folderPath + "Domain");
                Directory.CreateDirectory(folderPath + "Mapping");
                domainFolderPath = folderPath;
            }
            else
            {
                // Domain folder is specified by user
                if (!Directory.Exists(domainFolderPath))
                {
                    Directory.CreateDirectory(domainFolderPath);
                }
            }

            var applicationPreferences = new ApplicationPreferences
            {
                ServerType                = _currentConnection.Type,
                FolderPath                = folderPath,
                DomainFolderPath          = domainFolderPath,
                TableName                 = tableName.Name,
                NameSpaceMap              = namespaceMapTextBox.Text,
                NameSpace                 = nameSpaceTextBox.Text,
                AssemblyName              = assemblyNameTextBox.Text,
                Sequence                  = sequence,
                Language                  = LanguageSelected,
                FieldNamingConvention     = GetFieldNamingConvention(),
                FieldGenerationConvention = GetFieldGenerationConvention(),
                Prefix   = prefixTextBox.Text,
                IsFluent = IsFluent,
                IsCastle = IsCastle,
                GeneratePartialClasses      = appSettings.GeneratePartialClasses,
                GenerateWcfDataContract     = appSettings.GenerateWcfContracts,
                ConnectionString            = _currentConnection.ConnectionString,
                ForeignEntityCollectionType = appSettings.ForeignEntityCollectionType,
                InheritenceAndInterfaces    = appSettings.InheritenceAndInterfaces,
                GenerateInFolders           = appSettings.GenerateInFolders,
                ClassNamePrefix             = appSettings.ClassNamePrefix,
                IsByCode = appSettings.IsByCode,
                UseLazy  = appSettings.UseLazy,
                FieldPrefixRemovalList = appSettings.FieldPrefixRemovalList,
                IncludeForeignKeys     = appSettings.IncludeForeignKeys,
                IncludeLengthAndScale  = appSettings.IncludeLengthAndScale,
                ValidatorStyle         = appSettings.ValidationStyle
            };

            return(applicationPreferences);
        }
Beispiel #37
0
 protected MappingGenerator(ApplicationPreferences applicationPreferences, Table table)
     : base(applicationPreferences.FolderPath, "Mapping", applicationPreferences.TableName, applicationPreferences.NameSpace, applicationPreferences.AssemblyName, applicationPreferences.Sequence, table, applicationPreferences)
 {
 }
Beispiel #38
0
 protected virtual void OnButton5Clicked(object sender, System.EventArgs e)
 {
     datavbox1.DataSource = ApplicationPreferences.GetMasterConfiguration().ConfigAdaptor;
 }
Beispiel #39
0
 public MainWindow() : base(Gtk.WindowType.Toplevel)
 {
     Build();
     datavbox1.DataSource = adaptor;
     adaptor.Target       = ApplicationPreferences.GetMasterConfiguration().ConfigAdaptor;
 }
 public ByCodeGenerator(ApplicationPreferences appPrefs, Table table) : base(appPrefs.FolderPath, "Mapping", appPrefs.TableName, appPrefs.NameSpaceMap, appPrefs.AssemblyName, appPrefs.Sequence, table, appPrefs)
 {
     this.appPrefs = appPrefs;
     language      = this.appPrefs.Language;
 }
 public SqlMappingGenerator(ApplicationPreferences applicationPreferences, ColumnDetails columnDetails)
     : base(applicationPreferences, columnDetails)
 {
 }
 public static string GetPreferenceFormattedText(this string text, ApplicationPreferences applicationPreferences)
 {
     return GetPreferenceFormattedText(text, applicationPreferences, false);
 }
Beispiel #43
0
 private static CodeSnippetStatement GetIdMapCodeSnippetStatement(ApplicationPreferences appPrefs, string pkColumnName, string pkColumnType, ITextFormatter formatter)
 {
     var dataTypeMapper = new DataTypeMapper();
     bool isPkTypeIntegral = (dataTypeMapper.MapFromDBType(appPrefs.ServerType, pkColumnType, null, null, null)).IsTypeIntegral();
     string idGeneratorType = (isPkTypeIntegral ? "GeneratedBy.Identity()" : "GeneratedBy.Assigned()");
     return new CodeSnippetStatement(string.Format(TABS + "Id(x => x.{0}).{1}.Column(\"{2}\");",
                                                formatter.FormatText(pkColumnName),
                                                idGeneratorType,
                                                pkColumnName));
 }
Beispiel #44
0
 protected AbstractCodeGenerator(
     string filePath, string additionalFolder, string tableName, string nameSpace, string assemblyName, string sequenceName,
     Table table, ApplicationPreferences appPrefs)
     : base(filePath, additionalFolder, tableName, nameSpace, assemblyName, sequenceName, table, appPrefs)
 {
 }
Beispiel #45
0
 protected virtual void OnButton2Clicked(object sender, System.EventArgs e)
 {
     System.Data.Bindings.Notificator.ReloadObjectNotification(ApplicationPreferences.GetMasterConfiguration().Configuration, null);
 }
 public DBColumnMapper(ApplicationPreferences applicationPreferences)
 {
     _applicationPreferences = applicationPreferences;
     _language = applicationPreferences.Language;
 }
Beispiel #47
0
 public CastleGenerator(ApplicationPreferences applicationPreferences, Table table) : base(applicationPreferences.FolderPath, "Mapping", applicationPreferences.TableName, applicationPreferences.NameSpaceMap, applicationPreferences.AssemblyName, applicationPreferences.Sequence, table, applicationPreferences)
 {
     this.applicationPreferences = applicationPreferences;
 }
 public CastleGenerator(ApplicationPreferences applicationPreferences, Table table)
     : base(applicationPreferences.FolderPath, "Mapping", applicationPreferences.TableName, applicationPreferences.NameSpaceMap, applicationPreferences.AssemblyName, applicationPreferences.Sequence, table, applicationPreferences)
 {
     this.applicationPreferences = applicationPreferences;
 }
Beispiel #49
0
 protected MappingGenerator(ApplicationPreferences applicationPreferences, Table table) : base(applicationPreferences.FolderPath, "Mapping", applicationPreferences.TableName, applicationPreferences.NameSpace, applicationPreferences.AssemblyName, applicationPreferences.Sequence, table, applicationPreferences)
 {
 }
Beispiel #50
0
 protected AbstractCodeGenerator(
     string filePath, string additionalFolder, string tableName, string nameSpace, string assemblyName, string sequenceName,
     Table table, ApplicationPreferences appPrefs)
     : base(filePath, additionalFolder, tableName, nameSpace, assemblyName, sequenceName, table, appPrefs)
 {
 }