public static void GenerateMetaTable(Dictionary <string, List <string> > metas, Dictionary <string, int> csl_id, string[] nums) { GlobalGroup_generated = new BindingList <GlobalGroup>(); foreach (var global in nums) { var newGlobalGroup = new GlobalGroup() { IDGlobalGroup = Array.IndexOf(nums, global) + 1 }; string groups = ""; if (metas[global].Count == 0) { groups = csl_id[global].ToString(); } else { foreach (var item in metas[global]) { if (groups == "") { groups = csl_id[item].ToString(); } else { groups = groups + ", " + csl_id[item].ToString(); } } } newGlobalGroup.LocGroups = groups; GlobalGroup_generated.Add(newGlobalGroup); } }
internal static GlobalItemTrack CreateGlobalItemTrack(GlobalGroup directorGroup) { string name = DirectorHelper.getCutsceneItemName(directorGroup.gameObject, GLOBAL_TRACK_LABEL, typeof(GlobalItemTrack)); GameObject globalTrackGO = new GameObject(name, typeof(GlobalItemTrack)); globalTrackGO.transform.parent = directorGroup.transform; return(globalTrackGO.GetComponent <GlobalItemTrack>()); }
public ModelGlobalGroup MapGlobalGroup(GlobalGroup globalGroup) { ModelGlobalGroup mgg = new ModelGlobalGroup(); mgg.Id = globalGroup.Id; mgg.Name = globalGroup.Name; List <MapGroup> mapGroups = new List <MapGroup>(); globalGroup.Groups.ToList().ForEach(h => mapGroups.Add(MappingGroups(h))); mgg.Groups = mapGroups; return(mgg); }
public static async Task LoadExcel(string filename) { ExcelEngine excelEngine = new ExcelEngine(); IApplication application = excelEngine.Excel; OpenFileDialog dlg = new OpenFileDialog(); IWorkbook workbook = application.Workbooks.Open(filename); //Sets workbook version. workbook.Version = ExcelVersion.Excel2016; IWorksheet worksheet = workbook.Worksheets[0]; ProgectData.CrossSystemsLimitation_data = new BindingList <CrossSystemsLimitation>(); ProgectData.UniClassGroup_data = new BindingList <UniClassGroup>(); ProgectData.GlobalGroup_data = new BindingList <GlobalGroup>(); ProgectData.Limitation_functions_data = new BindingList <Limitation_functions>(); ProgectData.GroupsSs = new BindingList <GroupsUC>(); ProgectData.GroupsPr = new BindingList <GroupsUC>(); ProgectData.OntologyGroups = new BindingList <OntologyGroups>(); for (int i = 2; i < worksheet.Rows.Count <IRange>(); i++) { if (worksheet.GetValueRowCol(i, 9) != null && worksheet.GetValueRowCol(i, 9) != "") { CrossSystemsLimitation newLimit = new CrossSystemsLimitation(); newLimit.N = i; newLimit.SsSource = worksheet.GetValueRowCol(i, 1).ToString(); newLimit.PrSource = worksheet.GetValueRowCol(i, 2).ToString(); newLimit.GroupSource = worksheet.GetValueRowCol(i, 3).ToString(); newLimit.SsTarget = worksheet.GetValueRowCol(i, 4).ToString(); newLimit.PrTarget = worksheet.GetValueRowCol(i, 5).ToString(); newLimit.GroupTarget = worksheet.GetValueRowCol(i, 6).ToString(); newLimit.Description = worksheet.GetValueRowCol(i, 7).ToString(); //string descr = ""/*Utils.CreateDescrLimitation(newLimit, ProgectData.uniClassGroups_key, ProgectData.UniSystemTable, ProgectData.UniProductTable)*/; //newLimit.Description = descr; newLimit.PointSource = worksheet.GetValueRowCol(i, 8).ToString(); newLimit.IDLimitation = worksheet.GetValueRowCol(i, 9).ToString(); newLimit.ConnectionWeight = worksheet.GetValueRowCol(i, 10).ToString(); newLimit.StrSource = worksheet.GetValueRowCol(i, 11).ToString(); newLimit.Category = worksheet.GetValueRowCol(i, 12).ToString(); ProgectData.CrossSystemsLimitation_data.Add(newLimit); //colLimitation.Add(newLimit); } else { break; } } ProgectData.UniclassGroupDescription = new Dictionary <int, string>(); worksheet = workbook.Worksheets[1]; for (int i = 2; i <= worksheet.Rows.Count <IRange>(); i++) { try { if (worksheet.GetValueRowCol(i, 1) != null && worksheet.GetValueRowCol(i, 1) != "") { int key = Convert.ToInt32(worksheet.GetValueRowCol(i, 1).ToString()); if (ProgectData.UniclassGroupDescription.ContainsKey(key) == false) { ProgectData.UniclassGroupDescription.Add(key, worksheet.GetValueRowCol(i, 8).ToString()); } if (worksheet.GetValueRowCol(i, 1) != null && worksheet.GetValueRowCol(i, 1) != "") { UniClassGroup newData = new UniClassGroup(); newData.GroupID = Convert.ToInt32(worksheet.GetValueRowCol(i, 1).ToString()); newData.Exclude = worksheet.GetValueRowCol(i, 2).ToString(); newData.SystemsID = worksheet.GetValueRowCol(i, 3).ToString(); newData.ProductID = worksheet.GetValueRowCol(i, 4).ToString(); newData.GroupDescription = Utils.CreateDescrGroups(newData.SystemsID, newData.ProductID); newData.GroupDescription_Note = worksheet.GetValueRowCol(i, 8).ToString(); newData.Function_layer = worksheet.GetValueRowCol(i, 7).ToString(); newData.AnalyticalModel = worksheet.GetValueRowCol(i, 6).ToString(); ProgectData.UniClassGroup_data.Add(newData); } } else { break; } } catch { MessageBox.Show("Ошибка при чтении UniClassGroups"); } } worksheet = workbook.Worksheets[2]; for (int i = 1; i < worksheet.Rows.Count <IRange>(); i++) { if (worksheet.GetValueRowCol(i, 1) != null && worksheet.GetValueRowCol(i, 1) != "") { Limitation_functions newLimitFunc = new Limitation_functions(); newLimitFunc.IDLimitation = worksheet.GetValueRowCol(i, 1).ToString(); newLimitFunc.IDLimitDescription = worksheet.GetValueRowCol(i, 2).ToString(); ProgectData.Limitation_functions_data.Add(newLimitFunc); } } worksheet = workbook.Worksheets[3]; for (int i = 2; i < worksheet.Rows.Count <IRange>(); i++) { var IDGlobalGroup = worksheet.GetValueRowCol(i, 1).ToString(); if (IDGlobalGroup != null && IDGlobalGroup != "") { GlobalGroup newGroup = new GlobalGroup(); newGroup.IDGlobalGroup = Convert.ToInt32(worksheet.GetValueRowCol(i, 1).ToString()); newGroup.SystemID = worksheet.GetValueRowCol(i, 2).ToString(); newGroup.ProductID = worksheet.GetValueRowCol(i, 3).ToString(); newGroup.LocGroups = worksheet.GetValueRowCol(i, 4).ToString(); newGroup.ZCoord = worksheet.GetValueRowCol(i, 5).ToString(); newGroup.GlobalGroupsDescription = worksheet.GetValueRowCol(i, 6).ToString(); ProgectData.GlobalGroup_data.Add(newGroup); } } worksheet = workbook.Worksheets[6]; for (int i = 2; i <= worksheet.Rows.Count <IRange>(); i++) { if (worksheet.GetValueRowCol(i, 1) != null && worksheet.GetValueRowCol(i, 1).ToString() != "") { var uc = new GroupsUC(); uc.Group = worksheet.GetValueRowCol(i, 1).ToString(); uc.UC_Id = worksheet.GetValueRowCol(i, 3).ToString(); uc.UC_Description = worksheet.GetValueRowCol(i, 4).ToString(); uc.GroupDescription = worksheet.GetValueRowCol(i, 2).ToString(); ProgectData.GroupsSs.Add(uc); } } worksheet = workbook.Worksheets[7]; for (int i = 2; i <= worksheet.Rows.Count <IRange>(); i++) { if (worksheet.GetValueRowCol(i, 1) != null && worksheet.GetValueRowCol(i, 1).ToString() != "") { var up = new GroupsUC(); up.Group = worksheet.GetValueRowCol(i, 1).ToString(); up.UC_Id = worksheet.GetValueRowCol(i, 3).ToString(); up.UC_Description = worksheet.GetValueRowCol(i, 4).ToString(); up.GroupDescription = worksheet.GetValueRowCol(i, 2).ToString(); ProgectData.GroupsPr.Add(up); } } OntologyGroups og = new OntologyGroups(); og.keyValuePairs = new Dictionary <string, string>(); worksheet = workbook.Worksheets[8]; for (int i = 2; i <= worksheet.Rows.Count <IRange>(); i++) { if (worksheet.GetValueRowCol(i, 1) != null && worksheet.GetValueRowCol(i, 1).ToString() != "") { string group = worksheet.GetValueRowCol(i, 2).ToString(); string ontology = worksheet.GetValueRowCol(i, 1).ToString(); og.keyValuePairs.Add(group, ontology); } } ProgectData.OntologyGroups.Add(og); }