Exemple #1
0
        private void UpdateDIObject <T>(T obj, string resourceXmlString, XDocument resourceXml, string name, string formatName, INotifier notifier)
        {
            Type   type    = typeof(T);
            string xml     = (string)type.InvokeMember("GetAsXML", BindingFlags.InvokeMethod | BindingFlags.Public, null, obj, null);
            var    currXml = XDocument.Parse(xml);

            if (!XDocument.DeepEquals(currXml, resourceXml))
            {
                var browser = type.InvokeMember("Browser", BindingFlags.GetProperty | BindingFlags.Public, null, obj, null);
                browser.GetType().InvokeMember("ReadXml", BindingFlags.InvokeMethod | BindingFlags.Public,
                                               null, browser, new object[] { resourceXmlString, 0 });
                int ret = (int)type.InvokeMember("Update", BindingFlags.InvokeMethod | BindingFlags.Public, null, obj, null);
                if (ret != 0)
                {
                    string err;
                    company.GetLastError(out ret, out err);
                    string exceptionErr = String.Format(Messages.ErrorUpdatingDI, name, formatName, err);
                    Logger.Error(exceptionErr);
                    notifier.Do(x => x.OnError(resourceXml.ToString(), ret, err));
                    throw new Exception(exceptionErr);
                }
                else
                {
                    Logger.Info(String.Format(Messages.SuccessUpdatingDI, name, formatName));
                    notifier.Do(x => x.OnSuccess(resourceXml.ToString(), ""));
                }
            }
            else
            {
                Logger.Debug(DebugString.Format(Messages.UpdateDINotNecessary, name));
            }
        }
Exemple #2
0
        private void DispatchForm(MenuEventAttribute menuEvent, ref MenuEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            // Prevent event from running twice.
            if (!pVal.BeforeAction)
            {
                return;
            }

            try
            {
                var obj = ContainerManager.Container.Resolve(menuEvent.OriginalType);
                if (obj is FormBase || obj is DoverFormBase)
                {
                    Logger.Debug(DebugString.Format(Messages.MenuDispatchInfo, pVal.MenuUID, menuEvent.OriginalType));
                    var method = menuEvent.OriginalType.GetMethod("Show");
                    method.Invoke(obj, null);
                }
                else if (menuEvent.OriginalMethod != null &&
                         menuEvent.OriginalMethod.GetGenericArguments().Count() == 0)
                {
                    Logger.Debug(DebugString.Format(Messages.MenuDispatchInfo, pVal.MenuUID, menuEvent.OriginalMethod));
                    menuEvent.OriginalMethod.Invoke(obj, null);
                }
                else
                {
                    Logger.Debug(DebugString.Format(Messages.FileMissing, menuEvent.OriginalType, "?"));
                }
            }
            catch (Exception e)
            {
                Logger.Error(String.Format(Messages.MenuDispatchError, pVal.MenuUID, e.Message), e);
            }
        }
Exemple #3
0
        private void ProcessAddInStartupAttribute(object[] attrs, Type type, MethodInfo method = null)
        {
            List <MenuAttribute> menus = new List <MenuAttribute>();

            foreach (var attr in attrs)
            {
                Logger.Debug(DebugString.Format(Messages.ProcessingAttribute, attr, type));
                if (attr is MenuEventAttribute)
                {
                    ((MenuEventAttribute)attr).OriginalType   = type;
                    ((MenuEventAttribute)attr).OriginalMethod = method;
                    menuHandler.RegisterMenuEvent((MenuEventAttribute)attr);
                }
                else if (attr is MenuAttribute)
                {
                    ((MenuAttribute)attr).OriginalType = type;
                    menus.Add((MenuAttribute)attr);
                }
                else if (attr is AddInAttribute)
                {
                    string initMethod = ((AddInAttribute)attr).InitMethod;
                    if (!string.IsNullOrWhiteSpace(initMethod))
                    {
                        object obj = ContainerManager.Container.Resolve(type);
                        type.InvokeMember(initMethod, BindingFlags.InvokeMethod, null, obj, null);
                    }
                }
            }

            if (menus.Count > 0)
            {
                uiDAO.ProcessMenuAttribute(menus);
            }
        }
