Ejemplo n.º 1
0
 public static IEnumerable <InputBindingViewModel> ToBindings(LanguageTable languageTable,
                                                              InputSourceMapping <WingsuitAction> inputMapping,
                                                              Maybe <UnityInputDeviceProfile> currentControllerProfile)
 {
     return(InputBindingView.ToBindings(languageTable, InputBindingGroup.Wingsuit, EmptyBindings, inputMapping,
                                        currentControllerProfile));
 }
Ejemplo n.º 2
0
 private static void ChangeLanguage()
 {
     MultiLanguageTextProvider.RootDirectory = GUI.Manager.GetEntryDirectory() + "/";
     MultiLanguageTextProvider.Reset();
     MultiLanguageTextProvider.LoadCSV("Base.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Options.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_BasicSettings.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Position.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Rotation.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Scale.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_BasicRenderSettings.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_RenderSettings.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_LocalForceField.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_AdvancedRenderCommon.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Environment.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_ProceduralModel.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Behavior.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_SpawnMethod.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Depth.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Culling.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Global.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_Sound.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_FCurve.csv");
     MultiLanguageTextProvider.LoadCSV("Effekseer_FCurve_Element.csv");
     LanguageTable.CreateTableFromDirectory(EntryDirectory);
     GUI.Manager.UpdateFont();
 }
Ejemplo n.º 3
0
        protected void btnSaveLanguage_Click(object sender, EventArgs e)
        {
            LanguageRepository lng = new LanguageRepository();
            LanguageTable      l   = new LanguageTable();

            l.LanguageName = txtLanguage.Text;
            lng.AddLanguage(l);
        }
Ejemplo n.º 4
0
 public LanguageRepository(LanguageTable languageTable)
 {
     _languageTable = languageTable;
     _dataEntities  = new List <LanguageDataEntity>();
     foreach (var language in languageTable.languageData)
     {
         var data = JsonUtility.FromJson <LanguageDataEntity>(language.jsonData.ToString());
         _dataEntities.Add(data);
     }
 }
