Ejemplo n.º 1
0
        public int GetHashCode(Project obj)
        {
            int uri      = Uri.GetHashCode();
            int ispinned = IsPinned.GetHashCode();

            return(uri ^ ispinned);
        }
Ejemplo n.º 2
0
        void IXmlSerializable.WriteXml(XmlWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.WriteAttributeString("IsPinned", IsPinned.ToString(CultureInfo.InvariantCulture));
            writer.WriteString(Path);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Exports the <see cref="Database"/> to an xml node so that it can be saved.
        /// </summary>
        /// <returns>The xml node representation of the <see cref="Database"/>.</returns>
        public XmlNode ExportToXmlNode(XmlDocument xmlDocument)
        {
            //Create database node, add it's attributes, and add it to the xml doc
            var xmlDatabaseNode = xmlDocument.CreateElement(databaseXmlNodeName);

            xmlDatabaseNode.SetAttribute(CommonXmlAttributeNames.Name, Name);
            xmlDatabaseNode.SetAttribute(CommonXmlAttributeNames.DateLastOpened, DateLastOpenedString);
            xmlDatabaseNode.SetAttribute(CommonXmlAttributeNames.IsPinned, IsPinned.ToString());

            return(xmlDatabaseNode);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Exports the <see cref="LogFile"/> to an xml node so that it can be saved.
        /// </summary>
        /// <returns>The xml node representation of the <see cref="LogFile"/>.</returns>
        public XmlNode ExportToXmlNode(XmlDocument xmlDocument)
        {
            //Create log file node, add it's attributes, and add it to the xml doc
            var xmlLogFileNode = xmlDocument.CreateElement(logFileXmlNodeName);

            xmlLogFileNode.SetAttribute(logFileXmlNetworkPathAttrName, NetworkFile.FullName);
            xmlLogFileNode.SetAttribute(CommonXmlAttributeNames.DateLastOpened, DateLastOpenedString);
            xmlLogFileNode.SetAttribute(CommonXmlAttributeNames.IsPinned, IsPinned.ToString());

            return(xmlLogFileNode);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Exports the <see cref="LogView"/> to xml format so that it can be saved.
        /// </summary>
        /// <returns>The xml representation of the <see cref="LogView"/>.</returns>
        public string ExportToXml()
        {
            try
            {
                var xmlDocument = new XmlDocument();

                //Create log view node, and add it's attributes
                var xmlLogViewNode = xmlDocument.CreateElement(logViewXmlNodeName);
                xmlLogViewNode.SetAttribute(CommonXmlAttributeNames.Name, Name);
                xmlLogViewNode.SetAttribute(CommonXmlAttributeNames.DateLastOpened, DateLastOpenedString);
                xmlLogViewNode.SetAttribute(CommonXmlAttributeNames.IsPinned, IsPinned.ToString());
                xmlDocument.AppendChild(xmlLogViewNode);

                //Create the xml log files list and add it to the log view node
                var xmlLogFilesList = xmlDocument.CreateElement(logFilesXmlNodeName);
                xmlLogViewNode.AppendChild(xmlLogFilesList);

                //Add the log files to the xml log files list
                foreach (var logFilePath in LogFilePaths)
                {
                    xmlLogFilesList.AppendChild(LogFile.CreateXmlNodeFromPath(logFilePath, xmlDocument));
                }

                //Create the xml databases list and add it to the log view node
                var xmlDatabasesList = xmlDocument.CreateElement(databasesXmlNodeName);
                xmlLogViewNode.AppendChild(xmlDatabasesList);

                //Add the databases to the xml databases list
                foreach (var databaseName in DatabaseNames)
                {
                    xmlDatabasesList.AppendChild(Database.CreateXmlNodeFromName(databaseName, xmlDocument));
                }

                //Create the xml filter options node, set its attributes, and add it to the log view node
                var xmlFilterOptions = xmlDocument.CreateElement(filterOptionsXmlNodeName);
                xmlLogViewNode.AppendChild(xmlFilterOptions);

                #region Log message type attributes
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeErrorsAttrName, FilterOptions.IncludeErrors.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeWarningsAttrName, FilterOptions.IncludeWarnings.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeInformationAttrName, FilterOptions.IncludeInformation.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeVerboseAttrName, FilterOptions.IncludeVerbose.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeDebugAttrName, FilterOptions.IncludeDebug.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeDebugErrorsAttrName, FilterOptions.IncludeDebugErrors.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeDebugWarningsAttrName, FilterOptions.IncludeDebugWarnings.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeDebugInformationAttrName, FilterOptions.IncludeDebugInformation.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeDebugVerboseAttrName, FilterOptions.IncludeDebugVerbose.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlIncludeUnknownAttrName, FilterOptions.IncludeUnknown.ToString());
                #endregion

                #region Date range attributes
                xmlFilterOptions.SetAttribute(filterOptionsXmlUseQuickDateRangeAtrrName, FilterOptions.UseQuickDateRange.ToString());
                var selectedQuickDateRangeName = FilterOptions.SelectedQuickDateRange == null ? "NULL" : FilterOptions.SelectedQuickDateRange.Name;
                xmlFilterOptions.SetAttribute(filterOptionsXmlSelectedQuickDateRangeNameAttrName, selectedQuickDateRangeName);

                xmlFilterOptions.SetAttribute(filterOptionsXmlMinDayAttrName, FilterOptions.MinDay.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlMinHourAttrName, FilterOptions.MinHour.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlMinMinuteAttrName, FilterOptions.MinMinute.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlMinSecondAttrName, FilterOptions.MinSecond.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlMinMilliSecondAttrName, FilterOptions.MinMillisecond.ToString());

                xmlFilterOptions.SetAttribute(filterOptionsXmlMaxDayAttrName, FilterOptions.MaxDay.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlMaxHourAttrName, FilterOptions.MaxHour.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlMaxMinuteAttrName, FilterOptions.MaxMinute.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlMaxSecondAttrName, FilterOptions.MaxSecond.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlMaxMilliSecondAttrName, FilterOptions.MaxMillisecond.ToString());
                #endregion

                #region Other filter options attributes
                xmlFilterOptions.SetAttribute(filterOptionsXmlUsernameAttrName, FilterOptions.FilterUsername.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlComputernameAttrName, FilterOptions.FilterComputername.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlSearchTermAttrName, FilterOptions.SearchTerm.ToString());
                xmlFilterOptions.SetAttribute(filterOptionsXmlExclusionTermAttrName, FilterOptions.ExclusionTerm.ToString());
                #endregion

                //Create the settings node, set it's attributes, and add it to the log view node
                var xmlSettingsNode = xmlDocument.CreateElement(settingsXmlNodeName);
                xmlSettingsNode.SetAttribute(settingsAutoRefreshAttrName, Settings.AutoRefresh.ToString());
                xmlSettingsNode.SetAttribute(settingsHighlightNewLogEntriesAttrName, Settings.HighlightNewLogEntries.ToString());
                xmlLogViewNode.AppendChild(xmlSettingsNode);

                return(xmlDocument.OuterXml);
            }
            catch (Exception ex)
            {
                throw new Exception($"Failed to export {GetType().Name} to xml. Inner exception message: {ex.Message}");
            }
        }
Ejemplo n.º 6
0
 public override int GetHashCode()
 {
     return((((IsPinned.GetHashCode() * 397)
              ^ LocalIndex.GetHashCode()) * 397)
            ^ LocalType.GetHashCode());
 }
Ejemplo n.º 7
0
        public bool Equals(PostResponse input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     LastReplyTimestamp == input.LastReplyTimestamp ||
                     (LastReplyTimestamp != null && LastReplyTimestamp.Equals(input.LastReplyTimestamp))
                     ) &&
                 (
                     IsPinned == input.IsPinned ||
                     (IsPinned != null && IsPinned.Equals(input.IsPinned))
                 ) &&
                 (
                     UrlMediaType == input.UrlMediaType ||
                     (UrlMediaType != null && UrlMediaType.Equals(input.UrlMediaType))
                 ) &&
                 (
                     Thumbnail == input.Thumbnail ||
                     (Thumbnail != null && Thumbnail.Equals(input.Thumbnail))
                 ) &&
                 (
                     Popularity == input.Popularity ||
                     (Popularity != null && Popularity.Equals(input.Popularity))
                 ) &&
                 (
                     IsActive == input.IsActive ||
                     (IsActive != null && IsActive.Equals(input.IsActive))
                 ) &&
                 (
                     IsAnnouncement == input.IsAnnouncement ||
                     (IsAnnouncement != null && IsAnnouncement.Equals(input.IsAnnouncement))
                 ) &&
                 (
                     UserRating == input.UserRating ||
                     (UserRating.Equals(input.UserRating))
                 ) &&
                 (
                     UserHasRated == input.UserHasRated ||
                     (UserHasRated != null && UserHasRated.Equals(input.UserHasRated))
                 ) &&
                 (
                     UserHasMutedPost == input.UserHasMutedPost ||
                     (UserHasMutedPost != null && UserHasMutedPost.Equals(input.UserHasMutedPost))
                 ) &&
                 (
                     LatestReplyPostId == input.LatestReplyPostId ||
                     (LatestReplyPostId.Equals(input.LatestReplyPostId))
                 ) &&
                 (
                     LatestReplyAuthorId == input.LatestReplyAuthorId ||
                     (LatestReplyAuthorId.Equals(input.LatestReplyAuthorId))
                 ) &&
                 (
                     IgnoreStatus == input.IgnoreStatus ||
                     (IgnoreStatus != null && IgnoreStatus.Equals(input.IgnoreStatus))
                 ) &&
                 (
                     Locale == input.Locale ||
                     (Locale != null && Locale.Equals(input.Locale))
                 ));
        }