Exemple #4
0
        public bool PermissionExists(Attribute.PermissionAttribute permissionAttribute)
        {
            UserPermissionTree userPermissionTree = null;

            Logger.Debug(DebugString.Format(Messages.PermissionStart, permissionAttribute.PermissionID));
            try
            {
                userPermissionTree = (UserPermissionTree)company.GetBusinessObject(BoObjectTypes.oUserPermissionTree);
                if (userPermissionTree.GetByKey(permissionAttribute.PermissionID))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Logger.Error(String.Format(Messages.UpdateOrSavePermissionError, e.Message), e);
                throw e;
            }
            finally
            {
                if (userPermissionTree != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(userPermissionTree);
                }
                Logger.Debug(DebugString.Format(Messages.PermissionEnd, permissionAttribute.PermissionID));
            }
        }
Exemple #5
0
    // Update is called once per frame
    void Update()
    {
        string display = "";

        int i = 0;

        while (i < _debugStrings.Count)
        {
            if (Time.time > _debugStrings[i].time && _debugStrings[i].displayed > 0)
            {
                Debug.Log("Discarding " + _debugStrings[i].text);
                _debugStrings.RemoveAt(i);
            }
            else
            {
                DebugString str = _debugStrings[i];
                display         += str.text + "\n";
                str.displayed   += 1;
                _debugStrings[i] = str;

                //Debug.Log(_debugStrings[i].text);
                i++;
            }
        }

        _text.text = display;
    }
Exemple #6
0
 // Start is called before the first frame update
 void Start()
 {
     DebugString.Log("start");
     //StartCoroutine("PrintMessge");
     DebugString.Log("End");
     //StartCoroutine(CoroutineTimer(1f));
 }
Exemple #7
0
    // Update is called once per frame
    void Update()
    {
        if (m_loadSceneState != null)
        {
            if (m_loadSceneState.isDone)
            {
                m_state            = m_loadState;
                m_loadState        = eSceneState.None;
                m_loadSceneState   = null;
                m_loadingBar.value = 1f;
                m_loadingObj.SetActive(false);
                PopupManager.Instance.ClearPopup();
            }
            else
            {
                // Debug.Log((int)(m_sceneLoadState.progress * 100));
                DebugString.Log((int)(m_loadSceneState.progress * 100));
                m_loadingBar.value = m_loadSceneState.progress;
            }
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (PopupManager.Instance.IsOpenPopup())
            {
                PopupManager.Instance.ClosePopup();
            }
            else
            {
                switch (m_state)
                {
                case eSceneState.Title:
                    PopupManager.Instance.OpenPopupOkCancel("[000000]Notice[-]", "[000000]게임을 종료하시겠습니까?[-]", () =>
                    {
#if UNITY_EDITOR
                        UnityEditor.EditorApplication.isPlaying = false;
#else
                        Application.Quit();
#endif
                    }, null, "예", "아니오");
                    break;

                case eSceneState.Lobby:
                    PopupManager.Instance.OpenPopupOkCancel("[000000]Notice[-]", "[000000]타이틀 화면으로 돌아가시겠습니까?[-]", () =>
                    {
                        LoadSceneAsync(eSceneState.Title);
                    }, null, "예", "아니오");
                    break;

                case eSceneState.Game:
                    PopupManager.Instance.OpenPopupOkCancel("[000000]Notice[-]", "[000000]로비 화면으로 돌아가시겠습니까?[-]", () =>
                    {
                        LoadSceneAsync(eSceneState.Lobby);
                    }, null, "예", "아니오");
                    break;
                }
            }
        }
    }
Exemple #8
0
        //GET: Default
        //                                                                                     INDEX
        public ActionResult Index()
        {
            DebugString model = new DebugString()
            {
                String = ""
            };

            return(View(model));
        }
Exemple #9
0
        internal void UpdateFrameworkAssemblies(string appFolder)
        {
            Logger.Debug(DebugString.Format(Messages.UpdatingAssembly, AssemblyType.Core));

            AssemblyInformation asm = asmDAO.GetCoreAssemblyInformation();

            UpdateFrameworkDBAssembly(ref asm);
            fileUpdate.UpdateAppDataFolder(asm, appFolder);
        }
