Esempio n. 1
0
        internal void Reload(API rm, ref double maxValue)
        {
            rainmeterAPI = rm;
            Logger(API.LogType.Debug, "PluginNetAtmo.dll: Entering function: Reload");

            switch (rm.ReadString("Action", "").ToLowerInvariant())
            {
            case "getvalue":
                m_Action = Action.GetValue;
                break;

            case "getvalues":
                m_Action = Action.GetValues;
                break;

            case "":
                Logger(API.LogType.Error, "PluginNetAtmo.dll: Action cannot be empty");
                return;

            default:
                Logger(API.LogType.Error, "PluginNetAtmo.dll: Action=" + rm.ReadString("Action", "").ToLowerInvariant() + " not valid");
                return;
            }

            switch (rm.ReadString("ValueName", "").ToLowerInvariant())
            {
            case "temperature":
                m_ValueName = ValueName.Temperature;
                break;

            case "co2":
                m_ValueName = ValueName.CO2;
                break;

            case "humidity":
                m_ValueName = ValueName.Humidity;
                break;

            case "noise":
                m_ValueName = ValueName.Noise;
                break;

            case "pressure":
                m_ValueName = ValueName.Pressure;
                break;

            case "":
                Logger(API.LogType.Error, "PluginNetAtmo.dll: ValueName cannot be empty");
                return;

            default:
                Logger(API.LogType.Error, "PluginNetAtmo.dll: ValueName=" + rm.ReadString("ValueName", "").ToLowerInvariant() + " not valid");
                return;
            }

            m_ClientID       = rm.ReadString("ClientID", "");
            m_ClientSecret   = rm.ReadString("ClientSecret", "");
            m_Username       = rm.ReadString("Username", "");
            m_Password       = rm.ReadString("Password", "");
            m_DeviceModuleID = rm.ReadString("DeviceModuleID", "");

            if (m_ClientID.Length == 0)
            {
                Logger(API.LogType.Error, "PluginNetAtmo.dll: ClientID cannot be empty");
                return;
            }
            if (m_ClientSecret.Length == 0)
            {
                Logger(API.LogType.Error, "PluginNetAtmo.dll: ClientSecret cannot be empty");
                return;
            }
            if (m_Username.Length == 0)
            {
                Logger(API.LogType.Error, "PluginNetAtmo.dll: Username cannot be empty");
                return;
            }
            if (m_Password.Length == 0)
            {
                Logger(API.LogType.Error, "PluginNetAtmo.dll: Password cannot be empty");
                return;
            }

            m_Atmo = new NetAtmo(m_ClientID, m_ClientSecret, m_Username, m_Password, Logger);
            LogDevicesIDs();
        }
 /// <summary>
 /// Return the value name with the complete registry key.
 /// </summary>
 /// <returns>A value name with the complete registry key.</returns>
 internal string GetValueNameWithKey()
 {
     return($"{Key?.Name ?? KeyPath}\\\\{ValueName?.ToString() ?? string.Empty}");
 }
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("//\n// Generated by ValueObjectGenerator\n// DO NOT EDIT THIS FILE\n//\nusing System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\n\n");

            ValueName = ValueName.Replace("\"", "");
            var declarationType = DeclarationSyntax.Keyword;

            var requireNotEmpty       = NotEmpty;
            var requireNonNegative    = NotNegative;
            var requireMinMax         = !string.IsNullOrEmpty(Min) && !string.IsNullOrEmpty(Max);
            var requireValidateMethod =
                !ValueOption.HasFlag(ValueOption.NonValidating) &&
                !requireNotEmpty &&
                !requireNonNegative &&
                !requireMinMax;

            var isClass  = DeclarationSyntax is ClassDeclarationSyntax;
            var isStruct = DeclarationSyntax is StructDeclarationSyntax;



            #line default
            #line hidden
            if (!string.IsNullOrEmpty(Namespace))
            {
            #line default
            #line hidden
                this.Write("namespace ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));

            #line default
            #line hidden
                this.Write("\n{\n");
            }

            #line default
            #line hidden
            this.Write("    public partial ");
            this.Write(this.ToStringHelper.ToStringWithCulture(declarationType));

            #line default
            #line hidden
            this.Write(" ");
            this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
            this.Write(" : IEquatable<");
            this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
            this.Write(">");
            this.Write(this.ToStringHelper.ToStringWithCulture(ValueOption.HasFlag(ValueOption.Comparable) ? $", IComparable<{Name}>" : ""));

            #line default
            #line hidden
            this.Write("\n    {\n        public ");
            this.Write(this.ToStringHelper.ToStringWithCulture(BaseTypeName));

            #line default
            #line hidden
            this.Write(" ");
            this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
            this.Write(" { get; }\n");
            /* Min-Max Variable */

            #line default
            #line hidden
            if (requireMinMax)
            {
            #line default
            #line hidden
                this.Write("        public static readonly ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(" Min = new ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write("( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Min));

            #line default
            #line hidden
                this.Write(" );\n        public static readonly ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(" Max = new ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write("( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Max));

            #line default
            #line hidden
                this.Write(" );\n");
            }

            #line default
            #line hidden
            this.Write("\n        public ");
            this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
            this.Write("( ");
            this.Write(this.ToStringHelper.ToStringWithCulture(BaseTypeName));

            #line default
            #line hidden
            this.Write(" value )\n        {\n");
            /* Non-Empty */

            #line default
            #line hidden
            if (requireNotEmpty)
            {
            #line default
            #line hidden
                if (BaseTypeName == "string")
                {
            #line default
            #line hidden
                    this.Write("            if( string.IsNullOrEmpty( value )");
                    this.Write(this.ToStringHelper.ToStringWithCulture(!ExcludeWhiteSpace ? " || value.Trim().Length == 0" : ""));

            #line default
            #line hidden
                    this.Write(" )\n            {\n                throw new ArgumentException( $\"(");
                    this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                    this.Write(") value is empty\" );\n            }\n");
                }
                else
                {
            #line default
            #line hidden
                    this.Write("            if( !value.Any() )\n            {\n                throw new ArgumentException( $\"(");
                    this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                    this.Write(") value is empty\" );\n            }\n");
                }

            #line default
            #line hidden
                this.Write("            ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(" = value;\n");
                /* Non-Negative */

            #line default
            #line hidden
            }
            else if (requireNonNegative)
            {
            #line default
            #line hidden
                this.Write("            if( value < 0 )\n            {\n                throw new ArgumentException( $\"(");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(") value is negative {value}\" );\n            }\n            ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(" = value;\n");
                /* Min, Max */

            #line default
            #line hidden
            }
            else if (requireMinMax)
            {
            #line default
            #line hidden
                this.Write("            if( value < (");
                this.Write(this.ToStringHelper.ToStringWithCulture(Min));

            #line default
            #line hidden
                this.Write(") || value > (");
                this.Write(this.ToStringHelper.ToStringWithCulture(Max));

            #line default
            #line hidden
                this.Write(") )\n            {\n                throw new ArgumentOutOfRangeException( $\"");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(" Out of range : {value} (range:");
                this.Write(this.ToStringHelper.ToStringWithCulture(Min));

            #line default
            #line hidden
                this.Write(" < ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Max));

            #line default
            #line hidden
                this.Write(")\" );\n            }\n            ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(" = value;\n");
                /* No Validation */

            #line default
            #line hidden
            }
            else if (!requireValidateMethod)
            {
            #line default
            #line hidden
                this.Write("            ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(" = value;\n");
            }
            else
            {
            #line default
            #line hidden
                this.Write("            ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(" = Validate( value );\n");
            }

            #line default
            #line hidden
            this.Write("        }\n\n");
            /* Validate method */

            #line default
            #line hidden
            if (requireValidateMethod)
            {
            #line default
            #line hidden
                this.Write("        private static partial ");
                this.Write(this.ToStringHelper.ToStringWithCulture(BaseTypeName));

            #line default
            #line hidden
                this.Write(" Validate( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(BaseTypeName));

            #line default
            #line hidden
                this.Write(" value );\n");
            }

            #line default
            #line hidden
            this.Write("\n");
            /* ToString */

            #line default
            #line hidden
            if (!ValueOption.HasFlag(ValueOption.ToString))
            {
            #line default
            #line hidden
                this.Write("        //\n        // Default ToString()\n        //\n        public override string ToString()\n        {\n            return ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(".ToString() ?? \"\";\n        }\n");
            }
            else
            {
            #line default
            #line hidden
                this.Write("        //\n        // Custom ToString()\n        //\n        private partial string ToStringImpl();\n\n        public override string ToString()\n        {\n            return ToStringImpl();\n        }\n");
            }

            #line default
            #line hidden
            this.Write("\n        //----------------------------------------------------------------------\n        // Equality\n        //----------------------------------------------------------------------\n        public bool Equals( ");
            this.Write(this.ToStringHelper.ToStringWithCulture(isClass ? "[AllowNull] " : ""));

            #line default
            #line hidden
            this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
            this.Write(" other )\n        {\n");
            if (isClass)
            {
            #line default
            #line hidden
                this.Write("            if( ReferenceEquals( null, other ) )\n            {\n                return false;\n            }\n\n            if( ReferenceEquals( this, other ) )\n            {\n                return true;\n            }\n            return ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(" == other.");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(";\n");
            }
            else if (isStruct)
            {
            #line default
            #line hidden
                this.Write("            return Equals( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(", other.");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(" );\n");
            }

            #line default
            #line hidden
            this.Write("        }\n\n        public override bool Equals( [AllowNull] object obj )\n        {\n");
            if (isClass)
            {
            #line default
            #line hidden
                this.Write("            if( ReferenceEquals( null, obj ) )\n            {\n                return false;\n            }\n\n            if( ReferenceEquals( this, obj ) )\n            {\n                return true;\n            }\n\n            if( obj.GetType() != this.GetType() )\n            {\n                return false;\n            }\n\n            return Equals( (");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(")obj );\n");
            }
            else if (isStruct)
            {
            #line default
            #line hidden
                this.Write("            return obj is ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(" other && Equals( other );\n");
            }

            #line default
            #line hidden
            this.Write("        }\n\n        // HashCode\n        public override int GetHashCode() => ");
            this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
            this.Write(".GetHashCode();\n\n        // Operator ==, !=\n        public static bool operator ==( ");
            this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
            this.Write(" a, ");
            this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
            this.Write(" b )\n        {\n");
            if (isClass)
            {
            #line default
            #line hidden
                this.Write("            if( ReferenceEquals( a, b ) )\n            {\n                return true;\n            }\n\n            return a?.Equals( b ) ?? ReferenceEquals( null, b );\n");
            }
            else if (isStruct)
            {
            #line default
            #line hidden
                this.Write("            return a.Equals( b );\n");
            }

            #line default
            #line hidden
            this.Write("        }\n\n        public static bool operator !=( ");
            this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
            this.Write(" a, ");
            this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
            this.Write(" b )\n        {\n            return !( a == b );\n        }\n\n");
            if (ValueOption.HasFlag(ValueOption.Explicit))
            {
            #line default
            #line hidden
                this.Write("        //----------------------------------------------------------------------\n        // Explicit\n        //----------------------------------------------------------------------\n        public static explicit operator ");
                this.Write(this.ToStringHelper.ToStringWithCulture(BaseTypeName));

            #line default
            #line hidden
                this.Write("( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(" x )\n        {\n            return x.");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(";\n        }\n\n        public static explicit operator ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write("( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(BaseTypeName));

            #line default
            #line hidden
                this.Write(" value )\n        {\n            return new ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write("( value );\n        }\n");
            }
            else if (ValueOption.HasFlag(ValueOption.Implicit))
            {
            #line default
            #line hidden
                this.Write("        //----------------------------------------------------------------------\n        // Implicit\n        //----------------------------------------------------------------------\n        public static implicit operator ");
                this.Write(this.ToStringHelper.ToStringWithCulture(BaseTypeName));

            #line default
            #line hidden
                this.Write("( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(" x )\n        {\n            return x.");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(";\n        }\n\n        public static implicit operator ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write("( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(BaseTypeName));

            #line default
            #line hidden
                this.Write(" value )\n        {\n            return new ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write("( value );\n        }\n");
            }

            #line default
            #line hidden
            this.Write("\n");
            if (ValueOption.HasFlag(ValueOption.Comparable))
            {
            #line default
            #line hidden
                this.Write("        //----------------------------------------------------------------------\n        // Comparable\n        //----------------------------------------------------------------------\n        public int CompareTo( ");
                this.Write(this.ToStringHelper.ToStringWithCulture(Name));

            #line default
            #line hidden
                this.Write(" other )\n        {\n            if( ReferenceEquals( this, other ) )\n            {\n                return 0;\n            }\n\n            if( ReferenceEquals( null, other ) )\n            {\n                return 1;\n            }\n\n            return ");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(".CompareTo( other.");
                this.Write(this.ToStringHelper.ToStringWithCulture(ValueName));

            #line default
            #line hidden
                this.Write(" );\n        }\n");
            }

            #line default
            #line hidden
            this.Write("\n    }\n\n");
            if (!string.IsNullOrEmpty(Namespace))
            {
            #line default
            #line hidden
                this.Write("}\n");
            }

            #line default
            #line hidden
            return(this.GenerationEnvironment.ToString());
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ValueName"/> class.
 /// </summary>
 /// <param name="value">The value.</param>
 public Value(ValueName value)
 {
     ValueName = value;
 }
Esempio n. 5
0
        public void SessionChange(int SessionId, System.ServiceProcess.SessionChangeReason Reason, SessionProperties properties)
        {
            if (properties == null)
            {
                return;
            }

            if (Reason == System.ServiceProcess.SessionChangeReason.SessionLogoff)
            {
                UserInformation userInfo = properties.GetTrackedSingle <UserInformation>();
                m_logger.DebugFormat("{1} SessionChange SessionLogoff for ID:{0}", SessionId, userInfo.Username);
                m_logger.InfoFormat("{3} {0} {1} {2}", userInfo.Description.Contains("pGina created pgSMB2"), userInfo.HasSID, properties.CREDUI, userInfo.Username);

                if (userInfo.Description.Contains("pGina created pgSMB2") && userInfo.HasSID && !properties.CREDUI)
                {
                    try
                    {
                        Locker.TryEnterWriteLock(-1);
                        RunningTasks.Add(userInfo.Username.ToLower(), true);
                    }
                    finally
                    {
                        Locker.ExitWriteLock();
                    }

                    // add this plugin into PluginActivityInformation
                    m_logger.DebugFormat("{1} properties.id:{0}", properties.Id, userInfo.Username);

                    PluginActivityInformation notification = properties.GetTrackedSingle <PluginActivityInformation>();
                    foreach (Guid gui in notification.GetNotificationPlugins())
                    {
                        m_logger.DebugFormat("{1} PluginActivityInformation Guid:{0}", gui, userInfo.Username);
                    }
                    m_logger.DebugFormat("{1} PluginActivityInformation add guid:{0}", PluginUuid, userInfo.Username);
                    notification.AddNotificationResult(PluginUuid, new BooleanResult {
                        Message = "", Success = false
                    });
                    properties.AddTrackedSingle <PluginActivityInformation>(notification);
                    foreach (Guid gui in notification.GetNotificationPlugins())
                    {
                        m_logger.DebugFormat("{1} PluginActivityInformation Guid:{0}", gui, userInfo.Username);
                    }

                    Thread rem_smb = new Thread(() => cleanup(userInfo, SessionId, properties));
                    rem_smb.Start();
                }
                else
                {
                    m_logger.InfoFormat("{0} {1}. I'm not executing Notification stage", userInfo.Username, (properties.CREDUI) ? "has a program running in his context" : "is'nt a pGina created pgSMB2 user");
                }
            }
            if (Reason == System.ServiceProcess.SessionChangeReason.SessionLogon)
            {
                UserInformation userInfo = properties.GetTrackedSingle <UserInformation>();
                if (!userInfo.HasSID)
                {
                    m_logger.InfoFormat("{1} SessionLogon Event denied for ID:{0}", SessionId, userInfo.Username);
                    return;
                }

                m_logger.DebugFormat("{1} SessionChange SessionLogon for ID:{0}", SessionId, userInfo.Username);

                if (userInfo.Description.Contains("pGina created pgSMB2"))
                {
                    Dictionary <string, string> settings = GetSettings(userInfo.Username, userInfo);

                    if (!String.IsNullOrEmpty(settings["ScriptPath"]))
                    {
                        if (!Abstractions.WindowsApi.pInvokes.StartUserProcessInSession(SessionId, settings["ScriptPath"]))
                        {
                            m_logger.ErrorFormat("Can't run application {0}", settings["ScriptPath"]);
                            Abstractions.WindowsApi.pInvokes.SendMessageToUser(SessionId, "Can't run application", String.Format("I'm unable to run your LoginScript\n{0}", settings["ScriptPath"]));
                        }
                    }

                    IntPtr hToken = Abstractions.WindowsApi.pInvokes.GetUserToken(userInfo.Username, null, userInfo.Password);
                    if (hToken != IntPtr.Zero)
                    {
                        string uprofile = Abstractions.WindowsApi.pInvokes.GetUserProfilePath(hToken);
                        if (String.IsNullOrEmpty(uprofile))
                        {
                            uprofile = Abstractions.WindowsApi.pInvokes.GetUserProfileDir(hToken);
                        }
                        Abstractions.WindowsApi.pInvokes.CloseHandle(hToken);
                        m_logger.InfoFormat("add LocalProfilePath:[{0}]", uprofile);
                        // the profile realy exists there, instead of assuming it will be created or changed during a login (temp profile[win error reading profile])
                        userInfo.LocalProfilePath = uprofile;
                        properties.AddTrackedSingle <UserInformation>(userInfo);

                        if ((uprofile.Contains(@"\TEMP") && !userInfo.Username.StartsWith("temp", StringComparison.CurrentCultureIgnoreCase)) || Abstractions.Windows.User.IsProfileTemp(userInfo.SID.ToString()) == true)
                        {
                            m_logger.InfoFormat("TEMP profile detected");

                            string userInfo_old_Description = userInfo.Description;
                            userInfo.Description = "pGina created pgSMB2 tmp";
                            properties.AddTrackedSingle <UserInformation>(userInfo);

                            pInvokes.structenums.USER_INFO_4 userinfo4 = new pInvokes.structenums.USER_INFO_4();
                            if (pInvokes.UserGet(userInfo.Username, ref userinfo4))
                            {
                                userinfo4.logon_hours = IntPtr.Zero;
                                userinfo4.comment     = userInfo.Description;
                                if (!pInvokes.UserMod(userInfo.Username, userinfo4))
                                {
                                    m_logger.ErrorFormat("Can't modify userinformation {0}", userInfo.Username);
                                }
                            }
                            else
                            {
                                m_logger.ErrorFormat("Can't get userinformation {0}", userInfo.Username);
                            }

                            if (userInfo_old_Description.EndsWith("pGina created pgSMB2"))
                            {
                                Abstractions.Windows.Networking.sendMail(pGina.Shared.Settings.pGinaDynamicSettings.GetSettings(pGina.Shared.Settings.pGinaDynamicSettings.pGinaRoot, new string[] { "notify_pass" }), userInfo.Username, userInfo.Password, String.Format("pGina: Windows tmp Login {0} from {1}", userInfo.Username, Environment.MachineName), "Windows was unable to load the profile");
                            }
                        }
                    }


                    if (userInfo.Description.EndsWith("pGina created pgSMB2"))
                    {
                        try
                        {
                            if (!EventLog.SourceExists("proquota"))
                            {
                                EventLog.CreateEventSource("proquota", "Application");
                            }
                        }
                        catch
                        {
                            EventLog.CreateEventSource("proquota", "Application");
                        }
                        Abstractions.Windows.User.SetQuota(pInvokes.structenums.RegistryLocation.HKEY_USERS, userInfo.SID.ToString(), 0);

                        string proquotaPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "proquota.exe");
                        try
                        {
                            using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows Defender\Exclusions\Processes", true))
                            {
                                if (key != null)
                                {
                                    bool proquota_exclude_found = false;
                                    foreach (string ValueName in key.GetValueNames())
                                    {
                                        if (ValueName.Equals(proquotaPath, StringComparison.CurrentCultureIgnoreCase))
                                        {
                                            proquota_exclude_found = true;
                                        }
                                    }

                                    if (!proquota_exclude_found)
                                    {
                                        key.SetValue(proquotaPath, 0, Microsoft.Win32.RegistryValueKind.DWord);
                                    }
                                }
                            }
                        }
                        catch { }

                        m_logger.InfoFormat("start session:{0} prog:{1}", SessionId, proquotaPath);
                        if (!Abstractions.WindowsApi.pInvokes.StartUserProcessInSession(SessionId, proquotaPath + " \"" + userInfo.LocalProfilePath + "\" " + settings["MaxStore"]))
                        {
                            m_logger.ErrorFormat("{0} Can't run application {1}", userInfo.Username, "proquota.exe");
                        }
                    }
                }
                else
                {
                    m_logger.InfoFormat("{0} is'nt a pGina pgSMB2 plugin created user. I'm not executing Notification stage", userInfo.Username);
                }
            }
        }
Esempio n. 6
0
 public WeatherValue(string themeID, ValueName floatName) : base(themeID)
 {
     Name = floatName;
 }
Esempio n. 7
0
 public WeatherValue(ValueName valueName)
 {
     Name = valueName;
 }
Esempio n. 8
0
 public Value(ValueName name)
 {
     _value = (byte) name;
 }