public static void QueryUpdateServer(UpdateInfo[] updateInfos, UpdateLevel level, Action <UpdateResult> callback) { if (updateInfos == null || updateInfos.Length == 0) { string error = GettextCatalog.GetString("No updatable products detected"); callback(new UpdateResult(null, level, error, null)); return; } var query = new StringBuilder(DesktopService.GetUpdaterUrl()); query.Append("?v="); query.Append(formatVersion); foreach (var info in updateInfos) { query.AppendFormat("&{0}={1}", info.AppId, info.VersionId); } if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MONODEVELOP_UPDATER_TEST"))) { level = UpdateLevel.Test; } if (level != UpdateLevel.Stable) { query.Append("&level="); query.Append(level.ToString().ToLower()); } bool hasEnv = false; foreach (string flag in DesktopService.GetUpdaterEnvironmentFlags()) { if (!hasEnv) { hasEnv = true; query.Append("&env="); query.Append(flag); } else { query.Append(","); query.Append(flag); } } var requestUrl = query.ToString(); var request = (HttpWebRequest)WebRequest.Create(requestUrl); LoggingService.LogDebug("Checking for updates: {0}", requestUrl); //FIXME: use IfModifiedSince, with a cached value //request.IfModifiedSince = somevalue; request.BeginGetResponse(delegate(IAsyncResult ar) { ReceivedResponse(request, ar, level, callback); }, null); }
public static void QueryUpdateServer(UpdateInfo[] updateInfos, UpdateLevel level, Action <UpdateResult> callback) { if (updateInfos == null || updateInfos.Length == 0) { string error = GettextCatalog.GetString("No updatable products detected"); callback(new UpdateResult(null, level, error, null)); return; } var query = new StringBuilder("http://go-mono.com/macupdate/update?v="); query.Append(formatVersion); foreach (var info in updateInfos) { query.AppendFormat("&{0}={1}", info.AppId, info.VersionId); } if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MONODEVELOP_UPDATER_TEST"))) { level = UpdateLevel.Test; } if (level != UpdateLevel.Stable) { query.Append("&level="); query.Append(level.ToString().ToLower()); } if (Directory.Exists("/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk")) { query.Append("&env=iphsdk4.0"); } var request = (HttpWebRequest)WebRequest.Create(query.ToString()); //FIXME: use IfModifiedSince //request.IfModifiedSince = somevalue; request.BeginGetResponse(delegate(IAsyncResult ar) { ReceivedResponse(request, ar, level, callback); }, null); }
/// <summary> /// The ToString implementation. /// </summary> /// <param name="format">The format specifier to use, e.g. <b>Console.WriteLine(workspace.ToString("L"));</b></param> /// <param name="provider">Allow clients to format output for their own types using [ICustomFormatter](https://msdn.microsoft.com/en-us/library/system.icustomformatter.aspx).</param> /// <returns>The formatted string.</returns> /// <exception cref="FormatException">thrown if an invalid format string is specified.</exception> /// \par Format specifiers: /// \arg \c G Name of the workspace, e.g. MARS_DEV3_barnyrd. Default when not using a format specifier. /// \arg \c LV Long version (verbose). /// \arg \c I Workspace ID number. /// \arg \c L Workspace [location](@ref AcUtils#AcWorkspace#Location). /// \arg \c S Location on the host ([storage](@ref AcUtils#AcWorkspace#Storage)) where the elements physically reside. /// \arg \c M Machine name ([host](@ref AcUtils#AcWorkspace#Host)) where the elements physically reside. /// \arg \c H \e True if the workspace is hidden, \e False otherwise. /// \arg \c D Depot name. /// \arg \c TL [Target level](@ref AcUtils#AcWorkspace#TargetLevel): how up-to-date the workspace should be. /// \arg \c UL [Update level](@ref AcUtils#AcWorkspace#UpdateLevel): how up-to-date the workspace actually is. /// \arg \c U Time of the oldest non-member file in the workspace with (\e modified) status, otherwise the time the \c update command was issued. /// \arg \c T [Workspace type](@ref AcUtils#WsType): standard, exclusive-file locking, anchor-required, or reference tree. /// \arg \c E [End-of-line character](@ref AcUtils#WsEOL) in use by the workspace: platform-appropriate, Unix/Linux style, or Windows style. /// \arg \c PI Workspace owner's principal ID number. /// \arg \c PN Workspace owner's principal name. public string ToString(string format, IFormatProvider provider) { if (provider != null) { ICustomFormatter fmt = provider.GetFormat(this.GetType()) as ICustomFormatter; if (fmt != null) { return(fmt.Format(format, this, provider)); } } if (String.IsNullOrEmpty(format)) { format = "G"; } switch (format.ToUpperInvariant()) { case "G": // name of the workspace, e.g. MARS_DEV3_barnyrd return(Name); // general format should be short since it can be called by anything case "LV": // long version (verbose) return($"{Name} ({ID}) {{{Type}}}{Environment.NewLine}" + $@"Location: ""{Location}"", Storage: ""{Storage}""{Environment.NewLine}" + $"Host: {Host}, ULevel-Target [{UpdateLevel}:{TargetLevel}]{((TargetLevel != UpdateLevel) ? " (incomplete)" : String.Empty)}{Environment.NewLine}" + $"Depot: {Depot}, EOL: {EOL}, Hidden: {Hidden}{Environment.NewLine}"); case "I": // workspace ID number return(ID.ToString()); case "L": // workspace location return(Location); case "S": // location on the host (storage) where the elements physically reside return(Storage); case "M": // machine name (host) where the elements physically reside return(Host); case "H": // True if workspace is hidden, False otherwise return(Hidden.ToString()); case "D": // depot name return(Depot.ToString()); case "TL": // how up-to-date the workspace should be return(TargetLevel.ToString()); case "UL": // how up-to-date the workspace actually is return(UpdateLevel.ToString()); case "U": // time of the oldest non-member file in the workspace with modified status, otherwise time the update command was issued return(FileModTime.ToString()); case "T": // type of workspace: standard, exclusive-file locking, anchor-required, or reference tree return(Type.ToString()); case "E": // end-of-line character in use by the workspace: platform-appropriate, Unix/Linux style, or Windows style return(EOL.ToString()); case "PI": // ID number of the AccuRev principal who owns the workspace return(Principal.ID.ToString()); case "PN": // principal name of the workspace owner return(Principal.Name); default: throw new FormatException($"The {format} format string is not supported."); } }
public static void QueryUpdateServer (UpdateInfo[] updateInfos, UpdateLevel level, Action<UpdateResult> callback) { if (updateInfos == null || updateInfos.Length == 0) { string error = GettextCatalog.GetString ("No updatable products detected"); callback (new UpdateResult (null, level, error, null)); return; } var query = new StringBuilder ("http://go-mono.com/macupdate/update?v="); query.Append (formatVersion); foreach (var info in updateInfos) query.AppendFormat ("&{0}={1}", info.AppId, info.VersionId); if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("MONODEVELOP_UPDATER_TEST"))) level = UpdateLevel.Test; if (level != UpdateLevel.Stable) { query.Append ("&level="); query.Append (level.ToString ().ToLower ()); } if (Directory.Exists ("/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk")) { query.Append ("&env=iphsdk4.0"); } var request = (HttpWebRequest) WebRequest.Create (query.ToString ()); //FIXME: use IfModifiedSince //request.IfModifiedSince = somevalue; request.BeginGetResponse (delegate (IAsyncResult ar) { ReceivedResponse (request, ar, level, callback); }, null); }
public static void QueryUpdateServer (UpdateInfo[] updateInfos, UpdateLevel level, Action<UpdateResult> callback) { if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("MONODEVELOP_UPDATER_TEST"))) level = UpdateLevel.Test; if (updateInfos == null || updateInfos.Length == 0) { QueryAddinUpdates (level, callback); return; } var query = new StringBuilder (DesktopService.GetUpdaterUrl ()); query.Append ("?v="); query.Append (formatVersion); foreach (var info in updateInfos) query.AppendFormat ("&{0}={1}", info.AppId, info.VersionId); if (level != UpdateLevel.Stable) { query.Append ("&level="); query.Append (level.ToString ().ToLower ()); } bool hasEnv = false; foreach (string flag in DesktopService.GetUpdaterEnvironmentFlags ()) { if (!hasEnv) { hasEnv = true; query.Append ("&env="); query.Append (flag); } else { query.Append (","); query.Append (flag); } } var requestUrl = query.ToString (); var request = (HttpWebRequest) WebRequest.Create (requestUrl); LoggingService.LogDebug ("Checking for updates: {0}", requestUrl); //FIXME: use IfModifiedSince, with a cached value //request.IfModifiedSince = somevalue; request.BeginGetResponse (delegate (IAsyncResult ar) { ReceivedResponse (request, ar, level, callback); }, null); }