Exemple #10
0
    private void internalLog(string DisplayText, float displayTime = 0)
    {
        DebugString str = new DebugString();

        str.text      = DisplayText;
        str.time      = Time.time + displayTime;
        str.displayed = 0;
        _debugStrings.Add(str);
    }
Exemple #11
0
        bool IAddinManager.CheckAddinConfiguration(string assemblyName, out string xmlDataTable,
                                                   out string addinName, out string addinNamespace)
        {
            Assembly  assembly  = Assembly.Load(assemblyName);
            XDocument dataTable = CreateDTXML();

            bool isValid = false;

            addinName      = string.Empty;
            addinNamespace = string.Empty;
            string tempComments = string.Empty;

            xmlDataTable = string.Empty;

            var types = (from type in assembly.GetTypes()
                         where type.IsClass
                         select type);

            foreach (var type in types)
            {
                var attrs = type.GetCustomAttributes(true);
                foreach (var attr in attrs)
                {
                    Logger.Debug(DebugString.Format(Messages.ProcessingAttribute, attr, type));
                    if (attr is ResourceBOMAttribute)
                    {
                        CheckAddInAttribute((ResourceBOMAttribute)attr, assembly, dataTable);
                    }
                    else if (attr is PermissionAttribute)
                    {
                        CheckPermissionAttribute((PermissionAttribute)attr, dataTable);
                    }
                    else if (attr is AddInAttribute &&
                             (!string.IsNullOrWhiteSpace(((AddInAttribute)attr).Description) ||
                              !string.IsNullOrWhiteSpace(((AddInAttribute)attr).i18n)) &&
                             !string.IsNullOrWhiteSpace(((AddInAttribute)attr).Name) &&
                             !string.IsNullOrWhiteSpace(((AddInAttribute)attr).Namespace))
                    {
                        isValid        = true;
                        addinName      = ((AddInAttribute)attr).Name;
                        addinNamespace = ((AddInAttribute)attr).Namespace;
                    }
                }
            }

            var rows = dataTable.Element("DataTable").Element("Rows").Elements("Row");

            if (rows != null && rows.Count() > 0)
            {
                xmlDataTable = dataTable.ToString();
            }

            return(isValid);
        }
Exemple #12
0
        private void UpdateOrSaveBOMIfNotExists(IBOM bom, bool Update = true, bool CheckExists = true, INotifier notifier = null)
        {
            object obj    = null;
            string xmlBom = bom.Serialize();

            company.XmlExportType = BoXmlExportTypes.xet_ExportImportMode;
            company.XMLAsString   = true;

            int length = company.GetXMLelementCount(xmlBom);

            for (int i = 0; i < length; i++)
            {
                Logger.Debug(DebugString.Format(Messages.StartUpdateOrSave, bom.BO[i].GetName()));
                Type type = bom.BO[i].GetBOClassType();
                try
                {
                    obj = company.GetBusinessObject(bom.BO[i].GetBOType());
                    if (CheckExists)
                    {
                        var browser = type.InvokeMember("Browser", BindingFlags.GetProperty | BindingFlags.Public, null, obj, null);
                        browser.GetType().InvokeMember("ReadXml", BindingFlags.InvokeMethod | BindingFlags.Public,
                                                       null, browser, new object[] { xmlBom, i });
                        string   xml         = (string)type.InvokeMember("GetAsXML", BindingFlags.InvokeMethod | BindingFlags.Public, null, obj, null);
                        var      resourceXml = XDocument.Parse(xml);
                        object[] keys        = GetKeys(obj, bom.BO[i].GetBOType(), bom.BO[i].GetKey());
                        bool     found       = (bool)type.InvokeMember("GetByKey", BindingFlags.InvokeMethod | BindingFlags.Public, null, obj, keys);
                        if (found)
                        {
                            if (Update)
                            {
                                UpdateDIObject(obj, xml, resourceXml, bom.BO[i].GetName(), bom.BO[i].GetFormattedKey(), notifier);
                            }
                        }
                        else
                        {
                            AddDIObject(obj, xmlBom, i, bom.BO[i].GetName(), bom.BO[i].GetFormattedKey(), notifier);
                        }
                    }
                    else
                    {
                        AddDIObject(obj, xmlBom, i, bom.BO[i].GetName(), bom.BO[i].GetFormattedKey(), notifier);
                    }
                }
                finally
                {
                    if (obj != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                    }
                }
                Logger.Debug(DebugString.Format(Messages.EndUpdateOrSave, bom.BO[i].GetName()));
            }
        }
