aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs
blob: e7be61b0ac42906d067161f69baebcf831c689d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Builders;
using Tango.BL.Entities;
using Tango.Core;
using Tango.Core.DI;
using Tango.PPC.Common.Authentication;
using Tango.PPC.Common.Navigation;

namespace Tango.PPC.UI.Authentication
{
    /// <summary>
    /// Represents the default PPC authentication provider.
    /// </summary>
    /// <seealso cref="Tango.Core.ExtendedObject" />
    /// <seealso cref="Tango.PPC.Common.Authentication.IAuthenticationProvider" />
    public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider
    {
        /// <summary>
        /// Gets or sets the navigation manager.
        /// </summary>
        [TangoInject(TangoInjectMode.WhenAvailable)]
        public INavigationManager NavigationManager { get; set; }

        /// <summary>
        /// Occurs when the current logged-in user has changed.
        /// </summary>
        public event EventHandler<User> CurrentUserChanged;

        private User _currentUser;
        /// <summary>
        /// Gets the current logged-in user.
        /// </summary>
        public User CurrentUser
        {
            get { return _currentUser; }
            private set
            {
                _currentUser = value;
                RaisePropertyChangedAuto();
            }
        }

        /// <summary>
        /// Gets a value indicating whether the authentication provider is using a null user.
        /// </summary>
        public bool AuthenticationRequired { get; private set; }

        /// <summary>
        /// Performs a user login by the specified email and password.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <param name="password">The password.</param>
        /// <param name="encrypt">Determines whether to encrypt the provided password before attempting to login</param>
        /// <returns></returns>
        public Task<User> Login(string email, string password, bool encrypt = true)
        {
            return Task.Factory.StartNew<User>(() =>
            {

                AuthenticationRequired = true;

                String hash = encrypt ? User.GetPasswordHash(password) : password;

                LogManager.Log($"Logging in user {email}...");

                using (var db = ObservablesContext.CreateDefault())
                {
                    CurrentUser = new UserBuilder(db).Set(x => x.Email.ToLower() == email && x.Password == hash)
                    .WithOrganization()
                    .WithRolesAndPermissions()
                    .Build();
                }

                if (CurrentUser != null)
                {
                    LogManager.Log($"Current user is now: {CurrentUser.Contact.FullName}.");
                }
                else
                {
                    LogManager.Log("Login failed!");
                }

                CurrentUserChanged?.Invoke(this, CurrentUser);
                return CurrentUser;
            });
        }

        public Task Login()
        {
            return Task.Factory.StartNew(() => 
            {
                AuthenticationRequired = false;
                CurrentUser = null;
                CurrentUserChanged?.Invoke(this, CurrentUser);
            });
        }

        /// <summary>
        /// Logs-out the current logged-in user.
        /// </summary>
        public void LogOut()
        {
            LogManager.Log("Logging out current user.");
            CurrentUser = null;
            CurrentUserChanged?.Invoke(this, CurrentUser);
            NavigationManager.NavigateTo(NavigationView.LoginView);
        }
    }
}
{ color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: JobFileBrushStop.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code

using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Tango.PMR.Exports {

  /// <summary>Holder for reflection information generated from JobFileBrushStop.proto</summary>
  public static partial class JobFileBrushStopReflection {

    #region Descriptor
    /// <summary>File descriptor for JobFileBrushStop.proto</summary>
    public static pbr::FileDescriptor Descriptor {
      get { return descriptor; }
    }
    private static pbr::FileDescriptor descriptor;

    static JobFileBrushStopReflection() {
      byte[] descriptorData = global::System.Convert.FromBase64String(
          string.Concat(
            "ChZKb2JGaWxlQnJ1c2hTdG9wLnByb3RvEhFUYW5nby5QTVIuRXhwb3J0cyLX",
            "AgoQSm9iRmlsZUJydXNoU3RvcBIWCg5Db2xvclNwYWNlR3VpZBgBIAEoCRIV",
            "Cg1PZmZzZXRQZXJjZW50GAIgASgBEgwKBEN5YW4YAyABKAESDwoHTWFnZW50",
            "YRgEIAEoARIOCgZZZWxsb3cYBSABKAESDQoFQmxhY2sYBiABKAESCwoDUmVk",
            "GAcgASgFEg0KBUdyZWVuGAggASgFEgwKBEJsdWUYCSABKAUSCQoBTBgKIAEo",
            "ARIJCgFBGAsgASgBEgkKAUIYDCABKAESCgoCVjAYDSABKAESCgoCVjEYDiAB",
            "KAESCgoCVjIYDyABKAESCgoCVjMYECABKAESCgoCVjQYESABKAESCgoCVjUY",
            "EiABKAESCgoCVjYYEyABKAESCgoCVjcYFCABKAESEQoJQ29ycmVjdGVkGBUg",
            "ASgIEhgKEENvbG9yQ2F0YWxvZ0d1aWQYFiABKAlCHQobY29tLnR3aW5lLnRh",
            "bmdvLnBtci5leHBvcnRzYgZwcm90bzM="));
      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
          new pbr::FileDescriptor[] { },
          new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
            new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Exports.JobFileBrushStop), global::Tango.PMR.Exports.JobFileBrushStop.Parser, new[]{ "ColorSpaceGuid", "OffsetPercent", "Cyan", "Magenta", "Yellow", "Black", "Red", "Green", "Blue", "L", "A", "B", "V0", "V1", "V2", "V3", "V4", "V5", "V6", "V7", "Corrected", "ColorCatalogGuid" }, null, null, null)
          }));
    }
    #endregion

  }
  #region Messages
  public sealed partial class JobFileBrushStop : pb::IMessage<JobFileBrushStop> {
    private static readonly pb::MessageParser<JobFileBrushStop> _parser = new pb::MessageParser<JobFileBrushStop>(() => new JobFileBrushStop());
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public static pb::MessageParser<JobFileBrushStop> Parser { get { return _parser; } }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public static pbr::MessageDescriptor Descriptor {
      get { return global::Tango.PMR.Exports.JobFileBrushStopReflection.Descriptor.MessageTypes[0]; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    pbr::MessageDescriptor pb::IMessage.Descriptor {
      get { return Descriptor; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public JobFileBrushStop() {
      OnConstruction();
    }

    partial void OnConstruction();

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public JobFileBrushStop(JobFileBrushStop other) : this() {
      colorSpaceGuid_ = other.colorSpaceGuid_;
      offsetPercent_ = other.offsetPercent_;
      cyan_ = other.cyan_;
      magenta_ = other.magenta_;
      yellow_ = other.yellow_;
      black_ = other.black_;
      red_ = other.red_;
      green_ = other.green_;
      blue_ = other.blue_;
      l_ = other.l_;
      a_ = other.a_;
      b_ = other.b_;
      v0_ = other.v0_;
      v1_ = other.v1_;
      v2_ = other.v2_;
      v3_ = other.v3_;
      v4_ = other.v4_;
      v5_ = other.v5_;
      v6_ = other.v6_;
      v7_ = other.v7_;
      corrected_ = other.corrected_;
      colorCatalogGuid_ = other.colorCatalogGuid_;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public JobFileBrushStop Clone() {
      return new JobFileBrushStop(this);
    }

    /// <summary>Field number for the "ColorSpaceGuid" field.</summary>
    public const int ColorSpaceGuidFieldNumber = 1;
    private string colorSpaceGuid_ = "";
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public string ColorSpaceGuid {
      get { return colorSpaceGuid_; }
      set {
        colorSpaceGuid_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
      }
    }

    /// <summary>Field number for the "OffsetPercent" field.</summary>
    public const int OffsetPercentFieldNumber = 2;
    private double offsetPercent_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double OffsetPercent {
      get { return offsetPercent_; }
      set {
        offsetPercent_ = value;
      }
    }

    /// <summary>Field number for the "Cyan" field.</summary>
    public const int CyanFieldNumber = 3;
    private double cyan_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double Cyan {
      get { return cyan_; }
      set {
        cyan_ = value;
      }
    }

    /// <summary>Field number for the "Magenta" field.</summary>
    public const int MagentaFieldNumber = 4;
    private double magenta_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double Magenta {
      get { return magenta_; }
      set {
        magenta_ = value;
      }
    }

    /// <summary>Field number for the "Yellow" field.</summary>
    public const int YellowFieldNumber = 5;
    private double yellow_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double Yellow {
      get { return yellow_; }
      set {
        yellow_ = value;
      }
    }

    /// <summary>Field number for the "Black" field.</summary>
    public const int BlackFieldNumber = 6;
    private double black_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double Black {
      get { return black_; }
      set {
        black_ = value;
      }
    }

    /// <summary>Field number for the "Red" field.</summary>
    public const int RedFieldNumber = 7;
    private int red_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public int Red {
      get { return red_; }
      set {
        red_ = value;
      }
    }

    /// <summary>Field number for the "Green" field.</summary>
    public const int GreenFieldNumber = 8;
    private int green_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public int Green {
      get { return green_; }
      set {
        green_ = value;
      }
    }

    /// <summary>Field number for the "Blue" field.</summary>
    public const int BlueFieldNumber = 9;
    private int blue_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public int Blue {
      get { return blue_; }
      set {
        blue_ = value;
      }
    }

    /// <summary>Field number for the "L" field.</summary>
    public const int LFieldNumber = 10;
    private double l_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double L {
      get { return l_; }
      set {
        l_ = value;
      }
    }

    /// <summary>Field number for the "A" field.</summary>
    public const int AFieldNumber = 11;
    private double a_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double A {
      get { return a_; }
      set {
        a_ = value;
      }
    }

    /// <summary>Field number for the "B" field.</summary>
    public const int BFieldNumber = 12;
    private double b_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double B {
      get { return b_; }
      set {
        b_ = value;
      }
    }

    /// <summary>Field number for the "V0" field.</summary>
    public const int V0FieldNumber = 13;
    private double v0_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double V0 {
      get { return v0_; }
      set {
        v0_ = value;
      }
    }

    /// <summary>Field number for the "V1" field.</summary>
    public const int V1FieldNumber = 14;
    private double v1_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double V1 {
      get { return v1_; }
      set {
        v1_ = value;
      }
    }

    /// <summary>Field number for the "V2" field.</summary>
    public const int V2FieldNumber = 15;
    private double v2_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double V2 {
      get { return v2_; }
      set {
        v2_ = value;
      }
    }

    /// <summary>Field number for the "V3" field.</summary>
    public const int V3FieldNumber = 16;
    private double v3_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double V3 {
      get { return v3_; }
      set {
        v3_ = value;
      }
    }

    /// <summary>Field number for the "V4" field.</summary>
    public const int V4FieldNumber = 17;
    private double v4_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double V4 {
      get { return v4_; }
      set {
        v4_ = value;
      }
    }

    /// <summary>Field number for the "V5" field.</summary>
    public const int V5FieldNumber = 18;
    private double v5_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double V5 {
      get { return v5_; }
      set {
        v5_ = value;
      }
    }

    /// <summary>Field number for the "V6" field.</summary>
    public const int V6FieldNumber = 19;
    private double v6_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double V6 {
      get { return v6_; }
      set {
        v6_ = value;
      }
    }

    /// <summary>Field number for the "V7" field.</summary>
    public const int V7FieldNumber = 20;
    private double v7_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public double V7 {
      get { return v7_; }
      set {
        v7_ = value;
      }
    }

    /// <summary>Field number for the "Corrected" field.</summary>
    public const int CorrectedFieldNumber = 21;
    private bool corrected_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public bool Corrected {
      get { return corrected_; }
      set {
        corrected_ = value;
      }
    }

    /// <summary>Field number for the "ColorCatalogGuid" field.</summary>
    public const int ColorCatalogGuidFieldNumber = 22;
    private string colorCatalogGuid_ = "";
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public string ColorCatalogGuid {
      get { return colorCatalogGuid_; }
      set {
        colorCatalogGuid_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
      }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override bool Equals(object other) {
      return Equals(other as JobFileBrushStop);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public bool Equals(JobFileBrushStop other) {
      if (ReferenceEquals(other, null)) {
        return false;
      }
      if (ReferenceEquals(other, this)) {
        return true;
      }
      if (ColorSpaceGuid != other.ColorSpaceGuid) return false;
      if (OffsetPercent != other.OffsetPercent) return false;
      if (Cyan != other.Cyan) return false;
      if (Magenta != other.Magenta) return false;
      if (Yellow != other.Yellow) return false;
      if (Black != other.Black) return false;
      if (Red != other.Red) return false;
      if (Green != other.Green) return false;
      if (Blue != other.Blue) return false;
      if (L != other.L) return false;
      if (A != other.A) return false;
      if (B != other.B) return false;
      if (V0 != other.V0) return false;
      if (V1 != other.V1) return false;
      if (V2 != other.V2) return false;
      if (V3 != other.V3) return false;
      if (V4 != other.V4) return false;
      if (V5 != other.V5) return false;
      if (V6 != other.V6) return false;
      if (V7 != other.V7) return false;
      if (Corrected != other.Corrected) return false;
      if (ColorCatalogGuid != other.ColorCatalogGuid) return false;
      return true;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override int GetHashCode() {
      int hash = 1;
      if (ColorSpaceGuid.Length != 0) hash ^= ColorSpaceGuid.GetHashCode();
      if (OffsetPercent != 0D) hash ^= OffsetPercent.GetHashCode();
      if (Cyan != 0D) hash ^= Cyan.GetHashCode();
      if (Magenta != 0D) hash ^= Magenta.GetHashCode();
      if (Yellow != 0D) hash ^= Yellow.GetHashCode();
      if (Black != 0D) hash ^= Black.GetHashCode();
      if (Red != 0) hash ^= Red.GetHashCode();
      if (Green != 0) hash ^= Green.GetHashCode();
      if (Blue != 0) hash ^= Blue.GetHashCode();
      if (L != 0D) hash ^= L.GetHashCode();
      if (A != 0D) hash ^= A.GetHashCode();
      if (B != 0D) hash ^= B.GetHashCode();
      if (V0 != 0D) hash ^= V0.GetHashCode();
      if (V1 != 0D) hash ^= V1.GetHashCode();
      if (V2 != 0D) hash ^= V2.GetHashCode();
      if (V3 != 0D) hash ^= V3.GetHashCode();
      if (V4 != 0D) hash ^= V4.GetHashCode();
      if (V5 != 0D) hash ^= V5.GetHashCode();
      if (V6 != 0D) hash ^= V6.GetHashCode();
      if (V7 != 0D) hash ^= V7.GetHashCode();
      if (Corrected != false) hash ^= Corrected.GetHashCode();
      if (ColorCatalogGuid.Length != 0) hash ^= ColorCatalogGuid.GetHashCode();
      return hash;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override string ToString() {
      return pb::JsonFormatter.ToDiagnosticString(this);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public void WriteTo(pb::CodedOutputStream output) {
      if (ColorSpaceGuid.Length != 0) {
        output.WriteRawTag(10);
        output.WriteString(ColorSpaceGuid);
      }
      if (OffsetPercent != 0D) {
        output.WriteRawTag(17);
        output.WriteDouble(OffsetPercent);
      }
      if (Cyan != 0D) {
        output.WriteRawTag(25);
        output.WriteDouble(Cyan);
      }
      if (Magenta != 0D) {
        output.WriteRawTag(33);
        output.WriteDouble(Magenta);
      }
      if (Yellow != 0D) {
        output.WriteRawTag(41);
        output.WriteDouble(Yellow);
      }
      if (Black != 0D) {
        output.WriteRawTag(49);
        output.WriteDouble(Black);
      }
      if (Red != 0) {
        output.WriteRawTag(56);
        output.WriteInt32(Red);
      }
      if (Green != 0) {
        output.WriteRawTag(64);
        output.WriteInt32(Green);
      }
      if (Blue != 0) {
        output.WriteRawTag(72);
        output.WriteInt32(Blue);
      }
      if (L != 0D) {
        output.WriteRawTag(81);
        output.WriteDouble(L);
      }
      if (A != 0D) {
        output.WriteRawTag(89);
        output.WriteDouble(A);
      }
      if (B != 0D) {
        output.WriteRawTag(97);
        output.WriteDouble(B);
      }
      if (V0 != 0D) {
        output.WriteRawTag(105);
        output.WriteDouble(V0);
      }
      if (V1 != 0D) {
        output.WriteRawTag(113);
        output.WriteDouble(V1);
      }
      if (V2 != 0D) {
        output.WriteRawTag(121);
        output.WriteDouble(V2);
      }
      if (V3 != 0D) {
        output.WriteRawTag(129, 1);
        output.WriteDouble(V3);
      }
      if (V4 != 0D) {
        output.WriteRawTag(137, 1);
        output.WriteDouble(V4);
      }
      if (V5 != 0D) {
        output.WriteRawTag(145, 1);
        output.WriteDouble(V5);
      }
      if (V6 != 0D) {
        output.WriteRawTag(153, 1);
        output.WriteDouble(V6);
      }
      if (V7 != 0D) {
        output.WriteRawTag(161, 1);
        output.WriteDouble(V7);
      }
      if (Corrected != false) {
        output.WriteRawTag(168, 1);
        output.WriteBool(Corrected);
      }
      if (ColorCatalogGuid.Length != 0) {
        output.WriteRawTag(178, 1);
        output.WriteString(ColorCatalogGuid);
      }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public int CalculateSize() {
      int size = 0;
      if (ColorSpaceGuid.Length != 0) {
        size += 1 + pb::CodedOutputStream.ComputeStringSize(ColorSpaceGuid);
      }
      if (OffsetPercent != 0D) {
        size += 1 + 8;
      }
      if (Cyan != 0D) {
        size += 1 + 8;
      }
      if (Magenta != 0D) {
        size += 1 + 8;
      }
      if (Yellow != 0D) {
        size += 1 + 8;
      }
      if (Black != 0D) {
        size += 1 + 8;
      }
      if (Red != 0) {
        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Red);
      }
      if (Green != 0) {
        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Green);
      }
      if (Blue != 0) {
        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Blue);
      }
      if (L != 0D) {
        size += 1 + 8;
      }
      if (A != 0D) {
        size += 1 + 8;
      }
      if (B != 0D) {
        size += 1 + 8;
      }
      if (V0 != 0D) {
        size += 1 + 8;
      }
      if (V1 != 0D) {
        size += 1 + 8;
      }
      if (V2 != 0D) {
        size += 1 + 8;
      }
      if (V3 != 0D) {
        size += 2 + 8;
      }
      if (V4 != 0D) {
        size += 2 + 8;
      }
      if (V5 != 0D) {
        size += 2 + 8;
      }
      if (V6 != 0D) {
        size += 2 + 8;
      }
      if (V7 != 0D) {
        size += 2 + 8;
      }
      if (Corrected != false) {
        size += 2 + 1;
      }
      if (ColorCatalogGuid.Length != 0) {
        size += 2 + pb::CodedOutputStream.ComputeStringSize(ColorCatalogGuid);
      }
      return size;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public void MergeFrom(JobFileBrushStop other) {
      if (other == null) {
        return;
      }
      if (other.ColorSpaceGuid.Length != 0) {
        ColorSpaceGuid = other.ColorSpaceGuid;
      }
      if (other.OffsetPercent != 0D) {
        OffsetPercent = other.OffsetPercent;
      }
      if (other.Cyan != 0D) {
        Cyan = other.Cyan;
      }
      if (other.Magenta != 0D) {
        Magenta = other.Magenta;
      }
      if (other.Yellow != 0D) {
        Yellow = other.Yellow;
      }
      if (other.Black != 0D) {
        Black = other.Black;
      }
      if (other.Red != 0) {
        Red = other.Red;
      }
      if (other.Green != 0) {
        Green = other.Green;
      }
      if (other.Blue != 0) {
        Blue = other.Blue;
      }
      if (other.L != 0D) {
        L = other.L;
      }
      if (other.A != 0D) {
        A = other.A;
      }
      if (other.B != 0D) {
        B = other.B;
      }
      if (other.V0 != 0D) {
        V0 = other.V0;
      }
      if (other.V1 != 0D) {
        V1 = other.V1;
      }
      if (other.V2 != 0D) {
        V2 = other.V2;
      }
      if (other.V3 != 0D) {
        V3 = other.V3;
      }
      if (other.V4 != 0D) {
        V4 = other.V4;
      }
      if (other.V5 != 0D) {
        V5 = other.V5;
      }
      if (other.V6 != 0D) {
        V6 = other.V6;
      }
      if (other.V7 != 0D) {
        V7 = other.V7;
      }
      if (other.Corrected != false) {
        Corrected = other.Corrected;
      }
      if (other.ColorCatalogGuid.Length != 0) {
        ColorCatalogGuid = other.ColorCatalogGuid;
      }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public void MergeFrom(pb::CodedInputStream input) {
      uint tag;
      while ((tag = input.ReadTag()) != 0) {
        switch(tag) {
          default:
            input.SkipLastField();
            break;
          case 10: {
            ColorSpaceGuid = input.ReadString();
            break;
          }
          case 17: {
            OffsetPercent = input.ReadDouble();
            break;
          }
          case 25: {
            Cyan = input.ReadDouble();
            break;
          }
          case 33: {
            Magenta = input.ReadDouble();
            break;
          }
          case 41: {
            Yellow = input.ReadDouble();
            break;
          }
          case 49: {
            Black = input.ReadDouble();
            break;
          }
          case 56: {
            Red = input.ReadInt32();
            break;
          }
          case 64: {
            Green = input.ReadInt32();
            break;
          }
          case 72: {
            Blue = input.ReadInt32();
            break;
          }
          case 81: {
            L = input.ReadDouble();
            break;
          }
          case 89: {
            A = input.ReadDouble();
            break;
          }
          case 97: {
            B = input.ReadDouble();
            break;
          }
          case 105: {
            V0 = input.ReadDouble();
            break;
          }
          case 113: {
            V1 = input.ReadDouble();
            break;
          }
          case 121: {
            V2 = input.ReadDouble();
            break;
          }
          case 129: {
            V3 = input.ReadDouble();
            break;
          }
          case 137: {
            V4 = input.ReadDouble();
            break;
          }
          case 145: {
            V5 = input.ReadDouble();
            break;
          }
          case 153: {
            V6 = input.ReadDouble();
            break;
          }
          case 161: {
            V7 = input.ReadDouble();
            break;
          }
          case 168: {
            Corrected = input.ReadBool();
            break;
          }
          case 178: {
            ColorCatalogGuid = input.ReadString();
            break;
          }
        }
      }
    }

  }

  #endregion

}

#endregion Designer generated code