/// <summary> /// Overloaded to load the WindowsMediaProfiles /// </summary> protected override void LoadProfileGroups() { ProfileGroups = new ProfileGroups(); string wmpRoot = PathMapper.ConfigProfiles(@"WindowsMediaProfiles\"); DirectoryInfo wmpRootInfo = new DirectoryInfo(wmpRoot); DirectoryInfo[] groups = wmpRootInfo.GetDirectories(); foreach (DirectoryInfo groupInfo in groups) { ProfileGroup g = new ProfileGroup(); g.Name = groupInfo.Name; foreach (FileInfo item in groupInfo.GetFiles("*.prx")) { Profile p = new Profile(); // p.SinkProtocol = SinkProtocolType.HTTP; p.Name = g.Name + ":" + Path.GetFileNameWithoutExtension(item.Name); g.Items.Add(p); } g.DefaultProfileName = (g.Items.Count > 0) ? g.Items[0].Name.Split(':')[1] : null; ProfileGroups.Items.Add(g); } }
private List <ProfileType> byProfileSet(string profileSet) { List <ProfileType> res = new List <ProfileType>(); ProfileType p = byName(profileSet); if (p != null) { res.Add(p); return(res); } ProfileGroup g = groupByName(profileSet); if (g == null) { throw new Exception(); } foreach (string s in g.ChildIDs) { res.AddRange(byProfileSet(s)); } return(res); }
/// <summary> /// Opens a given file /// </summary> /// <param name="filename">path of file to open. if successful, this path will be cached for saving and opening</param> /// <returns>returns true if the operation was successful, false if it failed.</returns> private bool OpenFile(string filename) { try { ProfileGroup temp = ProfileGroup.LoadFromFile(filename); try { ProfileGroup = temp; saveFileDialog.FileName = openFileDialog.FileName = filename; return(true); } catch (Exception loadEx) { MessageBox.Show(this, "An error occurred while loading the file! A blank Profile Group will be loaded instead." + Environment.NewLine + Environment.NewLine + loadEx.Message, "Error loading file!", MessageBoxButtons.OK, MessageBoxIcon.Error); saveFileDialog.FileName = ""; ProfileGroup = null; } } catch (Exception ex) { MessageBox.Show(this, "An error occurred while reading the file!" + Environment.NewLine + Environment.NewLine + ex.ToString(), "Error reading file!", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(false); }
public List <Profile> Load(ISqlConnectionInfo connection, ProfileGroup profileGroup) { SqlQueryParameters parameters = new SqlQueryParameters(); parameters.Where = "[p].ProfileGroupID = @ProfileGroupID"; parameters.Arguments.Add("ProfileGroupID", profileGroup.ID); return(this.LoadMany(connection, parameters)); }
public ServiceProfileGroupMap CreateInstance(ProfileGroup profileGroup) { if (!this.HasData) { return(null); } return(new ServiceProfileGroupMap(this.ServiceProfileGroupMapID, this.ServiceID, profileGroup ?? new ProfileGroup(this.ProfileGroupID), this.IsActive, this.Updated, this.Created)); }
public Profile CreateInstance(ProfileGroup profileGroup) { if (!this.HasData) { return(null); } return(new Profile(this.ProfileID, profileGroup ?? new ProfileGroup(this.ProfileGroupID), this.Updated, this.Created)); }
/// <summary> /// Displays the overall group editor. /// </summary> /// <param name="group">group to display in the editor</param> private void ShowGroupEditor(ProfileGroup group) { this.profileEditor.Dock = DockStyle.Top; this.profileEditor.Height = 0; this.groupEditor.Dock = DockStyle.Fill; this.groupEditor.ProfileGroup = group; }
public List <Profile> Load(IConnectionInfo connection, ProfileGroup profileGroup) { ISqlConnectionInfo sqlConnection = connection as ISqlConnectionInfo; if (sqlConnection != null) { return(this.Load(sqlConnection, profileGroup)); } using (sqlConnection = new SqlConnectionInfo(connection, this.Type)) return(this.Load(sqlConnection, profileGroup)); }
public void Build(List <Waypoint> points) { var group = new ProfileGroup(ProfileName); var wps = ProfileFactory.CreateWithFixedStep(points, StepMeters, SelectedNamingScheme.GetWaypointName); wps.ForEach(p => { WaypointsService.Waypoints.Add(p); group.Children.Add(p); }); GroupsService.Groups.Add(group); }
/// <summary> /// Adds a ProfileGroup to the tree! /// </summary> /// <param name="g"></param> private void AddProfileGroupNode(ProfileGroup g) { TreeNode parent = tvGroup.Nodes.Add(g.Name); parent.Tag = g; foreach (Profile p in _myGroup.Items) { AddProfileNode(parent, p); } parent.Expand(); tvGroup.SelectedNode = parent; }
public ActionResult Delete(int id) { Group grp = db.Groups.Find(id); var currentUserId = User.Identity.GetUserId(); Profile currentProfile = db.Profiles.Where(i => i.User.Id == currentUserId).FirstOrDefault(); ProfileGroup pg = (from profg in db.ProfileGroups where profg.Profile.ProfileId == currentProfile.ProfileId && profg.Group.GroupId == grp.GroupId select profg).FirstOrDefault(); db.ProfileGroups.Remove(pg); db.SaveChanges(); return(RedirectToAction("Index")); }
public Profile GetSelectedProfile(string profileType) { ProfileType t = byName(profileType); if (t != null) { return(t.SelectedProfile); } ProfileGroup g = groupByName(profileType); Debug.Assert(g != null); return(GetSelectedProfile(g.SelectedChild)); }
/// <summary> /// Takes care of loading the profile groups from disk. /// </summary> protected virtual void LoadProfileGroups() { if (SourceConfig.ProfileGroupNames != null) { ProfileGroups = new ProfileGroups(); foreach (string profileGroupName in SourceConfig.ProfileGroupNames) { ProfileGroup profileGroup = ProfileGroup.LoadFromFile(profileGroupName); ProfileGroups.Items.Add(profileGroup); foreach (Profile profile in profileGroup.Items) { profile.Name = profileGroup.Name + ":" + profile.Name; } } } }
/// <summary> /// Loads all the buttons for a specified profile group. /// </summary> /// <param name="g">group to load</param> /// <param name="profileNameToSelect">a RELATIVE profile name</param> private void LoadProfileGroup(ProfileGroup group, string profileNameToSelect) { ClearProfileButtons(); int lowestBitrate = Int32.MaxValue; int highestBitrate = 1024; string fqProfileName = group.Name + ":" + profileNameToSelect; //Since the buttons are Dock'ed Top, we need to add them in reverse order //so that they appear in the correct order. for (int i = group.Items.Count - 1; i >= 0; i--) { lowestBitrate = Math.Min(lowestBitrate, GetLowestVideoBitrate(group[i])); highestBitrate = Math.Max(highestBitrate, GetHighestVideoBitrate(group[i])); //set acceptable ranges for the custom controls, as currently known. //this makes sure that the sliders will always be set correctly tbBitrate.Maximum = BitrateToExponent(highestBitrate); tbBitrate.Minimum = BitrateToExponent(lowestBitrate); if (group[i].Name == fqProfileName) { SelectedProfileButton = AddProfile(group[i]); } else { AddProfile(group[i]); } } // if (group.CustomProfileEnabled) // { // pTrackbars.Visible = true; // //take care of custom profile // if (RefreshCustomProfile()) // { // this.SelectedProfile = StreamViewer.CustomProfile; // } // } // else { CustomProfile = null; StreamViewer.CustomProfile = null; pTrackbars.Visible = false; } }
public static string ToLadybugTools_HourlyContinousCollection(this Profile profile, Dictionary <string, object> metadata = null) { if (profile == null) { return(null); } string name = profile.Name; double[] values = null; int endHour = 23; int endDay = -1; int endMonth = -1; int count = profile.Count; if (count <= 24) { values = profile.GetDailyValues(); endDay = 1; endMonth = 1; } else { values = profile.GetYearlyValues(); endDay = 31; endMonth = 12; } if (values == null) { return(null); } ProfileGroup profileGroup = profile.ProfileGroup; if (profileGroup == ProfileGroup.Undefined) { profileGroup = profile.ProfileType.ProfileGroup(); } return(ToLadybugTools_HourlyContinousCollection(values, profileGroup, name, 0, 1, 1, endHour, endDay, endMonth, 1, false, metadata)); }
public RTSPDeviceControl(StreamSourceInfo streamSourceInfo, String serverAddress) { _sourceInfo = streamSourceInfo; _sessionDescription = new SessionDescription(); _sessionDescription.SinkURL = _sourceInfo.SinkAddress; Profile profile = new Profile(); profile.Name = "RTSP:RTSP"; ProfileGroup profileGroup = new ProfileGroup(); profileGroup.Name = "RTSP"; profileGroup.Items.Add(profile); ProfileGroups profileGroups = new ProfileGroups(); profileGroups.Items.Add(profileGroup); _sessionDescription.ProfileGroups = profileGroups; _sessionDescription.CurrentProfileName = "RTSP:RTSP"; }
public ActionResult JoinGroup(Guid id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Guid profileId = Guid.Parse(Session["profileId"].ToString()); var profileGroup = new ProfileGroup(); profileGroup.Id = Guid.NewGuid(); profileGroup.Profile = db.Profiles.Find(profileId); profileGroup.Group = db.Groups.Find(id); db.ProfileGroups.Add(profileGroup); db.SaveChanges(); return(RedirectToAction("Details", new { id })); }
public HttpGetDeviceControl(StreamSourceInfo streamSourceInfo, String serverAddress) { _sourceInfo = streamSourceInfo; _sessionDescription = new SessionDescription(); // _sessionDescription.ClientURL = streamSourceInfo.ClientURL; Profile profile = new Profile(); profile.Name = "RTSP:RTSP"; ProfileGroup profileGroup = new ProfileGroup(); profileGroup.Name = "RTSP"; profileGroup.Items.Add(profile); ProfileGroups profileGroups = new ProfileGroups(); profileGroups.Items.Add(profileGroup); _sessionDescription.ProfileGroups = profileGroups; _sessionDescription.CurrentProfileName = "RTSP:RTSP"; // _sessionDescription.SinkProtocolType = SinkProtocolType.RTSP; }
/// <summary> /// saves a file. /// </summary> /// <param name="filename">"" to ask user to select a new file, or provide a filename to save directly</param> /// <param name="saveMe">The Profile group to save.</param> /// <returns>returns true if the user saved, or false if the user canceled.</returns> private bool SaveFile(string filename, ProfileGroup saveMe) { if (saveMe.Items.Count == 0) { ShowErrorCheckMessage("A Profile Group must contain one or more Profiles.", saveMe.Name, true); return(false); } if (!ErrorCheckProfileGroup(saveMe)) { return(false); } if (filename == "") { saveFileDialog.FileName = groupEditor.ProfileGroup.Name + ".xml"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { filename = saveFileDialog.FileName; } else { saveFileDialog.FileName = ""; return(false); } } try { saveMe.SaveToFile(filename); return(true); } catch (Exception ex) { MessageBox.Show(this, "An error occurred while saving the Profile Group!" + Environment.NewLine + Environment.NewLine + ex.Message, "Error while saving!", MessageBoxButtons.OK, MessageBoxIcon.Error); saveFileDialog.FileName = ""; return(false); } }
/// <summary> /// Moves the specified TreeNode, contained in the given ProfileGroup a certain number of indicies. /// </summary> /// <param name="moveMe">TreeNode being moved</param> /// <param name="group">ProfileGroup that contains the Profile represented by the moving TreeNode</param> /// <param name="indicies">direction and number of indicies to move. Negative = up, Positive = down</param> private void MoveProfileNode(TreeNode moveMe, ProfileGroup group, int indicies) { try { TreeNode parent = moveMe.Parent; Profile p = group.Items[moveMe.Index]; parent.Nodes.RemoveAt(moveMe.Index); group.Items.RemoveAt(moveMe.Index); group.Items.Insert(moveMe.Index + indicies, p); parent.Nodes.Insert(moveMe.Index + indicies, moveMe); } finally { tvGroup.SelectedNode = moveMe; } }
public ActionResult Join(string GroupId) { var currentUserId = User.Identity.GetUserId(); Profile currentProfile = db.Profiles.Where(i => i.User.Id == currentUserId).FirstOrDefault(); Group group = db.Groups.Find(int.Parse(GroupId)); try { ProfileGroup pg = new ProfileGroup(currentProfile, group); db.ProfileGroups.Add(pg); db.SaveChanges(); } catch (Exception e) { return(View("Index")); } return(RedirectToAction("Index")); }
public ActionResult New(Group group) { try { db.Groups.Add(group); db.SaveChanges(); var currentUserId = User.Identity.GetUserId(); Profile currentProfile = db.Profiles.Where(i => i.User.Id == currentUserId).FirstOrDefault(); ProfileGroup pg = new ProfileGroup(currentProfile, group); db.ProfileGroups.Add(pg); db.SaveChanges(); } catch (Exception e) { return(View("Index")); } return(RedirectToAction("Index")); }
public ActionResult JoinGroup(Guid id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Guid profileId = Guid.Parse(Session["profileId"].ToString()); //Adiciono um registro ProfileGroup na tabela ProfilesGroups //contendo meu Profile e meu MarketPlace var profileGroup = new ProfileGroup(); profileGroup.Id = Guid.NewGuid(); profileGroup.Profile = db.Profiles.Find(profileId); profileGroup.MarketPlace = db.MarketPlaces.Find(id); //Adiciono o novo registro/tupla no banco de dados db.ProfilesGroups.Add(profileGroup); db.SaveChanges(); return(RedirectToAction("Details", new { id })); }
public BaseGraph(StreamSourceInfo sourceConfig, OpenGraphRequest openGraphRequest) { int hr = 0; SourceConfig = sourceConfig; OpenGraphRequest = openGraphRequest; // An exception is thrown if cast fail _graphBuilder = (IGraphBuilder) new FilterGraph(); _captureGraphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); _mediaControl = (IMediaControl)_graphBuilder; // Attach the filter graph to the capture graph hr = _captureGraphBuilder.SetFiltergraph(_graphBuilder); DsError.ThrowExceptionForHR(hr); #if DEBUG_ROTENTRY _rot = new DsROTEntry(_graphBuilder); #endif LoadProfileGroups(); //the first listed ProfileGroup is the default ProfileGroup if (ProfileGroups.Items.Count == 0) { throw new SourceConfigException("No Profile Groups loaded!"); } ProfileGroup profileGroup = ProfileGroups.Items[0]; DefaultProfileName = profileGroup.Name + ":" + profileGroup.DefaultProfileName; if (OpenGraphRequest.Profile != null) { CurrentProfile = OpenGraphRequest.Profile; } else { CurrentProfile = FindProfile(DefaultProfileName); } }
/// <summary> /// Checks an entire profile group for errors /// </summary> /// <param name="g">the group to check</param> /// <returns>true if no errors were found, false if errors were encountered</returns> private bool ErrorCheckProfileGroup(ProfileGroup g) { if (DisableErrorChecking) { return(true); } if (String.IsNullOrEmpty(g.Name)) { ShowErrorCheckMessage("You must specify a name for the Profile Group!", g.Name, true); ShowErrorNode(GetTreeNode(g.Name)); return(false); } if (!ErrorCheckNameTokens(g.Name, true)) { ShowErrorNode(GetTreeNode(g.Name)); return(false); } if (String.IsNullOrEmpty(g.DefaultProfileName) && (groupEditor.ProfileGroup.Items.Count > 0)) { ShowErrorCheckMessage("You must select a Default Profile!", g.Name, true); ShowErrorNode(GetTreeNode(g.Name)); return(false); } foreach (Profile p in g.Items) { if (!ErrorCheckProfile(p)) { return(false); } } return(true); }
public void Apply() { var group = new Group(GridName); var wpts = GridFactory.CreateGrid(Corner, ProfileStep, SiteStep, ProfileLength, GridWidth, ProfileAngleDeg / 180.0 * Math.PI, GridAngleDeg / 180.0 * Math.PI); WaypointsService.Waypoints.AddRange(wpts.SelectMany(w => w)); for (int i = 0; i < wpts.Count; i++) { var profileGroup = new ProfileGroup($"{group.Name} Профиль #:{i}"); group.Children.Add(profileGroup); profileGroup.Children.AddRange(wpts[i]); } for (int i = 0; i < wpts[0].Count; i++) { var orthGroup = new ProfileGroup($"{group.Name} Пикет #:{i}"); orthGroup.Children.AddRange(wpts.ConvertAll(wpt => wpt[i])); group.Children.Add(orthGroup); } GroupsService.Groups.Add(group); }
public ActionResult Delete(ProfileGroup profile) { _profileGroupRepository.Delete(profile.Id); return(RedirectToAction("Index")); }
/// <summary> /// Loads a profile group into current view, and selects the default profile for that group /// </summary> /// <param name="group">profile group to load</param> private void LoadProfileGroup(ProfileGroup group) { LoadProfileGroup(group, group.DefaultProfileName); }
/// <summary> /// Adds a profile to the Profile Group list. /// </summary> /// <param name="profileGroup">the profile group to add.</param> public void AddProfileGroup(ProfileGroup group) { Debug.Assert(group != null); ProfileGroups.Items.Add(group); cbProfileGroups.Items.Add((group.Name == null) ? "<Unknown>" : group.Name); }
public ProfileThumbnail Load(ISqlConnectionInfo connection, SqlQueryParameters parameters) { IDatabase database = connection.Database; if (database == null) { throw new ArgumentNullException("database", "Error initializing database connection."); } if (parameters == null) { throw new ArgumentNullException("parameters"); } string sqlCmdText = string.Empty; try { sqlCmdText = "SELECT {0} " + ProfileThumbnailTable.GetColumnNames("[pt]") + (this.Depth > 0 ? "," + ProfileTable.GetColumnNames("[pt_p]") : string.Empty) + (this.Depth > 1 ? "," + ProfileGroupTable.GetColumnNames("[pt_p_pg]") : string.Empty) + " FROM [web].[ProfileThumbnail] AS [pt] "; if (this.Depth > 0) { sqlCmdText += "INNER JOIN [web].[Profile] AS [pt_p] ON [pt].[ProfileID] = [pt_p].[ProfileID] "; } if (this.Depth > 1) { sqlCmdText += "INNER JOIN [web].[ProfileGroup] AS [pt_p_pg] ON [pt_p].[ProfileGroupID] = [pt_p_pg].[ProfileGroupID] "; } parameters.Top = 1; sqlCmdText = parameters.BuildQuery(sqlCmdText); SqlCommand sqlCmd = database.Add(sqlCmdText) as SqlCommand; foreach (KeyValuePair <string, object> argument in parameters.Arguments) { sqlCmd.Parameters.AddWithValue("@" + argument.Key, argument.Value); } SqlDataReader sqlReader = database.Add(sqlCmd) as SqlDataReader; if (!sqlReader.HasRows || !sqlReader.Read()) { IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("pt", "customload", "notfound"), "ProfileThumbnail could not be loaded using custom logic as it was not found.", sqlCmdText, this, connection, parameters); if (this.Logger.IsDebugEnabled) { this.Logger.Debug(builder.ToString()); } sqlReader.Close(); return(null); } SqlQuery query = new SqlQuery(sqlReader); ProfileThumbnailTable ptTable = new ProfileThumbnailTable(query); ProfileTable pt_pTable = (this.Depth > 0) ? new ProfileTable(query) : null; ProfileGroupTable pt_p_pgTable = (this.Depth > 1) ? new ProfileGroupTable(query) : null; ProfileGroup pt_p_pgObject = (this.Depth > 1) ? pt_p_pgTable.CreateInstance() : null; Profile pt_pObject = (this.Depth > 0) ? pt_pTable.CreateInstance(pt_p_pgObject) : null; ProfileThumbnail ptObject = ptTable.CreateInstance(pt_pObject); sqlReader.Close(); return(ptObject); } catch (Exception ex) { database.HandleException(ex); IMessageBuilder builder = new DbLogMessageBuilder(new LogErrorCode("pt", "customload", "exception"), "ProfileThumbnail could not be loaded using custom logic. See exception for details.", sqlCmdText, ex, this, connection, parameters); if (this.Logger.IsErrorEnabled) { this.Logger.Error(builder.ToString(), ex); } throw new DataOperationException(DataOperation.Load, "ProfileThumbnail", "Exception while loading (custom/single) ProfileThumbnail object from database. See inner exception for details.", ex); } }