Exemple #13
0
        private List <int> ListMissingOrOutdatedKeysBOM(IBOM bom, bool update = false)
        {
            object     obj         = null;
            List <int> missingKeys = new List <int>();

            string xmlBom = bom.Serialize();

            company.XmlExportType = BoXmlExportTypes.xet_ExportImportMode;
            company.XMLAsString   = true;

            int length = company.GetXMLelementCount(xmlBom);

            for (int i = 0; i < length; i++)
            {
                Logger.Debug(DebugString.Format(Messages.StartListMissingBOMKeys, bom.BO[i].GetName()));
                Type type = bom.BO[i].GetBOClassType();
                try
                {
                    obj = company.GetBusinessObject(bom.BO[i].GetBOType());
                    var browser = type.InvokeMember("Browser", BindingFlags.GetProperty | BindingFlags.Public, null, obj, null);
                    browser.GetType().InvokeMember("ReadXml", BindingFlags.InvokeMethod | BindingFlags.Public,
                                                   null, browser, new object[] { xmlBom, i });
                    string   xml         = (string)type.InvokeMember("GetAsXML", BindingFlags.InvokeMethod | BindingFlags.Public, null, obj, null);
                    var      resourceXml = XDocument.Parse(xml);
                    object[] keys        = GetKeys(obj, bom.BO[i].GetBOType(), bom.BO[i].GetKey());
                    bool     found       = (bool)type.InvokeMember("GetByKey", BindingFlags.InvokeMethod | BindingFlags.Public, null, obj, keys);
                    if (!found)
                    {
                        missingKeys.Add(i);
                    }
                    else if (update)
                    {
                        xml = (string)type.InvokeMember("GetAsXML", BindingFlags.InvokeMethod | BindingFlags.Public, null, obj, null);
                        var currXml = XDocument.Parse(xml);
                        if (!XDocument.DeepEquals(currXml, resourceXml))
                        {
                            missingKeys.Add(i);
                        }
                    }
                }
                finally
                {
                    if (obj != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                    }
                }
                Logger.Debug(DebugString.Format(Messages.EndListMissingBOMKeys, bom.BO[i].GetName()));
            }
            return(missingKeys);
        }
Exemple #14
0
        public List <T> ExecuteSqlForList <T>(string sql)
        {
            var       retValue = new List <T>();
            Type      type     = typeof(T);
            Recordset rs       = (Recordset)company.GetBusinessObject(BoObjectTypes.BoRecordset);

            Logger.Debug(DebugString.Format(Messages.ExecuteForListCommand, sql));

            try
            {
                rs.DoQuery(sql);
                int fieldsSize = rs.Fields.Count;
                while (!rs.EoF)
                {
                    T obj;
                    if (IsNotCoreType(type))
                    {
                        obj = PrepareObject <T>(rs);
                    }
                    else
                    {
                        if (rs.Fields.Item(0).Value.GetType() != type)
                        {
                            String errMsg = String.Format(
                                Messages.ExecuteForObjectArgument,
                                rs.Fields.Item(0).Value.GetType(), type);
                            Logger.Error(errMsg);
                            throw new Exception(errMsg);
                        }
                        obj = (T)rs.Fields.Item(0).Value;
                    }
                    Logger.Debug(DebugString.Format(Messages.ExecuteForListReturn, obj));
                    retValue.Add(obj);
                    rs.MoveNext();
                }
                return(retValue);
            }
            catch (Exception e)
            {
                Logger.Error(String.Format(Messages.ExecuteForObjectError, e.Message), e);
                throw e;
            }
            finally
            {
                if (rs != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(rs);
                }
            }
        }