Ejemplo n.º 5
0
 protected override void Seed(DatabaseContext context)
 {
     SettingTable.Initialize(context);
     FileTypeTable.Initialize(context);
     LanguageTable.Initialize(context);
     CategoryTable.Initialize(context);
     UserMessageCreationModeTable.Initialize(context);
     UserMessageStateTable.Initialize(context);
     MessageStateTable.Initialize(context);
     CategoryFavouriteLevelTable.Initialize(context);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Вызывается при старте сцены и подписываемся на смену языка
        /// Is called when the scene starts subscribes for language change
        /// </summary>
        private void Awake()
        {
            if (table == null)
            {
                table = new LanguageTable();
            }

            UISettings.Current.LangugeChange += handleLanguageChange;
            string localisedString = table.GetElementText(Key, UISettings.Current.language);

            TextComponent.text = localisedString;
        }
 private static void ExportAssetsToFileSystem()
 {
     // Export art
     LanguageTable.LoadCulture("en");
     ExportSpriteFolderToFileSystem("burnImages/", "png");
     ExportSpriteFolderToFileSystem("cardBacks/", "png");
     ExportSpriteFolderToFileSystem("elementArt/", "png");
     ExportSpriteFolderToFileSystem("elementArt/anim/", "png");
     ExportSpriteFolderToFileSystem("endingArt/", "png");
     ExportSpriteFolderToFileSystem("icons40/aspects/", "png");
     ExportSpriteFolderToFileSystem("icons100/legacies/", "png");
     ExportSpriteFolderToFileSystem("icons100/verbs/", "png");
 }
Ejemplo n.º 8
0
 public void SetLanguage(LanguageTable languageTable)
 {
     _titles = new MeasurementTitles {
         Speed      = languageTable.Table["air_speed"],
         Altitude   = languageTable.Table["altitude"],
         GlideRatio = languageTable.Table["glide_ratio"],
         GForce     = languageTable.Table["g_force"]
     };
     if (TitlesUpdated != null)
     {
         TitlesUpdated(_titles);
     }
 }
        private static bool TryParseLanguage(DriveItem driveItem, out string languageCode, out string languageDisplayName)
        {
            // Detect the source language for this file (we're just reading it from the filename, but you could use a cognitive service for this)
            string[] split = driveItem.Name.Split(new[] { '.' });
            if (split.Length != 3)
            {
                languageCode        = null;
                languageDisplayName = null;
                return(false);
            }

            languageCode = split[1];
            if (LanguageTable.TryGetValue(languageCode, out languageDisplayName))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 10
0
    public void SetLanguage(CultureCode culture)
    {
        _languages = _languages ?? LanguageSettings.ReadLanguages();
        var languageTable = GetLanguageTable(_languages, culture);

        _table = languageTable;
        if (_tableUpdates == null)
        {
            _tableUpdates = new BehaviorSubject <LanguageTable>(_table);
        }
        else
        {
            _tableUpdates.OnNext(_table);
        }
        //_tableUpdates = _tableUpdates ?? new ReplaySubject<LanguageTable>(1);
        _tableUpdates.OnNext(languageTable);

        _isInitialized = true;
    }
Ejemplo n.º 11
0
        public override void Update()
        {
            if (binding != null)
            {
            }

            if (Manager.NativeManager.BeginCombo(id, FieldNames[LanguageTable.SelectedIndex], swig.ComboFlags.None, null))
            {
                for (int i = 0; i < FieldNames.Count; i++)
                {
                    bool is_selected = (FieldNames[LanguageTable.SelectedIndex] == FieldNames[i]);

                    if (Manager.NativeManager.Selectable(FieldNames[i], is_selected, swig.SelectableFlags.None))
                    {
                        LanguageTable.SelectLanguage(i);
                    }

                    if (is_selected)
                    {
                        Manager.NativeManager.SetItemDefaultFocus();
                    }
                }

                Manager.NativeManager.EndCombo();
            }


            var isActive_Current = Manager.NativeManager.IsItemActive();

            if (isActive && !isActive_Current)
            {
                FixValue();
            }

            isActive = isActive_Current;
        }
Ejemplo n.º 12
0
        public static void LoadFromElement(XmlElement e, object o, bool isClip)
        {
            var text = e.GetText();

            LanguageTable.SelectLanguage(text);
        }
Ejemplo n.º 13
0
        public bool Initialize(bool gui)
        {
            // Setup Special Paths
            {
                try
                {
                    StartDirectory = System.IO.Directory.GetCurrentDirectory();
                    EntryDirectory = GUI.Manager.GetEntryDirectory();
                }
                catch (Exception e)
                {
                    ExportError(e);
                    return(false);
                }

                Name = Path.GetFileNameWithoutExtension(System.AppDomain.CurrentDomain.FriendlyName);
            }



            // Register UI
            GUI.Component.ParameterListComponentFactory.Register(typeof(Data.LanguageSelector), () => { return(new GUI.Component.LanguageSelector()); });

            GUI.Component.ParameterListComponentFactory.Register(typeof(Data.ProceduralModelReference), () => {
                return(new GUI.Component.ObjectReference <Data.ProceduralModelParameter>(Core.ProceduralModel.ProceduralModels));
            });

            // Debug
            bool isDebugMode = false;

#if DEBUG
            isDebugMode = true;
#endif
            if (System.IO.File.Exists(Path.Combine(EntryDirectory, "debug.txt")) || isDebugMode)
            {
                swig.Native.SetFileLogger(Path.Combine(GUI.Manager.GetEntryDirectory(), "Effekseer.log.txt"));
                Utils.Logger.LogPath = Path.Combine(GUI.Manager.GetEntryDirectory(), "Effekseer.Managed.log.txt");
            }

            LanguageTable.CreateTableFromDirectory(EntryDirectory);

            var    systemLanguage = EfkN.GetSystemLanguage();
            string language       = null;

            if (systemLanguage != swig.SystemLanguage.Unknown)
            {
                if (systemLanguage == swig.SystemLanguage.Japanese)
                {
                    language = "ja";
                }
                else if (systemLanguage == swig.SystemLanguage.English)
                {
                    language = "en";
                }
            }
            else
            {
                language = "en";
            }

            Core.OnOutputMessage += new Action <string>(Core_OnOutputMessage);
            Core.Initialize(language);

            if (gui)
            {
                ChangeLanguage();
                LanguageTable.OnLanguageChanged += (o, e) => { ChangeLanguage(); };

                // Failed to compile script
                if (Core.ExportScripts.Count == 0)
                {
                    Script.ExportScript efkpkgExporter = new Script.ExportScript(
                        Script.ScriptPosition.External,
                        Plugin.ExportEfkPkg.UniqueName,
                        Plugin.ExportEfkPkg.Author,
                        Plugin.ExportEfkPkg.Title,
                        Plugin.ExportEfkPkg.Description,
                        Plugin.ExportEfkPkg.Filter,
                        Plugin.ExportEfkPkg.Call);
                    Core.ExportScripts.Add(efkpkgExporter);

                    Script.ExportScript defaultExporter = new Script.ExportScript(
                        Script.ScriptPosition.External,
                        Plugin.ExportDefault.UniqueName,
                        Plugin.ExportDefault.Author,
                        Plugin.ExportDefault.Title,
                        Plugin.ExportDefault.Description,
                        Plugin.ExportDefault.Filter,
                        Plugin.ExportDefault.Call);
                    Core.ExportScripts.Add(defaultExporter);

                    Script.ImportScript efkpkgImporter = new Script.ImportScript(
                        Script.ScriptPosition.External,
                        Plugin.ImportEfkPkg.UniqueName,
                        Plugin.ImportEfkPkg.Author,
                        Plugin.ImportEfkPkg.Title,
                        Plugin.ImportEfkPkg.Description,
                        Plugin.ImportEfkPkg.Filter,
                        Plugin.ImportEfkPkg.Call);
                    Core.ImportScripts.Add(efkpkgImporter);
                }

                OnInitialize();
            }

            return(true);
        }
Ejemplo n.º 14
0
        public static string Interactable2String(LanguageTable languageTable, InputSourceType sourceType, Interactable interactable,
                                                 Maybe <UnityInputDeviceProfile> currentControllerProfile)
        {
            var l = languageTable.Table;

            if (interactable is Interactable.Key)
            {
                var key = ((Interactable.Key)interactable).Id;
                if (key == KeyCode.UpArrow)
                {
                    return("↑");
                }
                else if (key == KeyCode.DownArrow)
                {
                    return("↓");
                }
                else if (key == KeyCode.LeftArrow)
                {
                    return("←");
                }
                else if (key == KeyCode.RightArrow)
                {
                    return("→");
                }
                else if (key == KeyCode.Return)
                {
                    return("Enter");
                }
                else
                {
                    return(EnumUtils.ToPrettyString(key));
                }
            }
            else if (interactable is Interactable.MouseButton)
            {
                var mouseButtonId = ((Interactable.MouseButton)interactable).Id;
                if (mouseButtonId == MouseButtonId.Left)
                {
                    return(l["left_mouse_button"]);
                }
                else if (mouseButtonId == MouseButtonId.Right)
                {
                    return(l["right_mouse_button"]);
                }
                else if (mouseButtonId == MouseButtonId.Middle)
                {
                    return(l["middle_mouse_button"]);
                }
                else
                {
                    return(l["mouse_button_n"].Replace("$n", ((int)mouseButtonId).ToString()));
                }
            }
            else if (interactable is Interactable.Button)
            {
                var    buttonId         = ((Interactable.Button)interactable).Id;
                string customMappingStr = null;
                // TODO Factor into a function
                if (currentControllerProfile.IsJust)
                {
                    var inputSources = UnityInputDeviceProfiles.InputSources[currentControllerProfile.Value.GetType()];
                    InputControlMapping inputControlMapping;
                    if (inputSources.TryGetValue(new InputControlSource.Button(buttonId), out inputControlMapping))
                    {
                        customMappingStr = inputControlMapping.Handle;
                    }
                }

                if (customMappingStr == null)
                {
                    return(l[(sourceType.Peripheral.ToString().ToLower() + "_button_n")].Replace("$n", buttonId.ToString()));
                }
                return(customMappingStr);
            }
            else if (interactable is Interactable.JoystickAxis)
            {
                var    axisId           = ((Interactable.JoystickAxis)interactable).Id;
                string customMappingStr = null;
                // TODO Factor into a function
                if (currentControllerProfile.IsJust)
                {
                    var inputSources = UnityInputDeviceProfiles.InputSources[currentControllerProfile.Value.GetType()];
                    InputControlMapping inputControlMapping;
                    if (inputSources.TryGetValue(new InputControlSource.Axis(axisId), out inputControlMapping))
                    {
                        customMappingStr = inputControlMapping.Handle;
                    }
                }

                if (customMappingStr == null)
                {
                    return(l["joystick_axis_n"].Replace("$n", axisId.ToString()));
                }
                return(customMappingStr);
            }
            else if (interactable is Interactable.XInputAxis)
            {
                var axisId = ((Interactable.XInputAxis)interactable).Id;
                return(EnumUtils.ToPrettyString(axisId));
            }
            else if (interactable is Interactable.XInputButton)
            {
                var buttonId = ((Interactable.XInputButton)interactable).Id;
                return(EnumUtils.ToPrettyString(buttonId));
            }
            else if (interactable is Interactable.MouseAxis)
            {
                var axisId = ((Interactable.MouseAxis)interactable).Id;
                return(l["mouse_axis_n"].Replace("$n", axisId.ToString()));
            }
            else if (interactable is Interactable.PolarizedAxis)
            {
                var polarizedInteractable = (Interactable.PolarizedAxis)interactable;

                // TODO Factor into a function
                if (currentControllerProfile.IsJust && polarizedInteractable.Axis is Interactable.JoystickAxis)
                {
                    var joystickAxisId = polarizedInteractable.Axis as Interactable.JoystickAxis;
                    var inputSources   = UnityInputDeviceProfiles.InputSources[currentControllerProfile.Value.GetType()];
                    InputControlMapping inputControlMapping;
                    if (inputSources.TryGetValue(new InputControlSource.Axis(joystickAxisId.Id), out inputControlMapping))
                    {
                        var customMappingStr = inputControlMapping.Handle;
                        var polarity         = inputControlMapping.Invert ? polarizedInteractable.Polarity.Invert() : polarizedInteractable.Polarity;

                        if (polarity == AxisPolarity.Positive)
                        {
                            return(customMappingStr
                                   .ReplaceLast("Y", "Up")
                                   .ReplaceLast("X", "Right"));
                        }
                        return(customMappingStr
                               .ReplaceLast("Y", "Down")
                               .ReplaceLast("X", "Left"));
                    }
                }

                return(Interactable2String(languageTable, sourceType, polarizedInteractable.Axis, currentControllerProfile) +
                       (polarizedInteractable.Polarity == AxisPolarity.Positive ? "+" : "-"));
            }
            else
            {
                throw new Exception("Unknown interactable type " + interactable.GetType());
            }
        }
Ejemplo n.º 15
0
 public static string InputSource2String(LanguageTable languageTable, InputSource inputSource,
                                         Maybe <UnityInputDeviceProfile> currentControllerProfile)
 {
     return(Interactable2String(languageTable, inputSource.SourceType, inputSource.Interactable, currentControllerProfile));
 }
Ejemplo n.º 16
0
 private void SetLanguage(LanguageTable language)
 {
     _viewModel.SetLanguage(language);
 }
Ejemplo n.º 17
0
 public CSVLanguageTable()
 {
     Languages = new LanguageTable();
 }
Ejemplo n.º 18
0
        public List <Message> LoadMany(ISqlConnectionInfo connection, SqlQueryParameters parameters)
        {
            IDatabase database = connection.Database;

            if (database == null)
            {
                throw new ArgumentNullException("database", "Error initializing database connection.");
            }
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }
            string sqlCmdText = string.Empty;

            try
            {
                sqlCmdText = "SELECT {0} " +
                             MessageTable.GetColumnNames("[m]") +
                             (this.Depth > 0 ? "," + ServiceTable.GetColumnNames("[m_s]") : string.Empty) +
                             (this.Depth > 1 ? "," + ApplicationTable.GetColumnNames("[m_s_a]") : string.Empty) +
                             (this.Depth > 1 ? "," + ProductTable.GetColumnNames("[m_s_p]") : string.Empty) +
                             (this.Depth > 1 ? "," + MerchantTable.GetColumnNames("[m_s_m]") : string.Empty) +
                             (this.Depth > 1 ? "," + ServiceTypeTable.GetColumnNames("[m_s_st]") : string.Empty) +
                             (this.Depth > 1 ? "," + UserSessionTypeTable.GetColumnNames("[m_s_ust]") : string.Empty) +
                             (this.Depth > 1 ? "," + CountryTable.GetColumnNames("[m_s_c]") : string.Empty) +
                             (this.Depth > 1 ? "," + LanguageTable.GetColumnNames("[m_s_l]") : string.Empty) +
                             (this.Depth > 1 ? "," + ServiceConfigurationTable.GetColumnNames("[m_s_sc]") : string.Empty) +
                             (this.Depth > 1 ? "," + TemplateTable.GetColumnNames("[m_s_t]") : string.Empty) +
                             (this.Depth > 0 ? "," + CustomerTable.GetColumnNames("[m_c]") : string.Empty) +
                             (this.Depth > 1 ? "," + UserTable.GetColumnNames("[m_c_u]") : string.Empty) +
                             (this.Depth > 1 ? "," + ServiceTable.GetColumnNames("[m_c_s]") : string.Empty) +
                             (this.Depth > 1 ? "," + CountryTable.GetColumnNames("[m_c_c]") : string.Empty) +
                             (this.Depth > 1 ? "," + LanguageTable.GetColumnNames("[m_c_l]") : string.Empty) +
                             (this.Depth > 1 ? "," + MobileOperatorTable.GetColumnNames("[m_c_mo]") : string.Empty) +
                             (this.Depth > 0 ? "," + MobileOperatorTable.GetColumnNames("[m_mo]") : string.Empty) +
                             (this.Depth > 1 ? "," + CountryTable.GetColumnNames("[m_mo_c]") : string.Empty) +
                             " FROM [stats].[Message] AS [m] ";
                if (this.Depth > 0)
                {
                    sqlCmdText += "INNER  JOIN [core].[Service] AS [m_s] ON [m].[ServiceID] = [m_s].[ServiceID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Application] AS [m_s_a] ON [m_s].[ApplicationID] = [m_s_a].[ApplicationID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Product] AS [m_s_p] ON [m_s].[ProductID] = [m_s_p].[ProductID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Merchant] AS [m_s_m] ON [m_s].[MerchantID] = [m_s_m].[MerchantID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[ServiceType] AS [m_s_st] ON [m_s].[ServiceTypeID] = [m_s_st].[ServiceTypeID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[UserSessionType] AS [m_s_ust] ON [m_s].[UserSessionTypeID] = [m_s_ust].[UserSessionTypeID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Country] AS [m_s_c] ON [m_s].[FallbackCountryID] = [m_s_c].[CountryID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Language] AS [m_s_l] ON [m_s].[FallbackLanguageID] = [m_s_l].[LanguageID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[ServiceConfiguration] AS [m_s_sc] ON [m_s].[ServiceConfigurationID] = [m_s_sc].[ServiceConfigurationID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Template] AS [m_s_t] ON [m_s].[TemplateID] = [m_s_t].[TemplateID] ";
                }
                if (this.Depth > 0)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Customer] AS [m_c] ON [m].[CustomerID] = [m_c].[CustomerID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[User] AS [m_c_u] ON [m_c].[UserID] = [m_c_u].[UserID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Service] AS [m_c_s] ON [m_c].[ServiceID] = [m_c_s].[ServiceID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Country] AS [m_c_c] ON [m_c].[CountryID] = [m_c_c].[CountryID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Language] AS [m_c_l] ON [m_c].[LanguageID] = [m_c_l].[LanguageID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[MobileOperator] AS [m_c_mo] ON [m_c].[MobileOperatorID] = [m_c_mo].[MobileOperatorID] ";
                }
                if (this.Depth > 0)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[MobileOperator] AS [m_mo] ON [m].[MobileOperatorID] = [m_mo].[MobileOperatorID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Country] AS [m_mo_c] ON [m_mo].[CountryID] = [m_mo_c].[CountryID] ";
                }


                sqlCmdText = parameters.BuildQuery(sqlCmdText);
                SqlCommand sqlCmd = database.Add(sqlCmdText) as SqlCommand;
                foreach (KeyValuePair <string, object> argument in parameters.Arguments)
                {
                    sqlCmd.Parameters.AddWithValue("@" + argument.Key, argument.Value);
                }

                SqlDataReader sqlReader = database.Add(sqlCmd) as SqlDataReader;

                if (!sqlReader.HasRows || !sqlReader.Read())
                {
                    IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("m", "customloadmany", "notfound"), "Message list could not be loaded using custom logic as no items were found.", sqlCmdText, this, connection, parameters);
                    if (this.Logger.IsDebugEnabled)
                    {
                        this.Logger.Debug(builder.ToString());
                    }
                    sqlReader.Close();
                    return(new List <Message>());
                }

                SqlQuery query = new SqlQuery(sqlReader);

                MessageTable              mTable       = new MessageTable(query);
                ServiceTable              m_sTable     = (this.Depth > 0) ? new ServiceTable(query) : null;
                ApplicationTable          m_s_aTable   = (this.Depth > 1) ? new ApplicationTable(query) : null;
                ProductTable              m_s_pTable   = (this.Depth > 1) ? new ProductTable(query) : null;
                MerchantTable             m_s_mTable   = (this.Depth > 1) ? new MerchantTable(query) : null;
                ServiceTypeTable          m_s_stTable  = (this.Depth > 1) ? new ServiceTypeTable(query) : null;
                UserSessionTypeTable      m_s_ustTable = (this.Depth > 1) ? new UserSessionTypeTable(query) : null;
                CountryTable              m_s_cTable   = (this.Depth > 1) ? new CountryTable(query) : null;
                LanguageTable             m_s_lTable   = (this.Depth > 1) ? new LanguageTable(query) : null;
                ServiceConfigurationTable m_s_scTable  = (this.Depth > 1) ? new ServiceConfigurationTable(query) : null;
                TemplateTable             m_s_tTable   = (this.Depth > 1) ? new TemplateTable(query) : null;
                CustomerTable             m_cTable     = (this.Depth > 0) ? new CustomerTable(query) : null;
                UserTable           m_c_uTable         = (this.Depth > 1) ? new UserTable(query) : null;
                ServiceTable        m_c_sTable         = (this.Depth > 1) ? new ServiceTable(query) : null;
                CountryTable        m_c_cTable         = (this.Depth > 1) ? new CountryTable(query) : null;
                LanguageTable       m_c_lTable         = (this.Depth > 1) ? new LanguageTable(query) : null;
                MobileOperatorTable m_c_moTable        = (this.Depth > 1) ? new MobileOperatorTable(query) : null;
                MobileOperatorTable m_moTable          = (this.Depth > 0) ? new MobileOperatorTable(query) : null;
                CountryTable        m_mo_cTable        = (this.Depth > 1) ? new CountryTable(query) : null;

                List <Message> result = new List <Message>();
                do
                {
                    Application          m_s_aObject   = (this.Depth > 1) ? m_s_aTable.CreateInstance() : null;
                    Product              m_s_pObject   = (this.Depth > 1) ? m_s_pTable.CreateInstance() : null;
                    Merchant             m_s_mObject   = (this.Depth > 1) ? m_s_mTable.CreateInstance() : null;
                    ServiceType          m_s_stObject  = (this.Depth > 1) ? m_s_stTable.CreateInstance() : null;
                    UserSessionType      m_s_ustObject = (this.Depth > 1) ? m_s_ustTable.CreateInstance() : null;
                    Country              m_s_cObject   = (this.Depth > 1) ? m_s_cTable.CreateInstance() : null;
                    Language             m_s_lObject   = (this.Depth > 1) ? m_s_lTable.CreateInstance() : null;
                    ServiceConfiguration m_s_scObject  = (this.Depth > 1) ? m_s_scTable.CreateInstance() : null;
                    Template             m_s_tObject   = (this.Depth > 1) ? m_s_tTable.CreateInstance() : null;
                    Service              m_sObject     = (this.Depth > 0) ? m_sTable.CreateInstance(m_s_aObject, m_s_pObject, m_s_mObject, m_s_stObject, m_s_ustObject, m_s_cObject, m_s_lObject, m_s_scObject, m_s_tObject) : null;
                    User           m_c_uObject         = (this.Depth > 1) ? m_c_uTable.CreateInstance() : null;
                    Service        m_c_sObject         = (this.Depth > 1) ? m_c_sTable.CreateInstance() : null;
                    Country        m_c_cObject         = (this.Depth > 1) ? m_c_cTable.CreateInstance() : null;
                    Language       m_c_lObject         = (this.Depth > 1) ? m_c_lTable.CreateInstance() : null;
                    MobileOperator m_c_moObject        = (this.Depth > 1) ? m_c_moTable.CreateInstance() : null;
                    Customer       m_cObject           = (this.Depth > 0) ? m_cTable.CreateInstance(m_c_uObject, m_c_sObject, m_c_cObject, m_c_lObject, m_c_moObject) : null;
                    Country        m_mo_cObject        = (this.Depth > 1) ? m_mo_cTable.CreateInstance() : null;
                    MobileOperator m_moObject          = (this.Depth > 0) ? m_moTable.CreateInstance(m_mo_cObject) : null;
                    Message        mObject             = (this.Depth > -1) ? mTable.CreateInstance(m_sObject, m_cObject, m_moObject) : null;
                    result.Add(mObject);
                } while (sqlReader.Read());
                sqlReader.Close();

                return(result);
            }
            catch (Exception ex)
            {
                database.HandleException(ex);
                IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("m", "customloadmany", "exception"), "Message list could not be loaded using custom logic. See exception for details.", sqlCmdText, ex, this, connection, parameters);
                if (this.Logger.IsErrorEnabled)
                {
                    this.Logger.Error(builder.ToString(), ex);
                }
                throw new DataOperationException(DataOperation.Load, "Message", "Exception while loading (custom/many) Message object from database. See inner exception for details.", ex);
            }
        }
