예제 #1
0
        public GuiSchema AddFromFile(string schemaFilePath)
        {
            // check if the schema already exists.
            var existingSchema = (from schema in this.GuiSchemas
                                  where schema.SchemaFilePath == schemaFilePath
                                  select schema).FirstOrDefault();

            if (existingSchema != null)
            {
                return(existingSchema);
            }

            CommandLineGuiConfig toolConfig = ReadToolSchema(schemaFilePath);

            //var existingSchema = (from schema in GuiSchemas
            //                      where schema.SchemaFilePath.ToUpper() == schemaFilePath.ToUpper()
            //                      select schema).FirstOrDefault();

            //if (existingSchema != null)
            //{
            //    var newExecs = toolConfig.Executables.Except(existingSchema.ToolConfig.Executables);
            //    var existingExecs = toolConfig.Executables.Intersect(existingSchema.ToolConfig.Executables);

            //    foreach (var exec in existingExecs)
            //    {
            //        var existingExec = existingSchema.FindExecutable(exec.Name);
            //        var newGroups = exec.Gui.BindingGroupsAndBindings.Except(existingExec.Gui.BindingGroupsAndBindings);

            //        var bindingList = new List<object>(existingExec.Gui.BindingGroupsAndBindings);
            //        bindingList.AddRange(newGroups);

            //        existingExec.Gui.BindingGroupsAndBindings = bindingList;
            //    }

            //    existingSchema.ToolConfig.Executables.AddRange(newExecs);

            //    return existingSchema;
            //}
            //else
            {
                var guiSchema = new GuiSchema();
                guiSchema.SchemaFilePath = schemaFilePath;
                guiSchema.ToolConfig     = toolConfig;

                GuiSchemas.Add(guiSchema);

                return(guiSchema);
            }
        }
예제 #2
0
 public ToolInfo(GuiSchema schema, Executable tool)
     : this(tool)
 {
     GuiSchema = schema;
 }