Ejemplo n.º 1
0
        public bool Open(Settings.Documentation target)
        {
			
			// TODO : THIS REALLLY REALLY NEEDS CLEANING UP
            if ((PropertyService.Get<bool>("Unity.Base.Documentation.ForceLocal", false) ||
                !PropertyService.Get<bool>("Unity.Connection", false) )

                &&

                (PropertyService.Get<string>("Unity.Base.Path", "") != "" ||
                PropertyService.Get<string>("Unity.iPhone.Path", "") != ""))
            {
				if ( Helpers.WhatOS() == Helpers.OS.Mac )
				{
					switch ( PropertyService.Get<string>("Unity.DocumentationPreference") ) {
					case "Unity iPhone":
						 switch (target)
	                		{
		                    case Settings.Documentation.Manual:
		                        return this.Open("file://" + PropertyService.Get<string>("Unity.iPhone.Path") +
		                            Settings.MAC_VIEW_MANUAL);
		                    case Settings.Documentation.Reference:
		                        return this.Open("file://" + PropertyService.Get<string>("Unity.iPhone.Path") +
		                            Settings.MAC_VIEW_REFERENCE);
		                    case Settings.Documentation.ScriptReference:
		                        return this.Open("file://" + PropertyService.Get<string>("Unity.iPhone.Path") +
		                            Settings.MAC_SEARCH_SCRIPT_REFERENCE);
	                		}
						break;
					case "Unity":
					default:
						switch (target)
		                {
		                    case Settings.Documentation.Manual:
		                        return this.Open("file://" + PropertyService.Get<string>("Unity.Base.Path") +
		                            Settings.MAC_VIEW_MANUAL);
		                    case Settings.Documentation.Reference:
		                        return this.Open("file://" + PropertyService.Get<string>("Unity.Base.Path") +
		                            Settings.MAC_VIEW_REFERENCE);
		                    case Settings.Documentation.ScriptReference:
		                        return this.Open("file://" + PropertyService.Get<string>("Unity.Base.Path") +
		                            Settings.MAC_SEARCH_SCRIPT_REFERENCE);
		                }
						break;
					}
	               
				}
				else if (Helpers.WhatOS() == Helpers.OS.Windows)
				{
					switch (target)
	                {
	                    case Settings.Documentation.Manual:
	                        return this.Open("file://" + PropertyService.Get<string>("Unity.Base.Path") +
	                            Settings.WIN_VIEW_MANUAL);
	                    case Settings.Documentation.Reference:
	                        return this.Open("file://" + PropertyService.Get<string>("Unity.Base.Path") +
	                            Settings.WIN_VIEW_REFERENCE);
	                    case Settings.Documentation.ScriptReference:
	                        return this.Open("file://" + PropertyService.Get<string>("Unity.Base.Path") +
	                            Settings.WIN_SEARCH_SCRIPT_REFERENCE);
	                }
				}

            }
            else
            {
                switch (target)
                {
                    case Settings.Documentation.Manual:
                        return this.Open(Settings.REMOTE_VIEW_MANUAL);
                    case Settings.Documentation.Reference:
                        return this.Open(Settings.REMOTE_VIEW_REFERENCE);
                    case Settings.Documentation.ScriptReference:
                        return this.Open(Settings.REMOTE_VIEW_SCRIPT_REFERENCE);
                }
            }
            return false;
        }
Ejemplo n.º 2
0
        public bool Open(Settings.Documentation target, string query)
        {
            // Searching
            if (query != null && query.Length > 0)
            {
                if ((PropertyService.Get<bool>("Unity.Base.Documentation.ForceLocal", false) ||
                    !PropertyService.Get<bool>("Unity.Connection", false) )

                    &&

                    (PropertyService.Get<string>("Unity.Base.Path", "") != "" ||
                     PropertyService.Get<string>("Unity.iPhone.Path", "") != ""))
                {
                    switch (target)
                    {
                        case Settings.Documentation.ScriptReference:
							if ( Helpers.WhatOS() == Helpers.OS.Mac )
							{
								if( PropertyService.Get<string>("Unity.DocumentationPreference") == "Unity iPhone" ) {
								return this.Open("file://" + PropertyService.Get<string>("Unity.iPhone.Path") +
                                Settings.MAC_SEARCH_SCRIPT_REFERENCE +
                                System.Web.HttpUtility.UrlEncode(query));
								}
								else{
								return this.Open("file://" + PropertyService.Get<string>("Unity.Base.Path") +
                                Settings.MAC_SEARCH_SCRIPT_REFERENCE +
                                System.Web.HttpUtility.UrlEncode(query));
								}
							    
							}
							else if ( Helpers.WhatOS() == Helpers.OS.Windows)
							{
							    return this.Open("file://" + PropertyService.Get<string>("Unity.Base.Path") +
                                 Settings.WIN_SEARCH_SCRIPT_REFERENCE +
                                System.Web.HttpUtility.UrlEncode(query));
							}
							break;

                    }
                }
                else
                {
                    switch (target)
                    {
                        case Settings.Documentation.Manual:
                            return this.Open(Settings.REMOTE_SEARCH_MANUAL + System.Web.HttpUtility.UrlEncode(query));
                        case Settings.Documentation.Reference:
                            return this.Open(Settings.REMOTE_SEARCH_REFERENCE + System.Web.HttpUtility.UrlEncode(query));
                        case Settings.Documentation.ScriptReference:
                            return this.Open(Settings.REMOTE_SEARCH_SCRIPT_REFERENCE + System.Web.HttpUtility.UrlEncode(query));
                    }
                }
            }
            return false;
        }