Exemple #15
0
 private string MD5Sum(byte[] fileByte)
 {
     using (var md5 = MD5.Create())
     {
         byte[] hash = md5.ComputeHash(fileByte);
         var    sb   = new StringBuilder();
         for (int i = 0; i < hash.Length; i++)
         {
             sb.Append(hash[i].ToString("X2"));
         }
         var md5sum = sb.ToString();
         Logger.Debug(DebugString.Format(Messages.MD5Sum, md5sum));
         return(md5sum);
     }
 }
Exemple #16
0
        virtual public void Initialize()
        {
            Console.WriteLine("Initialize()");

            stopwatch = new Stopwatch();
            stopwatch.Start();
            preSecondTicks = stopwatch.ElapsedTicks;

            graphics = new GraphicsContext();
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Enable(EnableMode.Blend);
            graphics.Enable(EnableMode.DepthTest);
            graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha);

            debugString = new DebugString(graphics);
        }
Exemple #17
0
        public T ExecuteSqlForObject <T>(string sql)
        {
            Type      type = typeof(T);
            Recordset rs   = (Recordset)company.GetBusinessObject(BoObjectTypes.BoRecordset);

            try
            {
                rs.DoQuery(sql);
                int fieldsSize = rs.Fields.Count;
                if (!rs.EoF)
                {
                    if (!IsNotCoreType(type))
                    {
                        object obj = rs.Fields.Item(0).Value;
                        if (obj.GetType() != type)
                        {
                            String errMsg = String.Format(
                                Messages.ExecuteForObjectArgument,
                                obj.GetType(), type);
                            Logger.Error(errMsg);
                            throw new ArgumentException(errMsg);
                        }
                        Logger.Debug(DebugString.Format(Messages.ExecuteForObjectReturn, obj, sql));
                        return((T)obj);
                    }
                    else
                    {
                        var ret = PrepareObject <T>(rs);
                        Logger.Debug(DebugString.Format(Messages.ExecuteForObjectReturn, ret, sql));
                        return(ret);
                    }
                }
                return(default(T));
            }
            catch (Exception e)
            {
                Logger.Error(String.Format(Messages.ExecuteForObjectError, e.Message));
                throw e;
            }
            finally
            {
                if (rs != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(rs);
                }
            }
        }
Exemple #18
0
        internal string GetLocalizedString(string key, Assembly addin = null)
        {
            if (key == null)
            {
                return(string.Empty);
            }

            var index = key.LastIndexOf(".");

            if (index < 0)
            {
                return(key);
            }
            string typeName = key.Substring(0, index);

            index++;
            string propertyName = key.Substring(index).Trim();
            var    assembly     = (addin == null) ?
                                  AppDomain.CurrentDomain.Load((string)AppDomain.CurrentDomain.GetData("assemblyName")) : addin;

            // TODO: cache e resourceCulture.
            var resource = new System.Resources.ResourceManager(typeName, assembly);

            if (resource != null)
            {
                Logger.Debug(DebugString.Format(Messages.GetLocalizedStringFoundResource, key));
            }
            else
            {
                Logger.Debug(DebugString.Format(Messages.GetLocalizedStringNotFoundResource, key));
            }

            try
            {
                string value = resource.GetString(propertyName, System.Threading.Thread.CurrentThread.CurrentUICulture);
                if (string.IsNullOrEmpty(value))
                {
                    return(key);
                }
                return(value);
            }
            catch (Exception)
            {
                return(key);
            }
        }
Exemple #19
0
        internal void RegisterMenuEvent(MenuEventAttribute menuEventAttribute)
        {
            List <MenuEventAttribute> events;

            Logger.Debug(DebugString.Format(Messages.RegisteringMenuEvent, menuEventAttribute.UniqueUID, menuEventAttribute.OriginalType));
            menuEvents.TryGetValue(menuEventAttribute.UniqueUID, out events);
            if (events == null)
            {
                events = new List <MenuEventAttribute>();
                menuEvents.Add(menuEventAttribute.UniqueUID, events);
            }

            if (!events.Contains(menuEventAttribute))
            {
                events.Add(menuEventAttribute);
            }
        }
