public void SaveSettingPath(SSettings idx) { string jsonString = JsonUtility.ToJson(idx); using (StreamWriter streamWriter = File.CreateText(settingspath)) { streamWriter.Write(jsonString); } }
static public SSettings GetOrCreateSettings() { if (m_settings == null) { m_settings = new SSettings(); } xmlSerializer = new XmlSerializer(typeof(SSettings)); if (!File.Exists(m_fileName)) { textWriter = new StreamWriter(m_fileName); xmlSerializer.Serialize(textWriter, m_settings); textWriter.Close(); Logger.Log(m_fileName + " did not exist. Created and autoconfiggured."); } textReader = new StreamReader(m_fileName); m_settings = (SSettings)xmlSerializer.Deserialize(textReader); textReader.Close(); return(m_settings); }
public string DownloadThumbSmallImage() { string path = SSettings.getCacheFolder() + id + "_small.jpg"; using (WebClient webClient = new WebClient()) { Directory.CreateDirectory(SSettings.getCacheFolder()); try { if (!File.Exists(path)) { webClient.DownloadFile(imgUrl + id + "/mqdefault.jpg", path); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } return(path); }
private void Start() { resolutions = Screen.resolutions; m_ResDropDown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); if (resolutions[i].Equals(Screen.currentResolution)) { currentResolutionIndex = i; } } m_ResDropDown.AddOptions(options); m_ResDropDown.value = currentResolutionIndex; m_ResDropDown.RefreshShownValue(); if (SaveManager.Singleton.LoadSettingsPath() != null) { sSettings = SaveManager.Singleton.LoadSettingsPath(); ToggleFullscreen(sSettings.isFullscreen); fs.isOn = sSettings.isFullscreen; SetMusicVolume(sSettings.musicVolume); music.value = sSettings.musicVolume; SetRadioVolume(sSettings.radioVolume); radio.value = sSettings.radioVolume; SetSFXVolume(sSettings.SFXVolume); sfx.value = sSettings.SFXVolume; } }