private static void RunInitializable(IEnumerable<InitializationInfo> list, InitializationInfo init, bool value)
        {
            Contract.Requires(list != null);
            Contract.Requires(init != null);

            // Prevent duplicate initialization/teardown.
            if (init.Initialized == value)
                return;

            var attr = init.Attribute;
            var type = init.Method.DeclaringType;
            var depType = attr.Dependency;

            if (value && depType != null)
            {
                var dep = list.FirstOrDefault(x => x.Method.DeclaringType == depType);

                if (dep != null)
                    if (!dep.Initialized)
                        RunInitializable(list, dep, true);
            }

            if (!value)
            {
                var dep = list.FirstOrDefault(x => x.Attribute.Dependency == type);

                if (dep != null)
                    if (dep.Initialized)
                        RunInitializable(list, dep, false);
            }

            var initType = value ? "initialization" : "teardown";

            try
            {
                init.Method.Invoke(null, new object[] { value });
                init.Initialized = value;

                _log.Info("Completed {0} of {1} successfully.", initType, type.Name);
            }
            catch (TargetInvocationException e)
            {
                var ex = e.InnerException;

                _log.Error("Error in {0} of {1}:", initType, init.Attribute.Name);
                _log.Error("{0}", ex.Message);
                _log.Error("{0}", ex.StackTrace);
            }
        }