Ejemplo n.º 19
0
        public List <ProfileDetail> LoadMany(ISqlConnectionInfo connection, SqlQueryParameters parameters)
        {
            IDatabase database = connection.Database;

            if (database == null)
            {
                throw new ArgumentNullException("database", "Error initializing database connection.");
            }
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }
            string sqlCmdText = string.Empty;

            try
            {
                sqlCmdText = "SELECT {0} " +
                             ProfileDetailTable.GetColumnNames("[pd]") +
                             (this.Depth > 0 ? "," + ProfileTable.GetColumnNames("[pd_p]") : string.Empty) +
                             (this.Depth > 1 ? "," + ProfileGroupTable.GetColumnNames("[pd_p_pg]") : string.Empty) +
                             (this.Depth > 0 ? "," + LanguageTable.GetColumnNames("[pd_l]") : string.Empty) +
                             " FROM [web].[ProfileDetail] AS [pd] ";
                if (this.Depth > 0)
                {
                    sqlCmdText += "INNER  JOIN [web].[Profile] AS [pd_p] ON [pd].[ProfileID] = [pd_p].[ProfileID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [web].[ProfileGroup] AS [pd_p_pg] ON [pd_p].[ProfileGroupID] = [pd_p_pg].[ProfileGroupID] ";
                }
                if (this.Depth > 0)
                {
                    sqlCmdText += "INNER  JOIN [core].[Language] AS [pd_l] ON [pd].[LanguageID] = [pd_l].[LanguageID] ";
                }


                sqlCmdText = parameters.BuildQuery(sqlCmdText);
                SqlCommand sqlCmd = database.Add(sqlCmdText) as SqlCommand;
                foreach (KeyValuePair <string, object> argument in parameters.Arguments)
                {
                    sqlCmd.Parameters.AddWithValue("@" + argument.Key, argument.Value);
                }

                SqlDataReader sqlReader = database.Add(sqlCmd) as SqlDataReader;

                if (!sqlReader.HasRows || !sqlReader.Read())
                {
                    IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("pd", "customloadmany", "notfound"), "ProfileDetail list could not be loaded using custom logic as no items were found.", sqlCmdText, this, connection, parameters);
                    if (this.Logger.IsDebugEnabled)
                    {
                        this.Logger.Debug(builder.ToString());
                    }
                    sqlReader.Close();
                    return(new List <ProfileDetail>());
                }

                SqlQuery query = new SqlQuery(sqlReader);

                ProfileDetailTable pdTable      = new ProfileDetailTable(query);
                ProfileTable       pd_pTable    = (this.Depth > 0) ? new ProfileTable(query) : null;
                ProfileGroupTable  pd_p_pgTable = (this.Depth > 1) ? new ProfileGroupTable(query) : null;
                LanguageTable      pd_lTable    = (this.Depth > 0) ? new LanguageTable(query) : null;

                List <ProfileDetail> result = new List <ProfileDetail>();
                do
                {
                    ProfileGroup  pd_p_pgObject = (this.Depth > 1) ? pd_p_pgTable.CreateInstance() : null;
                    Profile       pd_pObject    = (this.Depth > 0) ? pd_pTable.CreateInstance(pd_p_pgObject) : null;
                    Language      pd_lObject    = (this.Depth > 0) ? pd_lTable.CreateInstance() : null;
                    ProfileDetail pdObject      = (this.Depth > -1) ? pdTable.CreateInstance(pd_pObject, pd_lObject) : null;
                    result.Add(pdObject);
                } while (sqlReader.Read());
                sqlReader.Close();

                return(result);
            }
            catch (Exception ex)
            {
                database.HandleException(ex);
                IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("pd", "customloadmany", "exception"), "ProfileDetail list could not be loaded using custom logic. See exception for details.", sqlCmdText, ex, this, connection, parameters);
                if (this.Logger.IsErrorEnabled)
                {
                    this.Logger.Error(builder.ToString(), ex);
                }
                throw new DataOperationException(DataOperation.Load, "ProfileDetail", "Exception while loading (custom/many) ProfileDetail object from database. See inner exception for details.", ex);
            }
        }
