public void UpdatePanel() { SettingData data = DataManager.Instance.settingData; musicSlider.value = data.musicVolume; soundSlider.value = data.soundVolume; }
private void Start() { m_settingData = GetSettingLoad; m_audioSource = GetComponent <AudioSource>(); ChangeVolume(m_settingData.volumeMeter); m_volumeSlider.value = m_settingData.volumeMeter; }
public void TestAscMc() { ConfigData config = new ConfigData(); AstroCalc calc = new AstroCalc(config); Dictionary <int, PlanetData> pdata = new Dictionary <int, PlanetData>(); double[] houses = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; SettingData setting = new SettingData(0); Dictionary <int, bool> disp = new Dictionary <int, bool>(); disp[CommonData.ZODIAC_ASC] = true; disp[CommonData.ZODIAC_MC] = false; setting.dispPlanet = new List <Dictionary <int, bool> >(); setting.dispPlanet.Add(disp); setting.dispAspectPlanet = new List <Dictionary <int, bool> >(); setting.dispAspectPlanet.Add(disp); pdata = calc.setHouse(pdata, houses, setting, 0); Assert.AreEqual(1, pdata[CommonData.ZODIAC_ASC].absolute_position); Assert.IsTrue(pdata[CommonData.ZODIAC_ASC].isDisp); Assert.IsTrue(pdata[CommonData.ZODIAC_ASC].isAspectDisp); Assert.AreEqual(10, pdata[CommonData.ZODIAC_MC].absolute_position); Assert.IsFalse(pdata[CommonData.ZODIAC_MC].isDisp); Assert.IsFalse(pdata[CommonData.ZODIAC_MC].isAspectDisp); }
//**************************** CSVのロード用 ****************************// /// <summary> /// CSVファイルからロードして初期化 /// </summary> /// <param name="parent">コルーチンをまわすためのMonoBehaviour</param> /// <param name="url">ファイルパス</param> /// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param> /// <returns></returns> public IEnumerator LoadCsvAsync(MonoBehaviour parent, string url, int version) { //起動ファイルの読み込み { AssetFile file = AssetFileManager.GetFileCreateIfMissing(url); if (version < 0) { file.Version = file.CacheVersion + 1; } AssetFileManager.Load(file, this); while (!file.IsLoadEnd) { yield return(0); } SettingData.InitFromCsv(file.Csv, url); file.Unuse(this); } parent.StartCoroutine(ScenarioSetting.LoadCsvAsync(SettingData.ScenarioSettingUrlList)); parent.StartCoroutine(CharacterSetting.LoadCsvAsync(SettingData.CharacterSettingUrlList)); parent.StartCoroutine(TextureSetting.LoadCsvAsync(SettingData.TextureSettingUrlList)); parent.StartCoroutine(SoundSetting.LoadCsvAsync(SettingData.SoundSettingUrlList)); parent.StartCoroutine(DefaultParam.LoadCsvAsync(SettingData.ParamSettingUrlList)); parent.StartCoroutine(LayerSetting.LoadCsvAsync(SettingData.LayerSettingUrlList)); parent.StartCoroutine(SceneGallerySetting.LoadCsvAsync(SettingData.SceneGallerySettingUrlList)); while (!IsLoadEndCsv()) { yield return(0); } }
public static SettingData LoadData() { string path = Application.persistentDataPath + "/GameSettings.harambe"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); SettingData data = formatter.Deserialize(stream) as SettingData; stream.Close(); Debug.Log("Loading settings"); return(data); } else if (!File.Exists(path)) { File.Create(path).Dispose(); Debug.LogError("Save file not found in " + path); return(null); } else { Debug.LogError("Unknow Error"); return(null); } }
private void Start() { subject = Subject.getInstance(); if (!observerDifficultAI.observerState && !observerVoice.observerState) { new observerDifficultAI(subject); new observerVoice(subject); } if (!File.Exists(Application.persistentDataPath + "save.binary")) { SettingData data = new SettingData(.5f, "MID"); SaveLoadSystem.Save(data); diff = "MID"; voi = .5f; } else { diff = SaveLoadSystem.Load().difficult; voi = SaveLoadSystem.Load().voice; } subject.setDifficultAndVoice(diff, voi); }
public void ConfigReader(string filename) { XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; settings.IgnoreWhitespace = true; settings.ValidationType = ValidationType.None; XmlReader reader = XmlTextReader.Create(filename, settings); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: string tagName = reader.LocalName; if (tagName.Equals(SettingTag.SetTag)) { this.settingData = new SettingData(reader[SettingTag.ConfidenceValue], reader[SettingTag.PictureSize], reader[SettingTag.Language], reader[SettingTag.CreateMaxTime], reader[SettingTag.CreateMinTime], reader[SettingTag.MaxDownSpeed], reader[SettingTag.MinDownSpeed], reader[SettingTag.SuccessSound], reader[SettingTag.FailSound]); } break; default: break; } } reader.Close(); }
static void Main(string[] args) { // mutexによりアクセス競合を防ぐ const string mutexName = "TaskTrayTimeSignal"; var mutex = new Mutex(false, mutexName); bool hasHandle = false; try { try { hasHandle = mutex.WaitOne(0, false); } catch (AbandonedMutexException) { hasHandle = true; } if (hasHandle == false) { return; } // 起動時動作 if (FirstBoot.isFirstBoot()) { // 初回起動時 MessageBox.Show( text: "設定ファイルを作成し、開きます", caption: "初回起動時メッセージ" ); FirstBoot.Boot(); Environment.Exit(0); } // 通常起動時 var settingData = new SettingData(); var setting = settingData.Deserialize(settingData.FileRead()); var timeSignal = new TimesignalPlayer(setting.SoundPaths); MessageBox.Show( text: "設定ファイルを読み込みました\n起動します", caption: "通常起動時メッセージ" ); // main var taskTray = new TaskTray( title: AppTitle, icon: taskTrayApp.Properties.Resources.Icon, span: TaskTray.TimeSpan.Hour, action: () => { timeSignal.PlayTimeSignal(); }, intervalTime: 1000 ); taskTray.Run(); Application.Run(); } finally { if (hasHandle) { mutex.ReleaseMutex(); } mutex.Close(); } }
/// <summary> /// マップ表示作成 /// </summary> public void CreateMap() { dgvMap.Rows.Clear(); dgvMap.Columns.Clear(); SettingData setting = SettingData.GetInstance(); int colWidth = this.Width / setting.MapWidth; for (int x = 0; x < setting.MapWidth; x++) { dgvMap.Columns.Add(string.Format("{0}", x), string.Empty); dgvMap.Columns[x].Width = colWidth; } int rowHeight = this.Height / setting.MapLength; for (int y = 0; y < setting.MapLength; y++) { dgvMap.Rows.Add(); dgvMap.Rows[y].Height = rowHeight; } dgvMap.CurrentCell = null; }
public static void Rest() { bool has_data = Tools.FileExists(data_path); if (!has_data) { _instance = new SettingData(); } else { byte[] byt = Tools.ReadAllBytes(data_path); SettingData setting_data = Tools.DeserializeObject <SettingData>(byt); _instance = setting_data; } if (_instance.resolutionl_width == 0 || _instance.resolutionl_height == 0) { Resolution resolutionl = Screen.resolutions[Screen.resolutions.Length - 1]; _instance.resolutionl_width = resolutionl.width; _instance.resolutionl_height = resolutionl.height; _instance.fullScreen = true; _instance.cursorLockMode = CursorLockMode.None; SaveSetting(); } Screen.SetResolution(_instance.resolutionl_width, _instance.resolutionl_height, _instance.fullScreen); Cursor.lockState = _instance.cursorLockMode; SoundManager.SetVolume(); }
public NotificationRow(Tweet tweet, string message, SettingData setting, NotificationType type, string ownerScreenName, Action <RowAction> actionCallback) : base(tweet, ownerScreenName, setting, actionCallback, RowType.Notification) { Initialize(rowActionCallback); this.NType = type; this.Message = message; }
private void buttonSaveSettings_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBoxSystem.Text) && !string.IsNullOrEmpty(textBoxTXNLocation.Text)) { SettingData newData = new SettingData(); newData.SystemName = textBoxSystem.Text; newData.TXNPath = textBoxTXNLocation.Text; newData.UserFilter = textBoxTeller.Text; newData.TXNFilter = textBoxTXN.Text; newData.DBDetails = textBoxDBDetails.Text; newData.LogName = textBoxLogName.Text; newData.Source = textBoxSource.Text; Utility.updateRegistryValue(newData); this.Close(); try { Environment.Exit(0); } catch { } } else { MessageBox.Show("Please fill the details."); } //EventVisualizer parent = (EventVisualizer)this.Owner; //parent.updatetext(); //parent.updatetext(); //parent.updatetext(); //parent.updatetext(); this.Close(); }
public bool ReadValue(string settingName, out byte[] settingValue) { SettingData setting = FindSettingByName(settingName); bool result = false; if (setting == null) { settingValue = null; result = false; } else if ((setting.Blob == null) || (setting.Blob.Length == 0)) { settingValue = null; result = true; } else { settingValue = setting.Blob; result = true; } int size = settingValue == null ? 0 : settingValue.Length; _logger.Debug(string.Format("Read. Find = {0}. {1} = size({2})", result, settingName, size)); return(result); }
/// <summary> /// 获取 Token 方法 /// </summary> /// <param name="session3rd">string 三方标识</param> /// <returns>Hash 返回结果</returns> public static Hash Token(string session3rd) { // 如果 session3rd 为空,则跳出 if (Genre.IsNull(session3rd)) { return(new Hash((int)CodeType.Session3rdRequired, "session3rd 为空")); } // 查询客户端编号是否存在 int clientId = ClientData.GetClientIdBySession3rd(session3rd); // 如果客户端存在 if (clientId > 0) { // 获取用户信息 Hash data = ClientData.GetByClientId(clientId); Hash setting = SettingData.Detail(); // 附加 APP 配置信息 foreach (string key in setting.Keys) { if (key.StartsWith("page")) { data[key] = setting[key]; } } // 返回成功结果 return(new Hash((int)CodeType.OK, "成功", data)); } return(new Hash((int)CodeType.ClientNotExists, "session3rd 无效")); }
public void SetUp(TextureUtility textureUtility, FileUtility fileUtility, SettingData settingData) { this._textureUtility = textureUtility; this._fileUtility = fileUtility; this._settingData = settingData; CompanyIndex = 0; canvasGroup = GetComponent <CanvasGroup>(); LeftImageCard.draw_phase.gameObject.SetActive(true); LeftImageCard.background.enabled = true; RightImageCard.draw_phase.gameObject.SetActive(true); RightImageCard.background.enabled = true; LeftImageCard.Reset(); RightImageCard.Reset(); _textureUtility.GetTexture(settingData.lucky_draw_background, (Sprite t) => { PeopleWallBG.texture = t.texture; }); CompanynameMapper = new Dictionary <string, string>() { { EventFlag.CompanyMap.C1_ID, EventFlag.CompanyMap.C1_Fullname }, { EventFlag.CompanyMap.C2_ID, EventFlag.CompanyMap.C2_Fullname }, { EventFlag.CompanyMap.C3_ID, EventFlag.CompanyMap.C3_Fullname } }; }
private bool LoadSetting() { if (File.Exists(SAVE_PATH)) { FileStream fs = new FileStream(SAVE_PATH, FileMode.Open); try { BinaryFormatter formatter = new BinaryFormatter(); SettingData data = (SettingData)formatter.Deserialize(fs); m_GameSetting.enableAudio = data.enableAudio; m_GameSetting.highScore = data.highScore; } catch (SerializationException e) { Debug.Log("Failed to deserialize. Reason: " + e.Message); return(false); } finally { fs.Close(); } } else { Debug.Log("File not found !!!"); return(false); } return(true); }
private bool SaveSetting() { FileStream fs = new FileStream(SAVE_PATH, FileMode.Create); // Construct a BinaryFormatter and use it to serialize the data to the stream. BinaryFormatter formatter = new BinaryFormatter(); try { SettingData data = new SettingData(); data.enableAudio = m_GameSetting.enableAudio; data.highScore = m_GameSetting.highScore; formatter.Serialize(fs, data); } catch (SerializationException e) { Debug.Log("Failed to serialize. Reason: " + e.Message); return(false); } finally { fs.Close(); } return(true); }
//**************************** CSVのロード用 ****************************// /// <summary> /// CSVファイルからロードして初期化 /// </summary> /// <param name="parent">コルーチンをまわすためのMonoBehaviour</param> /// <param name="url">ファイルパス</param> /// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param> /// <returns></returns> public IEnumerator LoadCsvAsync(MonoBehaviour parent, string url, int version) { //起動ファイルの読み込み { AssetFile file = AssetFileManager.Load(url, version, this); Debug.Log("Boot Scenario Version:" + file.Version); while (!file.IsLoadEnd) { yield return(0); } SettingData.InitFromCsv(file.Csv, url); file.Unuse(this); } importVersion = Version; parent.StartCoroutine(ScenarioSetting.LoadCsvAsync(SettingData.ScenarioSettingUrlList)); parent.StartCoroutine(CharacterSetting.LoadCsvAsync(SettingData.CharacterSettingUrlList)); parent.StartCoroutine(TextureSetting.LoadCsvAsync(SettingData.TextureSettingUrlList)); parent.StartCoroutine(SoundSetting.LoadCsvAsync(SettingData.SoundSettingUrlList)); parent.StartCoroutine(DefaultParam.LoadCsvAsync(SettingData.ParamSettingUrlList)); parent.StartCoroutine(LayerSetting.LoadCsvAsync(SettingData.LayerSettingUrlList)); parent.StartCoroutine(SceneGallerySetting.LoadCsvAsync(SettingData.SceneGallerySettingUrlList)); while (!IsLoadEndCsv()) { yield return(0); } }
private void ShowInformation(ListViewItem item, string key) { selectedData = null; selectedListData = null; ListData data = item.Tag as ListData; selectedListData = data; bool isRequireDownload = false; SettingData settingData = null; //추후에 if (data.dataList.ContainsKey(key)) { settingData = data.dataList[key]; if (!settingData.isInit) { isRequireDownload = true; } } else { isRequireDownload = true; } if (isRequireDownload) { using (WebClient client = new WebClient()) { Stream stream = client.OpenRead(DATA_PATH + data.path + "/" + key + "/info.txt"); using (StreamReader reader = new StreamReader(stream)) { if (settingData == null) { settingData = new SettingData(); } settingData.Init(key, data.path, reader.ReadToEnd()); } } } if (settingData != null && settingData.isInit) { lbTitleResult.Text = settingData.GetTitle(); SetLinkLabel(lbLinkShop, settingData.GetShop()); SetLinkLabel(lbLinkExtra, settingData.GetExtraLink()); tbInformation.Text = settingData.GetInformation(); selectedData = settingData; } else { selectedData = null; selectedListData = null; lbTitleResult.Text = "에러!"; } }
//메인 기준으로 먼저 설정한다. public ListData(string content) { string[] keys = content.Split('\t'); if (keys.Length >= 2) { path = keys[0]; title = keys[1]; if (keys.Length >= 3) { korTitle = keys[2]; } isInit = true; SettingData data = new SettingData(); data.path = MAIN_PATH; dataList.Add(data.path, data); } else { isInit = false; } }
// GET: /Home/CallGold public JsonResult CallGold() { try { SettingData data = new SettingData(); List <GoldData> datanew = new List <GoldData>(); datanew = data.GetPriceGold(); return(Json(new { data = datanew, NewCustomer = 3, PriceSaleOfWeek = 2, CustomerReceiptCount = 20, Closejob = 20, success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { data = ex.Message, success = false }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// デフォルトデータを読み込む. /// </summary> public void LoadDefaultData() { /* * // TODO:通信実装. * UserData = GetDummyData(); * * // TODO:正しいものに. * List<string> skillSlotIdList = new List<string>(); * UnitData friendUnit = new UnitData(GetKituneArcheTypeDummy(5), 0, 12, 0, UnitKind.PLAYER, skillSlotIdList); * * UserPublicData friendPublicData = new UserPublicData( * "friend", * "ミスターフレンド", * friendUnit, * 100 * ); * BattleInitializer.Inst.SetSortieInfo(UserData.GetPartyData(0), friendPublicData); */ PlayData = new PlayData(); SettingData = new SettingData(); // 各セーブデータがあればロードする PlayData = JsonDataSaver.FileExists(PlayData) ? JsonDataSaver.Load(PlayData) : PlayData; SettingData = JsonDataSaver.FileExists(SettingData) ? JsonDataSaver.Load(SettingData) : SettingData; }
void Start() { GameRoot.Instance.evt.AddListener(GameEventDefine.BOSS_BATTLE, OnBossBattle); GameRoot.Instance.evt.AddListener(GameEventDefine.GET_WEAPON, OnGetWeapon); GameRoot.Instance.evt.AddListener(GameEventDefine.IN_BATTLE, OnInBattle); GameRoot.Instance.evt.AddListener(GameEventDefine.OUT_BATTLE, OnOutBattle); GameRoot.Instance.evt.AddListener(GameEventDefine.LEVEL_CLEAR, OnLevelClear); GameRoot.Instance.evt.AddListener(GameEventDefine.GET_KEY, OnGetWeapon); GameRoot.Instance.evt.AddListener(GameEventDefine.SET_BGM_VOLUME, OnSetBgmVolume); GameRoot.Instance.evt.AddListener(GameEventDefine.SET_EFFECT_VOLUME, OnSetEffectVolume); setting = DataManager.Instance.GetSetting(); if (setting == null) { setting = new SettingData(); audioSource.volume = 0.5f; audioEffect.volume = 0.2f; setting.bgmVolume = 0.5f; setting.effectVolume = 0.2f; setting.viewSensitive = 0.3f; DataManager.Instance.SaveSetting(setting); } else { audioSource.volume = setting.bgmVolume; audioEffect.volume = setting.effectVolume; } }
private bool CheckLoadSetting() { if (File.Exists(Common.SAVE_PATH)) { FileStream fs = new FileStream(Common.SAVE_PATH, FileMode.Open); try { BinaryFormatter formatter = new BinaryFormatter(); SettingData data = (SettingData)formatter.Deserialize(fs); GameSetting.Instance.enableAds = data.enableAds; GameSetting.Instance.enableAudio = data.enableAudio; GameSetting.Instance.currentCardSkin = data.currentCardSkin; } catch (SerializationException e) { Logger.Instance.PrintExc(Common.DEBUG_TAG, "Failed to deserialize. Reason: " + e.Message); return(false); } finally { fs.Close(); } } else { Logger.Instance.PrintError(Common.DEBUG_TAG, "File not found !!!"); return(false); } return(true); }
static void LoadConfigData(string filename, bool isDefaultConfig) ///ProtoConfig.txt { string filePath = configPath + filename; string assetPath = "Assets/Editor/CsvToData/protoConfig" + filename; if (File.Exists(filePath)) { TextAsset asset = (TextAsset)AssetDatabase.LoadAssetAtPath(assetPath, typeof(TextAsset)); if (null == asset) { Debug.LogError("load " + filePath + " failed!"); } string[] settingStr = asset.text.Split('\t'); mSettingData = new SettingData(); mSettingData.excelPath = ParseSettingStr(settingStr[0], isDefaultConfig); mSettingData.bytesPath = ParseSettingStr(settingStr [1], isDefaultConfig); mSettingData.csPath = ParseSettingStr(settingStr [2], isDefaultConfig); mSettingData.commdefPath = ParseSettingStr(settingStr [3], isDefaultConfig); mSettingData.protoToolsDir = ParseSettingStr(settingStr [4], isDefaultConfig); } else { EditorUtility.DisplayDialog("提示", "配置文件读取失败,请检查配置文件是否存在!", "OK"); mSettingData = new SettingData(); } }
public async Task UpdateSetting <T>(T obj, string name = null) { name ??= obj.GetType().FullName; using (var ctx = _ContextFactory.CreateContext()) { var settings = new SettingData(); settings.Id = name; settings.Value = Serialize(obj); ctx.Attach(settings); ctx.Entry(settings).State = EntityState.Modified; try { await ctx.SaveChangesAsync(); } catch (DbUpdateException) { ctx.Entry(settings).State = EntityState.Added; await ctx.SaveChangesAsync(); } } _EventAggregator.Publish(new SettingsChanged <T>() { Settings = obj }); }
/// <summary> /// 動作完了判定閾値 設定変更後イベント /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> private void evMoveEndRateSettingChanged(object sender, EventArgs e) { SettingData setting = SettingData.GetInstance(); FloatText moveEndRateText = (FloatText)pnlSetting.Controls[4]; setting.MoveEndRate = moveEndRateText.Value; }
public override async void Initialize(TwitterAccount account, SettingData setting, Action <TimelineAction> timelineActionCallback, Action <RowAction> rowActionCallback) { base.Initialize(account, setting, timelineActionCallback, rowActionCallback); ChangeLoadState(true); if (TimeLine.Count > 0) { string sinceId = (TimeLine.First() as DirectMessageRow).DirectMessage.id_str; var dms = await Account.TwitterClient.GetDirectMessages(sinceId); var sents = await Account.TwitterClient.GetDirectMessageSent(sinceId); dms.AddRange(sents); dms.Sort(); dms.Reverse(); var dmRows = dms.Select(d => new DirectMessageRow(d, Account.UserInfomation.screen_name, Setting, rowActionCallback)).Cast <RowBase>().ToList(); await InsertRestInTimeLineAsync(dmRows); } else { var dms = await Account.TwitterClient.GetDirectMessages(); var sents = await Account.TwitterClient.GetDirectMessageSent(); dms.AddRange(sents); dms.Sort(); dms.Reverse(); var dmRows = dms.Select(d => new DirectMessageRow(d, Account.UserInfomation.screen_name, Setting, rowActionCallback)).Cast <RowBase>().ToList(); await InsertRestInTimeLineAsync(dmRows); } ChangeLoadState(false); }
private async void SetConfiguration(bool isSetting, bool isImageResource) { Dp_Image.Stop(); Pg_Loading.Visibility = Visibility.Visible; if (isImageResource) { Pg_Loading.SetMessage("이미지 정보를 가져옵니다."); List <ImageResource> sources = await resourceCore.GetImageSources(); Dp_Image.SetImageResources(sources); } if (isSetting) { Pg_Loading.SetMessage("설정 정보를 가져옵니다."); SettingData settingData = await resourceCore.GetSettingData(); if (settingData != null) { Dp_Image.SetOutputTime(int.Parse(settingData.GetDisplayTime())); } } Pg_Loading.Visibility = Visibility.Collapsed; Dp_Image.Start(isImageResource); }
public static void SetVolume() { SettingData data = SettingData.instance; instance.music.volume = data.volume * data.music / 10000f; instance.sound_effect.volume = data.volume * data.sound_effect / 10000f; }
void Update() { SettingData data = SaveSetting.LoadSetting(); try{ Debug.Log(data.shape); if (data.shape.Equals("Triangle")) { Hexagon.SetActive(false); Triangle.SetActive(true); } else if (data.shape.Equals("Hexagon")) { Hexagon.SetActive(true); Triangle.SetActive(false); } else { Hexagon.SetActive(true); Triangle.SetActive(false); } } catch { Hexagon.SetActive(true); Triangle.SetActive(false); } }
public void ConfigWrite(SettingData setting) { this.settingData = setting; XmlDocument doc = new XmlDocument(); doc.Load(GameDefinition.SettingFilePath); XmlNode setNode = doc.SelectSingleNode(SettingTag.SettingsTag + "/" + SettingTag.SetTag); XmlElement element = (XmlElement)setNode; XmlAttributeCollection attributes = element.Attributes; foreach (XmlAttribute attribute in attributes) { switch (attribute.Name) { case SettingTag.GameTime: attribute.Value = this.settingData.GameTime; break; case SettingTag.ColdDownTime: attribute.Value = this.settingData.ColdDownTime; break; case SettingTag.ConfidenceValue: attribute.Value = this.settingData.ConfidenceValue; break; case SettingTag.PictureSize: attribute.Value = this.settingData.PictureSize; break; case SettingTag.Language: attribute.Value = this.settingData.Language; break; case SettingTag.MaterialMax: attribute.Value = this.settingData.MaterialMax; break; case SettingTag.MaterialMin: attribute.Value = this.settingData.MaterialMin; break; case SettingTag.CreateMaxTime: attribute.Value = this.settingData.CreateMaxTime; break; case SettingTag.CreateMinTime: attribute.Value = this.settingData.CreateMinTime; break; case SettingTag.MaxDownSpeed: attribute.Value = this.settingData.MaxDownSpeed; break; case SettingTag.MinDownSpeed: attribute.Value = this.settingData.MinDownSpeed; break; case SettingTag.SuccessSound: attribute.Value = this.settingData.SuccessSound; break; case SettingTag.FailSound: attribute.Value = this.settingData.FailSound; break; default: break; } } doc.Save(GameDefinition.SettingFilePath); }
public void Save() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/SettingInfo.dat", FileMode.Open); SettingData data = new SettingData(); data.movementType = movementType; data.volume = volume; bf.Serialize(file, data); file.Close(); }
private VDMSSetting() { string path = Path.Combine(HttpRuntime.AppDomainAppPath, "VDMS.II.Config.xml"); if (File.Exists(path)) { using (Stream s = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { try { XmlSerializer xmlSerializer = new XmlSerializer(typeof(SettingData)); data = (SettingData)xmlSerializer.Deserialize(s); } catch { data = new SettingData(); } } } else data = new SettingData(); }
/// <summary> /// 切换同级别设置项 /// </summary> /// <param name="action"></param> private void switchMenuItem(ACTION action) { ItemType curItem = SettingTitle_Grid.DataContext as ItemType; ItemType actionItem = new ItemType(); if (action == ACTION.LEFT) actionItem = curItem.LeftItemWithFinalLevel; else if (action == ACTION.RIGHT) actionItem = curItem.RightItemWithFinalLevel; if (actionItem == curItem) return; SettingData setting = DseFunctions.GetSettingByMenu(GlobalDefines.StaName, GlobalDefines.EquName, actionItem); ; if (setting.Count == 0) { SettingData errSetting = new SettingData() { Name = "加载失败,请检查配置文件!" }; setting.Add(errSetting); } Setting_Grid.DataContext = setting; SettingContent_ListBox.SelectedIndex = 0; ListBoxUtil.SetSvRoll(SettingContent_ListBox, 23); }
/// <summary> /// 根据参数获得定值,软压板,装置设置 /// </summary> /// <param name="staName">站名称</param> /// <param name="equName">装置名称</param> /// <param name="menuPath">菜单路径</param> /// <param name="dsType">在配置文件中的数据集类型,保护定值填1,其他定值填3,默认值是3</param> /// <param name="actSg">表示定值区号,只有保护定值有区号,别的定值没有,填0,默认值是1。具体查看mmssgcfg.cfg</param> /// <returns></returns> public static SettingData GetSetting(string staName, string equName, string menuPath, int dsType = 1, int actSg = 1) { SettingData setting = new SettingData(); int iMaxNum = 256; int size = Marshal.SizeOf(typeof(DATA_ITEM)); IntPtr pBuffer = Marshal.AllocHGlobal(size * iMaxNum); try { int iGet = dse_get_setting(staName, equName, menuPath, dsType, actSg, pBuffer, iMaxNum); IntPtr ipC = new IntPtr(pBuffer.ToInt64()); for (int i = 0; i < iGet; i++) { DATA_ITEM dataItem = (DATA_ITEM)Marshal.PtrToStructure(ipC, typeof(DATA_ITEM)); SettingData addData = new SettingData(dataItem); setting.Add(addData); ipC += size; } } finally { Marshal.FreeHGlobal(pBuffer); } if (setting.Count == 0) return null; else return setting; }
public void loadSetting() { try { FileStream stream; stream = File.Open(filename, FileMode.Open, FileAccess.Read); XmlSerializer serializer = new XmlSerializer(typeof(SettingData)); data = (SettingData)serializer.Deserialize(stream); stream.Close(); Music = data.music; Sfx = data.sfx; Mode = data.mode; modes[Mode](); } catch (Exception) { Music = true; Sfx = true; setEasyMode(); saveSetting(); } }
/// <summary> /// Get setting (Read [\Setting.xml]) /// </summary> void GetConfigSetting() { SettingData settingData = new SettingData(); this.filemanager = new FileManager(); this.filemanager.ConfigReader(GameDefinition.SettingFilePath); settingData = this.filemanager.GetSettingData(); this.confidenceValue = float.Parse(settingData.ConfidenceValue); this.pictureSize = Int32.Parse(settingData.PictureSize); this.language = settingData.Language; //get SR language this.createMaxTime = Int32.Parse(settingData.CreateMaxTime); this.createMinTime = Int32.Parse(settingData.CreateMinTime); this.maxDownSpeed = Int32.Parse(settingData.MaxDownSpeed); this.minDownSpeed = Int32.Parse(settingData.MinDownSpeed); this.SuccessSoundName = settingData.SuccessSound; this.FailSoundName = settingData.FailSound; }
/// <summary> /// Load settings data /// </summary> private void LoadSettings() { data = new SettingData(); CreateSettingsIfNotExist(); data.pairedIndex = (int)localSettings.Values["MSBandViewer-pairedIndex"]; data.sessionTrackInterval = (double)localSettings.Values["MSBandViewer-sessionTrackInterval"]; data.fileSeparator = localSettings.Values["MSBandViewer-fileSeparator"].ToString(); data.sessionDataPath = localSettings.Values["MSBandViewer-sessionDataPath"].ToString(); data.sessionDataPathToken = localSettings.Values["MSBandViewer-sessionDataPathToken"].ToString(); VerifySettings(); }
/// <summary> /// 跳转到设置界面 /// </summary> /// <param name="selItem">菜单选中项</param> private void jumpSetting(ItemType selItem) { prepareJump(); SettingData setting = DseFunctions.GetSettingByMenu(GlobalDefines.StaName, GlobalDefines.EquName, selItem); if (setting.Count == 0) { SettingData errSetting = new SettingData() { Name = "加载失败,请检查配置文件!" }; setting.Add(errSetting); } displayer.ScreenJump(SCREEN_JUMP.SETTING, setting); }
private SettingData CreateDataForStore(SettingStore store) { //Must be authenticated SettingData data = new SettingData(); var version = Store.GetVersion(store.ApplicationName, store.Version); if (version == null) { throw new SettingsStoreException(Constants.ERROR_VERION_UNKNOWN); } var directory = Store.GetDirectory(store.ApplicationName, store.DirectoryName); if (directory == null) { throw new SettingsStoreException(Constants.ERROR_DIRECTORY_UNKOWN); } data.DirectoryId = directory.Id; data.VersionId = version.Id; data.ObjecId = 0; return data; }
private SettingModel DataToModel(SettingData data) { return new SettingModel { TypeInfo = data.SettingTypeInfo, Created = data.Created, Info = data.SettingInfo, ObjectId = data.ObjecId, Modified = data.Modified, Key = data.SettingKey, Value = data.SettingValue }; }
public bool VerifyFileExist(string filename) { XmlDocument document = new XmlDocument(); switch (filename) { case GameDefinition.SettingFilePath: if (!File.Exists(filename)) { XmlNode docNode = document.CreateXmlDeclaration("1.0", "UTF-8", null); document.AppendChild(docNode); XmlNode productsNode = document.CreateElement(SettingTag.SettingsTag); document.AppendChild(productsNode); document.Save(filename); XmlNode nodee = document.SelectSingleNode(SettingTag.SettingsTag); XmlElement newMachine = document.CreateElement(SettingTag.SetTag); newMachine.SetAttribute(SettingTag.ConfidenceValue, "0.6"); newMachine.SetAttribute(SettingTag.PictureSize, "100"); newMachine.SetAttribute(SettingTag.Language, "en-US"); newMachine.SetAttribute(SettingTag.CreateMaxTime, "6"); newMachine.SetAttribute(SettingTag.CreateMinTime, "4"); newMachine.SetAttribute(SettingTag.MaxDownSpeed, "3"); newMachine.SetAttribute(SettingTag.MinDownSpeed, "1"); newMachine.SetAttribute(SettingTag.SuccessSound, "Success.mp3"); newMachine.SetAttribute(SettingTag.FailSound, "Fail.mp3"); nodee.AppendChild(newMachine); document.Save(filename); this.settingData = new SettingData("0.6", "100", "en-US", "6", "4", "3", "1", "Success.mp3", "Fail.mp3"); return false; } break; default: break; } return true; }
public bool VerifyFileExist(string filename) { XmlDocument document = new XmlDocument(); switch (filename) { case GameDefinition.SettingFilePath: if (!File.Exists(filename)) { XmlNode docNode = document.CreateXmlDeclaration("1.0", "UTF-8", null); document.AppendChild(docNode); XmlNode productsNode = document.CreateElement(SettingTag.SettingsTag); document.AppendChild(productsNode); document.Save(filename); XmlNode nodee = document.SelectSingleNode(SettingTag.SettingsTag); XmlElement newMachine = document.CreateElement(SettingTag.SetTag); newMachine.SetAttribute(SettingTag.ConfidenceValue, "0.2"); newMachine.SetAttribute(SettingTag.Language, "zh-TW"); nodee.AppendChild(newMachine); document.Save(filename); this.settingData = new SettingData("0.2", "zh-TW"); return false; } break; case GameDefinition.ScoresFilePath: if (!File.Exists(filename)) { XmlNode docNode = document.CreateXmlDeclaration("1.0", "UTF-8", null); document.AppendChild(docNode); XmlNode productsNode = document.CreateElement(ScoreTag.ScoresTag); document.AppendChild(productsNode); document.Save(filename); return false; } break; case GameDefinition.RecordFilePath: if (!File.Exists(filename)) { XmlNode docNode = document.CreateXmlDeclaration("1.0", "UTF-8", null); document.AppendChild(docNode); XmlNode node = document.CreateElement(RecordTag.Records); document.AppendChild(node); document.Save(filename); XmlNode newNode = document.SelectSingleNode(RecordTag.Records); for (int count = 1; count <= 5; count++) { XmlElement newUser = document.CreateElement(RecordTag.Record); newUser.SetAttribute(RecordTag.RecordName, "Record " + count.ToString()); newUser.SetAttribute(RecordTag.Scene, ""); newUser.SetAttribute(RecordTag.SaveDate, ""); node.AppendChild(newUser); } document.Save(filename); } break; default: break; } return true; }
/// <summary> /// Get setting (Read notepad [\config.txt]) /// </summary> void GetConfigSetting() { SettingData settingData = new SettingData(); this.filemanager = new FileManager(); this.filemanager.ConfigReader(GameDefinition.SettingFilePath); settingData = this.filemanager.GetSettingData(); this.confidenceValue = float.Parse(settingData.ConfidenceValue); //get current Series name this.pictureSize = Int32.Parse(settingData.PictureSize); //get current Series name this.language = settingData.Language; //get SR language this.createMaxTime = Int32.Parse(settingData.CreateMaxTime); this.createMinTime = Int32.Parse(settingData.CreateMinTime); this.maxDownSpeed = Int32.Parse(settingData.MaxDownSpeed); this.minDownSpeed = Int32.Parse(settingData.MinDownSpeed); this.SuccessSoundName = settingData.SuccessSound; this.FailSoundName = settingData.FailSound; // string sFolderPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), configPath); // objReader = new StreamReader(sFolderPath); // string[] tempStr; // // read confidence value // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "confidenceValue") // { // this.confidenceValue = float.Parse(tempStr[1]); //get current Series name // } // // read picture size // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "pictureSize") // { // this.pictureSize = Int32.Parse(tempStr[1]); //get current Series name // } // // read SR language // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "language") // { // this.language = tempStr[1]; //get SR language // } // // read createMaxTime // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "createMaxTime") // { // this.createMaxTime = Int32.Parse(tempStr[1]); // } // // read createMinTime // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "createMinTime") // { // this.createMinTime = Int32.Parse(tempStr[1]); // } // // read maxDownSpeed // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "maxDownSpeed") // { // this.maxDownSpeed = Int32.Parse(tempStr[1]); // } // // read minDownSpeed // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "minDownSpeed") // { // this.minDownSpeed = Int32.Parse(tempStr[1]); // } // // read SuccessSound name // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "SuccessSound") // { // this.SuccessSoundName = tempStr[1]; // } // // read FailSound name // ReadLine(ref readStr); // tempStr = readStr.Split(new string[] { "=", " " }, StringSplitOptions.RemoveEmptyEntries); // if (tempStr[0] == "FailSound") // { // this.FailSoundName = tempStr[1]; // } // objReader.Close(); // have to close reader (don't forget) //} ///// <summary> ///// Ū���@���r�A���pŪ��ťաA�~�U�@��Ū�� ///// </summary> ///// <param name="readString">�s�r��</param> //void ReadLine(ref string readString) //{ // do // { // readString = objReader.ReadLine(); // } while (readString == ""); }
public void ConfigWrite(SettingData setting) { this.settingData = setting; XmlDocument doc = new XmlDocument(); doc.Load(GameDefinition.SettingFilePath); XmlNode setNode = doc.SelectSingleNode(SettingTag.SettingsTag + "/" + SettingTag.SetTag); XmlElement element = (XmlElement)setNode; XmlAttributeCollection attributes = element.Attributes; foreach (XmlAttribute attribute in attributes) { switch (attribute.Name) { case SettingTag.ConfidenceValue: attribute.Value = this.settingData.ConfidenceValue; break; case SettingTag.Language: attribute.Value = this.settingData.Language; break; default: break; } } doc.Save(GameDefinition.SettingFilePath); }
private void LoadData () { m_PerpetualData = SharedPrefs.LoadDecrypt<PerpetualData> (PerpetualData.PREFSKEY); m_SettingData = SharedPrefs.LoadDecrypt<SettingData> (SettingData.PREFSKEY); m_RunningData = new RunningData (); }