Exemple #20
0
        internal void PrepareFramework()
        {
            try
            {
                while (reboot)
                {
                    microBoot.coreShutdownEvent.Reset();
                    reboot = false;
                    Logger.Debug(Messages.PreparingFramework);
                    dbConf.PrepareDatabase();

                    if (InsideInception())
                    {
                        return;
                    }

                    string appFolder = CheckAppFolder();
                    Logger.Debug(DebugString.Format(Messages.CreatedAppFolder, appFolder));

                    assemblyLoader.UpdateFrameworkAssemblies(appFolder);
                    assemblyLoader.UpdateAddinsDBAssembly();

                    if (rebootCount == 0)
                    {
                        dispatcher.RegisterEvents();
                    }

                    microBoot.AppFolder = appFolder;
                    microBoot.StartInception();
                    microBoot.Boot();
                    microBoot.coreShutdownEvent.WaitOne();
                    rebootCount++;
                }
                reboot = true; // in case we need to start it again (i.e. unit test).
                ContainerManager.Container.Dispose();
                SAPServiceFactory.LogOff();
            }
            catch (Exception e)
            {
                Logger.Fatal(String.Format(Messages.GeneralError, e.Message), e);
                Environment.Exit(10);
            }
        }
Exemple #21
0
        internal void UpdateAssemblies(AssemblySource assemblyLocation, string appFolder)
        {
            List <AssemblyInformation> asms;

            Logger.Debug(DebugString.Format(Messages.UpdatingAssembly, assemblyLocation));
            if (assemblyLocation == AssemblySource.Core)
            {
                asms = InitializeCoreAssemblies(appFolder);
            }
            else
            {
                asms = InitializeAddInAssemblies(appFolder);
            }

            foreach (var asm in asms)
            {
                UpdateAppDataFolder(asm, appFolder);
            }
        }
Exemple #22
0
        internal void PrepareFramework()
        {
            try
            {
                while (reboot)
                {
                    reboot = false;
                    Logger.Debug(Messages.PreparingFramework);
                    dbConf.PrepareDatabase();

                    if (InsideInception())
                    {
                        return;
                    }

                    string appFolder = CheckAppFolder();
                    Logger.Debug(DebugString.Format(Messages.CreatedAppFolder, appFolder));

                    assemblyLoader.UpdateAssemblies(AssemblySource.Core, appFolder);
                    assemblyLoader.UpdateAssemblies(AssemblySource.AddIn, appFolder);
                    CopyInstallResources(appFolder, Environment.CurrentDirectory);

                    if (rebootCount == 0)
                    {
                        dispatcher.RegisterEvents();
                    }

                    microBoot.AppFolder = appFolder;
                    microBoot.StartInception();
                    microBoot.Boot();
                    System.Windows.Forms.Application.Run();
                    rebootCount++;
                }
                ContainerManager.Container.Dispose();
                SAPServiceFactory.LogOff();
            }
            catch (Exception e)
            {
                Logger.Fatal(String.Format(Messages.GeneralError, e.Message), e);
                Environment.Exit(10);
            }
        }
Exemple #23
0
        internal void ConfigureAddin(AssemblyInformation addin)
        {
            List <ResourceBOMAttribute> resourceAttr = new List <ResourceBOMAttribute>();
            Assembly assembly;

            try
            {
                assembly = Assembly.Load(addin.Name);
            }
            catch (InvalidOperationException e)
            {
                Logger.Error(String.Format(Messages.AddInNotFound, addin), e);
                return;
            }
            ContainerManager.CheckProxy(assembly);

            var types = (from type in assembly.GetTypes()
                         where type.IsClass
                         select type);

            foreach (var type in types)
            {
                var attrs = type.GetCustomAttributes(true);
                foreach (var attr in attrs)
                {
                    Logger.Debug(DebugString.Format(Messages.ProcessingAttribute, attr, type));
                    if (attr is ResourceBOMAttribute)
                    {
                        resourceAttr.Add((ResourceBOMAttribute)attr);
                    }
                    else if (attr is PermissionAttribute)
                    {
                        b1DAO.UpdateOrSavePermissionIfNotExists((PermissionAttribute)attr);
                    }
                }
            }
            resourceAttr.Sort(); // need to order becase we need create tables, than fields and at the end UDOs.
            foreach (var resource in resourceAttr)
            {
                ProcessAddInResourceAttribute(resource, assembly);
            }
        }