Ejemplo n.º 20
0
        protected override ProfileDetail LoadInternal(ISqlConnectionInfo connection, int id)
        {
            IDatabase database = connection.Database;

            if (database == null)
            {
                throw new ArgumentNullException("database", "Error initializing database connection.");
            }
            string sqlCmdText = string.Empty;

            try
            {
                sqlCmdText = "SELECT " +
                             ProfileDetailTable.GetColumnNames("[pd]") +
                             (this.Depth > 0 ? "," + ProfileTable.GetColumnNames("[pd_p]") : string.Empty) +
                             (this.Depth > 1 ? "," + ProfileGroupTable.GetColumnNames("[pd_p_pg]") : string.Empty) +
                             (this.Depth > 0 ? "," + LanguageTable.GetColumnNames("[pd_l]") : string.Empty) +
                             " FROM [web].[ProfileDetail] AS [pd] ";
                if (this.Depth > 0)
                {
                    sqlCmdText += "INNER  JOIN [web].[Profile] AS [pd_p] ON [pd].[ProfileID] = [pd_p].[ProfileID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [web].[ProfileGroup] AS [pd_p_pg] ON [pd_p].[ProfileGroupID] = [pd_p_pg].[ProfileGroupID] ";
                }
                if (this.Depth > 0)
                {
                    sqlCmdText += "INNER  JOIN [core].[Language] AS [pd_l] ON [pd].[LanguageID] = [pd_l].[LanguageID] ";
                }
                sqlCmdText += "WHERE [pd].[ProfileDetailID] = @ProfileDetailID;";

                SqlCommand sqlCmd = database.Add(sqlCmdText) as SqlCommand;
                sqlCmd.Parameters.AddWithValue("@ProfileDetailID", id);
                SqlDataReader sqlReader = database.Add(sqlCmd) as SqlDataReader;

                if (!sqlReader.HasRows || !sqlReader.Read())
                {
                    IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("pd", "loadinternal", "notfound"), "ProfileDetail could not be loaded by id as it was not found.", sqlCmdText, this, connection, id);
                    if (this.Logger.IsWarnEnabled)
                    {
                        this.Logger.Warn(builder.ToString());
                    }
                    sqlReader.Close();
                    return(null);
                }

                SqlQuery query = new SqlQuery(sqlReader);

                ProfileDetailTable pdTable      = new ProfileDetailTable(query);
                ProfileTable       pd_pTable    = (this.Depth > 0) ? new ProfileTable(query) : null;
                ProfileGroupTable  pd_p_pgTable = (this.Depth > 1) ? new ProfileGroupTable(query) : null;
                LanguageTable      pd_lTable    = (this.Depth > 0) ? new LanguageTable(query) : null;


                ProfileGroup  pd_p_pgObject = (this.Depth > 1) ? pd_p_pgTable.CreateInstance() : null;
                Profile       pd_pObject    = (this.Depth > 0) ? pd_pTable.CreateInstance(pd_p_pgObject) : null;
                Language      pd_lObject    = (this.Depth > 0) ? pd_lTable.CreateInstance() : null;
                ProfileDetail pdObject      = pdTable.CreateInstance(pd_pObject, pd_lObject);
                sqlReader.Close();

                return(pdObject);
            }
            catch (Exception ex)
            {
                database.HandleException(ex);
                IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("pd", "loadinternal", "exception"), "ProfileDetail could not be loaded by id. See exception for details.", sqlCmdText, ex, this, connection, id);
                if (this.Logger.IsErrorEnabled)
                {
                    this.Logger.Error(builder.ToString(), ex);
                }
                throw new DataOperationException(DataOperation.Load, "ProfileDetail", "Exception while loading ProfileDetail object from database. See inner exception for details.", ex);
            }
        }
