public static PrinterSettings RestoreFromOemProfile(PrinterInfo profile)
        {
            PrinterSettings oemProfile = null;

            try
            {
                string publicProfileDeviceToken = OemSettings.Instance.OemProfiles[profile.Make][profile.Model];
                string publicProfileToLoad      = Path.Combine(ApplicationDataStorage.ApplicationUserDataPath, "data", "temp", "cache", "profiles", publicProfileDeviceToken + ProfileManager.ProfileExtension);

                oemProfile    = JsonConvert.DeserializeObject <PrinterSettings>(File.ReadAllText(publicProfileToLoad));
                oemProfile.ID = profile.ID;
                oemProfile.SetValue(SettingsKey.printer_name, profile.Name);
                oemProfile.DocumentVersion = PrinterSettings.LatestVersion;

                oemProfile.Helpers.SetComPort(profile.ComPort);
                oemProfile.Save();
            }
            catch { }

            return(oemProfile);
        }
        public static PrinterSettings RestoreFromOemProfile(PrinterInfo profile)
        {
            PrinterSettings oemProfile = null;

            try
            {
                var    publicDevice = OemSettings.Instance.OemProfiles[profile.Make][profile.Model];
                string cacheScope   = Path.Combine("public-profiles", profile.Make);

                string publicProfileToLoad = ApplicationController.CacheablePath(cacheScope, publicDevice.CacheKey);

                oemProfile    = JsonConvert.DeserializeObject <PrinterSettings>(File.ReadAllText(publicProfileToLoad));
                oemProfile.ID = profile.ID;
                oemProfile.SetValue(SettingsKey.printer_name, profile.Name);
                oemProfile.DocumentVersion = PrinterSettings.LatestVersion;

                oemProfile.Helpers.SetComPort(profile.ComPort);
                oemProfile.Save();
            }
            catch { }

            return(oemProfile);
        }
Esempio n. 3
0
 public void SetBaudRate(string baudRate)
 {
     printerSettings.SetValue(SettingsKey.baud_rate, baudRate);
 }
Esempio n. 4
0
 public void SetActiveValue(string sliceSetting, string sliceValue, PrinterSettingsLayer persistenceLayer = null)
 {
     layeredProfile.SetValue(sliceSetting, sliceValue, persistenceLayer);
 }