Exemple #24
0
    void Start()
    {
        //给委托对象赋值
        handlerDebugString = DebugNameOfChina;
        handlerDebugString("丁小未");
        Debug.Log("................................");

        //给委托对象再加一个事件,叫多路广播
        handlerDebugString += DebugNameOfEnglish;
        handlerDebugString("DingXiaowei");
        Debug.Log("................................");

        //输出中文试试
        handlerDebugString("丁小未");
        Debug.Log("................................");

        //给委托对象减去一个事件
        handlerDebugString -= DebugNameOfChina;
        handlerDebugString("DingXiaowei");
    }
Exemple #25
0
        public PermissionDAOSQLImpl(BusinessOneDAO b1DAO, ILogger Logger)
        {
            this.Logger = Logger;
            this.b1DAO  = b1DAO;
            List <AddInPermission> addInPermission = b1DAO.ExecuteSqlForList <AddInPermission>(
                this.GetSQL("GetModulePermission.sql"));

            foreach (var permission in addInPermission)
            {
                addInHash.Add(permission.AddinCode, permission.Permission);
                Logger.Debug(DebugString.Format(Messages.AddInPermission, permission.AddInName, permission.Permission));
            }
            string currentUser = b1DAO.GetCurrentUser();

            addInPermission = b1DAO.ExecuteSqlForList <AddInPermission>(
                String.Format(this.GetSQL("GetUserPermission.sql"), currentUser)
                );
            foreach (var permission in addInPermission)
            {
                userAddInHash.Add(permission.AddinCode, permission.Permission);
                Logger.Debug(DebugString.Format(Messages.AddInUserPermission, currentUser, permission.AddInName, permission.Permission));
            }
        }
Exemple #26
0
        public void ExecuteStatement(string sql)
        {
            var objRecordSet = (Recordset)company.GetBusinessObject(BoObjectTypes.BoRecordset);

            Logger.Debug(DebugString.Format(Messages.StartExecuteStatement, sql));
            try
            {
                objRecordSet.DoQuery(sql);
            }
            catch (Exception e)
            {
                Logger.Error(String.Format(Messages.ErrorExecuteStatement, sql, e.Message), e);
                throw e;
            }
            finally
            {
                if (objRecordSet != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(objRecordSet);
                }
            }
            Logger.Debug(DebugString.Format(Messages.EndExecuteStatement, sql));
        }
Exemple #27
0
 public override string ToString()
 {
     return(Text == null ? Class.Name : Class.Name + ":" + DebugString.Format(Text));
 }
