public override object Deserialize( IDictionary<string, object> dictionary,Type type,JavaScriptSerializer serializer ) { if( type == typeof( PublishProperty ) ) { var obj = new PublishProperty(); if( dictionary.ContainsKey( "name" ) ) obj.PublishName = serializer.ConvertToType<string>(dictionary["name"] ); if( dictionary.ContainsKey( "value" ) ) obj.PublishValue = serializer.ConvertToType<string>(dictionary["value"] ); return obj; } return null; }
public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { if (type == typeof(PublishProperty)) { var obj = new PublishProperty(); if (dictionary.ContainsKey("name")) { obj.PublishName = serializer.ConvertToType <string>(dictionary["name"]); } if (dictionary.ContainsKey("value")) { obj.PublishValue = serializer.ConvertToType <string>(dictionary["value"]); } return(obj); } return(null); }
public bool ExecuteTask() { if (MainClass.Workspace.ActualProject == null) { SetError(MainClass.Languages.Translate("no_project_selected")); return false; } project = MainClass.Workspace.ActualProject; if (String.IsNullOrEmpty(project.ProjectOutput)){ if (!String.IsNullOrEmpty(MainClass.Workspace.OutputDirectory)){ project.ProjectOutput = MainClass.Workspace.OutputDirectory; } else project.ProjectOutput = project.AbsolutProjectDir; } if(!Directory.Exists(project.OutputMaskToFullPath)){ try{ Directory.CreateDirectory(project.OutputMaskToFullPath); }catch { SetError(MainClass.Languages.Translate("cannot_create_output")); return false; } } stateTask = StateEnum.OK; //################ uvodne kontroly if (MainClass.MainWindow.RunningEmulator) { SetError(MainClass.Languages.Translate("emulator_is_running")); return false; } string cmd = Path.Combine(MainClass.Settings.EmulatorDirectory, "moscrif.exe"); if(MainClass.Platform.IsMac){ //Console.WriteLine("EmulatorDirectory --> {0}",MainClass.Settings.EmulatorDirectory); //cmd = "open";// + MainClass.Settings.EmulatorDirectory, "moscrif.app"); string file = System.IO.Path.Combine( MainClass.Settings.EmulatorDirectory, "Moscrif.app");//.app file = System.IO.Path.Combine(file, "Contents"); file = System.IO.Path.Combine(file, "MacOS"); file = System.IO.Path.Combine(file, "Moscrif"); cmd = file; Tool.Logger.LogDebugInfo(String.Format("command compile MAC ->{0}",cmd),null); } if(MainClass.Platform.IsWindows){ if (!System.IO.File.Exists(cmd)) { SetError(MainClass.Languages.Translate("emulator_not_found")); return false; } } string tempDir = MainClass.Paths.TempPublishDir;//System.IO.Path.Combine(MainClass.Settings.PublishDirectory,"_temp"); if (!Directory.Exists(tempDir)){ try{ Directory.CreateDirectory(tempDir); } catch{ SetError(MainClass.Languages.Translate("cannot_create_temp_f1")); return false; } } if ((listCombinePublish == null) || (listCombinePublish.Count <1)){ SetError(MainClass.Languages.Translate("publish_list_is_empty")); return false; //project.GeneratePublishCombination(); } bool cancelled = false; 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)){ Console.WriteLine("ANDROID FOUND"); CheckJava(); } } } if(!isJavaInstaled && isAndroid){ 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(); } project = MainClass.Workspace.ActualProject; if((MainClass.User == null) || (string.IsNullOrEmpty(MainClass.User.Token))){ SetError(MainClass.Languages.Translate("invalid_login")); return false; } //########################## kompilovanie progressDialog = new ProgressDialog(MainClass.Languages.Translate("compiling"),ProgressDialog.CancelButtonType.None,listCombinePublish.Count,ParentWindow);//MainClass.MainWindow //#################### kompilovanie try { List<string> list = new List<string>(); GetComands(project.AbsolutProjectDir, ref list,true); string[] libs = project.AppFile.Libs; foreach (string lib in libs){ if(string.IsNullOrEmpty(lib)) continue; string pathLib = System.IO.Path.Combine(MainClass.Workspace.RootDirectory,lib); GetComands(pathLib, ref list,true); } if (list.Count > 0) { double step = 1 / (list.Count * 1.0); MainClass.MainWindow.ProgressStart(step, MainClass.Languages.Translate("compiling")); progressDialog.Reset(list.Count,MainClass.Languages.Translate("compiling")); } foreach (string f in list) { if (exitCompile) { // chyba koncim MainClass.MainWindow.ProgressEnd(); progressDialog.Destroy(); SetError(MainClass.Languages.Translate("compiling_failed")); return false; } string fileUpdate = FileUtility.AbsoluteToRelativePath(MainClass.Workspace.RootDirectory ,f); if ( project.FilesProperty != null){ FileItem fi = project.FilesProperty.Find(x => x.SystemFilePath == fileUpdate); if (fi != null) { if (fi.IsExcluded) continue; } } string fdir = System.IO.Path.GetDirectoryName(f); string fname = System.IO.Path.GetFileName(f); string args = String.Format("/d \"{0}\" /c {1} /o console", fdir, fname); if(MainClass.Platform.IsMac){ args = String.Format("-d {0} -c {1} -o console", fdir, fname); /*Process []pArry = Process.GetProcesses(); foreach(Process p in pArry) { if(p != null){ try { if(p.ProcessName == "Moscrif"){ p.Kill(); MainClass.MainWindow.RunningEmulator= false; } //string s = p.ProcessName; //s = s.ToLower(); //Console.WriteLine("\t"+s); } catch (Exception ex){ Console.WriteLine(ex.Message); } } }*/ } string a = args; //output.Add(new TaskMessage("args>>" + a)); ProcessService ps = new ProcessService(); MainClass.MainWindow.ProgressStep(); progressDialog.Update(f); ProcessWrapper pw = ps.StartProcess(cmd, a, fdir, ProcessOutputChange, ProcessOutputChange); pw.WaitForExit(); //pw.WaitForOutput(); pw.Exited += delegate(object sender, EventArgs e) { //Console.WriteLine("pw.Exited"); ParseOutput(MainClass.Languages.Translate("exit_compiling"),pw.StartInfo.WorkingDirectory); }; } } catch (Exception ex) { MainClass.MainWindow.ProgressEnd(); progressDialog.Destroy(); SetError(MainClass.Languages.Translate("compiling_failed"),ex.Message); return false; } finally { } if(stateTask != StateEnum.OK){ MainClass.MainWindow.ProgressEnd(); progressDialog.Destroy(); SetError(MainClass.Languages.Translate("compiling_failed")); return false; } //#################### regenerate app file, backup, hash parentTask = new TaskMessage("OK",MainClass.Languages.Translate("compiling"),null); output.Add(parentTask); List<string> filesList = new List<string>(); GetAllFiles(ref filesList,project.AbsolutProjectDir ); progressDialog.Reset(filesList.Count,MainClass.Languages.Translate("generate_app")); string bakAppPath =project.AbsolutAppFilePath+".bak"; string hashAppPath =project.AbsolutAppFilePath+".hash"; if(System.IO.File.Exists(bakAppPath)){ try{ File.Delete(bakAppPath); } catch { progressDialog.Destroy(); SetError(MainClass.Languages.Translate("cannot_create_backup")); return false; } } if(System.IO.File.Exists(hashAppPath)){ try{ File.Delete(hashAppPath); } catch { progressDialog.Destroy(); SetError(MainClass.Languages.Translate("cannot_create_hash")); return false; } } try{ File.Copy(project.AbsolutAppFilePath,bakAppPath); File.Copy(project.AbsolutAppFilePath,hashAppPath); } catch { progressDialog.Destroy(); SetError(MainClass.Languages.Translate("cannot_create_backup")); return false; } using (StreamWriter stream = File.AppendText(hashAppPath)) { stream.WriteLine(); foreach(string file in filesList){ if (System.IO.Path.GetExtension(file)==".ms") continue; string fileUpdate = FileUtility.AbsoluteToRelativePath(project.AbsolutProjectDir,file); fileUpdate = FileUtility.TrimStartingDotCharacter(fileUpdate); fileUpdate = FileUtility.TrimStartingDirectorySeparator(fileUpdate); /* stream.WriteLine("file : {0}",fileUpdate); string fileNameHash = Cryptographer.SHA1HashBase64(fileUpdate); stream.WriteLine("hash : {0}",fileNameHash); */ progressDialog.Update(MainClass.Languages.Translate("create_app")); using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read)) { int size = (int)fs.Length; byte[] data = new byte[size]; fs.Read(data, 0, size); fs.Close(); stream.WriteLine("file: {0}",fileUpdate); stream.WriteLine("hash: {0}", Cryptographer.SHA1HashBase64(data)); } } stream.Flush(); stream.Close(); stream.Dispose(); } //#################### podpisovanie progressDialog.Reset(0,MainClass.Languages.Translate("sign_app_f1")); progressDialog.SetLabel (MainClass.Languages.Translate("sign_app_f1") ); SignApp sa = new SignApp(); string newAppdata = ""; try{ if(!sa.PostFile(hashAppPath,MainClass.User.Token,out newAppdata)){ //timer.Stop(); progressDialog.Destroy(); RestoreBackup(hashAppPath,bakAppPath); //SetError(MainClass.Languages.Translate("expired_licence"),newAppdata); output.Add(new TaskMessage(newAppdata,MainClass.Languages.Translate("expired_licence"),null)); stateTask = StateEnum.ERROR; LicenceExpiredDialog md = new LicenceExpiredDialog(MainClass.Languages.Translate("expired_licence")); md.Run(); md.Destroy(); return false; } if(String.IsNullOrEmpty(newAppdata)){ //timer.Stop(); progressDialog.Destroy(); RestoreBackup(hashAppPath,bakAppPath); SetError(MainClass.Languages.Translate("sign_app_failed")); return false; } using (StreamWriter file = new StreamWriter(project.AbsolutAppFilePath)) { file.Write(newAppdata); file.Flush(); file.Close(); } }catch(Exception ex){ //timer.Stop(); progressDialog.Destroy(); SetError(MainClass.Languages.Translate("sign_app_failed"), ex.Message); //Console.WriteLine(ex.Message); RestoreBackup(hashAppPath,bakAppPath); return false; } //timer.Stop(); parentTask = new TaskMessage("OK",MainClass.Languages.Translate("sign"),null); output.Add(parentTask); //#################### publish //if (listCombinePublish.Count > 0) { //List<CombinePublish> lst =project.CombinePublish.FindAll(x=>x.IsSelected==true); double step2 = 1 / (listCombinePublish.Count * 1.0); MainClass.MainWindow.ProgressStart(step2, MainClass.Languages.Translate("publish")); //progressDialog = new ProgressDialog(MainClass.Languages.Translate("publishing"),ProgressDialog.CancelButtonType.Cancel,listCombinePublish.Count,MainClass.MainWindow); progressDialog.Reset(listCombinePublish.Count,MainClass.Languages.Translate("publishing")); //} foreach(CombinePublish ccc in listCombinePublish){//listCC ){ //if (!ccc.IsSelected) continue; //Console.WriteLine(ccc.ToString()); if (cancelled) 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(MainClass.Languages.Translate("publishing"),fileName,null); devicePublishError = false; 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) && (!isJavaInstaled)){ if (((crPlatform.RuleId == (int)DeviceType.Android_1_6) || (crPlatform.RuleId == (int)DeviceType.Android_2_2)) && (!isJavaInstaled)){ SetError(MainClass.Languages.Translate("java_missing"), parentTask); 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; 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 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 = ""; 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+"&"; } } } 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; if (System.IO.Path.GetExtension(file)==".ms") continue; string checkFile =file; if (System.IO.Path.GetExtension(file)==".msc") checkFile = System.IO.Path.ChangeExtension(file,".ms"); string fileUpdate = FileUtility.AbsoluteToRelativePath(MainClass.Workspace.RootDirectory ,checkFile); 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)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)){ goto nav; } } } } } nav1: fileUpdate = FileUtility.AbsoluteToRelativePath(project.AbsolutProjectDir,file); fileUpdate = FileUtility.TrimStartingDotCharacter(fileUpdate); fileUpdate = FileUtility.TrimStartingDirectorySeparator(fileUpdate); filesForPublish.Add(fileUpdate); nav:; } dvc.Includes.Files = filesForPublish.ToArray(); dvc.Output_Name = fileName; dvc.PublishPropertisFull = new List<PublishProperty>(); foreach(PublishProperty pp in dvc.PublishPropertisMask){ PublishProperty ppFull = new PublishProperty(pp.PublishName); ppFull.PublishValue = project.ConvertProjectMaskPathToFull(pp.PublishValue); dvc.PublishPropertisFull.Add(ppFull); } /*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.Includes.Files 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();//GenerateJson(dvc); 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); //isPublishError = true; 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(MainClass.Platform.IsMac){ ExitPublish(null,null); } if(devicePublishError){ allPublishError = true; parentTask.Message =MainClass.Languages.Translate("publish_error"); //Console.WriteLine(parentTask.Child.Message); output.Add(parentTask); stateTask = StateEnum.ERROR; } else{ parentTask.Message = MainClass.Languages.Translate("publish_successfully_done"); output.Add(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); stateTask = StateEnum.ERROR; isPublishError = true; //output.Add(new TaskMessage(MainClass.Languages.Translate("publish_error"),dvc.Platform.Specific,null)); }*/ MainClass.MainWindow.ProgressStep(); if (progressDialog != null) cancelled = progressDialog.Update (fileName ); } MainClass.MainWindow.ProgressEnd(); if (progressDialog != null){ progressDialog.Destroy(); } RestoreBackup(hashAppPath,bakAppPath); 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"), s); return false; } else { this.stateTask = StateEnum.OK; ShowInfo(MainClass.Languages.Translate("publish_successfully_done"), ""); if(MainClass.Settings.OpenOutputAfterPublish){ if (!String.IsNullOrEmpty(project.ProjectOutput)){ MainClass.Tools.OpenFolder(project.OutputMaskToFullPath); } } return true; } /*if(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"), s); return false; } else { ShowInfo(MainClass.Languages.Translate("publish_successfully_done"), ""); if(MainClass.Settings.OpenOutputAfterPublish){ if (!String.IsNullOrEmpty(project.ProjectOutput)){ MainClass.Tools.OpenFolder(project.OutputMaskToFullPath); } } return true; }*/ }
/* private void FillSkinComboNew(string path) { if (!Directory.Exists(path)) return; DirectoryInfo di = new DirectoryInfo(path); if (di == null) return; int i = 0; Gtk.TreeIter iter2 = skinListStore.AppendValues("", ""); cbSkin.SetActiveIter(iter2); try { di.GetDirectories(); }catch(Exception ex){ Tool.Logger.Error(ex.Message,null); Tool.Logger.Error("SKIN directory {0} in Workspace {1} is invalid!",path,MainClass.Workspace.Name); return; } foreach (DirectoryInfo d in di.GetDirectories()) { int indx = -1; indx = MainClass.Settings.IgnoresFolders.FindIndex(x => x.Folder == d.Name && x.IsForIde); //if (!d.Name.StartsWith(".")) { if (indx > -1) continue;//if (!d.Name.StartsWith(".")) if (dpd.Device.Includes.Skin.Name == d.Name) { Gtk.TreeIter iter = skinListStore.AppendValues(d.Name, d.FullName); cbSkin.SetActiveIter(iter); i++; } else skinListStore.AppendValues(d.Name, d.FullName); } if (i == 0) cbSkin.Active = i; } private void FillSkinComboOld(string path) { if (!Directory.Exists(path)) return; DirectoryInfo di = new DirectoryInfo(path); if (di == null) return; int i = 0; Gtk.TreeIter iter2 = skinListStore.AppendValues("", ""); cbSkin.SetActiveIter(iter2); try { di.GetDirectories(); }catch(Exception ex){ Tool.Logger.Error(ex.Message,null); Tool.Logger.Error("SKIN directory {0} in Workspace {1} is invalid!",path,MainClass.Workspace.Name); return; } foreach (DirectoryInfo d in di.GetDirectories()) { int indx = -1; indx = MainClass.Settings.IgnoresFolders.FindIndex(x => x.Folder == d.Name && x.IsForIde); //if (!d.Name.StartsWith(".")) { if (indx > -1) continue;//if (!d.Name.StartsWith(".")) if (dpd.Device.Includes.Skin.Name == d.Name) { Gtk.TreeIter iter = skinListStore.AppendValues(d.Name, d.FullName); cbSkin.SetActiveIter(iter); i++; } else skinListStore.AppendValues(d.Name, d.FullName); } if (i == 0) cbSkin.Active = i; } void OnComboSkinChanged(object o, EventArgs args) { ComboBox combo = o as ComboBox; if (o == null) return; TreeIter iter; if (combo.GetActiveIter(out iter)) { string skin = (string)combo.Model.GetValue(iter, 0); themeListStore.Clear(); if (String.IsNullOrEmpty(skin)) return; string stringTheme = ""; if(dpd.Project.NewSkin){ string skinDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, MainClass.Settings.SkinDir); stringTheme = System.IO.Path.Combine(skinDir,skin); stringTheme = System.IO.Path.Combine(stringTheme, "themes");//".themes"); } else { stringTheme = System.IO.Path.Combine(dpd.Project.AbsolutProjectDir, MainClass.Settings.ThemeDir);//".themes"); } if (!Directory.Exists(stringTheme)) return; DirectoryInfo di = new DirectoryInfo(stringTheme); int i = 0; bool isSelected = false; DirectoryInfo[] dirInfos;// = di.GetDirectories(skin + ".*"); if(dpd.Project.NewSkin){ dirInfos = di.GetDirectories(); } else { Gtk.TreeIter iter2 = themeListStore.AppendValues("", ""); cbTheme.SetActiveIter(iter2); // po starom vybereme "nic" isSelected = true; dirInfos = di.GetDirectories(skin + ".*"); } foreach (DirectoryInfo d in dirInfos) { int indx = -1; indx = MainClass.Settings.IgnoresFolders.FindIndex(x => x.Folder == d.Name && x.IsForIde); //if (!d.Name.StartsWith(".")) { if (indx > -1) continue; // po novom predvybereme default if(!isSelected && dpd.Project.NewSkin){ if(d.Name == "default"){ Gtk.TreeIter iter3 = themeListStore.AppendValues(d.Name, d.FullName); cbTheme.SetActiveIter(iter3); continue; } } if (dpd.Device.Includes.Skin.Theme == d.Name) { Gtk.TreeIter iter4 = themeListStore.AppendValues(d.Name, d.FullName); cbTheme.SetActiveIter(iter4); isSelected = true; } else themeListStore.AppendValues(d.Name, d.FullName); i++; } } } */ /* void OnComboSkinChangedOld(object o, EventArgs args) { ComboBox combo = o as ComboBox; if (o == null) return; TreeIter iter; if (combo.GetActiveIter(out iter)) { string skin = (string)combo.Model.GetValue(iter, 0); themeListStore.Clear(); if (String.IsNullOrEmpty(skin)) return; string stringTheme = System.IO.Path.Combine(dpd.Project.AbsolutProjectDir, MainClass.Settings.ThemeDir);//".themes"); if (!Directory.Exists(stringTheme)) return; DirectoryInfo di = new DirectoryInfo(stringTheme); int i = 0; Gtk.TreeIter iter2 = themeListStore.AppendValues("", ""); cbTheme.SetActiveIter(iter2); foreach (DirectoryInfo d in di.GetDirectories(skin + ".*")) { if (dpd.Device.Includes.Skin.Theme == d.Name) { Gtk.TreeIter iter3 = themeListStore.AppendValues(d.Name, d.FullName); cbTheme.SetActiveIter(iter3); } else themeListStore.AppendValues(d.Name, d.FullName); i++; } } } */ public void StoreTable(Gtk.Container parent) { foreach (Widget w in parent.Children ){ //Console.WriteLine(w.Name); if (w is Gtk.Container) { Gtk.Container container = w as Gtk.Container; StoreTable(container); } switch (w.Name) { case Project.KEY_SPLASH: case Project.KEY_SPLASH_BADA1: case Project.KEY_SPLASH_BADA2: case Project.KEY_SPLASH_BADA3: case Project.KEY_MANIFEST: case Project.KEY_APPLICATIONFILE: case Project.KEY_ICON: case Project.KEY_ICON_BADA1 : case Project.KEY_ICON_BADA2 : case Project.KEY_ICON_BADA3 : case Project.KEY_CERTIFICATE: case Project.KEY_KEYSTORE: case Project.KEY_KEY: case Project.KEY_IP4ICON : case Project.KEY_IP4SPLASH : case Project.KEY_IP5SPLASH : case Project.KEY_IPADICON : case Project.KEY_IPADSPLASH : case Project.KEY_INEWPADICON : case Project.KEY_INEWPADSPLASH : /*case Project.KEY_ICON3GS: case Project.KEY_ICON4: case Project.KEY_ICONPAD: case Project.KEY_SPLASH3GS: case Project.KEY_SPLASH4: case Project.KEY_SPLASHPAD:*/ { string file = (w as FileMaskEntry).Path; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask,w.Name);//dpd.Device.PublishPropertis.Find(x=>x.PublishName == Project.KEY_ICON);// if (pp == null){ pp = new PublishProperty(w.Name); dpd.Device.PublishPropertisMask.Add(pp); } pp.PublishValue = file; if(w.Name == Project.KEY_IP4ICON){ PublishProperty pp5 = FindPublishProperty(dpd.Device.PublishPropertisMask,Project.KEY_IP5ICON); if(pp5 != null){ pp5.PublishValue = file; } } break; } case Project.KEY_IP5ICON :{ PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask,w.Name);//dpd.Device.PublishPropertis.Find(x=>x.PublishName == Project.KEY_ICON);// if (pp == null){ pp = new PublishProperty(w.Name); dpd.Device.PublishPropertisMask.Add(pp); } PublishProperty pp4 = FindPublishProperty(dpd.Device.PublishPropertisMask,Project.KEY_IP4ICON); if(pp4 != null){ pp.PublishValue = pp4.PublishValue; } break; } /*case Project.KEY_SPLASH: case Project.KEY_MANIFEST: case Project.KEY_APPLICATIONFILE: case Project.KEY_ICON:{ string file = (w as FileEntry).Path; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask,w.Name);//dpd.Device.PublishPropertis.Find(x=>x.PublishName == Project.KEY_ICON);// if (pp == null){ pp = new PublishProperty(w.Name); dpd.Device.PublishPropertisMask.Add(pp); } pp.PublishValue = file; break; }*/ case Project.KEY_PASSWORD: case Project.KEY_STOREPASSWORD: case Project.KEY_ALIAS: case Project.KEY_KEYPASSWORD: { string text = (w as Entry).Text; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask,w.Name); if (pp == null){ pp = new PublishProperty(w.Name); dpd.Device.PublishPropertisMask.Add(pp); } pp.PublishValue = text; break; } case Project.KEY_PERMISSION: { string text = (w as PermissionButton).Permission; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask,w.Name); if (pp == null){ pp = new PublishProperty(w.Name); dpd.Device.PublishPropertisMask.Add(pp); } pp.PublishValue = text; break; } case Project.KEY_BUNDLEIDENTIFIER:{ string text = (w as Entry).Text; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask,w.Name); if (pp == null){ pp = new PublishProperty(w.Name); dpd.Device.PublishPropertisMask.Add(pp); } string txt = MainClass.Tools.RemoveDiacritics(text); txt = Regex.Replace(txt, @"[^A-Za-z\.]", ""); pp.PublishValue = txt; break; } case Project.KEY_INSTALLOCATION: case Project.KEY_SUPPORTEDDEVICES: case Project.KEY_CODESIGNINGIDENTITY: { //string text = (w as ComboBox). ActiveText; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask,w.Name); if (pp == null){ pp = new PublishProperty(w.Name); dpd.Device.PublishPropertisMask.Add(pp); }; TreeIter ti = new TreeIter(); if( !(w as ComboBox).GetActiveIter(out ti) ) { pp.PublishValue = ""; break;//return; } string text = (w as ComboBox).Model.GetValue(ti,1).ToString(); pp.PublishValue = text; break; } case Project.KEY_APPLICATIONID:{ string text = (w as EntryMenu).LabelText; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask,w.Name); if (pp == null){ pp = new PublishProperty(w.Name); dpd.Device.PublishPropertisMask.Add(pp); } pp.PublishValue = text; break; } } } }
public DeviceWidget(DevicePropertyData dpd,Gtk.Window parent) { parentWindow = parent; this.dpd = dpd; this.Build(); skinThemeControl = new SkinThemeControl(); //table2.Attach(skinThemeControl,0,1,0,1,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Expand,0,0); /*this.WidthRequest = 650; this.HeightRequest = 500;*/ hbox1.PackStart(skinThemeControl,true,true,0); //table2.Attach(skinThemeControl,0,2,0,1,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Expand,0,0); if(dpd.Device.Devicetype == DeviceType.iOS_5_0) GetIdentify(); skinThemeControl.SetLabelWidth(115); skinThemeControl.SetDevice(dpd.Device); this.dpd.Project.GenerateDevices(); switch (dpd.Device.Devicetype) { //switch ((DeviceType)dpd.Device.TargetPlatformId) { case DeviceType.Android_1_6:{ table2.NRows = table2.NRows+5; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_ICON)); GenerateFileMaskEntry(ref table2,Project.KEY_ICON,MainClass.Languages.Translate("icon"),pp.PublishValue,1); //GenerateFileEntry pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH)); GenerateFileMaskEntry(ref table2,Project.KEY_SPLASH,MainClass.Languages.Translate("splash"),pp.PublishValue,2); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_BUNDLEIDENTIFIER); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_BUNDLEIDENTIFIER)); GenerateBundleEntry(ref table2,Project.KEY_BUNDLEIDENTIFIER,MainClass.Languages.Translate("bundleIdentifier"),pp.PublishValue,3); Gtk.Expander expanderAndr16 = new Expander("Android signing"); Table tblAndr16 = new Table(4,2,false); tblAndr16.RowSpacing = 3; expanderAndr16.Add(tblAndr16); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_KEYSTORE); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_KEYSTORE)); GenerateFileMaskEntry(ref tblAndr16,Project.KEY_KEYSTORE,MainClass.Languages.Translate("keystore")+" ",pp.PublishValue,0); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_STOREPASSWORD); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_STOREPASSWORD)); GenerateEntry(ref tblAndr16,Project.KEY_STOREPASSWORD,MainClass.Languages.Translate("storepassword")+" ",pp.PublishValue,1); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ALIAS); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_ALIAS)); GenerateEntry(ref tblAndr16,Project.KEY_ALIAS,MainClass.Languages.Translate("alias")+" ",pp.PublishValue,2); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_KEYPASSWORD); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_KEYPASSWORD)); GenerateEntry(ref tblAndr16,Project.KEY_KEYPASSWORD,MainClass.Languages.Translate("keypassword")+" ",pp.PublishValue,3); // table2.Attach(expanderAndr16,0,2,6,7,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Shrink,0,0); expanderAndr16.ShowAll(); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SUPPORTEDDEVICES); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_SUPPORTEDDEVICES)); GenerateComboBox(ref table2,Project.KEY_SUPPORTEDDEVICES,MainClass.Languages.Translate("supportedDevices"),pp.PublishValue,5,MainClass.Settings.AndroidSupportedDevices,true); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_PERMISSION); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_PERMISSION)); GeneratePermissionEditor(ref table2,Project.KEY_PERMISSION,MainClass.Languages.Translate("permisions"),pp.PublishValue,6); break; } case DeviceType.Android_2_2:{ if ((MainClass.Settings.InstallLocations == null) || ((MainClass.Settings.InstallLocations.Count <1 )) ){ MainClass.Settings.GenerateInstallLocation(); } table2.NRows = table2.NRows+6; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_ICON)); GenerateFileMaskEntry(ref table2,Project.KEY_ICON,MainClass.Languages.Translate("icon"),pp.PublishValue,1); //GenerateFileEntry pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH)); GenerateFileMaskEntry(ref table2,Project.KEY_SPLASH,MainClass.Languages.Translate("splash"),pp.PublishValue,2); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_BUNDLEIDENTIFIER); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_BUNDLEIDENTIFIER)); GenerateBundleEntry(ref table2,Project.KEY_BUNDLEIDENTIFIER,MainClass.Languages.Translate("bundleIdentifier"),pp.PublishValue,3); Gtk.Expander expanderAndr22 = new Expander("Android signing"); Table tblAndr22 = new Table(4,2,false); tblAndr22.RowSpacing = 3; expanderAndr22.Add(tblAndr22); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_KEYSTORE); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_KEYSTORE)); GenerateFileMaskEntry(ref tblAndr22,Project.KEY_KEYSTORE,MainClass.Languages.Translate("keystore")+" ",pp.PublishValue,0); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_STOREPASSWORD); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_STOREPASSWORD)); GenerateEntry(ref tblAndr22,Project.KEY_STOREPASSWORD,MainClass.Languages.Translate("storepassword")+" ",pp.PublishValue,1); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ALIAS); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_ALIAS)); GenerateEntry(ref tblAndr22,Project.KEY_ALIAS,MainClass.Languages.Translate("alias")+" ",pp.PublishValue,2); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_KEYPASSWORD); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_KEYPASSWORD)); GenerateEntry(ref tblAndr22,Project.KEY_KEYPASSWORD,MainClass.Languages.Translate("keypassword")+" ",pp.PublishValue,3); table2.Attach(expanderAndr22,0,2,6,7,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Shrink,0,0); expanderAndr22.ShowAll(); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SUPPORTEDDEVICES); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_SUPPORTEDDEVICES)); GenerateComboBox(ref table2,Project.KEY_SUPPORTEDDEVICES,MainClass.Languages.Translate("supportedDevices"),pp.PublishValue,5,MainClass.Settings.AndroidSupportedDevices,true); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_INSTALLOCATION); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_INSTALLOCATION)); GenerateComboBox(ref table2,Project.KEY_INSTALLOCATION,MainClass.Languages.Translate("installLocation"),pp.PublishValue,6,MainClass.Settings.InstallLocations,false); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_PERMISSION); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_PERMISSION)); GeneratePermissionEditor(ref table2,Project.KEY_PERMISSION,MainClass.Languages.Translate("permisions"),pp.PublishValue,7); break; } case DeviceType.Bada_1_0: case DeviceType.Bada_1_1: case DeviceType.Bada_1_2: case DeviceType.Bada_2_0:{ table2.NRows = table2.NRows+5; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_ICON)); GenerateFileMaskEntry(ref table2,Project.KEY_ICON,MainClass.Languages.Translate("icon"),pp.PublishValue,1); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH)); GenerateFileMaskEntry(ref table2,Project.KEY_SPLASH,MainClass.Languages.Translate("splash"),pp.PublishValue,2); /*PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON_BADA1); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_ICON_BADA1)); GenerateFileMaskEntry(ref table1,Project.KEY_ICON_BADA1,MainClass.Languages.Translate("icon_f1", "100x96"),pp.PublishValue,1); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH_BADA1); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH_BADA1)); GenerateFileMaskEntry(ref table1,Project.KEY_SPLASH_BADA1,MainClass.Languages.Translate("splash_f1","480x800"),pp.PublishValue,2); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON_BADA2); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_ICON_BADA2)); GenerateFileMaskEntry(ref table1,Project.KEY_ICON_BADA2,MainClass.Languages.Translate("icon_f1","50x47"),pp.PublishValue,3); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH_BADA2); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH_BADA2)); GenerateFileMaskEntry(ref table1,Project.KEY_SPLASH_BADA2,MainClass.Languages.Translate("splash_f1","240x400"),pp.PublishValue,4); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON_BADA3); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_ICON_BADA3)); GenerateFileMaskEntry(ref table1,Project.KEY_ICON_BADA3,MainClass.Languages.Translate("icon_f1","50x50"),pp.PublishValue,xx); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH_BADA3); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH_BADA3)); GenerateFileMaskEntry(ref table1,Project.KEY_SPLASH_BADA3,MainClass.Languages.Translate("splash_f1","320x480"),pp.PublishValue,xx); */ pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_MANIFEST); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_MANIFEST)); GenerateFileMaskEntry(ref table2,Project.KEY_MANIFEST,MainClass.Languages.Translate("manifest"),pp.PublishValue,3); // break;} case DeviceType.Symbian_9_4:{ table2.NRows = table2.NRows+7; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_ICON)); GenerateFileMaskEntry(ref table2,Project.KEY_ICON,MainClass.Languages.Translate("icon"),pp.PublishValue,1); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH)); GenerateFileMaskEntry(ref table2,Project.KEY_SPLASH,MainClass.Languages.Translate("splash"),pp.PublishValue,2); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_APPLICATIONID); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_APPLICATIONID)); GenerateEntryWithMenu(ref table2,Project.KEY_APPLICATIONID,MainClass.Languages.Translate("application_id"),pp.PublishValue,3); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_CERTIFICATE); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_CERTIFICATE)); GenerateFileMaskEntry(ref table2,Project.KEY_CERTIFICATE,MainClass.Languages.Translate("certificate"),pp.PublishValue,4); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_KEY); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_KEY)); GenerateFileMaskEntry(ref table2,Project.KEY_KEY,MainClass.Languages.Translate("key"),pp.PublishValue,5); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_PASSWORD); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_PASSWORD)); GenerateEntry(ref table2,Project.KEY_PASSWORD,MainClass.Languages.Translate("password_f1"),pp.PublishValue,6); // break;} case DeviceType.iOS_5_0:{ table2.NRows = table2.NRows+10; // PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_BUNDLEIDENTIFIER); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_BUNDLEIDENTIFIER)); GenerateBundleEntry(ref table2,Project.KEY_BUNDLEIDENTIFIER,MainClass.Languages.Translate("bundleIdentifier"),pp.PublishValue,1); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_CODESIGNINGIDENTITY); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_CODESIGNINGIDENTITY)); GenerateComboBoxSigning(ref table2,Project.KEY_CODESIGNINGIDENTITY,MainClass.Languages.Translate("codeSigningIdentity"),pp.PublishValue,2,securityIOs); //GenerateComboBox(ref table1,Project.KEY_CODESIGNINGIDENTITY,MainClass.Languages.Translate("codeSigningIdentity"),pp.PublishValue,2,securityIOs); //GenerateEntry(ref table1,Project.KEY_CODESIGNINGIDENTITY,MainClass.Languages.Translate("codeSigningIdentity"),pp.PublishValue,1); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SUPPORTEDDEVICES); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp = new PublishProperty(Project.KEY_SUPPORTEDDEVICES)); GenerateComboBox(ref table2,Project.KEY_SUPPORTEDDEVICES,MainClass.Languages.Translate("supportedDevices"),pp.PublishValue,3,MainClass.Settings.OSSupportedDevices,false); // iPhone4 Gtk.Expander expanderiPh4 = new Expander("iPhone 4(S)"); Table tbliPh4 = new Table(2,2,false); tbliPh4.RowSpacing = 3; expanderiPh4.Add(tbliPh4); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_IP4ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_IP4ICON)); GenerateFileMaskEntry(ref tbliPh4,Project.KEY_IP4ICON,"Icon : ",pp.PublishValue,0,true,MainClass.Languages.Translate("property_ios_icon",114,114)); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_IP4SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_IP4SPLASH)); GenerateFileMaskEntry(ref tbliPh4,Project.KEY_IP4SPLASH,"Splash : ",pp.PublishValue,1,MainClass.Languages.Translate("property_ios_splash",640,960)); table2.Attach(expanderiPh4,0,2,6,7,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Shrink,0,0); expanderiPh4.ShowAll(); // iPhone5 Gtk.Expander expanderiPh5 = new Expander("iPhone 5"); Table tbliPh5 = new Table(4,2,false); tbliPh5.RowSpacing = 3; expanderiPh5.Add(tbliPh5); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_IP5ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_IP5ICON)); GenerateFileMaskEntry(ref tbliPh5,Project.KEY_IP5ICON,"Icon : ",MainClass.Languages.Translate("property_ios_icon_4s"),0,false,MainClass.Languages.Translate("property_ios_icon",114,114)); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_IP5SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_IP5SPLASH)); GenerateFileMaskEntry(ref tbliPh5,Project.KEY_IP5SPLASH,"Splash : ",pp.PublishValue,1,MainClass.Languages.Translate("property_ios_splash",640,1136)); table2.Attach(expanderiPh5,0,2,7,8,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Shrink,0,0); expanderiPh5.ShowAll(); // iPad2 Gtk.Expander expanderiPd2 = new Expander("iPad 2"); Table tbliPd2 = new Table(4,2,false); tbliPd2.RowSpacing = 3; expanderiPd2.Add(tbliPd2); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_IPADICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_IPADICON)); GenerateFileMaskEntry(ref tbliPd2,Project.KEY_IPADICON,"Icon : ",pp.PublishValue,0,MainClass.Languages.Translate("property_ios_icon",72,72)); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_IPADSPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_IPADSPLASH)); GenerateFileMaskEntry(ref tbliPd2,Project.KEY_IPADSPLASH,"Splash : ",pp.PublishValue,1,MainClass.Languages.Translate("property_ios_splash",768,1004)); table2.Attach(expanderiPd2,0,2,8,9,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Shrink,0,0); expanderiPh5.ShowAll(); // new iPad Gtk.Expander expanderNewiPd = new Expander("the new iPad"); Table tbliNewPd = new Table(4,2,false); tbliNewPd.RowSpacing = 3; expanderNewiPd.Add(tbliNewPd); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_INEWPADICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_INEWPADICON)); GenerateFileMaskEntry(ref tbliNewPd,Project.KEY_INEWPADICON,"Icon : ",pp.PublishValue,0,MainClass.Languages.Translate("property_ios_icon",144,144)); pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_INEWPADSPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_INEWPADSPLASH)); GenerateFileMaskEntry(ref tbliNewPd,Project.KEY_INEWPADSPLASH,"Splash : ",pp.PublishValue,1,MainClass.Languages.Translate("property_ios_splash",1536,2008)); table2.Attach(expanderNewiPd,0,2,9,10,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Shrink,0,0); expanderiPh5.ShowAll(); break; } case DeviceType.PocketPC_2003SE: case DeviceType.WindowsMobile_5: case DeviceType.WindowsMobile_6:{ table2.NRows = table2.NRows+3; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_ICON)); GenerateFileMaskEntry(ref table2,Project.KEY_ICON,MainClass.Languages.Translate("icon"),pp.PublishValue,1); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH)); GenerateFileMaskEntry(ref table2,Project.KEY_SPLASH,MainClass.Languages.Translate("splash"),pp.PublishValue,2); // break; } case DeviceType.Windows:{ table2.NRows = table2.NRows+3; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_ICON)); GenerateFileMaskEntry(ref table2,Project.KEY_ICON,MainClass.Languages.Translate("icon"),pp.PublishValue,1); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH)); GenerateFileMaskEntry(ref table2,Project.KEY_SPLASH,MainClass.Languages.Translate("splash"),pp.PublishValue,2); // break; } case DeviceType.MacOs:{ table2.NRows = table2.NRows+3; PublishProperty pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_ICON); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_ICON)); GenerateFileMaskEntry(ref table2,Project.KEY_ICON,MainClass.Languages.Translate("icon"),pp.PublishValue,1); // pp = FindPublishProperty(dpd.Device.PublishPropertisMask, Project.KEY_SPLASH); if (pp == null) dpd.Device.PublishPropertisMask.Add(pp =new PublishProperty(Project.KEY_SPLASH)); GenerateFileMaskEntry(ref table2,Project.KEY_SPLASH,MainClass.Languages.Translate("splash"),pp.PublishValue,2); // break; } default:{ break; } } nvFonts.Model = fontListStore; CellRendererToggle crt = new CellRendererToggle(); crt.Activatable = true; crt.Toggled += delegate(object o, ToggledArgs args) { TreeIter iter; if (fontListStore.GetIter (out iter, new TreePath(args.Path))) { bool old = (bool) fontListStore.GetValue(iter,2); string font = (string) fontListStore.GetValue(iter,4); //CombinePublish cp =(CombinePublish) fontListStore.GetValue(iter,2); //cp.IsSelected = !old; if(old) fonts.Remove(font); else fonts.Add(font); fontListStore.SetValue(iter,2,!old); } }; nvFonts.AppendColumn("", crt , "active", 2); nvFonts.AppendColumn(MainClass.Languages.Translate("name"), new Gtk.CellRendererText(), "text", 0); //nvFonts.AppendColumn(MainClass.Languages.Translate("path"), new Gtk.CellRendererText(), "text", 1); nvFonts.AppendColumn(MainClass.Languages.Translate("location"), new Gtk.CellRendererText(), "text", 3); //nvFonts.Columns [1].Visible = false; string[] listFont = Directory.GetFiles(MainClass.Workspace.RootDirectory, "*.ttf"); // fonty z projektoveho adresara string[] listFontProject = Directory.GetFiles(dpd.Project.AbsolutProjectDir, "*.ttf"); if(MainClass.Platform.IsMac){ // for Mac UpperCase string[] listFont2 = Directory.GetFiles(MainClass.Workspace.RootDirectory, "*.TTF"); var list = new List<string>(); list.AddRange(listFont); list.AddRange(listFont2); listFont = list.ToArray(); string[] listFontProject2 = Directory.GetFiles(dpd.Project.AbsolutProjectDir, "*.TTF"); list = new List<string>(); list.AddRange(listFontProject); list.AddRange(listFontProject2); listFontProject = list.ToArray(); } if(dpd.Device != null && (dpd.Device.Includes!= null) && (dpd.Device.Includes.Fonts != null)){ fonts = new List<string>(dpd.Device.Includes.Fonts); // odobratie neplatnich fontov - ak je nastaveny a nieje vo workspace - alebo v projektovom adresary List<string> fontsTmp = new List<string>(listFont); List<string> fontsTmpPrj = new List<string>(listFontProject); foreach (string fi in dpd.Device.Includes.Fonts) { int strFontWorks = fontsTmp.FindIndex(x=>System.IO.Path.GetFileName(x) == fi); string tmp =fi; tmp = tmp.Replace('/',System.IO.Path.DirectorySeparatorChar); tmp = tmp.Replace('\\',System.IO.Path.DirectorySeparatorChar); int strFontPrj =fontsTmpPrj.FindIndex(x=> System.IO.Path.Combine(dpd.Project.ProjectName,System.IO.Path.GetFileName(x)) == tmp); if (strFontWorks<0 && strFontPrj<0) fonts.Remove(fi); } } else fonts = new List<string>(); Gtk.TreeIter firstSelectedTI = new Gtk.TreeIter(); bool scrollToIter = false; foreach (string fi in listFont) { string fontname = System.IO.Path.GetFileName(fi); // ak obsahuje font v nazve medzeru nepouzije sa if(fontname.Contains(" ") ){ MainClass.MainWindow.OutputConsole.WriteError("IGNORE FONT : '"+fontname+"' Invalid name contains a spacenvalid name contains a space \n"); continue; } bool isSelect = false; int strNumber = fonts.FindIndex(x=>x == fontname); if (strNumber>-1) isSelect = true; if(isSelect && !scrollToIter){ scrollToIter = true; firstSelectedTI =fontListStore.AppendValues(System.IO.Path.GetFileName(fi), fi,isSelect,MainClass.Languages.Translate("location_workspace"),System.IO.Path.GetFileName(fi)); } else { fontListStore.AppendValues(System.IO.Path.GetFileName(fi), fi,isSelect,MainClass.Languages.Translate("location_workspace"),System.IO.Path.GetFileName(fi)); } } foreach (string fi in listFontProject) { string fontname = System.IO.Path.GetFileName(fi); // ak obsahuje font v nazve medzeru nepouzije sa if(fontname.Contains(" ") ){ MainClass.MainWindow.OutputConsole.WriteError("IGNORE FONT : '"+fontname+"' Invalid name contains a spacenvalid name contains a space"); continue; } bool isSelect = false; string fontPath = System.IO.Path.Combine(dpd.Project.ProjectName,System.IO.Path.GetFileName(fi)); //string fontPath = System.IO.Path.GetFileName(fi); string tmp =fi; tmp = tmp.Replace('/',System.IO.Path.DirectorySeparatorChar); tmp = tmp.Replace('\\',System.IO.Path.DirectorySeparatorChar); int strNumber = fonts.FindIndex(x=> x.Replace('/',System.IO.Path.DirectorySeparatorChar).Replace('\\',System.IO.Path.DirectorySeparatorChar) == fontPath); if (strNumber>-1) isSelect = true; if(isSelect && !scrollToIter){ scrollToIter = true; firstSelectedTI =fontListStore.AppendValues(System.IO.Path.GetFileName(fi), fi,isSelect,MainClass.Languages.Translate("location_application"),fontPath); } else{ fontListStore.AppendValues(System.IO.Path.GetFileName(fi), fi,isSelect,MainClass.Languages.Translate("location_application"),fontPath); } } if(scrollToIter){ TreePath path = fontListStore.GetPath(firstSelectedTI); nvFonts.ScrollToCell(path,null, false, 0, 0); } skinThemeControl.ShowAll(); //ShowWidget(); /* Gtk.CellRendererText textRenderer2 = new Gtk.CellRendererText(); cbTheme.PackStart(textRenderer2, true); //cbTheme.AddAttribute(textRenderer2, "text", 0); cbTheme.Model = themeListStore; Gtk.CellRendererText textRenderer = new Gtk.CellRendererText(); cbSkin.PackStart(textRenderer, true); //cbSkin.AddAttribute(textRenderer, "text", 0); cbSkin.Model = skinListStore; cbSkin.Changed += new EventHandler(OnComboSkinChanged); if(dpd.Project.NewSkin){ string skinDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, MainClass.Settings.SkinDir); //cbSkin.Changed += new EventHandler(OnComboSkinChangedNew); FillSkinComboNew(skinDir); }*/ }