/// <summary> /// ファイル出力 /// </summary> public static bool ExportOne(ProfileData[] datas, int profileNo, string fileName) { try { Encoding unicode = System.Text.Encoding.GetEncoding("utf-16"); using (StreamWriter sw = new StreamWriter(fileName, false, unicode)) { try { if (datas[0] == null) return false; sw.WriteLine(GetProfileFileString(datas[profileNo]).ToString()); } finally { sw.Close(); } } } catch (Exception ex) { // ファイルの保存失敗 System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.Assert(false); return false; } return true; }
/// <summary> /// ファイル出力 /// </summary> public static bool ExportAll(ProfileData[] datas, int profileNo, int outProfileCount, string fileName) { try { Encoding unicode = System.Text.Encoding.GetEncoding("utf-16"); // 複数プロファイル受信した場合は全部に対してファイル出力? for (int i = profileNo; i < profileNo + outProfileCount; i++) { using (StreamWriter sw = new StreamWriter(fileName + i, false, unicode)) { try { sw.WriteLine(datas[i].ToString()); } finally { sw.Close(); } } } } catch (Exception ex) { // ファイルの保存失敗 System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.Assert(false); return false; } return true; }
static Profiler() { m_Context = new List<ContextAndTick>(); m_ThisFrameData = new List<Tuple<string[], double>>(); m_AllFrameData = new List<ProfileData>(); m_TotalTimeData = new ProfileData(null, 0d); m_Timer = new HighPerformanceTimer(); m_Timer.Start(); }
public static void Start(string profilingName) { ProfileData profileData; if(_profiles.TryGetValue(profilingName, out profileData) == false) { profileData = new ProfileData {Stopwatch = new Stopwatch(), Name = profilingName}; _profiles.Add(profilingName, profileData); } profileData.Stopwatch.Start(); }
public void PutProfile(ProfileData data) { updateUser.Execute(new User { Id = 1, AuthorizationId = "http://not/a/real/openid/url", DisplayName = data.Name, Country = data.Country, HasRegistered = true }); }
private void LoadProfileData() { ProfileData data = null; if (IsolatedStorageSettings.ApplicationSettings.TryGetValue(PROFILE_KEY, out data)) { PROFILE_DATA = data; } else { PROFILE_DATA = new ProfileData(); IsolatedStorageSettings.ApplicationSettings[PROFILE_KEY] = PROFILE_DATA; IsolatedStorageSettings.ApplicationSettings.Save(); } }
public static void Main(string [] args) { var path = ProcessArguments(args); if (args.Length == 1) { Modules = Types = Methods = true; } var reader = new ProfileReader(); ProfileData pd = null; if (path == null) { if (Port < 0) { Error($"You should specify path or -p PORT to read the profile."); Environment.Exit(4); } else { try { pd = ReadProfileFromPort(reader); } catch (Exception e) { Error($"Unable to read profile through local port: {Port}.\n{e}"); Environment.Exit(5); } } } else if (!File.Exists(path)) { Error($"'{path}' doesn't exist."); Environment.Exit(3); } else { using (var stream = new FileStream(path, FileMode.Open)) { if (Verbose) { ColorWriteLine($"Reading '{path}'...", ConsoleColor.Yellow); } pd = reader.ReadAllData(stream); } } List <MethodRecord> methods = new List <MethodRecord> (pd.Methods); ICollection <TypeRecord> types = new List <TypeRecord> (pd.Types); ICollection <ModuleRecord> modules = new List <ModuleRecord> (pd.Modules); if (FilterMethod != null || FilterType != null || FilterModule != null) { types = new HashSet <TypeRecord> (); modules = new HashSet <ModuleRecord> (); methods = pd.Methods.Where(method => { var type = method.Type; var module = type.Module; if (FilterModule != null) { var match = FilterModule.Match(module.ToString()); if (!match.Success) { return(false); } } if (SkipModule != null) { var skip = SkipModule.Match(module.ToString()); if (skip.Success) { return(false); } } if (FilterType != null) { var match = FilterType.Match(method.Type.ToString()); if (!match.Success) { return(false); } } if (SkipType != null) { var skip = SkipType.Match(method.Type.ToString()); if (skip.Success) { return(false); } } if (FilterMethod != null) { var match = FilterMethod.Match(method.ToString()); if (!match.Success) { return(false); } } if (SkipMethod != null) { var skip = SkipMethod.Match(method.ToString()); if (skip.Success) { return(false); } } return(true); }).Skip(SkipCount).Take(TakeCount).ToList(); foreach (var method in methods) { var type = method.Type; var module = type.Module; types.Add(type); modules.Add(module); } } if (FilterMethod == null && FilterType != null) { foreach (var type in pd.Types) { if (types.Contains(type)) { continue; } var match = FilterType.Match(type.ToString()); if (!match.Success) { continue; } types.Add(type); } } if (Modules) { ColorWriteLine($"Modules:", ConsoleColor.Green); foreach (var module in modules) { WriteLine($"\t{module.Mvid} {module.ToString ()}"); } } if (Types) { ColorWriteLine($"Types:", ConsoleColor.Green); foreach (var type in types) { WriteLine($"\t{type}"); } } if (Methods) { ColorWriteLine($"Methods:", ConsoleColor.Green); foreach (var method in methods) { WriteLine($"\t{method}"); } } if (Summary) { ColorWriteLine($"Summary:", ConsoleColor.Green); WriteLine($"\tModules: {modules.Count.ToString ("N0"),10}{(modules.Count != pd.Modules.Length ? $" (of {pd.Modules.Length})" : "" )}"); WriteLine($"\tTypes: {types.Count.ToString ("N0"),10}{(types.Count != pd.Types.Length ? $" (of {pd.Types.Length})" : "")}"); WriteLine($"\tMethods: {methods.Count.ToString ("N0"),10}{(methods.Count != pd.Methods.Length ? $" (of {pd.Methods.Length})" : "")}"); } if (!string.IsNullOrEmpty(Output)) { if (Verbose) { ColorWriteLine($"Going to write the profile to '{Output}'", ConsoleColor.Yellow); } var modulesArray = new ModuleRecord [modules.Count]; modules.CopyTo(modulesArray, 0); var typesArray = new TypeRecord [types.Count]; types.CopyTo(typesArray, 0); var updatedPD = new ProfileData(modulesArray, typesArray, methods.ToArray()); using (var stream = new FileStream(Output, FileMode.Create)) { var writer = new ProfileWriter(); writer.WriteAllData(stream, updatedPD); } } }
private async Task UpdateExistingProfile(SonarrReleaseProfile profileToUpdate, ProfileData profile, List <int> tagIds) { Log.Debug("Update existing profile with id {ProfileId}", profileToUpdate.Id); SetupProfileRequestObject(profileToUpdate, profile, tagIds); await _api.UpdateReleaseProfile(profileToUpdate); }
// Start is called before the first frame update void Start() { profile = ProfileData.Load(); SwitchToGameModeMenu(); UpdateDifficultyButtons(); }
private void SyncProfile(string p_username, int p_level, int p_xp) { playerProfile = new ProfileData(p_username, p_level, p_xp); playerUsername.text = playerProfile.username; }
private ProfileData CreateModel(string profileText, IEnumerable<ProfileTag> tags, ApiProfileImagesResponse imageResponse, IEnumerable<ProfileKink> kinks, IEnumerable<string> alts) { var allKinks = kinks.Select(GetFullKink); var toReturn = new ProfileData { ProfileText = profileText, Kinks = allKinks.ToList(), Alts = alts.ToList() }; var tagActions = new Dictionary<string, Action<string>>(StringComparer.OrdinalIgnoreCase) { {"age", s => toReturn.Age = s}, {"species", s => toReturn.Species = s}, {"orientation", s => toReturn.Orientation = s}, {"build", s => toReturn.Build = s}, {"height/length", s => toReturn.Height = s}, {"body type", s => toReturn.BodyType = s}, {"position", s => toReturn.Position = s}, {"dom/sub role", s => toReturn.DomSubRole = s} }; var profileTags = tags.ToList(); profileTags.Each(x => { Action<string> action; if (tagActions.TryGetValue(x.Label, out action)) action(x.Value.DoubleDecode()); }); toReturn.AdditionalTags = profileTags .Where(x => !tagActions.ContainsKey(x.Label)) .Select(x => { x.Value = x.Value.DoubleDecode(); return x; }).ToList(); toReturn.Images = imageResponse.Images.Select(x => new ProfileImage(x)).ToList(); toReturn.LastRetrieved = DateTime.Now; return toReturn; }
public void AddProfile(ProfileData data, PlayerID id = PlayerID.One) { loadedProfiles.Add(id,data); }
public void SetProfile(ProfileData _profile) { profile = _profile; }
public void SetProfileData(int _dataIndex) { ProfileData _profileData = DataList[_dataIndex]; SetProfileData(_profileData); }
public static String createPersona() { String name = Access.sHttp.request.Params.Get("name"); Int16 iconIndex = Convert.ToInt16(Access.sHttp.request.Params.Get("iconIndex")); ProfileData respondProfileData = new ProfileData(); using (var session = SessionManager.getSessionFactory().OpenSession()) using (var transaction = session.BeginTransaction()) { PersonaEntity personaEntity = new PersonaEntity(); personaEntity.boost = 0; personaEntity.cash = 250000; personaEntity.currentCarIndex = -1; personaEntity.iconIndex = iconIndex; personaEntity.level = 1; personaEntity.motto = ""; personaEntity.name = name; personaEntity.percentageOfLevelCompletion = 0; personaEntity.rating = 0; personaEntity.reputationInLevel = 0; personaEntity.reputationInTotal = 0; personaEntity.score = 0; session.Save(personaEntity); foreach (String powerup in Powerups.powerups) { InventoryItemEntity itemEntity = new InventoryItemEntity(); itemEntity.entitlementTag = powerup; itemEntity.hash = Engine.getOverflowHash(powerup); itemEntity.productId = "DO NOT USE ME"; itemEntity.status = "ACTIVE"; itemEntity.stringHash = "0x" + Engine.getHexHash(powerup); itemEntity.remainingUseCount = 50; itemEntity.resellPrice = 0; itemEntity.virtualItemType = VirtualItemType.powerup; personaEntity.addInventoryItem(itemEntity); session.Save(powerup); } respondProfileData.boost = 0; respondProfileData.cash = 250000; respondProfileData.iconIndex = iconIndex; respondProfileData.level = 1; respondProfileData.name = name; respondProfileData.personaId = personaEntity.id; lock (NfswSession.personaListLock) { Access.CurrentSession.PersonaList.Add(new Persona(personaEntity)); } transaction.Commit(); } lock (NfswSession.personaListLock) { Int32 newDefaultPersonaIdx = Access.CurrentSession.PersonaList.Count - 1; Access.CurrentSession.ActivePersona = Access.CurrentSession.PersonaList[newDefaultPersonaIdx]; } return(respondProfileData.SerializeObject()); }
public void Awake() { PhotonNetwork.AutomaticallySyncScene = true; myProfile = Data.LoadProfile(); usernameField.text = myProfile.username; }
public CxWSBasicRepsonse UpdateUserProfileData(string sessionID, ProfileData userProfileData) { CxWSBasicRepsonse result = _web_Service.UpdateUserProfileData(sessionID, userProfileData); return result; }
public MainWindow() { studentData = new ProfileData(jointsTracked); InitializeComponent(); }
public static void SetCurrentProfile(ProfileData data) { ProfileData.currentProfile = data; }
protected override AbsTabViewModel CreateViewModel(ProfileData viewModelProfile, Services.Models.Tab tabData) { return(new ProfileTabViewModel(viewModelProfile, tabData)); }
public void SetProfileData(ProfileData _profileData) { _profileData.Value = _profileData.Inputfield.text; _profileData.OutputTextfield.text = _profileData.Name + ": " + _profileData.Value; }
protected override string GetDimensionKey(ProfileData profile) { return string.Format("{1} ({0})", profile.ProfileName, profile.PatternLabel); //return string.Format("{0}{1}{2}", (object)profile.ProfileName, (object)Constants.HierarchySeparator, (object)profile.PatternLabel); }
/// <summary> /// "High-speed mode get batch profiles" button pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _btnGetBatchProfile_Click(object sender, EventArgs e) { // Specify get target batch. LJV7IF_GET_BATCH_PROFILE_REQ req = new LJV7IF_GET_BATCH_PROFILE_REQ(); req.byTargetBank = ProfileBank.Active; req.byPosMode = BatchPos.Commited; req.dwGetBatchNo = 0; req.dwGetProfNo = 0; req.byGetProfCnt = byte.MaxValue; req.byErase = 0; LJV7IF_GET_BATCH_PROFILE_RSP rsp = new LJV7IF_GET_BATCH_PROFILE_RSP(); LJV7IF_PROFILE_INFO profileInfo = new LJV7IF_PROFILE_INFO(); int profileDataSize = MAX_PROFILE_COUNT + (Marshal.SizeOf(typeof(LJV7IF_PROFILE_HEADER)) + Marshal.SizeOf(typeof(LJV7IF_PROFILE_FOOTER))) / sizeof(int); int[] receiveBuffer = new int[profileDataSize * req.byGetProfCnt]; using (ProgressForm progressForm = new ProgressForm()) { Cursor.Current = Cursors.WaitCursor; progressForm.Status = Status.Communicating; progressForm.Show(this); progressForm.Refresh(); List <ProfileData> profileDatas = new List <ProfileData>(); // Get profiles. using (PinnedObject pin = new PinnedObject(receiveBuffer)) { Rc rc = (Rc)NativeMethods.LJV7IF_GetBatchProfile(DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer, (uint)(receiveBuffer.Length * sizeof(int))); if (!CheckReturnCode(rc)) { return; } // Output profile data int unitSize = ProfileData.CalculateDataSize(profileInfo); for (int i = 0; i < rsp.byGetProfCnt; i++) { profileDatas.Add(new ProfileData(receiveBuffer, unitSize * i, profileInfo)); } // Get all profiles in the batch. req.byPosMode = BatchPos.Spec; req.dwGetBatchNo = rsp.dwGetBatchNo; do { // Update get profile position. req.dwGetProfNo = rsp.dwGetBatchTopProfNo + rsp.byGetProfCnt; req.byGetProfCnt = (byte)Math.Min((uint)(byte.MaxValue), (rsp.dwCurrentBatchProfCnt - req.dwGetProfNo)); rc = (Rc)NativeMethods.LJV7IF_GetBatchProfile(DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer, (uint)(receiveBuffer.Length * sizeof(int))); if (!CheckReturnCode(rc)) { return; } for (int i = 0; i < rsp.byGetProfCnt; i++) { profileDatas.Add(new ProfileData(receiveBuffer, unitSize * i, profileInfo)); } } while (rsp.dwGetBatchProfCnt != (rsp.dwGetBatchTopProfNo + rsp.byGetProfCnt)); } progressForm.Status = Status.Saving; progressForm.Refresh(); // Save file SaveProfile(profileDatas, _txtSavePath.Text); } }
/// <summary> /// "Advanced mode get batch profiles" button pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _btnGetBatchProfileAdvance_Click(object sender, EventArgs e) { MessageBox.Show("Start advanced mode get batch profiles.\r\nCheck that LJ-Navigator 2 is not starting up"); LJV7IF_GET_BATCH_PROFILE_ADVANCE_REQ req = new LJV7IF_GET_BATCH_PROFILE_ADVANCE_REQ(); req.byPosMode = BatchPos.Commited; req.dwGetBatchNo = 0; req.dwGetProfNo = 0; req.byGetProfCnt = byte.MaxValue; LJV7IF_GET_BATCH_PROFILE_ADVANCE_RSP rsp = new LJV7IF_GET_BATCH_PROFILE_ADVANCE_RSP(); LJV7IF_PROFILE_INFO profileInfo = new LJV7IF_PROFILE_INFO(); LJV7IF_MEASURE_DATA[] batchMeasureData = new LJV7IF_MEASURE_DATA[NativeMethods.MesurementDataCount]; LJV7IF_MEASURE_DATA[] measureData = new LJV7IF_MEASURE_DATA[NativeMethods.MesurementDataCount]; int profileDataSize = MAX_PROFILE_COUNT + (Marshal.SizeOf(typeof(LJV7IF_PROFILE_HEADER)) + Marshal.SizeOf(typeof(LJV7IF_PROFILE_FOOTER))) / sizeof(int); int measureDataSize = Marshal.SizeOf(typeof(LJV7IF_MEASURE_DATA)) * NativeMethods.MesurementDataCount / sizeof(int); int[] receiveBuffer = new int[(profileDataSize + measureDataSize) * req.byGetProfCnt]; using (ProgressForm progressForm = new ProgressForm()) { Cursor.Current = Cursors.WaitCursor; progressForm.Status = Status.Communicating; progressForm.Show(this); progressForm.Refresh(); List <ProfileData> profileDatas = new List <ProfileData>(); // Get profiles. using (PinnedObject pin = new PinnedObject(receiveBuffer)) { Rc rc = (Rc)NativeMethods.LJV7IF_GetBatchProfileAdvance(DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer, (uint)(receiveBuffer.Length * sizeof(int)), batchMeasureData, measureData); if (!CheckReturnCode(rc)) { return; } // Output profile data int unitSize = ProfileData.CalculateDataSize(profileInfo) + measureDataSize; for (int i = 0; i < rsp.byGetProfCnt; i++) { profileDatas.Add(new ProfileData(receiveBuffer, unitSize * i, profileInfo)); } // Get all profiles in the batch. req.byPosMode = BatchPos.Spec; req.dwGetBatchNo = rsp.dwGetBatchNo; do { // Update get profile position. req.dwGetProfNo = rsp.dwGetBatchTopProfNo + rsp.byGetProfCnt; req.byGetProfCnt = (byte)Math.Min((uint)(byte.MaxValue), (rsp.dwGetBatchProfCnt - req.dwGetProfNo)); rc = (Rc)NativeMethods.LJV7IF_GetBatchProfileAdvance(DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer, (uint)(receiveBuffer.Length * sizeof(int)), batchMeasureData, measureData); if (!CheckReturnCode(rc)) { return; } for (int i = 0; i < rsp.byGetProfCnt; i++) { profileDatas.Add(new ProfileData(receiveBuffer, unitSize * i, profileInfo)); } } while (rsp.dwGetBatchProfCnt != (rsp.dwGetBatchTopProfNo + rsp.byGetProfCnt)); } progressForm.Status = Status.Saving; progressForm.Refresh(); // Save file SaveProfile(profileDatas, _txtSavePath.Text); } }
public override Drawables GetDrawables(ProfileData data) { Text = $"{data.XpShown:#,##0} / {data.MaxXpShown:N0} ({Math.Floor(data.XpPercentage * 100):0}%)"; return(base.GetDrawables(data)); }
// ===================================================== public static void LoadProfile(string filename) { var path = Application.streamingAssetsPath + "/Profiles/" + filename; s_currentProfile = LoadFile <ProfileData>(path); }
static bool IsEmpty(ProfileData data) { return(data.Required.Count == 0 && data.Ignored.Count == 0 && data.Preferred.Count == 0); }
public void RetrieveProfileNow(Dictionary <ProfileSearchCriteria, string> criteria, Action action, bool executeActionOnProfileFound = true) { string uri = CognitoUrl + @"forms/api/" + CognitoAPIKey + @"/forms/" + ProfileFormName + "/searchEntries?criteria==("; Debug.Log("RETRIEVE"); if (criteria == null || criteria.Count == 0) { return; } foreach (var c in criteria) { switch (c.Key) { case ProfileSearchCriteria.Email: uri += "Email"; break; case ProfileSearchCriteria.Username: uri += "Username"; break; case ProfileSearchCriteria.Password: uri += "Password"; break; default: uri += "Id1"; break; } uri += ".ToLower()=\"" + c.Value.ToLower(); if (criteria.Last().Key == c.Key) { uri += "\")"; } else { uri += "\" and "; } } Debug.Log(uri); var request = new Request(uri, "", RequestType.Get, returnFunction: null, retry: false); request.returnFunction = ((r) => { var req = r.requestStatus; var text = System.Text.UTF8Encoding.Default.GetString(req.downloadHandler.data); Debug.Log(text); if (text.Replace(" ", string.Empty) != "{\"entries\":[],\"orders\":[]}") { profileReferenceData = new ProfileData(true); var keys = new List <string>() { "Username", "Id1", "Email", "Password" }; foreach (var key in keys) { text = text.Substring(text.IndexOf(key) + key.Length + 3); var value = text.Substring(0, text.IndexOf('"')); if (key == "Username") { profileReferenceData.UserName = value; } else if (key == "Id1") { profileReferenceData.ID = value; } else if (key == "Email") { profileReferenceData.Email = value; } else { profileReferenceData.Password = value; } Debug.Log(value); } //username, id, email, password if (executeActionOnProfileFound) { action(); } } else if (text.Replace(" ", string.Empty) == "{\"entries\":[],\"orders\":[]}" && !executeActionOnProfileFound) { action(); } return(true); }); GetNow(request); return; }
protected AbsTabViewModel(ProfileData profile, Services.Models.Tab tabData) { ProfileData = profile; Tab = tabData; }
private static void SetupProfileRequestObject(SonarrReleaseProfile profileToUpdate, ProfileData profile, List <int> tagIds) { profileToUpdate.Preferred = profile.Preferred .SelectMany(kvp => kvp.Value.Select(term => new SonarrPreferredTerm(kvp.Key, term))) .ToList(); profileToUpdate.Ignored = string.Join(',', profile.Ignored); profileToUpdate.Required = string.Join(',', profile.Required); // Null means the guide didn't specify a value for this, so we leave the existing setting intact. if (profile.IncludePreferredWhenRenaming != null) { profileToUpdate.IncludePreferredWhenRenaming = profile.IncludePreferredWhenRenaming.Value; } profileToUpdate.Tags = tagIds; }
public static void Main(string [] args) { var path = ProcessArguments(args); if (!File.Exists(path)) { Error($"'{path}' doesn't exist."); Environment.Exit(3); } if (args.Length == 1) { Modules = Types = Methods = true; } var reader = new ProfileReader(); ProfileData pd; using (var stream = new FileStream(path, FileMode.Open)) { if (Verbose) { ColorWriteLine($"Reading '{path}'...", ConsoleColor.Yellow); } pd = reader.Read(stream); } List <MethodRecord> methods = pd.Methods; ICollection <TypeRecord> types = pd.Types; ICollection <ModuleRecord> modules = pd.Modules; if (FilterMethod != null || FilterType != null || FilterModule != null) { methods = new List <MethodRecord> (); types = new HashSet <TypeRecord> (); modules = new HashSet <ModuleRecord> (); foreach (var method in pd.Methods) { var type = method.Type; var module = type.Module; if (FilterModule != null) { var match = FilterModule.Match(module.ToString()); if (!match.Success) { continue; } } if (FilterType != null) { var match = FilterType.Match(method.Type.ToString()); if (!match.Success) { continue; } } if (FilterMethod != null) { var match = FilterMethod.Match(method.ToString()); if (!match.Success) { continue; } } methods.Add(method); types.Add(type); modules.Add(module); } } if (FilterMethod == null && FilterType != null) { foreach (var type in pd.Types) { if (types.Contains(type)) { continue; } var match = FilterType.Match(type.ToString()); if (!match.Success) { continue; } types.Add(type); } } if (Modules) { ColorWriteLine($"Modules:", ConsoleColor.Green); foreach (var module in modules) { WriteLine($"\t{module.Mvid} {module}"); } } if (Types) { ColorWriteLine($"Types:", ConsoleColor.Green); foreach (var type in types) { WriteLine($"\t{type}"); } } if (Methods) { ColorWriteLine($"Methods:", ConsoleColor.Green); foreach (var method in methods) { WriteLine($"\t{method}"); } } if (Summary) { ColorWriteLine($"Summary:", ConsoleColor.Green); WriteLine($"\tModules: {modules.Count.ToString ("N0"),10}{(modules.Count != pd.Modules.Count ? $" (of {pd.Modules.Count})" : "" )}"); WriteLine($"\tTypes: {types.Count.ToString ("N0"),10}{(types.Count != pd.Types.Count ? $" (of {pd.Types.Count})" : "")}"); WriteLine($"\tMethods: {methods.Count.ToString ("N0"),10}{(methods.Count != pd.Methods.Count ? $" (of {pd.Methods.Count})" : "")}"); } if (!string.IsNullOrEmpty(Output)) { if (Verbose) { ColorWriteLine($"Going to write the profile to '{Output}'", ConsoleColor.Yellow); } var updatedPD = new ProfileData(new List <ModuleRecord>(modules), new List <TypeRecord> (types), methods); using (var stream = new FileStream(Output, FileMode.Create)) { var writer = new ProfileWriter(stream, updatedPD); writer.Write(); } } }
public static void RemoveProfile(ProfileData profile) { profiles.Remove(profile); AssetDatabase.DeleteAsset(profile.AssetPath); }
public static void ImportPrinter(Printer printer, ProfileData profileData, string profilePath) { var printerInfo = new PrinterInfo() { Name = printer.Name, Id = printer.Id.ToString() }; profileData.Profiles.Add(printerInfo); var layeredProfile = ActiveSliceSettings.LoadEmptyProfile(); layeredProfile.OemProfile = new OemProfile(LoadOemLayer(printer)); LoadQualitySettings(layeredProfile, printer); LoadMaterialSettings(layeredProfile, printer); layeredProfile.ID = printer.Id.ToString(); layeredProfile.UserLayer["MatterControl.PrinterName"] = printer.Name ?? ""; layeredProfile.UserLayer["MatterControl.Make"] = printer.Make ?? ""; layeredProfile.UserLayer["MatterControl.Model"] = printer.Model ?? ""; layeredProfile.UserLayer["MatterControl.BaudRate"] = printer.BaudRate ?? ""; layeredProfile.UserLayer["MatterControl.ComPort"] = printer.ComPort ?? ""; layeredProfile.UserLayer["MatterControl.AutoConnect"] = printer.AutoConnect ? "1" : "0"; layeredProfile.UserLayer["MatterControl.DefaultMaterialPresets"] = printer.MaterialCollectionIds ?? ""; layeredProfile.UserLayer["MatterControl.WindowsDriver"] = printer.DriverType ?? ""; layeredProfile.UserLayer["MatterControl.DeviceToken"] = printer.DeviceToken ?? ""; layeredProfile.UserLayer["MatterControl.DeviceType"] = printer.DeviceType ?? ""; if (string.IsNullOrEmpty(UserSettings.Instance.get("ActiveProfileID"))) { UserSettings.Instance.set("ActiveProfileID", printer.Id.ToString()); } layeredProfile.UserLayer["MatterControl.ActiveThemeIndex"] = UserSettings.Instance.get("ActiveThemeIndex"); // Import macros from the database var allMacros = Datastore.Instance.dbSQLite.Query <CustomCommands>("SELECT * FROM CustomCommands WHERE PrinterId = " + printer.Id); layeredProfile.Macros = allMacros.Select(macro => new GCodeMacro() { GCode = macro.Value.Trim(), Name = macro.Name, LastModified = macro.DateLastModified }).ToList(); string query = string.Format("SELECT * FROM PrinterSetting WHERE Name = 'PublishBedImage' and PrinterId = {0};", printer.Id); var publishBedImage = Datastore.Instance.dbSQLite.Query <PrinterSetting>(query).FirstOrDefault(); layeredProfile.UserLayer["MatterControl.PublishBedImage"] = publishBedImage?.Value == "true" ? "1" : "0"; // Print leveling var printLevelingData = PrintLevelingData.Create( new SettingsProfile(layeredProfile), printer.PrintLevelingJsonData, printer.PrintLevelingProbePositions); layeredProfile.UserLayer["MatterControl.PrintLevelingData"] = JsonConvert.SerializeObject(printLevelingData); layeredProfile.UserLayer["MatterControl.PrintLevelingEnabled"] = printer.DoPrintLeveling ? "true" : "false"; layeredProfile.UserLayer["MatterControl.ManualMovementSpeeds"] = printer.ManualMovementSpeeds; // TODO: Where can we find CalibrationFiiles in the current model? //layeredProfile.SetActiveValue("MatterControl.CalibrationFiles", printer.Make); layeredProfile.ID = printer.Id.ToString(); string fullProfilePath = Path.Combine(profilePath, printer.Id + ".json"); File.WriteAllText(fullProfilePath, JsonConvert.SerializeObject(layeredProfile, Formatting.Indented)); }
private void GoToProfile(ProfileData data) { GeneralBlackboard.SetValue(BlackBoardValues.EProfileData, data); GeneralBlackboard.SetValue(BlackBoardValues.EBackPage, this); PageNavigationManager.SwitchToSubpage(new UserProfilePage()); }
public HeadlineTabViewModel(ProfileData profile, Services.Models.Tab tabData) : base(profile, tabData) { }
public static void SetUserProfile(ProfileData profileData) { UserName = profileData.UserName; ID = profileData.ID; Email = profileData.Email; }
public override Drawables GetDrawables(ProfileData data) { Text = data.Level.ToString(); return(base.GetDrawables(data)); }
public CxWSBasicRepsonse UpdateUserProfileData(string sessionID, ProfileData userProfileData) { CxWSBasicRepsonse result = _web_Service.UpdateUserProfileData(sessionID, userProfileData); return(result); }
//=========================================================================== // // Functions // //=========================================================================== // // AttemptLoad() // Attempts to load a profile and will try various things to achieve success // private Boolean AttemptLoad() { ProfileData loadProfileData = new ProfileData(); if (profile.Load(ddbProfile.Text, ref loadProfileData)) { //load from file successful ProfileData previousProfileData = profileData; profileData = loadProfileData; if (!UpdatePreferences()) { profileData = previousProfileData; return false; //preferences could not be updated, so the loading failed } previousProfile = ddbProfile.Text; RetryAttempts = 0; Properties.Settings.Default.DefaultProfile = ddbProfile.Text; Properties.Settings.Default.Save(); SetInstructions(); if (Startup && profileData.loadSound && (profileData.alwaysPlay || profileData.turbo >= 30)) { //play the prepare ship sound effect at startup soundEffects.PlayEffect(); } return true; } else //load from file failed { if (!Directory.Exists(currentDirectory)) //make sure the profile folder exists { try { Directory.CreateDirectory(currentDirectory); //if not, create it } catch { } } if (!Startup && RetryAttempts == 0) //only show the error message one time MessageBox.Show("Unable to load profile!", "Clicktastic", MessageBoxButtons.OK, MessageBoxIcon.Error); if (RetryAttempts == 0 && ddbProfile.Items.Contains(previousProfile)) { RetryAttempts++; ddbProfile.SelectedItem = previousProfile; //revert back to previous profile } else if (RetryAttempts < 2 && ddbProfile.Items.Count > 0) { RetryAttempts++; ddbProfile.SelectedIndex = 0; //attempt to revert to the first profile in the list } else if (RetryAttempts < 3 && ddbProfile.Items.Contains("Default")) { RetryAttempts++; ddbProfile.SelectedItem = "Default"; //attempt to fall back to the default profile } else //give up { RetryAttempts = 0; CreateDefaultProfile(); //recreate default profile return true; } return false; } }
private void SignIn() { if (ControllerManager.instance.GetButtonDown(ControllerInputWrapper.Buttons.B, PlayerID.One)) { state = Enums.UIStates.Splash; UpdatePanels(SplashPanel); SFXManager.instance.PlayNegative(); ControllerManager.instance.AllowPlayerRemoval(ControllerInputWrapper.Buttons.B); } if (ControllerManager.instance.GetButtonDown(ControllerInputWrapper.Buttons.Start, PlayerID.One)) { string text = SignInPanel.FindChild("NameCreator").FindChild("LetterHolder").GetComponent<NameCreator>().t.text; if(text.Length > 0 && text.ToCharArray()[text.Length-1] != ' ') { ProfileData pd = new ProfileData(text); ProfileManager.instance.AddProfile(pd); SignInToMain(); SFXManager.instance.PlayAffirm(); } } }
/// <remarks/> public System.IAsyncResult BeginUpdateUserProfileData(string sessionID, ProfileData userProfileData, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("UpdateUserProfileData", new object[] { sessionID, userProfileData}, callback, asyncState); }
private void LoadAndParseProfiles() { //make sure this code and necessary libraries are not included in native builds to avoid increasing the app size #if UNITY_EDITOR try { string filePath = Path.Combine(Application.dataPath, "Editor/QCAR/WebcamProfiles/profiles.xml"); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filePath); // XmlNodeList cameraNodes = xmlDoc.GetElementsByTagName("webcam"); foreach (XmlNode cameraNode in cameraNodes) { // parse this entry and store it in dictionary mProfiles[cameraNode.Attributes["deviceName"].Value.ToLower()] = ParseConfigurationEntry(cameraNode); } // parse default configuration mDefaultProfile = ParseConfigurationEntry(xmlDoc.GetElementsByTagName("default")[0]); } catch (Exception e) { string errorMsg = "Exception occurred when trying to parse web cam profile file: " + e.Message; EditorUtility.DisplayDialog("Error occurred!", errorMsg, "Ok"); Debug.LogError(errorMsg); } #endif }
/// <remarks/> public void UpdateUserProfileDataAsync(string sessionID, ProfileData userProfileData, object userState) { if ((this.UpdateUserProfileDataOperationCompleted == null)) { this.UpdateUserProfileDataOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateUserProfileDataOperationCompleted); } this.InvokeAsync("UpdateUserProfileData", new object[] { sessionID, userProfileData}, this.UpdateUserProfileDataOperationCompleted, userState); }
public override Drawables GetDrawables(ProfileData data) { Text = data.XpTotal.ToString("N0", new CultureInfo("en-US")); return(base.GetDrawables(data)); }
//@@@エンベロープ数等の制御のメソッドも追加必要 /// <summary> /// 1プロファイルデータの出力 /// </summary> /// <param name="info"></param> /// <param name="datas"></param> /// <returns></returns> private static StringBuilder GetProfileFileString(ProfileData data) { StringBuilder sb = new StringBuilder(); double ratio = Define.PROFILE_UNIT_MM; // データ位置の算出 double posX = data.ProfInfo.lXStart * ratio; double deltaX = data.ProfInfo.lXPitch * ratio; int singleProfileCount = data.ProfInfo.wProfDataCnt; bool isEnvelope = (data.ProfInfo.byEnvelope == 1); bool isTwoHead = (data.ProfInfo.byProfileCnt == 2); double headAMax = 0.0; double headAMin = 0.0; double headBMax = 0.0; double headBMin = 0.0; for (int i = 0; i < singleProfileCount; i++) { headAMax = (data.ProfDatas[i] * ratio); if (isEnvelope) { if (isTwoHead) { headAMin = data.ProfDatas[i + singleProfileCount] * ratio; headBMax = data.ProfDatas[i + singleProfileCount * 2] * ratio; headBMin = data.ProfDatas[i + singleProfileCount * 3] * ratio; sb.AppendFormat("{0,0:f3}\t{1,0:f3}\t{2,0:f3}\t{3,0:f3}\t{4,0:f3}", (posX + deltaX * i), headAMax, headAMin, headBMax, headBMin).AppendLine(); } else { headAMin = data.ProfDatas[i + singleProfileCount] * ratio; sb.AppendFormat("{0,0:f3}\t{1,0:f3}\t{2,0:f3}", (posX + deltaX * i), headAMax, headAMin).AppendLine(); } } else { if (isTwoHead) { headBMax = data.ProfDatas[i + singleProfileCount] * ratio; sb.AppendFormat("{0,0:f3}\t{1,0:f3}\t{2,0:f3}", (posX + deltaX * i), headAMax, headBMax).AppendLine(); } else { headAMin = double.NaN; headBMax = double.NaN; headBMin = double.NaN; sb.AppendFormat("{0,0:f3}\t{1,0:f3}", (posX + deltaX * i), headAMax).AppendLine(); } } } return sb; }
public CxWSBasicRepsonse UpdateUserProfileData(string sessionID, ProfileData userProfileData) { object[] results = this.Invoke("UpdateUserProfileData", new object[] { sessionID, userProfileData}); return ((CxWSBasicRepsonse)(results[0])); }
public override Drawables GetDrawables(ProfileData data) { Text = $"#{data.KarmaRank}"; return(base.GetDrawables(data)); }
/// <remarks/> public void UpdateUserProfileDataAsync(string sessionID, ProfileData userProfileData) { this.UpdateUserProfileDataAsync(sessionID, userProfileData, null); }
protected override async Task OnInitAsync() { currentProfile = await Http.GetJsonAsync <ProfileData>("https://uinames.com/api/?&amount=1&ext"); }
private void SignIn() { if (ControllerManager.instance.GetButtonDown(ControllerInputWrapper.Buttons.B, PlayerID.One)) { state = Enums.UIStates.Splash; UpdatePanels(SplashPanel); } if (ControllerManager.instance.GetButtonDown(ControllerInputWrapper.Buttons.Start, PlayerID.One)) { string text = SignInPanel.FindChild("NameCreator").FindChild("LetterHolder").GetComponent<NameCreator>().t.text; if(text.Length == 4) { ProfileData pd = new ProfileData(text); ProfileManager.instance.AddProfile(pd); SignInToMain(); } } }
private void GetKinkDataAsync(object s, DoWorkEventArgs e) { var kinkDataCache = SettingsService.RetrieveProfile("!kinkdata"); if (kinkDataCache == null) { var response = browser.GetResponse(Constants.UrlConstants.KinkList); var data = JsonConvert.DeserializeObject<ApiKinkDataResponse>(response); var apiKinks = data.Kinks .SelectMany(x => x.Value.Kinks) .Select(x => new ProfileKink { Id = x.Id, IsCustomKink = false, Name = x.Name.DoubleDecode(), Tooltip = x.Description.DoubleDecode(), KinkListKind = KinkListKind.MasterList }).ToList(); kinkDataCache = new ProfileData { Kinks = apiKinks }; SettingsService.SaveProfile("!kinkdata", kinkDataCache); } kinkData.Clear(); kinkDataCache.Kinks.Each(x => kinkData.Add(x.Id, x)); }