PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/settings/Settings.cs

https://github.com/moscrif/ide
C# | 941 lines | 658 code | 194 blank | 89 comment | 98 complexity | 78d73bf496203dd4e71179babb7ceed6 MD5 | raw file
  1. using System;
  2. using System.Linq;
  3. using System.Xml;
  4. using System.Xml.Serialization;
  5. using System.Collections.Generic;
  6. using System.IO;
  7. using Moscrif.IDE.Iface.Entities;
  8. using Moscrif.IDE.Iface;
  9. namespace Moscrif.IDE.Option
  10. {
  11. public class Settings
  12. {
  13. private static Paths paths = new Paths();
  14. private List<string> projectMaskDirectory;
  15. private List<string> workspaceMaskDirectory;
  16. #region Public Property
  17. [XmlIgnore]
  18. public string FilePath
  19. {
  20. get;
  21. set;
  22. }
  23. [XmlAttribute("currentWorkspace")]
  24. public string CurrentWorkspace ;
  25. [XmlAttribute("precompile")]
  26. public bool PreCompile = true;
  27. [XmlAttribute("autoselectProject")]
  28. public bool AutoSelectProject = true;
  29. [XmlAttribute("openLastOpenedWorkspace")]
  30. public bool OpenLastOpenedWorkspace = true;
  31. [XmlAttribute("rssUrl")]
  32. public string RssUrl = "http://moscrif.com/rss/news";//"http://moscrif.com/rss/news.ashx?source=IDE";
  33. [XmlAttribute("tweetUrl")]
  34. public string TweetUrl = "http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=mothiva";
  35. [XmlAttribute("tweetBaseUrl")]
  36. public string TweetBaseUrl = "http://twitter.com/mothiva/statuses/" ;
  37. [XmlAttribute("maxRssTweetMessageCount")]
  38. public int MaxRssTweetMessageCount =3;
  39. [XmlAttribute("stopCompilationOnError")]
  40. public bool FirstErrorStopCompile = false;
  41. [XmlAttribute("bringErrorPaneToFront")]
  42. public bool ShowErrorPane = true;
  43. //[XmlAttribute("loggAllStep")]
  44. [XmlIgnore]
  45. public bool LoggAllStep = true;
  46. [XmlAttribute("publishDir")]
  47. public string PublishDirectory = System.IO.Path.Combine(paths.AppPath,"publish");//@"\work\moscrif-publish\";
  48. [XmlAttribute("frameworkDir")]
  49. public string LibDirectory = System.IO.Path.Combine(paths.AppPath,"framework");//@"\work\moscrif-lib\";
  50. [XmlAttribute("emulatorDir")]
  51. public string EmulatorDirectory = paths.AppPath;//@"\work\moscrif-publish\";
  52. [XmlAttribute("socetServerPort")]
  53. public string SocetServerPort = "4321";
  54. [XmlAttribute("projectCount")]
  55. public int ProjectCount = 1;
  56. [XmlAttribute("workspaceCount")]
  57. public int WorkspaceCount = 1;
  58. [XmlElement("remoteIpAdress")]
  59. public string RemoteIpAdress ;
  60. [XmlElement("samplesBaseUrl")]
  61. public string SamplesBaseUrl = "http://moscrif.com/samples?source=IDE" ;
  62. [XmlElement("showcaseBaseUrl")]
  63. public string ShowcaseBaseUrl = "http://moscrif.com/showcase?source=IDE" ;
  64. [XmlElement("apiBaseUrl")]
  65. public string ApiBaseUrl = "http://moscrif.com/userfiles/pages/developer/api/index.html" ;
  66. [XmlElement("videosBaseUrl")]
  67. public string VideosBaseUrl = "http://moscrif.com/videos?source=IDE" ;
  68. [XmlElement("tutorialsBaseUrl")]
  69. public string TutorialsBaseUrl = "http://moscrif.com/tutorials?source=IDE" ;
  70. [XmlElement("demosBaseUrl")]
  71. public string DemosBaseUrl = "http://moscrif.com/demos?source=IDE" ;
  72. [XmlElement("documentsBaseUrl")]
  73. public string DocumentsBaseUrl = "http://moscrif.com/documents?source=IDE" ;
  74. /*#if DEBUG
  75. [XmlIgnore]
  76. public String signUrl = "http://rc.moscrif.com/ide/signApp.ashx?t={0}&a={1}";
  77. [XmlIgnore]
  78. public String checkVersion = "http://rc.moscrif.com/ide/signApp.ashx?v={0}";
  79. [XmlIgnore]
  80. public String checkVersionLog = "http://rc.moscrif.com/ide/signApp.ashx?v={0}&t={1}";
  81. [XmlIgnore]
  82. public String getVersion = "http://rc.moscrif.com/ide/getVersion.ashx?v={0}";
  83. [XmlIgnore]
  84. public String getVersionLog = "http://rc.moscrif.com/ide/getVersion.ashx?v={0}&t={1}";
  85. [XmlIgnore]
  86. public String redgisterUrl = "http://rc.moscrif.com/ide/registerLogin.ashx";
  87. [XmlIgnore]
  88. public String pingUrl = "http://rc.moscrif.com/ide/ping.ashx";
  89. [XmlIgnore]
  90. public String loggUrl = "http://rc.moscrif.com/ide/analytics.ashx";
  91. [XmlIgnore]
  92. public String loginUrl = "http://rc.moscrif.com/ide/checkLogin.ashx";
  93. [XmlIgnore]
  94. public String feedbackUrl = "http://rc.moscrif.com/ide/reportIssue.ashx";
  95. [XmlIgnore]
  96. public String bannerUrl = "http://rc.moscrif.com/ide/getBanner.ashx";
  97. [XmlIgnore]
  98. public String licenceUrl = "http://rc.moscrif.com/ide/getLicenses.ashx";
  99. */
  100. //#else
  101. [XmlIgnore]
  102. public String signUrl = "http://moscrif.com/ide/signApp.ashx?t={0}&a={1}";
  103. [XmlIgnore]
  104. public String checkVersion = "http://moscrif.com/ide/signApp.ashx?v={0}";
  105. [XmlIgnore]
  106. public String checkVersionLog = "http://moscrif.com/ide/signApp.ashx?v={0}&t={1}";
  107. [XmlIgnore]
  108. public String getVersion = "http://moscrif.com/ide/getVersion.ashx?v={0}";
  109. [XmlIgnore]
  110. public String getVersionLog = "http://moscrif.com/ide/getVersion.ashx?v={0}&t={1}";
  111. [XmlIgnore]
  112. public String redgisterUrl = "http://moscrif.com/ide/registerLogin.ashx";
  113. [XmlIgnore]
  114. public String pingUrl = "http://moscrif.com/ide/ping.ashx";
  115. [XmlIgnore]
  116. public String loggUrl = "http://moscrif.com/ide/analytics.ashx";
  117. [XmlIgnore]
  118. public String loginUrl = "http://moscrif.com/ide/checkLogin.ashx";
  119. [XmlIgnore]
  120. public String feedbackUrl = "http://moscrif.com/ide/reportIssue.ashx";
  121. [XmlIgnore]
  122. public String bannerUrl = "http://moscrif.com/ide/getBanner.ashx";
  123. [XmlIgnore]
  124. public String licenceUrl = "http://moscrif.com/ide/getLicenses.ashx";
  125. //#endif
  126. [XmlElement("backgroundColor")]
  127. public BackgroundColors BackgroundColor = null;
  128. [XmlElement("imageEditor")]
  129. public ImageEditorSetting ImageEditors = null;
  130. [XmlElement("proxy")]
  131. public ProxySetting Proxy = null;
  132. [XmlElement ("sourceEditor")]
  133. public SourceEditorSetting SourceEditorSettings = null;
  134. [XmlArrayAttribute("ignoresFolders")]
  135. [XmlArrayItem("folder")]
  136. public List<IgnoreFolder> IgnoresFolders;
  137. //public List<string> IgnoreFolders;
  138. [XmlArrayAttribute("ignoresFiles")]
  139. [XmlArrayItem("file")]
  140. public List<IgnoreFolder> IgnoresFiles;
  141. [XmlArray("logicalViews")]
  142. [XmlArrayItem("view")]
  143. public List<LogicalSystem> LogicalSort = null;
  144. [XmlArrayAttribute("extensionList")]
  145. [XmlArrayItem("extension")]
  146. public List<ExtensionSetting> ExtensionList;
  147. [XmlElement("resolution")]
  148. public Condition Resolution;
  149. [XmlElement("account")]
  150. public Account Account;
  151. [XmlElement("emulatorSettings")]
  152. public EmulatorSetting EmulatorSettings;
  153. [XmlAttribute("lastOpenedFileDir")]
  154. public string LastOpenedFileDir ;
  155. [XmlAttribute("lastOpenedWorkspaceDir")]
  156. public string LastOpenedWorkspaceDir ;
  157. [XmlAttribute("lastOpenedImportDir")]
  158. public string LastOpenedImportDir ;
  159. [XmlAttribute("lastOpenedExportDir")]
  160. public string LastOpenedExportDir ;
  161. [XmlAttribute("clearConsoleBeforeRun")]
  162. public bool ClearConsoleBeforRuning = true;
  163. [XmlAttribute("openOutputAfterPublish")]
  164. public bool OpenOutputAfterPublish= true;
  165. [XmlAttribute("consoleTaskFont")]
  166. public string ConsoleTaskFont ;
  167. [XmlAttribute("saveChangesBeforeRun")]
  168. public bool SaveChangesBeforeRun= true;
  169. [XmlAttribute("showUnsupportedDevices")]
  170. public bool ShowUnsupportedDevices= false;
  171. [XmlAttribute("showDebugDevices")]
  172. public bool ShowDebugDevices= false;
  173. [XmlArrayAttribute("displayOrientations")]
  174. [XmlArrayItem("orientation")]
  175. public List<SettingValue> DisplayOrientations;
  176. [XmlArrayAttribute("applicationType")]
  177. [XmlArrayItem("type")]
  178. public List<SettingValue> ApplicationType;
  179. //GenerateApplicationType
  180. [XmlArrayAttribute("InstallLocations")]
  181. [XmlArrayItem("location")]
  182. public List<SettingValue> InstallLocations;
  183. [XmlArrayAttribute("osSupportedDevices")]
  184. [XmlArrayItem("supportedDevices")]
  185. public List<SettingValue> OSSupportedDevices;
  186. [XmlArrayAttribute("androidSupportedDevices")]
  187. [XmlArrayItem("supportedDevices")]
  188. public List<SettingValue> AndroidSupportedDevices;
  189. [XmlArray("platformResolutions")]
  190. [XmlArrayItem("platform")]
  191. public List<PlatformResolution> PlatformResolutions = null;
  192. [XmlAttribute("javaCommand")]
  193. public string JavaCommand = "java";
  194. /*[XmlAttribute("signAllow")]
  195. public bool SignAllow = false;*/
  196. [XmlAttribute("javaArgument")]
  197. public string JavaArgument = "-version";
  198. [XmlAttribute("versionSetting")]
  199. public int VersionSetting ;
  200. [XmlAttribute("logPublish")]
  201. public bool LogPublish = false;
  202. [XmlIgnore]
  203. public List<string> WorkspaceMaskDirectory
  204. {
  205. get{
  206. if(workspaceMaskDirectory == null){
  207. workspaceMaskDirectory = new List<string>();
  208. workspaceMaskDirectory.Add("$(workspace_dir)");
  209. //workspaceMaskDirectory.Add("$(workspace_work)");
  210. }
  211. return workspaceMaskDirectory;
  212. }
  213. }
  214. [XmlIgnore]
  215. public List<string> ProjectMaskDirectory
  216. {
  217. get{
  218. if(projectMaskDirectory == null){
  219. projectMaskDirectory = new List<string>();
  220. projectMaskDirectory.Add("$(publish_dir)");
  221. projectMaskDirectory.Add("$(project_dir)");
  222. }
  223. return projectMaskDirectory;
  224. }
  225. }
  226. [XmlIgnore]
  227. public string ThemeDir = ".themes";
  228. [XmlIgnore]
  229. public string SkinDir = "uix-skin";
  230. [XmlIgnore]
  231. public Condition Platform;
  232. //private List<string> libsDefine;
  233. //[XmlArrayAttribute("libs")]
  234. //[XmlArrayItem("lib")]
  235. [XmlIgnore]
  236. public List<string> LibsDefine{
  237. get{
  238. return GenerateLibs();
  239. }
  240. }
  241. [XmlElement("symbian-unprotectedRange")]
  242. public Range UnprotectedRange;
  243. [XmlElement("symbian-protectedRange")]
  244. public Range ProtectedRange;
  245. public List<string> GetUnprotectedRange()
  246. {
  247. if (UnprotectedRange == null){
  248. UnprotectedRange = new Range();
  249. UnprotectedRange.Minimal = "0xA89FDE0E";
  250. UnprotectedRange.Maximal = "0xA89FDE21";
  251. }
  252. uint min =0xA89FDE0E;
  253. uint max =0xA89FDE21;
  254. if (!UInt32.TryParse(UnprotectedRange.Minimal, out min))
  255. min = 0xA89FDE0E;
  256. if (!UInt32.TryParse(UnprotectedRange.Maximal, out max))
  257. max = 0xA89FDE21;
  258. if(min> max){
  259. min = 0xA89FDE0E;
  260. max = 0xA89FDE21;
  261. }
  262. List<string> unprRange = new List<string>();
  263. for (uint i =min ; i <= max ;i++ ){
  264. unprRange.Add(string.Format( "0x"+"{0:X}", i));
  265. }
  266. return unprRange;
  267. }
  268. public List<string> GetProtectedRange()
  269. {
  270. if (ProtectedRange == null){
  271. ProtectedRange = new Range();
  272. ProtectedRange.Minimal = "0x20041437";
  273. ProtectedRange.Maximal = "0x2004144A";
  274. }
  275. uint min =0xA89FDE0E;
  276. uint max =0xA89FDE21;
  277. if (!UInt32.TryParse(ProtectedRange.Minimal, out min))
  278. min = 0x20041437;
  279. if (!UInt32.TryParse(ProtectedRange.Maximal, out max))
  280. max = 0x2004144A;
  281. if(min> max){
  282. min = 0x20041437;
  283. max = 0x2004144A;
  284. }
  285. List<string> unprRange = new List<string>();
  286. for (uint i = min ; i <=max ;i++ ){
  287. unprRange.Add(string.Format( "0x"+"{0:X}", i));
  288. }
  289. return unprRange;
  290. }
  291. #endregion
  292. #region RecentFiles
  293. [XmlIgnore]
  294. public RecentFiles RecentFiles
  295. {
  296. get { return recentFiles ?? (recentFiles = CreateRecentFilesProvider()); }
  297. }
  298. protected virtual RecentFiles CreateRecentFilesProvider()
  299. {
  300. return new FdoRecentFiles(System.IO.Path.Combine(paths.SettingDir, ".recently-used"));
  301. }
  302. RecentFiles recentFiles;
  303. #endregion
  304. #region FavoriteFile
  305. [XmlIgnore]
  306. public RecentFiles FavoriteFiles
  307. {
  308. get { return favoriteFiles ?? (favoriteFiles = CreateFavoriteFilesProvider()); }
  309. }
  310. protected virtual RecentFiles CreateFavoriteFilesProvider()
  311. {
  312. return new FdoRecentFiles(System.IO.Path.Combine(paths.SettingDir, ".favorite-files"));
  313. }
  314. RecentFiles favoriteFiles;
  315. #endregion
  316. public Settings()
  317. {
  318. FilePath = System.IO.Path.Combine(paths.SettingDir, "moscrif.mss");
  319. if (Platform == null) GeneratePlatform();
  320. if (Resolution == null) GenerateResolution();
  321. }
  322. public Settings(string filePath)
  323. {
  324. FilePath = filePath;
  325. if (Platform == null) GeneratePlatform();
  326. if (Resolution == null) GenerateResolution();
  327. if(Resolution.Rules[0].Width<0){
  328. GenerateResolution();
  329. }
  330. if (IgnoresFolders == null) GenerateIgnoreFolder();
  331. if (IgnoresFiles == null) GenerateIgnoreFiles();
  332. if (ExtensionList == null) GenerateExtensionList();
  333. if (DisplayOrientations == null) GenerateOrientations();
  334. if (InstallLocations == null) GenerateInstallLocation();
  335. if (OSSupportedDevices == null) GenerateOSSupportedDevices();
  336. if (PlatformResolutions == null) GeneratePlatformResolutions();
  337. if (ApplicationType == null) GenerateApplicationType();
  338. if (AndroidSupportedDevices == null) GenerateAndroidSupportedDevices();
  339. if ((EmulatorSettings == null)) EmulatorSettings = new EmulatorSetting();
  340. EmulatorSettings.UsDefault = true;
  341. //if(LibsDefine == null)) GenerateLibs();
  342. //VersionSetting = 111202;
  343. }
  344. public void SaveSettings()
  345. {
  346. try{
  347. using (FileStream fs = new FileStream(FilePath, FileMode.Create)) {
  348. XmlSerializer serializer = new XmlSerializer(typeof(Settings));
  349. serializer.Serialize(fs, this);
  350. }
  351. } catch(Exception ex){
  352. Moscrif.IDE.Tool.Logger.Error(ex.Message);
  353. }
  354. }
  355. static public Settings OpenSettings(string filePath)
  356. {
  357. if (System.IO.File.Exists(filePath)) {
  358. try {
  359. using (FileStream fs = File.OpenRead(filePath)) {
  360. XmlSerializer serializer = new XmlSerializer(typeof(Settings));
  361. Settings s = (Settings)serializer.Deserialize(fs);
  362. if ((s.EmulatorSettings == null) || ( String.IsNullOrEmpty(s.EmulatorSettings.Exec) ) ) {
  363. s.EmulatorSettings = new EmulatorSetting();
  364. s.EmulatorSettings.UsDefault = true;
  365. }
  366. if ((s.LogicalSort == null) || ((s.LogicalSort.Count <1 )) ) {
  367. s.LogicalSort = LogicalSystem.GetDefaultLogicalSystem();
  368. }
  369. if ((s.Resolution == null) || ((s.Resolution.Rules.Count <1 )) ){
  370. s.GenerateResolution();
  371. } else {
  372. if(s.Resolution.Rules[1].Width<1){
  373. s.GenerateResolution();
  374. }
  375. }
  376. if ((s.IgnoresFolders == null) || (s.IgnoresFolders.Count<1)){
  377. s.GenerateIgnoreFolder();
  378. }
  379. if((s.ExtensionList == null)||(s.ExtensionList.Count<1)){
  380. s.GenerateExtensionList();
  381. }
  382. if ((s.IgnoresFiles == null) || (s.IgnoresFiles.Count<1)){
  383. s.GenerateIgnoreFiles();
  384. }
  385. if ((s.Platform == null) || (s.Platform.Rules.Count < 1)){
  386. s.GeneratePlatform();
  387. }
  388. if ((s.DisplayOrientations == null) || ((s.DisplayOrientations.Count <1 )) ){
  389. s.GenerateOrientations();
  390. }
  391. if ((s.InstallLocations == null) || ((s.InstallLocations.Count <1 )) ){
  392. s.GenerateInstallLocation();
  393. }
  394. if ((s.OSSupportedDevices == null) || ((s.OSSupportedDevices.Count <1 )) ){
  395. s.GenerateOSSupportedDevices();
  396. }
  397. if ((s.PlatformResolutions == null) || ((s.PlatformResolutions.Count <1 )) ){
  398. s.GeneratePlatformResolutions();
  399. }
  400. if ((s.ApplicationType == null) || ((s.ApplicationType.Count <1 )) ){
  401. s.GenerateApplicationType();
  402. }
  403. if ((s.AndroidSupportedDevices == null) || ((s.AndroidSupportedDevices.Count <1 )) ){
  404. s.GenerateAndroidSupportedDevices();
  405. }
  406. if (s.VersionSetting < 111202){ //year, month, day
  407. s.GenerateIgnoreFolder();
  408. s.VersionSetting = 111202;
  409. }
  410. if (s.VersionSetting < 120314){ //year, month, day
  411. s.GenerateResolution();
  412. s.GeneratePlatformResolutions();
  413. s.VersionSetting = 120314;
  414. }
  415. if (s.VersionSetting < 120828){ //year, month, day
  416. s.TweetUrl = "http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=moscrif";
  417. s.TweetBaseUrl = "http://twitter.com/moscrif/statuses/" ;
  418. s.VersionSetting = 120828;
  419. }
  420. if (s.VersionSetting < 120903){ //year, month, day
  421. s.GeneratePlatformResolutions();
  422. s.VersionSetting = 120903;
  423. }
  424. if (s.VersionSetting < 121001){ //year, month, day
  425. s.ShowUnsupportedDevices = false;
  426. s.VersionSetting = 121001;
  427. }
  428. if (s.VersionSetting < 121017){ //year, month, day
  429. s.GenerateResolution();
  430. s.GeneratePlatformResolutions();
  431. s.VersionSetting = 121017;
  432. }
  433. if (s.VersionSetting < 121106){ //year, month, day
  434. s.MaxRssTweetMessageCount = 3;
  435. s.VersionSetting = 121106;
  436. }
  437. return s;
  438. }
  439. } catch (Exception ex) {
  440. throw ex;
  441. }
  442. } else {
  443. throw new Exception("Settings file does not exist!");
  444. }
  445. }
  446. public class EmulatorSetting
  447. {
  448. public EmulatorSetting(){
  449. }
  450. [XmlAttribute("usDefault")]
  451. public bool UsDefault ;
  452. [XmlAttribute("params")]
  453. public string Params = "" ;
  454. [XmlAttribute("exec")]
  455. public string Exec = "" ;
  456. }
  457. public class BackgroundColors
  458. {
  459. public BackgroundColors(){}
  460. public BackgroundColors(byte red,byte green,byte blue){
  461. Red= red;
  462. Green=green;
  463. Blue=blue;
  464. }
  465. public BackgroundColors(byte red,byte green,byte blue,ushort alpha){
  466. Red= red;
  467. Green=green;
  468. Blue=blue;
  469. Alpha = alpha;
  470. }
  471. [XmlAttribute("red")]
  472. public byte Red;
  473. [XmlAttribute("green")]
  474. public byte Green;
  475. [XmlAttribute("blue")]
  476. public byte Blue;
  477. [XmlAttribute("alpha")]
  478. public ushort Alpha;
  479. }
  480. public class SourceEditorSetting
  481. {
  482. public SourceEditorSetting(){
  483. if( MainClass.Platform.IsMac){
  484. EditorFont= "Monaco 12";//"Monospace 15";
  485. }
  486. }
  487. [XmlAttribute("sourceEditorFont")]
  488. public string EditorFont = "Monospace 10";
  489. [XmlAttribute("sourceEditorTabSpace")]
  490. public int TabSpace = 4;
  491. [XmlAttribute("sourceEditorTabsToSpaces")]
  492. public bool TabsToSpaces = true;
  493. [XmlAttribute("sourceEditorShowEolMarker")]
  494. public bool ShowEolMarker = false;
  495. [XmlAttribute("sourceEditorShowTab")]
  496. public bool ShowTab = false;
  497. [XmlAttribute("sourceEditorSpaces")]
  498. public bool ShowSpaces = false;
  499. [XmlAttribute("sourceEditorRulerColumn")]
  500. public int RulerColumn = 85;
  501. [XmlAttribute("sourceEditorShowRuler")]
  502. public bool ShowRuler = false;
  503. [XmlAttribute("sourceEditorShowLineNumber")]
  504. public bool ShowLineNumber = true;
  505. [XmlAttribute("sourceEditorEnableAnimations")]
  506. public bool EnableAnimations = true;
  507. [XmlAttribute("sourceEditorAggressivelyCompletion")]
  508. public bool AggressivelyTriggerCL = true;
  509. }
  510. public class ImageEditorSetting
  511. {
  512. [XmlAttribute("line")]
  513. public int LineWidth;
  514. [XmlAttribute("point")]
  515. public int PointWidth;
  516. [XmlElement("lineColor")]
  517. public BackgroundColors LineColor;
  518. [XmlElement("pointColor")]
  519. public BackgroundColors PointColor;
  520. [XmlElement("selectPointColor")]
  521. public BackgroundColors SelectPointColor;
  522. }
  523. public class Range
  524. {
  525. [XmlAttribute("minimal")]
  526. public string Minimal;
  527. [XmlAttribute("maximal")]
  528. public string Maximal;
  529. }
  530. private void GeneratePlatform(){
  531. Platform = new Condition();
  532. Platform.Id = -1;
  533. Platform.Name = "Platform";
  534. Platform.System = true;
  535. Platform.Rules = new List<Rule> ();
  536. Platform.Rules.Add(new Rule((int)DeviceType.Android_1_6,"Android 1.6 +","android_1_6",0));
  537. Platform.Rules.Add(new Rule((int)DeviceType.Android_2_2,"Android 2.2 +","android_2_2",0));
  538. Platform.Rules.Add(new Rule((int)DeviceType.iOS_5_0,"iOS","ios_5_0",0));
  539. Platform.Rules.Add(new Rule((int)DeviceType.Bada_1_0,"Bada 1.0","bada_1_0",0));
  540. Platform.Rules.Add(new Rule((int)DeviceType.Bada_1_1,"Bada 1.1","bada_1_1",0));
  541. Platform.Rules.Add(new Rule((int)DeviceType.Symbian_9_4,"Symbian","symbian_9_4",-1));
  542. Platform.Rules.Add(new Rule((int)DeviceType.WindowsMobile_6,"Windows Mobile","wm_6",-1));
  543. Platform.Rules.Add(new Rule((int)DeviceType.Bada_2_0,"Bada 2.0","bada_2_0",-2));
  544. Platform.Rules.Add(new Rule((int)DeviceType.Windows,"Windows","windows",-2));
  545. Platform.Rules.Add(new Rule((int)DeviceType.MacOs,"MacOs","mac",-2));
  546. //Platform.Rules.Add(new Rule((int)DeviceType.webOs,"webOS","webOS"));
  547. //Platform.Rules.Add(new Rule((int)DeviceType.MeeGo,"MeeGo","MeeGo"));
  548. }
  549. public void GeneratePlatformResolutions(){
  550. PlatformResolutions = new List<PlatformResolution>();
  551. PlatformResolution prAndr16 = new PlatformResolution((int)DeviceType.Android_1_6);
  552. prAndr16.AllowResolution = new List<int>();
  553. prAndr16.AllowResolution.Add(-1);
  554. //prAndr16.AllowResolution.Add(-2);
  555. prAndr16.AllowResolution.Add(-3);
  556. //prAndr16.AllowResolution.Add(-4);
  557. prAndr16.AllowResolution.Add(-5);
  558. prAndr16.AllowResolution.Add(-6);
  559. prAndr16.AllowResolution.Add(-7);
  560. prAndr16.AllowResolution.Add(-8);
  561. prAndr16.AllowResolution.Add(-9);
  562. prAndr16.AllowResolution.Add(-10);
  563. //prAndr16.AllowResolution.Add(-11);
  564. prAndr16.AllowResolution.Add(-12);
  565. prAndr16.AllowResolution.Add(-13);
  566. prAndr16.AllowResolution.Add(-14);
  567. prAndr16.AllowResolution.Add(-15);
  568. prAndr16.AllowResolution.Add(-16);
  569. PlatformResolutions.Add(prAndr16);
  570. PlatformResolution prAndr22 = new PlatformResolution((int)DeviceType.Android_2_2);
  571. prAndr22.AllowResolution = new List<int>();
  572. prAndr22.AllowResolution.Add(-1);
  573. //prAndr22.AllowResolution.Add(-2);
  574. prAndr22.AllowResolution.Add(-3);
  575. //prAndr22.AllowResolution.Add(-4);
  576. prAndr22.AllowResolution.Add(-5);
  577. prAndr22.AllowResolution.Add(-6);
  578. prAndr22.AllowResolution.Add(-7);
  579. prAndr22.AllowResolution.Add(-8);
  580. prAndr22.AllowResolution.Add(-9);
  581. prAndr22.AllowResolution.Add(-10);
  582. //prAndr22.AllowResolution.Add(-11);
  583. prAndr22.AllowResolution.Add(-12);
  584. prAndr22.AllowResolution.Add(-13);
  585. prAndr22.AllowResolution.Add(-14);
  586. prAndr22.AllowResolution.Add(-15);
  587. prAndr22.AllowResolution.Add(-16);
  588. PlatformResolutions.Add(prAndr22);
  589. PlatformResolution prIos = new PlatformResolution((int)DeviceType.iOS_5_0);
  590. prIos.AllowResolution = new List<int>();
  591. prIos.AllowResolution.Add(-1);
  592. prIos.AllowResolution.Add(-3);
  593. prIos.AllowResolution.Add(-7);
  594. prIos.AllowResolution.Add(-8);
  595. prIos.AllowResolution.Add(-15);
  596. prIos.AllowResolution.Add(-17);
  597. PlatformResolutions.Add(prIos);
  598. PlatformResolution prBada10 = new PlatformResolution((int)DeviceType.Bada_1_0);
  599. prBada10.AllowResolution = new List<int>();
  600. prBada10.AllowResolution.Add(-1);
  601. //prBada10.AllowResolution.Add(-3);
  602. prBada10.AllowResolution.Add(-6);
  603. //prBada10.AllowResolution.Add(-11);
  604. PlatformResolutions.Add(prBada10);
  605. PlatformResolution prBada11 = new PlatformResolution((int)DeviceType.Bada_1_1);
  606. prBada11.AllowResolution = new List<int>();
  607. prBada11.AllowResolution.Add(-1);
  608. prBada11.AllowResolution.Add(-3);
  609. //prBada11.AllowResolution.Add(-6);
  610. //prBada11.AllowResolution.Add(-11);
  611. PlatformResolutions.Add(prBada11);
  612. /*PlatformResolution prBada2 = new PlatformResolution((int)DeviceType.Bada_1_2);
  613. prBada2.AllowResolution = new List<int>();
  614. prBada2.AllowResolution.Add(-1);
  615. prBada2.AllowResolution.Add(-6);
  616. PlatformResolutions.Add(prBada2);*/
  617. PlatformResolution prSymbian94 = new PlatformResolution((int)DeviceType.Symbian_9_4);
  618. prSymbian94.AllowResolution = new List<int>();
  619. prSymbian94.AllowResolution.Add(-1);
  620. //prSymbian94.AllowResolution.Add(-4);
  621. prSymbian94.AllowResolution.Add(-6);
  622. PlatformResolutions.Add(prSymbian94);
  623. /*PlatformResolution prSymbian95 = new PlatformResolution((int)DeviceType.Symbian_9_5);
  624. prSymbian95.AllowResolution = new List<int>();
  625. prSymbian95.AllowResolution.Add(-1);
  626. prSymbian95.AllowResolution.Add(-4);
  627. prSymbian95.AllowResolution.Add(-6);
  628. prSymbian95.AllowResolution.Add(-11);
  629. PlatformResolutions.Add(prSymbian95);*/
  630. /*PlatformResolution prWindowsMobile5 = new PlatformResolution((int)DeviceType.WindowsMobile_5);
  631. prWindowsMobile5.AllowResolution = new List<int>();
  632. prWindowsMobile6.AllowResolution.Add(-1);
  633. prWindowsMobile5.AllowResolution.Add(-3);
  634. prWindowsMobile5.AllowResolution.Add(-2);
  635. prWindowsMobile5.AllowResolution.Add(-5);
  636. prWindowsMobile5.AllowResolution.Add(-6);
  637. PlatformResolutions.Add(prWindowsMobile5);*/
  638. PlatformResolution prWindowsMobile6 = new PlatformResolution((int)DeviceType.WindowsMobile_6);
  639. prWindowsMobile6.AllowResolution = new List<int>();
  640. prWindowsMobile6.AllowResolution.Add(-1);
  641. prWindowsMobile6.AllowResolution.Add(-3);
  642. //prWindowsMobile6.AllowResolution.Add(-2);
  643. prWindowsMobile6.AllowResolution.Add(-5);
  644. prWindowsMobile6.AllowResolution.Add(-6);
  645. PlatformResolutions.Add(prWindowsMobile6);
  646. }
  647. public void GenerateResolution(){
  648. Resolution = new Condition();
  649. Resolution.Id = -2;
  650. Resolution.Name = "Resolution";
  651. Resolution.System = true;
  652. Resolution.Rules = new List<Rule> ();
  653. Resolution.Rules.Add(new Rule(-1,"Universal","uni",0,0));
  654. Resolution.Rules.Add(new Rule(-2,"QVGA","qvga",240,320));
  655. Resolution.Rules.Add(new Rule(-3,"HVGA","hvga",320,480));
  656. Resolution.Rules.Add(new Rule(-4,"nHD","nhd",360,640));
  657. Resolution.Rules.Add(new Rule(-5,"VGA","vga",480,640));
  658. Resolution.Rules.Add(new Rule(-6,"WVGA","wvga",480,800));
  659. Resolution.Rules.Add(new Rule(-7,"DVGA","dvga",640,960));
  660. Resolution.Rules.Add(new Rule(-8,"XGA","xga",768,1024));
  661. Resolution.Rules.Add(new Rule(-9,"SVGA","svga",600,800));
  662. Resolution.Rules.Add(new Rule(-10,"qHD","qhd",540,960));
  663. Resolution.Rules.Add(new Rule(-11,"WQVGA","wqvga",240,400));
  664. Resolution.Rules.Add(new Rule(-12,"VXGA","vxga",800,1280));
  665. Resolution.Rules.Add(new Rule(-13,"FWVGA","fwvga",480,854));
  666. Resolution.Rules.Add(new Rule(-14,"WSVGA","wsvga",600,1024));
  667. Resolution.Rules.Add(new Rule(-15,"QXGA","qxga",1536,2048));
  668. Resolution.Rules.Add(new Rule(-16,"HD720","hd720",720,1280));
  669. Resolution.Rules.Add(new Rule(-17,"WDVGA","wdvga",640,1136));
  670. }
  671. public void GenerateOrientations(){
  672. DisplayOrientations = new List<SettingValue>();
  673. DisplayOrientations.Add(new SettingValue("portrait","Portrait"));
  674. DisplayOrientations.Add(new SettingValue("landscape left","Landscape Left"));
  675. DisplayOrientations.Add(new SettingValue("landscape right","Landscape Right"));
  676. }
  677. public void GenerateApplicationType(){
  678. ApplicationType = new List<SettingValue>();
  679. ApplicationType.Add(new SettingValue("application","Application"));
  680. ApplicationType.Add(new SettingValue("game","Game"));
  681. }
  682. public void GenerateInstallLocation(){
  683. //"internalOnly", "auto", "preferExternal"
  684. InstallLocations = new List<SettingValue>();
  685. InstallLocations.Add(new SettingValue("internalOnly","Internal Only"));
  686. InstallLocations.Add(new SettingValue("auto","Auto"));
  687. InstallLocations.Add(new SettingValue("preferExternal","Prefer External"));
  688. }
  689. public void GenerateOSSupportedDevices(){
  690. //"internalOnly", "auto", "preferExternal"
  691. OSSupportedDevices = new List<SettingValue>();
  692. OSSupportedDevices.Add(new SettingValue("universal","Universal"));
  693. OSSupportedDevices.Add(new SettingValue("iPhone","iPhone"));
  694. OSSupportedDevices.Add(new SettingValue("iPad","iPad"));
  695. }
  696. public void GenerateAndroidSupportedDevices(){
  697. //"internalOnly", "auto", "preferExternal"
  698. AndroidSupportedDevices = new List<SettingValue>();
  699. AndroidSupportedDevices.Add(new SettingValue("universal","Universal"));
  700. AndroidSupportedDevices.Add(new SettingValue("armv7a","ARMv7a only"));
  701. }
  702. public List<string> GenerateLibs(){
  703. List<string> libsDefine = new List<string>();
  704. DirectoryInfo dirWorkspace = new DirectoryInfo(LibDirectory);
  705. DirectoryInfo[] listDirectory = dirWorkspace.GetDirectories("*",SearchOption.TopDirectoryOnly);
  706. foreach(DirectoryInfo di in listDirectory){
  707. int ignore = IgnoresFolders.FindIndex( x=> x.Folder == di.Name && x.IsForIde);
  708. if(ignore <0){
  709. libsDefine.Add( di.Name);
  710. }
  711. }
  712. return libsDefine;
  713. }
  714. public void GenerateIgnoreFiles(){
  715. IgnoresFiles = new List<IgnoreFolder>();
  716. IgnoresFiles.Add(new IgnoreFolder(".DS_Store",true,true));
  717. IgnoresFiles.Add(new IgnoreFolder("Thumbs.db",true,true));
  718. }
  719. public void GenerateExtensionList(){
  720. ExtensionList = new List<ExtensionSetting>();
  721. ExtensionList.Add(new ExtensionSetting(".xml,.ms,.mso,.txt,.tab,.app,.js",ExtensionSetting.OpenTyp.TEXT ));
  722. ExtensionList.Add(new ExtensionSetting(".png,.jpg,.bmp",ExtensionSetting.OpenTyp.IMAGE));
  723. ExtensionList.Add(new ExtensionSetting(".db",ExtensionSetting.OpenTyp.DATABASE));
  724. }
  725. public void GenerateIgnoreFolder(){
  726. IgnoresFolders = new List<IgnoreFolder>();
  727. IgnoresFolders.Add(new IgnoreFolder(".svn",true,true));
  728. IgnoresFolders.Add(new IgnoreFolder(".git",true,true));
  729. IgnoresFolders.Add(new IgnoreFolder("platform",false,true));
  730. IgnoresFolders.Add(new IgnoreFolder("marketing",false,true));
  731. IgnoresFolders.Add(new IgnoreFolder("output",false,true));
  732. //IgnoresFolders.Add(new IgnoreFolder("temp",true,true));
  733. }
  734. }
  735. }