Exemple #1
0
        protected virtual void ReloadOutLinkChache()
        {
            outLinkRawData = new Dictionary <string, object>();

            for (int i = 0; i < Chache.Count; i++)
            {
                if (Chache[i].config_editor_setting == null)
                {
                    continue;
                }

                if (string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkEditor))
                {
                    if (!string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkClass))
                    {
                        Chache[i].config_editor_setting.OutLinkEditor = Chache[i].config_editor_setting.OutLinkClass + "Editor";
                    }
                    else if (!string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkSubClass))
                    {
                        Chache[i].config_editor_setting.OutLinkEditor = Chache[i].config_editor_setting.OutLinkSubClass + "ConfigEditor";
                    }
                    else
                    {
                        Log("Out link info is null ...");
                        continue;
                    }
                }

                if (string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkClass))
                {
                    if (!string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkSubClass))
                    {
                        Chache[i].config_editor_setting.OutLinkClass = Chache[i].config_editor_setting.OutLinkSubClass + "Config";
                    }
                    else
                    {
                        Chache[i].config_editor_setting.OutLinkClass = Chache[i].config_editor_setting.OutLinkEditor.Replace("Editor", "");
                    }
                }

                if (string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkFilePath))
                {
                    if (!string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkSubClass))
                    {
                        Chache[i].config_editor_setting.OutLinkFilePath = Chache[i].config_editor_setting.OutLinkSubClass;
                    }
                    else
                    {
                        Chache[i].config_editor_setting.OutLinkFilePath = Chache[i].config_editor_setting.OutLinkClass.Replace("ConfigEditor", "");
                    }
                }


                //TODO VERSION 2.0 Load Raw Data
                if (!string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkEditor) &&
                    !string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkClass) &&
                    !string.IsNullOrEmpty(Chache[i].config_editor_setting.OutLinkFilePath)
                    )
                {
                    string rawClass = Chache[i].config_editor_setting.OutLinkClass;
                    if (string.IsNullOrEmpty(rawClass))
                    {
                        rawClass = Chache[i].config_editor_setting.OutLinkSubClass + "Config";
                    }
                    Type classType = SmartDataViewer.Utility.GetType(rawClass);
                    if (classType == null)
                    {
                        Log("Can't find calss " + rawClass);
                        continue;
                    }
                    var modelRaw = ConfigBase <IModel> .LoadRawConfig(classType, Chache[i].config_editor_setting.OutLinkFilePath);

                    if (modelRaw != null)
                    {
                        if (!outLinkRawData.ContainsKey(Chache[i].config_editor_setting.OutLinkClass))
                        {
                            outLinkRawData.Add(Chache[i].config_editor_setting.OutLinkClass, modelRaw);
                        }

                        Log(string.Format("Loading OutLink Class [{0}] Data", Chache[i].config_editor_setting.OutLinkClass));
                    }
                }
            }
        }