Beispiel #2
0
        private static void AddCache <T>(string id, T[] objs) where T : ICacheable, new()
        {
            try
            {
                if (CacheService == null)
                {
                    return;
                }

                if (string.IsNullOrEmpty(id))
                {
                    return;
                }

                ArrayCache <T> arrayCache = new ArrayCache <T>();

                arrayCache.Id      = id;
                arrayCache.Objects = objs;
                arrayCache.Version = DateTime.Now.Ticks;

                CacheService.Set(arrayCache);
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
        }
Beispiel #3
0
        private void OutputList()
        {
            try
            {
                string condition = CreateCondition();

                QueryInDTO inDto = new QueryInDTO();
                inDto.PageSize  = 99;
                inDto.PageIndex = 1;
                inDto.Condition = condition;

                QueryOutDTO outDto = QueryService.GetNewsList(inDto);
                if (outDto.IsSucceed)
                {
                    ltBody.Text = outDto.Body;
                    ltCnt.Text  = outDto.RecordCount.ToString();
                }
                else
                {
                    ltBody.Text = outDto.ErrorMsg;
                }
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
        }
Beispiel #4
0
        public static string GetOneId <T>(params object[] args)
        {
            //{0}时间
            DateTime dt = DateTime.Now;
            //{1}当天唯一时间戳
            Tuple <string, string> stamp = GetStamp(dt);

            string idFormat;
            bool   isGetted = IdFormat.TryGetValue(typeof(T).FullName, out idFormat);

            if (isGetted)
            {
                Queue queue = new Queue();
                queue.Enqueue(dt);
                queue.Enqueue(stamp.Item1);
                queue.Enqueue(stamp.Item2);
                queue.Enqueue(AppService.AppId);
                if (args != null)
                {
                    foreach (object o in args)
                    {
                        queue.Enqueue(o);
                    }
                }
                return(string.Format(idFormat, queue.ToArray()));
            }

            LogProxy.Error(string.Format(GETONEIDIDFORMATSTRINGISNULL, typeof(T).FullName), true);

            return(string.Empty);
        }
        private static void AutoCreateTable()
        {
            try
            {
                XElement root = null;
                if (File.Exists(TableCreatedDirectory))
                {
                    root = XElement.Load(TableCreatedDirectory);
                }
                //IEnumerable<XElement> assemblies = root.Elements("Assembly");

                string assemblyPath = Tools.GetAssemblyPath();

                Assembly assembly;
                foreach (string assemblyName in Assemblies.Keys)
                {
                    assembly = Assembly.LoadFrom(assemblyPath + assemblyName + ".dll");
                    Type[] types = assembly.GetTypes();
                    CreateTable(types, root);
                }
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
        }
Beispiel #6
0
        public static DeleteUserOutDTO DeleteUser(DeleteUserInDTO inDto)
        {
            DeleteUserOutDTO outDto = new DeleteUserOutDTO();

            try
            {
                if (inDto == null || string.IsNullOrEmpty(inDto.Id))
                {
                    outDto.ErrorMsg = "参数错误";
                    return(outDto);
                }

                User user = UserService.GetUser(inDto.Id, LoadType.DataBaseDirect);
                if (user == null)
                {
                    outDto.ErrorMsg = "用户不存在";
                    return(outDto);
                }

                user.IsDeleted = true;

                string    remark    = "删除用户";
                SystemLog systemLog = LogService.CreateSystemLog(SystemLogType.DeleteUser, typeof(User), user.Id, remark);

                PersisterService.SaveObject(new SRO[] { user, systemLog });
                outDto.IsSucceed = true;
            }
            catch (Exception ex)
            {
                outDto.ErrorMsg = ex.Message;
                LogProxy.Error(ex, false);
            }

            return(outDto);
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                foreach (Gender item in Enum.GetValues(typeof(Gender)))
                {
                    drpGender.Items.Add(new ListItem(item.ToString(), ((int)item).ToString()));
                }

                GetUserInDTO inDto = new GetUserInDTO();
                inDto.Id = Request.QueryString["id"];

                var outDto = UserService.GetUser(inDto);
                if (!outDto.IsSucceed)
                {
                    LogProxy.Error(outDto.ErrorMsg);
                    Response.Redirect("/index.aspx");
                }

                txtName.Text             = outDto.Name;
                drpGender.SelectedValue  = ((int)outDto.Gender).ToString();
                txtMobile.Text           = outDto.Mobile;
                txtAvailableBalance.Text = outDto.AvailableBalance.ToString();
            }
        }
Beispiel #8
0
        private static Dictionary <string, string> LoadStorageContexts(IEnumerable <XElement> storageContextList)
        {
            Dictionary <string, string> storageContexts = new Dictionary <string, string>();

            string name;

            foreach (XElement el in storageContextList)
            {
                try
                {
                    name = el.Attribute("name").Value;
                    if (string.IsNullOrEmpty(name))
                    {
                        LogProxy.Warn(ALIASISNULL);
                        continue;
                    }

                    storageContexts[name] = el.Value;
                }
                catch (Exception ex)
                {
                    LogProxy.Error(ex, false);
                }
            }
            return(storageContexts);
        }
        public static void SaveObject(SRO obj)
        {
            if (obj == null)
            {
                LogProxy.Warn(OBJECTISNULL);
                return;
            }

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    SaveSingleObject(obj);

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                obj.Reset();

                LogProxy.Error(ex, true);
            }

            obj.AfterSave();
        }
Beispiel #10
0
        private static void AutoCreateTable()
        {
            try
            {
                XElement root = null;
                if (File.Exists(TableCreatedDirectory))
                {
                    root = XElement.Load(TableCreatedDirectory);
                }
                else
                {
                    root = new XElement("Assemblies");
                    root.Save(TableCreatedDirectory);
                }

                string assemblyPath = Tools.GetAssemblyPath();
                var    name         = Assemblies.Select <AssemblyConfig, string>(x => x.Name);

                Assembly assembly;
                foreach (string assemblyName in name)
                {
                    assembly = Assembly.LoadFrom(assemblyPath + assemblyName + ".dll");
                    Type[] types = assembly.GetTypes();
                    CreateTable(types, root);
                }
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
        }
Beispiel #11
0
        private static T[] LoadCacheObjects <T>(string id) where T : ICacheable
        {
            try
            {
                if (CacheService == null)
                {
                    return(null);
                }
                if (string.IsNullOrEmpty(id))
                {
                    return(null);
                }

                ArrayCache <T> arrayCache = CacheService.Get <ArrayCache <T> >(id) as ArrayCache <T>;
                if (arrayCache == null)
                {
                    return(null);
                }
                return(arrayCache.Objects);
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
                return(null);
            }
        }
Beispiel #12
0
        public SynGetted Get(long lastIndex)
        {
            SynGetted getted = new SynGetted();

            getted.Index = lastIndex;

            LockDicObj.EnterReadLock();

            try
            {
                if (Data.Count != 0)
                {
                    getted.Index   = Data.Keys.Max();
                    getted.SynData = (from d in Data where d.Key > lastIndex select d.Value.SynData).ToArray();
                }
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
            finally
            {
                LockDicObj.ExitReadLock();
            }

            return(getted);
        }
Beispiel #13
0
        public static ReadingNewsOutDTO ReadingNews(DeleteNewsInDTO inDto)
        {
            ReadingNewsOutDTO outDto = new ReadingNewsOutDTO();

            try
            {
                if (inDto == null || string.IsNullOrEmpty(inDto.Id))
                {
                    outDto.ErrorMsg = "参数错误";
                    return(outDto);
                }

                News news = NewsService.GetNews(inDto.Id, LoadType.DataBaseDirect);
                if (news == null)
                {
                    outDto.ErrorMsg = "新闻不存在";
                    return(outDto);
                }

                news.ReadingQuantity++;

                PersisterService.SaveObject(news);
                outDto.IsSucceed       = true;
                outDto.ReadingQuantity = news.ReadingQuantity;
            }
            catch (Exception ex)
            {
                outDto.ErrorMsg = ex.Message;
                LogProxy.Error(ex, false);
            }

            return(outDto);
        }
Beispiel #14
0
        private static async void RunTask(int count)
        {
            IList <Task> tasks = new List <Task>();

            for (int i = 0; i < count; i++)
            {
                var task = Task.Run(() =>
                {
                    for (int index = 0; index < 100; index++)
                    {
                        LogProxy.Error(string.Format("{0}_{1}", "Exception : ", index), "Snake.DemoConsole", new Random().Next(1, 5), new List <string>()
                        {
                            "Block", "Red"
                        });
                        LogProxy.Debug(string.Format("{0}_{1}", "Debug : ", index), "Snake.DemoConsole", tags: new List <string>()
                        {
                            "Blue", "Red"
                        });
                        Console.WriteLine("Log{0} published", index);
                    }
                });
                tasks.Add(task);
            }
            await Task.WhenAll(tasks.ToArray());

            Console.WriteLine("Completed...");
        }
Beispiel #15
0
        private static void LoadSingleTypeCacheConfig(IEnumerable <XElement> types)
        {
            SingleTypeCacheConfig config;

            foreach (XElement el in types)
            {
                try
                {
                    string name = el.Attribute("name").Value;
                    if (string.IsNullOrEmpty(name))
                    {
                        LogProxy.Warn(CACHETYPENAMEISNULL);
                        continue;
                    }

                    bool isFix = false;
                    if (el.Attribute("isfix") != null)
                    {
                        bool.TryParse(el.Attribute("isfix").Value.Trim(), out isFix);

                        if (isFix)
                        {
                            config = new SingleTypeCacheConfig(name, true, 0, 0);
                            MyCacheConfig[name] = config;

                            continue;
                        }
                    }

                    int second = 0;
                    if (el.Attribute("second") != null)
                    {
                        int.TryParse(el.Attribute("second").Value.Trim(), out second);

                        if (second < 0)
                        {
                            second = 0;
                        }
                    }

                    int size = 0;
                    if (el.Attribute("size") != null)
                    {
                        int.TryParse(el.Attribute("size").Value.Trim(), out size);

                        if (size < 0)
                        {
                            size = 0;
                        }
                    }

                    config = new SingleTypeCacheConfig(name, false, second, size);
                    MyCacheConfig[name] = config;
                }
                catch (Exception ex)
                {
                    LogProxy.Error(ex, false);
                }
            }
        }
Beispiel #16
0
        private static void LoadSynClientConfig(IEnumerable <XElement> excludedTypes, IEnumerable <XElement> synTypes)
        {
            SynClientConfig config;

            foreach (XElement el in excludedTypes)
            {
                try
                {
                    string name = el.Attribute("name").Value;
                    if (string.IsNullOrEmpty(name))
                    {
                        LogProxy.Warn(SYNCLIENTTYPENAMEISNULL);
                        continue;
                    }

                    if (MySynClientConfig.ContainsKey(name))
                    {
                        continue;
                    }

                    config = new SynClientConfig(name, true, false);
                    MySynClientConfig[name] = config;
                }
                catch (Exception ex)
                {
                    LogProxy.Error(ex, false);
                }
            }

            foreach (XElement el in synTypes)
            {
                try
                {
                    string name = el.Attribute("name").Value;
                    if (string.IsNullOrEmpty(name))
                    {
                        LogProxy.Warn(SYNCLIENTTYPENAMEISNULL);
                        continue;
                    }

                    if (MySynClientConfig.ContainsKey(name))
                    {
                        continue;
                    }

                    bool isLazy = false;
                    if (el.Attribute("islazy") != null)
                    {
                        bool.TryParse(el.Attribute("islazy").Value.Trim(), out isLazy);
                    }

                    config = new SynClientConfig(name, false, isLazy);
                    MySynClientConfig[name] = config;
                }
                catch (Exception ex)
                {
                    LogProxy.Error(ex, false);
                }
            }
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                foreach (NewsType item in Enum.GetValues(typeof(NewsType)))
                {
                    drpType.Items.Add(new ListItem(item.ToString(), ((int)item).ToString()));
                }

                GetNewsInDTO inDto = new GetNewsInDTO();
                inDto.Id = Request.QueryString["id"];

                var outDto = NewsService.GetNews(inDto);
                if (!outDto.IsSucceed)
                {
                    LogProxy.Error(outDto.ErrorMsg);
                    Response.Redirect("/index.aspx");
                }

                drpType.SelectedValue = ((int)outDto.Type).ToString();
                txtTitle.Text         = outDto.Title;
                txtAuthor.Text        = outDto.Author;
                txtContext.Text       = outDto.Context;
            }
        }
Beispiel #18
0
        internal static void SROLogging(SRO[] objs)
        {
            try
            {
                List <SRO> list = new List <SRO>();
                SROLog     log;
                foreach (SRO obj in objs)
                {
                    if (obj == null || obj.SaveMode == SROSaveMode.Init || obj.SaveMode == SROSaveMode.NoChange ||
                        !(obj is INeedFullLogging))
                    {
                        continue;
                    }

                    log            = new SROLog();
                    log.ObjectId   = obj.Id;
                    log.ObjectType = obj.GetType().FullName;
                    log.ObjectJson = JsonConvert.SerializeObject(obj);
                    log.HostName   = Tools.GetHostName();
                    list.Add(log);
                }

                if (list.Count > 0)
                {
                    PersisterService.SaveObject(list.ToArray());
                }
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
        }
Beispiel #19
0
        private static void PostCallbackThreadMethod(object obj)
        {
            ISynData[] objs = obj as ISynData[];

            if (objs == null || objs.Length == 0)
            {
                return;
            }

            int cnt      = 0;
            int interval = PostTryInterval;

L:
            try
            {
                SynServerService.Add(objs);
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false, string.Format(POSTFAIL, objs.Length));
                if (cnt < PostTrys)
                {
                    Thread.Sleep(interval);
                    cnt++;
                    interval *= PostTryMultiple;
                    goto L;
                }
            }
        }
Beispiel #20
0
        internal void Bestrow()
        {
            if (OriginalValue != null && OriginalValue.Count > 0)
            {
                return;
            }

            try
            {
                IMyPropertyInfo[] myPropertys = PropertyInfoProxy.GetProperties(this.GetType());
                foreach (IMyPropertyInfo property in myPropertys)
                {
                    if (property.IsLoad == false && property.IsSave == false)
                    {//判断是否加载
                        continue;
                    }
                    object value = property.GetValue(this);
                    OriginalValue[property.Name] = value;
                }
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
        }
Beispiel #21
0
        public void Add(ISynData[] data)
        {
            if (data == null || data.Length == 0)
            {
                return;
            }

            if (LockDicObj.TryEnterWriteLock(WriteLockTimeout))
            {
                try
                {
                    foreach (ISynData d in data)
                    {
                        if (d == null)
                        {
                            continue;
                        }
                        Index++;
                        Data.Add(Index, new MySynData(d, DateTime.Now));
                    }
                }
                catch (Exception ex)
                {
                    LogProxy.Error(ex, true);
                }
                finally
                {
                    LockDicObj.ExitWriteLock();
                }
            }
        }
Beispiel #22
0
        protected void UpdatePosition()
        {
            if (CurrentLocation.Value.HasValue && Director.TryGetEntity(CurrentLocation.Value.Value, out var currentLocationEntity))
            {
                CurrentLocationEntity = currentLocationEntity;

                var nodeBehaviour = CurrentLocationEntity.EntityBehaviour as NodeBehaviour;
                if (nodeBehaviour == null)
                {
                    LogProxy.Error($"EntityBehaviour for entity {Entity.Id} is not NodeBehaviour");
                }
                if (transform.parent != CurrentLocationEntity.GameObject)
                {
                    transform.SetParent(CurrentLocationEntity.GameObject.transform, true);
                }
                if (nodeBehaviour != null)
                {
                    var visitorVectors = nodeBehaviour.GetVisitorPosition(VisitorPosition.Position);
                    _rectTransform.anchoredPosition = new Vector3(visitorVectors.Position.x, visitorVectors.Position.y, transform.position.z);
                    _rectTransform.eulerAngles      = new Vector3(0, 0, visitorVectors.Rotation.z);
                }
            }
            else
            {
                LogProxy.Error($"Failed to load actor component(s) for UpdatePosition on entity {Entity.Id}");
            }
        }
Beispiel #23
0
        internal void Reset()
        {
            if (OriginalValue == null || OriginalValue.Count == 0)
            {
                return;
            }

            try
            {
                IMyPropertyInfo[] myPropertys = PropertyInfoProxy.GetProperties(this.GetType());
                foreach (IMyPropertyInfo property in myPropertys)
                {
                    if (property.IsLoad == false)
                    {//判断是否加载
                        continue;
                    }

                    object value = OriginalValue.ContainsKey(property.Name) ? OriginalValue[property.Name] : null;

                    property.SetValue(this, value);
                }
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
        }
Beispiel #24
0
        private static void Clear()
        {
            LogProxy.InfoFormat(BEGINCLEAR, Data.Count);

            DateTime clearTime = DateTime.Now.AddMinutes(-TimeLimit);

            if (LockDicObj.TryEnterWriteLock(WriteLockTimeout))
            {
                try
                {
                    var keys = (from o in Data
                                where o.Value.SynTime < clearTime
                                select o.Key).ToArray();

                    foreach (var key in keys)
                    {
                        Data.Remove(key);
                    }
                }
                catch (Exception ex)
                {
                    LogProxy.Error(ex, false);
                }
                finally
                {
                    LockDicObj.ExitWriteLock();
                }
            }

            LogProxy.InfoFormat(ENDCLEAR, Data.Count);
        }
Beispiel #25
0
        internal static bool Init()
        {
            if (!MappingService.IsInitialized)
            {
                return(false);
            }

            try
            {
                if (MappingService.IsAutoCreateTable)
                {
                    Assemblies = MappingService.GetAssemblies();
                    Mappings   = MappingService.GetMappings();

                    AutoCreateTable();

                    Assemblies = null;
                    Mappings   = null;
                }
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }

            return(true);
        }
Beispiel #26
0
        public static DeleteNewsOutDTO DeleteNews(DeleteNewsInDTO inDto)
        {
            DeleteNewsOutDTO outDto = new DeleteNewsOutDTO();

            try
            {
                if (inDto == null || string.IsNullOrEmpty(inDto.Id))
                {
                    outDto.ErrorMsg = "参数错误";
                    return(outDto);
                }

                News news = NewsService.GetNews(inDto.Id, LoadType.DataBaseDirect);
                if (news == null)
                {
                    outDto.ErrorMsg = "新闻不存在";
                    return(outDto);
                }

                news.IsDeleted = true;

                string    remark    = "删除新闻";
                SystemLog systemLog = LogService.CreateSystemLog(SystemLogType.DeleteNews, typeof(News), news.Id, remark);

                PersisterService.SaveObject(new SRO[] { news, systemLog });
                outDto.IsSucceed = true;
            }
            catch (Exception ex)
            {
                outDto.ErrorMsg = ex.Message;
                LogProxy.Error(ex, false);
            }

            return(outDto);
        }
Beispiel #27
0
        public ICacheable Get(Type type, string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(null);
            }

            string fullName = type.FullName;

            if (!IsNeedCached(fullName))
            {
                return(null);
            }

            SingleTypeCacheConfig config = SingleTypeCacheConfig.Get(fullName);

            Dictionary <string, MyCacheObject> caches = GetCaches(fullName);

            config.LockObj.EnterReadLock();

            try
            {
                id = id.ToLower();
                if (!caches.ContainsKey(id))
                {
                    return(null);
                }

                MyCacheObject myCacheObject = caches[id];

                if (!config.IsFix && myCacheObject.OverdueTime < DateTime.Now)
                {
                    return(null);
                }

                myCacheObject.LastGetTime = DateTime.Now;

                try
                {
                    config.Getted(myCacheObject.Obj);
                }
                catch (Exception ex)
                {
                    LogProxy.Error(ex, false);
                }

                return(myCacheObject.Obj);
            }
            catch (Exception ex)
            {
                LogProxy.Error(ex, false);
            }
            finally
            {
                config.LockObj.ExitReadLock();
            }

            return(null);
        }
Beispiel #28
0
 private void ProcessErrorMessage(Message message)
 {
     if (message is ErrorMessage errorMessage)
     {
         LogProxy.Error($"Received server error message: {errorMessage.Message}");
         throw new Exception(errorMessage.Message);
     }
 }
Beispiel #29
0
        /// <summary>
        /// Registers an exception that occurred.
        /// </summary>
        /// <param name="ex">The exception that occurred.</param>
        public static void RegisterException(Exception ex)
        {
            Contract.Requires(ex != null);

            _log.Error("{0} caught:", ex.GetType().Name);
            PrintException(ex);

            var info = new ExceptionInfo(ex);

            _exceptionList.Add(info);

            var evnt = ExceptionOccurred;

            if (evnt != null)
            {
                evnt(null, new ExceptionEventArgs(info));
            }
        }
Beispiel #30
0
        public bool Initialize(SimulationRoot simulationRoot, int playerServerId, List <ITAlertPlayer> players)
        {
            try
            {
                SimulationRoot = simulationRoot;
                Players        = players;

                LogProxy.Warning($"Initializing Director for simulation Instance {InstanceId}");

                //TODO: get rid of this hacky sack
                PlayerCommands.Director = this;

                ItemPanel       = transform.FindComponent <ItemPanel>("Canvas/ItemPanel");
                _queuedMessages = new Queue <TickMessage>();

                ResetDirector();

                // all of this must happen after reset

                // TODO: this should probably be pushed into the ECS
                if (SimulationRoot.ECS.TryGetSystem <ICommandSystem>(out var commandSystem) == false)
                {
                    throw new SimulationIntegrationException("Could not locate command processing system");
                }
                CommandSystem = commandSystem;

                CalculateNetworkOffset();
                CreateInitialEntities();
                SetupPlayers(players, playerServerId);
                // item panel must come after players
                GetComponentsInChildren <Canvas>(true).ToList().ForEach(c => c.gameObject.SetActive(true));
                ItemPanel.Initialize();
                ItemPanel.ExplicitUpdate();


                SimulationRoot.ECS.EntityRegistry.EntityDestroyed += EntityRegistryOnEntityDestroyed;
                if (SimulationRoot.ECS.TryGetSystem(out _endGameSystem) == false)
                {
                    throw new SimulationIntegrationException("Could not locate end game system");
                }

                CultureInfo.CurrentCulture = new CultureInfo("en");
                _updatethread = new Thread(ThreadWorker)
                {
                    IsBackground = true
                };
                _updatethread.Start();
                return(true);
            }
            catch (Exception ex)
            {
                LogProxy.Error($"Error initializing Director: {ex}");
                throw;
            }
        }