This commit is contained in:
Lars Brubaker 2016-06-23 11:30:38 -07:00
commit dc1186d4bf
7 changed files with 23 additions and 15 deletions

View file

@ -280,7 +280,7 @@ namespace MatterHackers.MatterControl
{
downloadAttempts++;
SetUpdateStatus(UpdateStatusStates.UpdateDownloading);
string downloadUri = string.Format("https://mattercontrol.appspot.com/downloads/development/{0}", ApplicationSettings.Instance.get("CurrentBuildToken"));
string downloadUri = $"{MatterControlApplication.MCWSBaseUri}/downloads/development/{ApplicationSettings.Instance.get("CurrentBuildToken")}";
//Make HEAD request to determine the size of the download (required by GAE)
System.Net.WebRequest request = System.Net.WebRequest.Create(downloadUri);

View file

@ -405,6 +405,12 @@ namespace MatterHackers.MatterControl
}
}
#if DEBUG
public static string MCWSBaseUri { get; } = "http://localhost.:9206";
#else
public static string MCWSBaseUri { get;} = "https://mattercontrol.appspot.com";
#endif
public static void LoadUITheme()
{
//Load the default theme by index

View file

@ -125,17 +125,21 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return empytProfile;
}
[JsonIgnore]
public string ActiveProfilePath => Path.Combine(ProfileManager.ProfilesPath, ActiveProfile.ID + ".json");
internal static SettingsProfile LoadProfileFromMCWS(string deviceToken)
{
WebClient client = new WebClient();
string json = client.DownloadString($"{MatterControlApplication.MCWSBaseUri}/api/1/device/get-profile?key={deviceToken}");
var printerSettings = JsonConvert.DeserializeObject<PrinterSettings>(json);
return new SettingsProfile(printerSettings);
}
internal static SettingsProfile LoadProfile(string profileID)
{
// Conceptually, LoadProfile should...
//
// Find and load a locally cached copy of the profile
// - Query the webservice for the given profile passing along our ETAG
// Result: 304 or error
// Use locally cached copy as it's the latest or we're offline or the service has errored
// Result: 200 (Document updated remotely)
// Determine if the local profile is dirty. If so, we need to perform conflict resolution to work through the issues
// If not, simply write the profile to disk as latest, load and return
//return LoadProfileFromMCWS(profileID);
// Only load profiles by ID that are defined in the profiles.json document
if (ProfileManager.Instance[profileID] == null)

View file

@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl.VersionManagement
{
requestValues["RequestToken"] = "ekshdsd5d5ssss5kels";
requestValues["ProjectToken"] = VersionInfo.Instance.ProjectToken;
uri = "https://mattercontrol.appspot.com/api/1/get-client-consumer-token";
uri = $"{MatterControlApplication.MCWSBaseUri}/api/1/get-client-consumer-token";
}
public override void ProcessSuccessResponse(JsonResponseDictionary responseValues)

View file

@ -46,7 +46,7 @@ namespace MatterHackers.MatterControl.VersionManagement
requestValues["Email"] = email;
requestValues["FeedbackType"] = "Question";
requestValues["Comment"] = string.Format("{0}\n{1}", question, details);
uri = "https://mattercontrol.appspot.com/api/1/submit-feedback";
uri = $"{MatterControlApplication.MCWSBaseUri}/api/1/submit-feedback";
}
public override void ProcessSuccessResponse(JsonResponseDictionary responseValues)

View file

@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.VersionManagement
}
requestValues["ProjectToken"] = VersionInfo.Instance.ProjectToken;
requestValues["UpdateFeedType"] = feedType;
uri = "https://mattercontrol.appspot.com/api/1/get-current-release-version";
uri = $"{MatterControlApplication.MCWSBaseUri}/api/1/get-current-release-version";
}
public override void Request()

View file

@ -2,8 +2,6 @@
using MatterHackers.MatterControl.SettingsManagement;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace MatterHackers.MatterControl.VersionManagement
{