private void RenderResolution(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { CombinePublish cp = (CombinePublish)model.GetValue(iter, 2); bool type = (bool)model.GetValue(iter, 4); // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x => x.ConditionId == MainClass.Settings.Resolution.Id); if (cc == null) { return; } Rule rl = MainClass.Settings.Resolution.Rules.Find(x => x.Id == cc.RuleId); if (rl == null) { return; } if (cc == null) { return; /// nema ziadne rozlisenie v combinacii } Pango.FontDescription fd = new Pango.FontDescription(); (cell as Gtk.CellRendererText).Text = String.Format("{0}x{1}", rl.Width, rl.Height); if (!type) { fd.Style = Pango.Style.Italic; } else { fd.Style = Pango.Style.Normal; } (cell as Gtk.CellRendererText).FontDesc = fd; }
public bool ExecuteTask() { //MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Cancel, "Cancel Publish.", filename, Gtk.MessageType.Question); Tool.Logger.LogDebugInfo("Publish no sign", null); /*if (MainClass.Settings.ClearConsoleBeforRuning){ * Tool.Logger.LogDebugInfo("CLEAR CONSOLE"); * MainClass.MainWindow.OutputConsole.Clear(); * }*/ if (MainClass.Workspace.ActualProject == null) { SetError(MainClass.Languages.Translate("no_project_selected")); Tool.Logger.LogDebugInfo(MainClass.Languages.Translate("no_project_selected"), null); return(false); } project = MainClass.Workspace.ActualProject; Tool.Logger.LogDebugInfo(String.Format("Project -> {0}", MainClass.Workspace.ActualProject), null); ShowInfo("Publish project", MainClass.Workspace.ActualProject.ProjectName); if (String.IsNullOrEmpty(project.ProjectOutput)) { if (!String.IsNullOrEmpty(MainClass.Workspace.OutputDirectory)) { project.ProjectOutput = MainClass.Workspace.OutputDirectory; } else { project.ProjectOutput = project.AbsolutProjectDir; } Tool.Logger.LogDebugInfo(String.Format("Project Output-> {0}", project.ProjectOutput), null); } if (!Directory.Exists(project.OutputMaskToFullPath)) { try{ Tool.Logger.LogDebugInfo(String.Format("CREATE DIR Output-> {0}", project.OutputMaskToFullPath), null); Directory.CreateDirectory(project.OutputMaskToFullPath); }catch { SetError(MainClass.Languages.Translate("cannot_create_output")); return(false); } } List <string> filesList = new List <string>(); //project.GetAllFiles(ref filesList); GetAllFiles(ref filesList, project.AbsolutProjectDir); string tempDir = MainClass.Paths.TempPublishDir; //System.IO.Path.Combine(MainClass.Settings.PublishDirectory,"_temp"); Tool.Logger.LogDebugInfo(String.Format("Temp Directory-> {0}", tempDir), null); if (!Directory.Exists(tempDir)) { try{ Tool.Logger.LogDebugInfo(String.Format("CREATE Temp Directory-> {0}", tempDir), null); Directory.CreateDirectory(tempDir); } catch { SetError(MainClass.Languages.Translate("cannot_create_temp_f1", tempDir)); return(false); } } if ((listCombinePublish == null) || (listCombinePublish.Count < 1)) { Tool.Logger.LogDebugInfo("Publish list empty", null); SetError(MainClass.Languages.Translate("publish_list_is_empty")); return(false); //project.GeneratePublishCombination(); } bool isAndroid = false; foreach (CombinePublish ccc in listCombinePublish) { CombineCondition crPlatform = ccc.combineRule.Find(x => x.ConditionId == MainClass.Settings.Platform.Id); if (crPlatform != null) { if ((crPlatform.RuleId == (int)DeviceType.Android_1_6) || (crPlatform.RuleId == (int)DeviceType.Android_2_2)) { isAndroid = true; //Console.WriteLine("ANDROID FOUND"); CheckJava(); } } } if (!isJavaInstaled && isAndroid) { ShowError(MainClass.Languages.Translate("java_missing"), MainClass.Languages.Translate("java_missing_title")); /*MessageDialogsUrl md = new MessageDialogsUrl(MessageDialogsUrl.DialogButtonType.Ok,MainClass.Languages.Translate("java_missing"), MainClass.Languages.Translate("java_missing_title"),"http://moscrif.com/java-requirement", Gtk.MessageType.Error,ParentWindow); * md.ShowDialog();*/ } /*if (listCombinePublish.Count > 0) { * * double step = 1 / (listCombinePublish.Count * 1.0); * MainClass.MainWindow.ProgressStart(step, MainClass.Languages.Translate("publish")); * progressDialog = new ProgressDialog(MainClass.Languages.Translate("publishing"),ProgressDialog.CancelButtonType.Cancel,listCombinePublish.Count,ParentWindow);//MainClass.MainWindow * }*/ foreach (CombinePublish ccc in listCombinePublish) //listCC ){ //if (!ccc.IsSelected) continue; //Console.WriteLine(ccc.ToString()); { if (stopProcess) { break; } if (String.IsNullOrEmpty(project.ProjectArtefac)) { project.ProjectArtefac = System.IO.Path.GetFileNameWithoutExtension(project.RelativeAppFilePath); } string fileName = project.ProjectArtefac; List <ConditionDevice> condList = new List <ConditionDevice>(); foreach (CombineCondition cr in ccc.combineRule) { ConditionDevice cd = new ConditionDevice(cr.ConditionName, cr.RuleName); //condList.Add(new ConditionDevice(cr.ConditionName,cr.RuleName)); if (cr.ConditionId == MainClass.Settings.Resolution.Id) { Rule rl = MainClass.Settings.Resolution.Rules.Find(x => x.Id == cr.RuleId); if (rl != null) { cd.Height = rl.Height; cd.Width = rl.Width; } } condList.Add(cd); fileName = fileName.Replace(String.Format("$({0})", cr.ConditionName), cr.RuleName); } parentTask = new TaskMessage("Publishing", fileName, null); devicePublishError = false; ShowInfo("Publishing", fileName); /*if (progressDialog != null) * progressDialog.SetLabel (fileName );*/ if (Directory.Exists(tempDir)) { try{ DirectoryInfo di = new DirectoryInfo(tempDir); foreach (DirectoryInfo d in di.GetDirectories()) { d.Delete(true); } foreach (FileInfo f in di.GetFiles()) { f.Delete(); } } catch { } } CombineCondition crPlatform = ccc.combineRule.Find(x => x.ConditionId == MainClass.Settings.Platform.Id); CombineCondition crRsolution = ccc.combineRule.Find(x => x.ConditionId == MainClass.Settings.Resolution.Id); if (crPlatform == null) { SetError(MainClass.Languages.Translate("platform_not_found", MainClass.Settings.Platform.Name), parentTask); continue; } Device dvc = project.DevicesSettings.Find(x => x.TargetPlatformId == crPlatform.RuleId); if (dvc == null) { SetError(MainClass.Languages.Translate("device_not_found", crPlatform.ConditionName, crPlatform.RuleName), parentTask); continue; } if (((crPlatform.RuleId == (int)DeviceType.Android_1_6) || (crPlatform.RuleId == (int)DeviceType.Android_2_2)) && (!isJavaInstaled)) { SetError(MainClass.Languages.Translate("java_missing"), parentTask); ShowError(MainClass.Languages.Translate("java_missing"), fileName); continue; } string dirPublish = MainClass.Tools.GetPublishDirectory(dvc.Platform.Specific); //System.IO.Path.Combine(MainClass.Settings.PublishDirectory,dvc.Platform.Specific);//crPlatform.RuleName); if (!Directory.Exists(dirPublish)) { SetError(MainClass.Languages.Translate("publish_tool_not_found"), parentTask); continue; } if (String.IsNullOrEmpty(dirPublish)) { SetError(MainClass.Languages.Translate("publish_tool_not_found_f1"), parentTask); continue; } dvc.Application = project.AppFile.Name; // TTT if (String.IsNullOrEmpty(project.ProjectOutput)) { if (!String.IsNullOrEmpty(MainClass.Workspace.OutputDirectory)) { project.ProjectOutput = MainClass.Workspace.OutputDirectory; } else { project.ProjectOutput = project.AbsolutProjectDir; } } dvc.Output_Dir = project.OutputMaskToFullPath; dvc.Temp = tempDir; dvc.Temp = LastSeparator(dvc.Temp); dvc.Publish = LastSeparator(MainClass.Settings.PublishDirectory); dvc.Root = LastSeparator(MainClass.Workspace.RootDirectory); dvc.Output_Dir = LastSeparator(dvc.Output_Dir); dvc.Conditions = condList.ToArray(); List <int> mergeResolutions = new List <int>(); string resolution = crRsolution.RuleName; mergeResolutions.Add(crRsolution.RuleId); // Ak je zaskrtnute Merge All Resolution // Najdem vsetky publishovatelne combinacie danej platformy (napr. vsetky publishovane andrroidy) // a vytiahnem z nich rezolution a spojim do string odeleneho & if (dvc.Includes.Skin != null) { dvc.Includes.Skin.ResolutionJson = dvc.Includes.Skin.Resolution; if (!String.IsNullOrEmpty(dvc.Includes.Skin.Name)) { if (project.IncludeAllResolution) { resolution = ""; mergeResolutions.Clear(); foreach (CombinePublish cp in listCombinePublish) { CombineCondition crPlatform2 = cp.combineRule.Find(x => x.ConditionId == MainClass.Settings.Platform.Id && x.RuleId == crPlatform.RuleId); if (crPlatform2 != null) { CombineCondition crResolution2 = cp.combineRule.Find(x => x.ConditionId == MainClass.Settings.Resolution.Id); if (crResolution2 != null) { resolution = resolution + crResolution2.RuleName + "&"; mergeResolutions.Add(crResolution2.RuleId); } } } resolution = resolution.Remove(resolution.Length - 1, 1); ConditionDevice cd = condList.Find(x => x.Name == MainClass.Settings.Resolution.Name); if (cd != null) { cd.Value = resolution; dvc.Conditions = condList.ToArray(); } } } } List <string> filesForPublish = new List <string>(); foreach (string file in filesList) { if (System.IO.Path.GetExtension(file) == ".msc") { continue; } string fileUpdate = FileUtility.AbsoluteToRelativePath(MainClass.Workspace.RootDirectory, file); if (project.FilesProperty != null) { // vyhldam property suborov a pozriem ci nemam nejake conditiony nastavene FileItem fi = project.FilesProperty.Find(x => x.SystemFilePath == fileUpdate); if (fi != null) { if (fi.IsExcluded) { continue; } if (fi.ConditionValues == null) // nema ziadne konditions tak ho pridam { goto nav1; //continue; } foreach (CombineCondition cr in ccc.combineRule) { ConditionRule conRile = fi.ConditionValues.Find(x => x.ConditionId == cr.ConditionId); if (conRile != null) { //if ((conRile.RuleId != cr.RuleId)) // subor ma condition daneho typu, ale nastavenu na inu hodnotu //goto nav; int resolutionId = -1; if (conRile.ConditionId == MainClass.Settings.Resolution.Id) { resolutionId = mergeResolutions.FindIndex(x => x == conRile.RuleId); //continue; } // mam merge resolution a subor patri do niektoreho mergnuteho resolution if ((conRile.ConditionId == MainClass.Settings.Resolution.Id) && (resolutionId > -1)) { goto nav1; } // subor ma condition daneho typu, ale nastavenu na inu hodnotu if ((conRile.RuleId != cr.RuleId)) { string msg1 = String.Format("File {0} REMOVE {1}-> {0}", fileUpdate, conRile.RuleId); Tool.Logger.LogDebugInfo(msg1, null); Console.WriteLine(msg1); goto nav; } } } } } nav1: fileUpdate = FileUtility.AbsoluteToRelativePath(project.AbsolutProjectDir, file); fileUpdate = FileUtility.TrimStartingDotCharacter(fileUpdate); fileUpdate = FileUtility.TrimStartingDirectorySeparator(fileUpdate); filesForPublish.Add(fileUpdate); /*string msg =String.Format("Add File to Publish-> {0}",fileUpdate); * Tool.Logger.LogDebugInfo(msg,null); * Console.WriteLine(msg);*/ nav :; } dvc.Includes.Files = filesForPublish.ToArray(); List <string> fontForPublish = new List <string>(); foreach (string fnt in dvc.Includes.Fonts) { string tmp = fnt; tmp = tmp.Replace('/', System.IO.Path.DirectorySeparatorChar); tmp = tmp.Replace('\\', System.IO.Path.DirectorySeparatorChar); fontForPublish.Add(tmp); } dvc.Includes.Fonts = fontForPublish.ToArray(); dvc.Output_Name = fileName; dvc.PublishPropertisFull = new List <PublishProperty>(); foreach (PublishProperty pp in dvc.PublishPropertisMask) { PublishProperty ppFull = new PublishProperty(pp.PublishName); ppFull.PublishValue = pp.PublishValue; dvc.PublishPropertisFull.Add(ppFull); if (pp.PublishName == Project.KEY_PERMISSION) { continue; } if (pp.PublishName == Project.KEY_CODESIGNINGIDENTITY) { continue; } if (pp.PublishName == Project.KEY_STOREPASSWORD) { continue; } if (pp.PublishName == Project.KEY_KEYPASSWORD) { continue; } if (pp.PublishName == Project.KEY_SUPPORTEDDEVICES) { continue; } if (pp.PublishName == Project.KEY_INSTALLOCATION) { continue; } if (pp.PublishName == Project.KEY_BUNDLEIDENTIFIER) { continue; } if (pp.PublishName == Project.KEY_ALIAS) { continue; } if (pp.PublishName == Project.KEY_APPLICATIONID) { continue; } if (pp.PublishName == Project.KEY_PASSWORD) { continue; } ppFull.PublishValue = project.ConvertProjectMaskPathToFull(pp.PublishValue); } // /*if(dvc.Includes.Skin != null){ * dvc.Includes.Skin.ResolutionJson = dvc.Includes.Skin.Resolution; * if(!String.IsNullOrEmpty(dvc.Includes.Skin.Name)){ * if(project.IncludeAllResolution){ * dvc.Includes.Skin.ResolutionJson = "*"; * } * } * }*/ dvc.LogDebug = MainClass.Settings.LogPublish; dvc.ApplicationType = project.ApplicationType; dvc.FacebookAppID = project.FacebookAppID; if (String.IsNullOrEmpty(project.FacebookAppID)) { dvc.FacebookAppID = ""; } string path = System.IO.Path.Combine(dirPublish, "settings.mso"); //fileName+".mso"); //dvc.TargetPlatform + "_settings.mso"); string json = dvc.GenerateJson(); if (String.IsNullOrEmpty(json)) { SetError(MainClass.Languages.Translate("cannot_generate_mso"), parentTask); continue; } try { using (StreamWriter file = new StreamWriter(path)) { file.Write(json); file.Close(); } } catch { SetError(MainClass.Languages.Translate("cannot_generate_mso"), parentTask); continue; } //var platformRule = MainClass.Settings.Platform.Rules.Find(x => x.Id == dvc.TargetPlatformId); string appFile = dvc.Platform.Specific + ".app"; /*dvc.TargetPlatform*/ //platformRule.Specific + ".app"; string fullAppPath = System.IO.Path.Combine(MainClass.Settings.PublishDirectory, appFile); if (!System.IO.File.Exists(fullAppPath)) { SetError(MainClass.Languages.Translate("publish_tool_not_found_f2"), parentTask); continue; } RunPublishTool(appFile, parentTask); /*if (RunPublishTool(appFile,parentTask) ){ * parentTask.Message =MainClass.Languages.Translate("publish_successfully_done"); * output.Add(parentTask); * * //output.Add(new TaskMessage(MainClass.Languages.Translate("publish_successfully_done"),dvc.Platform.Specific,null)); * } else { * parentTask.Message =MainClass.Languages.Translate("publish_error"); * Console.WriteLine(parentTask.Child.Message); * output.Add(parentTask); * //output.Add(new TaskMessage(MainClass.Languages.Translate("publish_error"),dvc.Platform.Specific,null)); * }*/ if (MainClass.Platform.IsMac) { ExitPublish(null, null); } if (devicePublishError) { parentTask.Message = StateEnum.ERROR.ToString(); allPublishError = true; ShowError(StateEnum.ERROR.ToString(), " "); //ShowError(lastMessage.Trim(),fileName); } else { parentTask.Message = StateEnum.OK.ToString(); ShowInfo(" ", StateEnum.OK.ToString()); } //parentTask.Message = //this.StateTask.ToString(); //Console.WriteLine(parentTask.Child.Message); output.Add(parentTask); MainClass.MainWindow.ProgressStep(); /*if (progressDialog != null) * cancelled = progressDialog.Update (fileName );*/ } MainClass.MainWindow.ProgressEnd(); /*if(progressDialog!= null){ * progressDialog.Destroy(); * }*/ //Console.WriteLine("allPublishError -> {0}",allPublishError); if (allPublishError) { this.stateTask = StateEnum.ERROR; string s = allErrors.ToString(); if (s.Length > 120) { s = s.Substring(0, 120); s = s + " ... and more."; } ShowError(MainClass.Languages.Translate("publish_error"), " "); return(false); } if (stopProcess) { this.stateTask = StateEnum.CANCEL; ShowInfo(MainClass.Languages.Translate("Canceled"), " ", -1); return(false); } else { this.stateTask = StateEnum.OK; ShowInfo(" ", MainClass.Languages.Translate("publish_successfully_done"), 1); /*if(MainClass.Settings.OpenOutputAfterPublish){ * if (!String.IsNullOrEmpty(project.ProjectOutput)){ * MainClass.Tools.OpenFolder(project.OutputMaskToFullPath); * } * }*/ return(true); } }
private void GenerateNotebookPages() { string platformName = MainClass.Settings.Platform.Name; foreach (Rule rl in MainClass.Settings.Platform.Rules) { bool iOsNoMac = false; if ((rl.Tag == -1) && !MainClass.Settings.ShowUnsupportedDevices) { continue; } if ((rl.Tag == -2) && !MainClass.Settings.ShowDebugDevices) { continue; } bool validDevice = true; if (!Device.CheckDevice(rl.Specific)) { Tool.Logger.Debug("Invalid Device " + rl.Specific); validDevice = false; } ScrolledWindow sw = new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedOut; TreeView tvList = new TreeView(); List <CombinePublish> lcp = project.ProjectUserSetting.CombinePublish.FindAll(x => x.combineRule.FindIndex(y => y.ConditionName == platformName && y.RuleId == rl.Id) > -1); List <CombinePublish> lcpDennied = new List <CombinePublish>(); string deviceName = rl.Name; int deviceTyp = rl.Id; ListStore ls = new ListStore(typeof(bool), typeof(string), typeof(CombinePublish), typeof(string), typeof(bool)); string ico = "empty.png"; switch (deviceTyp) { case (int)DeviceType.Android_1_6: { ico = "android.png"; break; } case (int)DeviceType.Android_2_2: { ico = "android.png"; break; } case (int)DeviceType.Bada_1_0: case (int)DeviceType.Bada_1_1: case (int)DeviceType.Bada_1_2: case (int)DeviceType.Bada_2_0: { ico = "bada.png"; break; } case (int)DeviceType.Symbian_9_4: { ico = "symbian.png"; break; } case (int)DeviceType.iOS_5_0: { ico = "apple.png"; if (!MainClass.Platform.IsMac) { iOsNoMac = true; } break; } case (int)DeviceType.PocketPC_2003SE: case (int)DeviceType.WindowsMobile_5: case (int)DeviceType.WindowsMobile_6: { ico = "windows.png"; break; } case (int)DeviceType.Windows: { ico = "win32.png"; break; } case (int)DeviceType.MacOs: { ico = "macos.png"; break; } } List <CombinePublish> tmp = lcp.FindAll(x => x.IsSelected == true); NotebookLabel nl = new NotebookLabel(ico, String.Format("{0} ({1})", deviceName, tmp.Count)); nl.Tag = deviceTyp; if (iOsNoMac) { Label lbl = new Label(MainClass.Languages.Translate("ios_available_Mac")); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; lbl.ModifyFont(customFont); notebook.AppendPage(lbl, nl); continue; } if (!validDevice) { Label lbl = new Label(MainClass.Languages.Translate("publish_tool_missing")); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; lbl.ModifyFont(customFont); notebook.AppendPage(lbl, nl); continue; } ; CellRendererToggle crt = new CellRendererToggle(); crt.Activatable = true; crt.Sensitive = true; tvList.AppendColumn("", crt, "active", 0); Gtk.CellRendererText fileNameRenderer = new Gtk.CellRendererText(); Gtk.CellRendererText collumnResolRenderer = new Gtk.CellRendererText(); tvList.AppendColumn(MainClass.Languages.Translate("file_name"), fileNameRenderer, "text", 1); tvList.AppendColumn(MainClass.Languages.Translate("resolution_f1"), collumnResolRenderer, "text", 1); tvList.Columns[1].SetCellDataFunc(fileNameRenderer, new Gtk.TreeCellDataFunc(RenderCombine)); tvList.Columns[2].SetCellDataFunc(collumnResolRenderer, new Gtk.TreeCellDataFunc(RenderResolution)); // povolene resolution pre danu platformu PlatformResolution listPR = MainClass.Settings.PlatformResolutions.Find(x => x.IdPlatform == deviceTyp); Device dvc = project.DevicesSettings.Find(x => x.TargetPlatformId == deviceTyp); string stringTheme = ""; List <System.IO.DirectoryInfo> themeResolution = new List <System.IO.DirectoryInfo>(); // resolution z adresara themes po novom if ((project.NewSkin) && (dvc != null)) { Skin skin = dvc.Includes.Skin; if ((skin != null) && (!String.IsNullOrEmpty(skin.Name)) && (!String.IsNullOrEmpty(skin.Theme))) { string skinDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, MainClass.Settings.SkinDir); stringTheme = System.IO.Path.Combine(skinDir, skin.Name); stringTheme = System.IO.Path.Combine(stringTheme, "themes"); stringTheme = System.IO.Path.Combine(stringTheme, skin.Theme); if (System.IO.Directory.Exists(stringTheme)) { System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(stringTheme); themeResolution = new List <System.IO.DirectoryInfo>(di.GetDirectories()); } } } crt.Toggled += delegate(object o, ToggledArgs args) { if ((deviceTyp == (int)DeviceType.Windows) || (deviceTyp == (int)DeviceType.MacOs)) { if (!MainClass.LicencesSystem.CheckFunction("windowsandmac", this)) { return; } } TreeIter iter; if (ls.GetIter(out iter, new TreePath(args.Path))) { bool old = (bool)ls.GetValue(iter, 0); CombinePublish cp = (CombinePublish)ls.GetValue(iter, 2); cp.IsSelected = !old; ls.SetValue(iter, 0, !old); List <CombinePublish> tmp2 = lcp.FindAll(x => x.IsSelected == true); nl.SetLabel(String.Format("{0} ({1})", deviceName, tmp2.Count)); //if(dvc == null) return; //if(dvc.Includes == null) return; if (dvc.Includes.Skin == null) { return; } if (String.IsNullOrEmpty(dvc.Includes.Skin.Name) || String.IsNullOrEmpty(dvc.Includes.Skin.Theme)) { return; } if (cp.IsSelected) { // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x => x.ConditionId == MainClass.Settings.Resolution.Id); if (cc == null) { return; /// nema ziadne rozlisenie v combinacii } int indxResol = themeResolution.FindIndex(x => x.Name.ToLower() == cc.RuleName.ToLower()); if (indxResol < 0) { // theme chyba prislusne rozlisenie string error = String.Format("Invalid {0} Skin and {1} Theme, using in {2}. Missing resolutions: {3}. ", dvc.Includes.Skin.Name, dvc.Includes.Skin.Theme, deviceName, cc.RuleName.ToLower()); MainClass.MainWindow.OutputConsole.WriteError(error + "\n"); List <string> lst = new List <string>(); lst.Add(error); MainClass.MainWindow.ErrorWritte("", "", lst); } } } }; int cntOfAdded = 0; foreach (CombinePublish cp in lcp) { bool isValid = cp.IsSelected; if (!validDevice) { isValid = false; } // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x => x.ConditionId == MainClass.Settings.Resolution.Id); if (cc == null) { continue; /// nema ziadne rozlisenie v combinacii } int indx = MainClass.Settings.Resolution.Rules.FindIndex(x => x.Id == cc.RuleId); if (indx < 0) { continue; /// rozlisenie pouzite v danej combinacii nexistuje } if (cc != null) { bool isValidResolution = false; //ak nema definovane ziadne povolenia, tak povolene su vsetky if ((listPR == null) || (listPR.AllowResolution == null) || (listPR.AllowResolution.Count < 1)) { isValidResolution = true; } else { isValidResolution = listPR.IsValidResolution(cc.RuleId); } if (isValidResolution) { // po novom vyhodom aj tie ktore niesu v adresaru themes - pokial je thema definovana if ((project.NewSkin) && (themeResolution.Count > 0)) { //cntResolution = 0; int indxResol = themeResolution.FindIndex(x => x.Name.ToLower() == cc.RuleName.ToLower()); if (indxResol > -1) { ls.AppendValues(isValid, cp.ProjectName, cp, cp.ProjectName, true); cntOfAdded++; } else { lcpDennied.Add(cp); } } else { ls.AppendValues(isValid, cp.ProjectName, cp, cp.ProjectName, true); cntOfAdded++; } } else { lcpDennied.Add(cp); } } //} } // pridam tie zakazane, ktore su vybrate na publish foreach (CombinePublish cp in lcpDennied) { if (cp.IsSelected) { ls.AppendValues(cp.IsSelected, cp.ProjectName, cp, cp.ProjectName, false); cntOfAdded++; } } if (cntOfAdded == 0) { MainClass.MainWindow.OutputConsole.WriteError(String.Format("Missing publish settings for {0}.\n", deviceName)); } bool showAll = false; tvList.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args){ if (args.Event.Button == 3) { TreeSelection ts = tvList.Selection; Gtk.TreePath[] selRow = ts.GetSelectedRows(); if (selRow.Length < 1) { TreeIter tiFirst = new TreeIter(); ls.GetIterFirst(out tiFirst); tvList.Selection.SelectIter(tiFirst); selRow = ts.GetSelectedRows(); } if (selRow.Length < 1) { return; } Gtk.TreePath tp = selRow[0]; TreeIter ti = new TreeIter(); ls.GetIter(out ti, tp); CombinePublish combinePublish = (CombinePublish)ls.GetValue(ti, 2); if (combinePublish != null) { Menu popupMenu = new Menu(); if (!showAll) { MenuItem miShowDenied = new MenuItem(MainClass.Languages.Translate("show_denied")); miShowDenied.Activated += delegate(object sender, EventArgs e) { // odoberem zakazane, ktore sa zobrazuju kedze su zaceknute na publish List <TreeIter> lst = new List <TreeIter>(); ls.Foreach((model, path, iterr) => { bool cp = (bool)ls.GetValue(iterr, 4); bool selected = (bool)ls.GetValue(iterr, 0); if (!cp && selected) { lst.Add(iterr); } return(false); }); foreach (TreeIter ti2 in lst) { TreeIter ti3 = ti2; ls.Remove(ref ti3); } // pridam zakazane if ((lcpDennied == null) || (lcpDennied.Count < 1)) { return; } foreach (CombinePublish cp in lcpDennied) { ls.AppendValues(cp.IsSelected, cp.ProjectName, cp, cp.ProjectName, false); } showAll = true; }; popupMenu.Append(miShowDenied); } else { MenuItem miHideDenied = new MenuItem(MainClass.Languages.Translate("hide_denied")); miHideDenied.Activated += delegate(object sender, EventArgs e) { List <TreeIter> lst = new List <TreeIter>(); ls.Foreach((model, path, iterr) => { bool cp = (bool)ls.GetValue(iterr, 4); bool selected = (bool)ls.GetValue(iterr, 0); if (!cp && !selected) { lst.Add(iterr); } return(false); }); foreach (TreeIter ti2 in lst) { TreeIter ti3 = ti2; ls.Remove(ref ti3); } showAll = false; }; popupMenu.Append(miHideDenied); } popupMenu.Append(new SeparatorMenuItem()); MenuItem miCheckAll = new MenuItem(MainClass.Languages.Translate("check_all")); miCheckAll.Activated += delegate(object sender, EventArgs e) { if ((deviceTyp == (int)DeviceType.Windows) || (deviceTyp == (int)DeviceType.MacOs)) { if (!MainClass.LicencesSystem.CheckFunction("windowsandmac", this)) { return; } } int cnt = 0; ls.Foreach((model, path, iterr) => { CombinePublish cp = (CombinePublish)ls.GetValue(iterr, 2); cp.IsSelected = true; ls.SetValue(iterr, 0, true); cnt++; return(false); }); nl.SetLabel(String.Format("{0} ({1})", deviceName, cnt)); }; popupMenu.Append(miCheckAll); MenuItem miUnCheckAll = new MenuItem(MainClass.Languages.Translate("uncheck_all")); miUnCheckAll.Activated += delegate(object sender, EventArgs e) { ls.Foreach((model, path, iterr) => { CombinePublish cp = (CombinePublish)ls.GetValue(iterr, 2); cp.IsSelected = false; ls.SetValue(iterr, 0, false); return(false); }); nl.SetLabel(String.Format("{0} ({1})", deviceName, 0)); }; popupMenu.Append(miUnCheckAll); popupMenu.Popup(); popupMenu.ShowAll(); } } }; tvList.Model = ls; if (!validDevice) { tvList.Sensitive = false; } sw.Add(tvList); notebook.AppendPage(sw, nl); } }
/*public void GetAllFiles(ref List<string> filesList,string path) * { * if (!Directory.Exists(path)) * return; * * DirectoryInfo di = new DirectoryInfo(path); * * foreach (DirectoryInfo d in di.GetDirectories()){ * int indx = -1; * indx = MainClass.Settings.IgnoresFolders.FindIndex(x => x.Folder == d.Name && x.IsForIde); * * if(indx<0){ * GetAllFiles(ref filesList, d.FullName); * } * } * * foreach (FileInfo f in di.GetFiles()) { * * //if (f.Extension == ".ms") continue; * * filesList.Add( f.FullName ); * } * * }*/ public void GeneratePublishCombination() { if (this.ProjectUserSetting.CombinePublish != null) { this.ProjectUserSetting.CombinePublish.Clear(); } if (String.IsNullOrEmpty(this.ProjectArtefac)) { string name = System.IO.Path.GetFileNameWithoutExtension(this.AppFilePath); this.ProjectArtefac = String.Format("{0}_$({1})_$({2})", name, MainClass.Settings.Platform.Name, MainClass.Settings.Resolution.Name); } List <Condition> fullCondition = new List <Condition>(); //fullCondition.Add(MainClass.Settings.Platform.Clone()); /*if ((this.SelectResolution == null) || * (this.SelectResolution.Count < 1)) { * * this.SelectResolution = new List<int>(); * SelectResolution.Add(-1); * }*/ // pridam rozlisenie, //fullCondition.Add(this.Resolution.Clone()); fullCondition.Add(MainClass.Settings.Resolution.Clone()); // pridam Conditions, ale len tie ktore su vmene pre aplikaciu foreach (Condition con in this.ConditoinsDefine) { int i = this.ProjectArtefac.IndexOf(String.Format("$({0})", con.Name)); if (i > -1) { fullCondition.Add(con.Clone()); } } int indx = 0; List <CombinePublish> listCC = new List <CombinePublish>(); // kombinacie si predplnim aplikaciami foreach (Rule rl in MainClass.Settings.Platform.Rules) { CombinePublish cc = new CombinePublish(); CombineCondition cr = new CombineCondition(); cr.RuleId = rl.Id; cr.RuleName = rl.Specific; cr.ConditionId = MainClass.Settings.Platform.Id; cr.ConditionName = MainClass.Settings.Platform.Name; cc.combineRule = new List <CombineCondition>(); cc.combineRule.Add(cr); //cc.ProjectName = this.ProjectArtefac; cc.ProjectName = this.ProjectArtefac.Replace(String.Format("$({0})", cr.ConditionName), cr.RuleName); listCC.Add(cc); } // samotne kombibnacie while (indx < fullCondition.Count) { List <CombinePublish> listCCcopy = MainClass.Tools.Clone <CombinePublish>(listCC); listCC.Clear(); foreach (CombinePublish cc in listCCcopy) { foreach (Rule rl in fullCondition [indx].Rules) { CombinePublish cc2 = cc.Clone(); CombineCondition cr = new CombineCondition(); cr.RuleId = rl.Id; if (fullCondition [indx].Name == MainClass.Settings.Resolution.Name) { cr.RuleName = rl.Specific; } else { cr.RuleName = rl.Name; } cr.ConditionId = fullCondition [indx].Id; cr.ConditionName = fullCondition [indx].Name; cc2.combineRule.Add(cr); cc2.ProjectName = cc2.ProjectName.Replace(String.Format("$({0})", cr.ConditionName), cr.RuleName); listCC.Add(cc2); } } indx++; } ProjectUserSetting.CombinePublish = new List <CombinePublish>(listCC.ToArray()); // return listCC; }