Ejemplo n.º 21
0
        static void Exec(bool gui, string input, string output, string export, string format, float magnification, bool materialCache)
        {
            // Register UI
            GUI.Component.ParameterListComponentFactory.Register(typeof(Data.LanguageSelector), () => { return(new GUI.Component.LanguageSelector()); });

            GUI.Component.ParameterListComponentFactory.Register(typeof(Data.ProcedualModelReference), () => {
                return(new GUI.Component.ObjectReference <Data.ProcedualModelParameter>(Core.ProcedualModel.ProcedualModels));
            });

            // Debug
            bool isDebugMode = false;

#if DEBUG
            isDebugMode = true;
#endif
            if (System.IO.File.Exists(Path.Combine(EntryDirectory, "debug.txt")) || isDebugMode)
            {
                swig.Native.SetFileLogger(Path.Combine(GUI.Manager.GetEntryDirectory(), "Effekseer.log.txt"));
                Utils.Logger.LogPath = Path.Combine(GUI.Manager.GetEntryDirectory(), "Effekseer.Managed.log.txt");
            }

            LanguageTable.LoadTable(Path.Combine(EntryDirectory, "resources/languages/languages.txt"));

            var    systemLanguage = EfkN.GetSystemLanguage();
            string language       = null;

            if (systemLanguage != swig.SystemLanguage.Unknown)
            {
                if (systemLanguage == swig.SystemLanguage.Japanese)
                {
                    language = "ja";
                }
                else if (systemLanguage == swig.SystemLanguage.English)
                {
                    language = "en";
                }
            }
            else
            {
                language = "en";
            }

            Core.OnOutputMessage += new Action <string>(Core_OnOutputMessage);
            Core.Initialize(language);

            if (gui)
            {
                ChangeLanguage();
                LanguageTable.OnLanguageChanged += (o, e) => { ChangeLanguage(); };

                // Failed to compile script
                if (Core.ExportScripts.Count == 0)
                {
                    Script.ExportScript efkpkgExporter = new Script.ExportScript(
                        Script.ScriptPosition.External,
                        Plugin.ExportEfkPkg.UniqueName,
                        Plugin.ExportEfkPkg.Author,
                        Plugin.ExportEfkPkg.Title,
                        Plugin.ExportEfkPkg.Description,
                        Plugin.ExportEfkPkg.Filter,
                        Plugin.ExportEfkPkg.Call);
                    Core.ExportScripts.Add(efkpkgExporter);

                    Script.ExportScript defaultExporter = new Script.ExportScript(
                        Script.ScriptPosition.External,
                        Plugin.ExportDefault.UniqueName,
                        Plugin.ExportDefault.Author,
                        Plugin.ExportDefault.Title,
                        Plugin.ExportDefault.Description,
                        Plugin.ExportDefault.Filter,
                        Plugin.ExportDefault.Call);
                    Core.ExportScripts.Add(defaultExporter);

                    Script.ExportScript glTFExporter = new Script.ExportScript(
                        Script.ScriptPosition.External,
                        Plugin.ExportglTF.UniqueName,
                        Plugin.ExportglTF.Author,
                        Plugin.ExportglTF.Title,
                        Plugin.ExportglTF.Description,
                        Plugin.ExportglTF.Filter,
                        Plugin.ExportglTF.Call);
                    Core.ExportScripts.Add(glTFExporter);

                    Script.ExportScript glbExporter = new Script.ExportScript(
                        Script.ScriptPosition.External,
                        Plugin.Exportglb.UniqueName,
                        Plugin.Exportglb.Author,
                        Plugin.Exportglb.Title,
                        Plugin.Exportglb.Description,
                        Plugin.Exportglb.Filter,
                        Plugin.Exportglb.Call);
                    Core.ExportScripts.Add(glbExporter);
                }



                System.OperatingSystem os         = System.Environment.OSVersion;
                swig.DeviceType        deviceType = swig.DeviceType.DirectX11;

                if (!(os.Platform == PlatformID.Win32NT ||
                      os.Platform == PlatformID.Win32S ||
                      os.Platform == PlatformID.Win32Windows ||
                      os.Platform == PlatformID.WinCE))
                {
                    deviceType = swig.DeviceType.OpenGL;
                }

                if (!GUI.Manager.Initialize(960, 540, deviceType))
                {
                    return;
                }
            }

            try
            {
                if (input != string.Empty)
                {
                    Core.LoadFrom(input);
                }

                if (output != string.Empty)
                {
                    Core.SaveTo(output);
                }

                if (export != string.Empty)
                {
                    if (magnification == 0.0f)
                    {
                        magnification = Core.Option.Magnification;
                    }

                    if (format == "gltf")
                    {
                        var option = new Effekseer.Exporter.glTFExporterOption();
                        option.Scale = magnification;
                        var exporter = new Effekseer.Exporter.glTFExporter();
                        exporter.Export(export, option);
                    }
                    else if (format == "glb")
                    {
                        var option = new Effekseer.Exporter.glTFExporterOption();
                        option.Scale  = magnification;
                        option.Format = Exporter.glTFExporterFormat.glb;
                        var exporter = new Effekseer.Exporter.glTFExporter();
                        exporter.Export(export, option);
                    }
                    else
                    {
                        var binaryExporter = new Binary.Exporter();
                        var binary         = binaryExporter.Export(Core.Root, magnification);
                        System.IO.File.WriteAllBytes(export, binary);
                    }
                }
            }
            catch (Exception e)
            {
                System.Console.Error.WriteLine(e.Message);
            }

            try
            {
                if (materialCache)
                {
                    IO.MaterialCacheGenerator.GenerateMaterialCaches();
                }
            }
            catch (Exception e)
            {
                System.Console.Error.WriteLine(e.Message);
            }

            if (gui)
            {
                while (GUI.Manager.NativeManager.DoEvents())
                {
                    GUI.Manager.Update();
                }

                GUI.Manager.Terminate();
                Process.MaterialEditor.Terminate();
            }

            Core.Dispose();
        }
