public void RegisterHandler(BaseResourceHandler handler)
 {
     if (!InternalHandlers.ContainsKey(handler.ResourceKeyword))
     {
         InternalHandlers.Add(handler.ResourceKeyword, handler);
     }
 }
 public static void Inject(BaseResourceHandler resourceInjector)
 {
     resourceInjector.InjectPrefab("ModOptionsPageView", ModOptionsPageView());
     resourceInjector.InjectPrefab("SettingsItemView", SettingsItemView());
     resourceInjector.InjectPrefab("SettingsPropertyGroupView", SettingsPropertyGroupView());
     resourceInjector.InjectPrefab("SettingsPropertyView", SettingsPropertyView());
     resourceInjector.InjectPrefab("SettingsView", SettingsView());
 }
Exemplo n.º 3
0
 public static void Inject(BaseResourceHandler resourceInjector)
 {
     resourceInjector.InjectBrush(ButtonBrushes());
     resourceInjector.InjectBrush(DividerBrushes());
     resourceInjector.InjectBrush(ExpandIndicator());
     resourceInjector.InjectBrush(SettingsBrush());
     resourceInjector.InjectBrush(ResetButtonBrush());
     resourceInjector.InjectBrush(SettingsValueDisplayBrush());
     resourceInjector.InjectBrush(TextBrushes());
 }
 public static void Inject(BaseResourceHandler resourceInjector)
 {
     resourceInjector.InjectWidget(typeof(EditValueTextWidget));
     WidgetInfo.ReLoad();
 }
        // should handle overwrite more reasonably!!!
        public void HandleCase(DBObject theObject,
                               List <DBCaseResource> resourceList,
                               string root, string targetType, string targetID,
                               bool overwrite)
        {
            ResourceInfoList ril         = null;
            string           resListName = string.Format(@"{0}\{1}\{2}\info.xml", root, targetType, targetID);

            if (File.Exists(resListName))
            {
                ril = ResourceInfoList.LoadList(resListName);
            }
            else
            {
                ril = new ResourceInfoList();
            }

            //foreach (BaseResourceHandler h in InternalHandlers.Values)

            for (int i = 0; i < InternalHandlers.Values.Count; i++)
            {
                BaseResourceHandler h = InternalHandlers.Values.ElementAt(i);

                HandleCaseResult hcr = h.HandleCase(theObject, resourceList, root, targetType, targetID, overwrite);
                if (hcr.Succeed == false)
                {
                    System.Console.Out.WriteLine("Fail Warning: " + targetID + " " + hcr.ResultFile);
                    continue;
                }
                ResourceInfo ri   = new ResourceInfo();
                string       file = Path.GetFileName(hcr.ResultFile);
                ri.SourceModifiedDate = hcr.SourceTimestamp;
                ri.TargetModifiedDate = DateTime.Now;
                ri.Key = file;
                foreach (KeyValuePair <string, string> info in hcr.PrivateAdditionalInfo)
                {
                    ResourceAdditionalInfo ral = new ResourceAdditionalInfo();
                    ral.Key   = info.Key;
                    ral.Value = info.Value;
                    ri.AdditionalInfo.Add(ral);
                }
                if (ril.TryGeyInfo(ri.Key) != null)
                {
                    ril.Info.Remove(ril.TryGeyInfo(ri.Key));
                }
                ril.Info.Add(ri);
                foreach (KeyValuePair <string, string> info in hcr.AdditionalInfo)
                {
                    ResourceAdditionalInfo ral = new ResourceAdditionalInfo();
                    ral.Key   = info.Key;
                    ral.Value = info.Value;
                    // avoid adding duplicated info
                    if (ril.TryGeyAdditionalInfo(ral.Key) == null)
                    {
                        ril.AdditionalInfo.Add(ral);
                    }
                }
            }
            ril.Key = targetID;
            ril.SaveList(root, targetType, targetID);
        }