Exemple #28
0
        public static IWindsorContainer BuildContainer()
        {
            string assemblyName;

            Func <SAPbobsCOM.Company>[] companyFactory = (customCompanyFactory == null)
                ? new Func <SAPbobsCOM.Company>[] { SAPServiceFactory.CompanyFactory } : customCompanyFactory;

            Container = new WindsorContainer();
            Container.Kernel.Resolver.AddSubResolver(new ArrayResolver(Container.Kernel));
            // proxy for forms.
            Container.Register(Component.For <IInterceptor>().ImplementedBy <FormProxy>().Named("formProxy"));
            // proxy for Transactions
            Container.Register(Component.For <IInterceptor>().ImplementedBy <TransactionProxy>().Named("transactionProxy"));
            // forms are Transient.
            Container.Register(Classes.FromThisAssembly().IncludeNonPublicTypes().InNamespace("Dover.Framework.Form")
                               .WithService.DefaultInterfaces().LifestyleTransient());

            // SAP App Facttory.
            Container.Register(Component.For <SAPbouiCOM.Application>().UsingFactoryMethod(SAPServiceFactory.ApplicationFactory));

            // company factory (use default, that initializes DI API from App if none was provided).
            for (int i = 0; i < companyFactory.Length; i++)
            {
                Container.Register(Component.For <SAPbobsCOM.Company>().UsingFactoryMethod(companyFactory[i]).Named("company" + i));
            }
            for (int i = 0; i < companyFactory.Length; i++)
            {
                Container.Register(Component.For <BusinessOneDAO>().ImplementedBy <BusinessOneDAOSQLImpl>()
                                   .DependsOn(Dependency.OnComponent(typeof(SAPbobsCOM.Company), "company" + i)).Named("b1dao" + i));
            }

            string runningFolder = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);

            // AddinManager registration. If I'm an AddIn, get addinManager from AppDomain, so
            // both (addin AppDomain and inception AppDomain) references the same implementation.
            IAddinManager addinManager = (IAddinManager)AppDomain.CurrentDomain.GetData("frameworkManager");

            if (addinManager != null)
            {
                addinManagerSponsor = new Sponsor <IAddinManager>(addinManager);
                Container.Register(Component.For <IAddinManager>().Instance(addinManager).Named("IAddinManager"));
            }

            IAppEventHandler appEventHandler = (IAppEventHandler)AppDomain.CurrentDomain.GetData("appHandler");

            if (appEventHandler != null)
            {
                appEventHandlerSponsor = new Sponsor <IAppEventHandler>(appEventHandler);
                Container.Register(Component.For <IAppEventHandler>().Instance(appEventHandler).Named("IAppEventHandler"));
            }

            // Register this Service as interface, not the underlying class.
            Container.Register(Component.For <ITempAssemblyLoader>().ImplementedBy <TempAssemblyLoader>());
            // DAO registration. Abstract classes, they're singleton.
            Container.Register(Component.For <BusinessOneUIDAO>().ImplementedBy <BusinessOneUIDAOImpl>());
            Container.Register(Component.For <AssemblyDAO>().ImplementedBy <AssemblyDAOImpl>());
            Container.Register(Component.For <PermissionDAO>().ImplementedBy <PermissionDAOSQLImpl>());
            Container.Register(Component.For <LicenseDAO>().ImplementedBy <LicenseDAOImpl>());

            // Core and MicroCore
            Container.Register(Component.For <MicroCore>().LifestyleSingleton());
            Container.Register(Component.For <MicroBoot>().LifestyleSingleton());
            Container.Register(Component.For <Boot>().LifestyleSingleton());

            assemblyName = Assembly.GetEntryAssembly() == null ? (string)AppDomain.CurrentDomain.GetData("assemblyName")
                : Assembly.GetEntryAssembly().GetName().Name;

            if (assemblyName == "Framework")
            {
                #if DEBUG
                CheckProxy(Assembly.Load(assemblyName)); // if passed on debug tests, we do not need this on production.
                #endif
                assemblyName = "Dover";                  // Framework should be threated the same as Dover.
            }

            string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assemblyName + ".config");

            if (!File.Exists(logPath))
            {
                logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DoverTemp.config"); // Temp AppDomain logging.
            }
            Container.AddFacility <LoggingFacility>(f => f.UseLog4Net(logPath));

            Container.Register(Component.For <TransactionProxy>().ImplementedBy <TransactionProxy>());
            Container.Register(Component.For <EventProxy>().ImplementedBy <EventProxy>());
            Container.Register(Component.For <AddinManager, IAddinManager>().Interceptors(typeof(TransactionProxy)));
            Container.Register(Component.For <FormEventHandler, IFormEventHandler>().Interceptors(typeof(EventProxy)));

            // Service registration, they are singleton.
            Container.Register(Classes.FromThisAssembly().IncludeNonPublicTypes().InNamespace("Dover.Framework.Service")
                               .WithServiceAllInterfaces().LifestyleSingleton());

            var logger = Container.Resolve <ILogger>();
            logger.Debug(DebugString.Format(Messages.StartupFolder, runningFolder));
            SAPServiceFactory.Logger = logger;

            var b1dao = Container.Resolve <BusinessOneDAO>();
            SAPAppender.B1DAO = b1dao;

            return(Container);
        }
Exemple #29
0
 private bool CheckSum(string asmHash, string filename)
 {
     Logger.Debug(DebugString.Format(Messages.CheckSum, asmHash, filename));
     byte[] fileByte = File.ReadAllBytes(filename);
     return(MD5Sum(fileByte) == asmHash);
 }
Exemple #30
0
 private JsonException Error(string s, Exception e)
 {
     return(new JsonException(string.Format("The value '{0}' cannot be imported as {1}.", DebugString.Format(s), OutputType.FullName), e));
 }