Ejemplo n.º 22
0
        protected override Message LoadInternal(ISqlConnectionInfo connection, int id)
        {
            IDatabase database = connection.Database;

            if (database == null)
            {
                throw new ArgumentNullException("database", "Error initializing database connection.");
            }
            string sqlCmdText = string.Empty;

            try
            {
                sqlCmdText = "SELECT " +
                             MessageTable.GetColumnNames("[m]") +
                             (this.Depth > 0 ? "," + ServiceTable.GetColumnNames("[m_s]") : string.Empty) +
                             (this.Depth > 1 ? "," + ApplicationTable.GetColumnNames("[m_s_a]") : string.Empty) +
                             (this.Depth > 1 ? "," + ProductTable.GetColumnNames("[m_s_p]") : string.Empty) +
                             (this.Depth > 1 ? "," + MerchantTable.GetColumnNames("[m_s_m]") : string.Empty) +
                             (this.Depth > 1 ? "," + ServiceTypeTable.GetColumnNames("[m_s_st]") : string.Empty) +
                             (this.Depth > 1 ? "," + UserSessionTypeTable.GetColumnNames("[m_s_ust]") : string.Empty) +
                             (this.Depth > 1 ? "," + CountryTable.GetColumnNames("[m_s_c]") : string.Empty) +
                             (this.Depth > 1 ? "," + LanguageTable.GetColumnNames("[m_s_l]") : string.Empty) +
                             (this.Depth > 1 ? "," + ServiceConfigurationTable.GetColumnNames("[m_s_sc]") : string.Empty) +
                             (this.Depth > 1 ? "," + TemplateTable.GetColumnNames("[m_s_t]") : string.Empty) +
                             (this.Depth > 0 ? "," + CustomerTable.GetColumnNames("[m_c]") : string.Empty) +
                             (this.Depth > 1 ? "," + UserTable.GetColumnNames("[m_c_u]") : string.Empty) +
                             (this.Depth > 1 ? "," + ServiceTable.GetColumnNames("[m_c_s]") : string.Empty) +
                             (this.Depth > 1 ? "," + CountryTable.GetColumnNames("[m_c_c]") : string.Empty) +
                             (this.Depth > 1 ? "," + LanguageTable.GetColumnNames("[m_c_l]") : string.Empty) +
                             (this.Depth > 1 ? "," + MobileOperatorTable.GetColumnNames("[m_c_mo]") : string.Empty) +
                             (this.Depth > 0 ? "," + MobileOperatorTable.GetColumnNames("[m_mo]") : string.Empty) +
                             (this.Depth > 1 ? "," + CountryTable.GetColumnNames("[m_mo_c]") : string.Empty) +
                             " FROM [stats].[Message] AS [m] ";
                if (this.Depth > 0)
                {
                    sqlCmdText += "INNER  JOIN [core].[Service] AS [m_s] ON [m].[ServiceID] = [m_s].[ServiceID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Application] AS [m_s_a] ON [m_s].[ApplicationID] = [m_s_a].[ApplicationID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Product] AS [m_s_p] ON [m_s].[ProductID] = [m_s_p].[ProductID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Merchant] AS [m_s_m] ON [m_s].[MerchantID] = [m_s_m].[MerchantID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[ServiceType] AS [m_s_st] ON [m_s].[ServiceTypeID] = [m_s_st].[ServiceTypeID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[UserSessionType] AS [m_s_ust] ON [m_s].[UserSessionTypeID] = [m_s_ust].[UserSessionTypeID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Country] AS [m_s_c] ON [m_s].[FallbackCountryID] = [m_s_c].[CountryID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Language] AS [m_s_l] ON [m_s].[FallbackLanguageID] = [m_s_l].[LanguageID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[ServiceConfiguration] AS [m_s_sc] ON [m_s].[ServiceConfigurationID] = [m_s_sc].[ServiceConfigurationID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "INNER  JOIN [core].[Template] AS [m_s_t] ON [m_s].[TemplateID] = [m_s_t].[TemplateID] ";
                }
                if (this.Depth > 0)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Customer] AS [m_c] ON [m].[CustomerID] = [m_c].[CustomerID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[User] AS [m_c_u] ON [m_c].[UserID] = [m_c_u].[UserID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Service] AS [m_c_s] ON [m_c].[ServiceID] = [m_c_s].[ServiceID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Country] AS [m_c_c] ON [m_c].[CountryID] = [m_c_c].[CountryID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Language] AS [m_c_l] ON [m_c].[LanguageID] = [m_c_l].[LanguageID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[MobileOperator] AS [m_c_mo] ON [m_c].[MobileOperatorID] = [m_c_mo].[MobileOperatorID] ";
                }
                if (this.Depth > 0)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[MobileOperator] AS [m_mo] ON [m].[MobileOperatorID] = [m_mo].[MobileOperatorID] ";
                }
                if (this.Depth > 1)
                {
                    sqlCmdText += "LEFT OUTER  JOIN [core].[Country] AS [m_mo_c] ON [m_mo].[CountryID] = [m_mo_c].[CountryID] ";
                }
                sqlCmdText += "WHERE [m].[MessageID] = @MessageID;";

                SqlCommand sqlCmd = database.Add(sqlCmdText) as SqlCommand;
                sqlCmd.Parameters.AddWithValue("@MessageID", id);
                SqlDataReader sqlReader = database.Add(sqlCmd) as SqlDataReader;

                if (!sqlReader.HasRows || !sqlReader.Read())
                {
                    IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("m", "loadinternal", "notfound"), "Message could not be loaded by id as it was not found.", sqlCmdText, this, connection, id);
                    if (this.Logger.IsWarnEnabled)
                    {
                        this.Logger.Warn(builder.ToString());
                    }
                    sqlReader.Close();
                    return(null);
                }

                SqlQuery query = new SqlQuery(sqlReader);

                MessageTable              mTable       = new MessageTable(query);
                ServiceTable              m_sTable     = (this.Depth > 0) ? new ServiceTable(query) : null;
                ApplicationTable          m_s_aTable   = (this.Depth > 1) ? new ApplicationTable(query) : null;
                ProductTable              m_s_pTable   = (this.Depth > 1) ? new ProductTable(query) : null;
                MerchantTable             m_s_mTable   = (this.Depth > 1) ? new MerchantTable(query) : null;
                ServiceTypeTable          m_s_stTable  = (this.Depth > 1) ? new ServiceTypeTable(query) : null;
                UserSessionTypeTable      m_s_ustTable = (this.Depth > 1) ? new UserSessionTypeTable(query) : null;
                CountryTable              m_s_cTable   = (this.Depth > 1) ? new CountryTable(query) : null;
                LanguageTable             m_s_lTable   = (this.Depth > 1) ? new LanguageTable(query) : null;
                ServiceConfigurationTable m_s_scTable  = (this.Depth > 1) ? new ServiceConfigurationTable(query) : null;
                TemplateTable             m_s_tTable   = (this.Depth > 1) ? new TemplateTable(query) : null;
                CustomerTable             m_cTable     = (this.Depth > 0) ? new CustomerTable(query) : null;
                UserTable           m_c_uTable         = (this.Depth > 1) ? new UserTable(query) : null;
                ServiceTable        m_c_sTable         = (this.Depth > 1) ? new ServiceTable(query) : null;
                CountryTable        m_c_cTable         = (this.Depth > 1) ? new CountryTable(query) : null;
                LanguageTable       m_c_lTable         = (this.Depth > 1) ? new LanguageTable(query) : null;
                MobileOperatorTable m_c_moTable        = (this.Depth > 1) ? new MobileOperatorTable(query) : null;
                MobileOperatorTable m_moTable          = (this.Depth > 0) ? new MobileOperatorTable(query) : null;
                CountryTable        m_mo_cTable        = (this.Depth > 1) ? new CountryTable(query) : null;


                Application          m_s_aObject   = (this.Depth > 1) ? m_s_aTable.CreateInstance() : null;
                Product              m_s_pObject   = (this.Depth > 1) ? m_s_pTable.CreateInstance() : null;
                Merchant             m_s_mObject   = (this.Depth > 1) ? m_s_mTable.CreateInstance() : null;
                ServiceType          m_s_stObject  = (this.Depth > 1) ? m_s_stTable.CreateInstance() : null;
                UserSessionType      m_s_ustObject = (this.Depth > 1) ? m_s_ustTable.CreateInstance() : null;
                Country              m_s_cObject   = (this.Depth > 1) ? m_s_cTable.CreateInstance() : null;
                Language             m_s_lObject   = (this.Depth > 1) ? m_s_lTable.CreateInstance() : null;
                ServiceConfiguration m_s_scObject  = (this.Depth > 1) ? m_s_scTable.CreateInstance() : null;
                Template             m_s_tObject   = (this.Depth > 1) ? m_s_tTable.CreateInstance() : null;
                Service              m_sObject     = (this.Depth > 0) ? m_sTable.CreateInstance(m_s_aObject, m_s_pObject, m_s_mObject, m_s_stObject, m_s_ustObject, m_s_cObject, m_s_lObject, m_s_scObject, m_s_tObject) : null;
                User           m_c_uObject         = (this.Depth > 1) ? m_c_uTable.CreateInstance() : null;
                Service        m_c_sObject         = (this.Depth > 1) ? m_c_sTable.CreateInstance() : null;
                Country        m_c_cObject         = (this.Depth > 1) ? m_c_cTable.CreateInstance() : null;
                Language       m_c_lObject         = (this.Depth > 1) ? m_c_lTable.CreateInstance() : null;
                MobileOperator m_c_moObject        = (this.Depth > 1) ? m_c_moTable.CreateInstance() : null;
                Customer       m_cObject           = (this.Depth > 0) ? m_cTable.CreateInstance(m_c_uObject, m_c_sObject, m_c_cObject, m_c_lObject, m_c_moObject) : null;
                Country        m_mo_cObject        = (this.Depth > 1) ? m_mo_cTable.CreateInstance() : null;
                MobileOperator m_moObject          = (this.Depth > 0) ? m_moTable.CreateInstance(m_mo_cObject) : null;
                Message        mObject             = mTable.CreateInstance(m_sObject, m_cObject, m_moObject);
                sqlReader.Close();

                return(mObject);
            }
            catch (Exception ex)
            {
                database.HandleException(ex);
                IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("m", "loadinternal", "exception"), "Message could not be loaded by id. See exception for details.", sqlCmdText, ex, this, connection, id);
                if (this.Logger.IsErrorEnabled)
                {
                    this.Logger.Error(builder.ToString(), ex);
                }
                throw new DataOperationException(DataOperation.Load, "Message", "Exception while loading Message object from database. See inner exception for details.", ex);
            }
        }