示例#1
0
        public QuotaInfo GetQuota(string username, string fileshare)
        {
            DiskQuotaControlClass dqc = new DiskQuotaControlClass();
            QuotaInfo             qi  = new QuotaInfo();

            //Initializes the control to the specified path
            dqc.Initialize(fileshare, true);
            qi.Used  = dqc.FindUser(username).QuotaUsed;
            qi.Total = dqc.FindUser(username).QuotaLimit;
            return(qi);
        }
示例#2
0
            public static void StartQuotaInitialization(string volumeUniqueName)
            {
                lock (locker)
                {
                    if (!quotaControls.ContainsKey(volumeUniqueName))
                    {
                        var qcontrol = quotaControls[volumeUniqueName] = new DiskQuotaControlClass();

                        qcontrol.Initialize(volumeUniqueName, true);
                        qcontrol.QuotaState = QuotaStateConstants.dqStateEnforce;

                        // Set to ResolveNone to prevent blocking when using account names.
                        qcontrol.UserNameResolution = UserNameResolutionConstants.dqResolveNone;
                        qcontrol.LogQuotaThreshold  = true;
                        qcontrol.LogQuotaLimit      = true;

                        // Disable default quota limit and threshold
                        qcontrol.DefaultQuotaThreshold = -1;
                        qcontrol.DefaultQuotaLimit     = -1;
                    }
                }
            }
示例#3
0
            public static void StartQuotaInitialization(string rootPath)
            {
                lock (locker)
                {
                    var uniqueVolumeName = Volume.GetUniqueVolumeNameForVolumeMountPoint(rootPath);

                    if (!quotaControls.ContainsKey(uniqueVolumeName))
                    {
                        var qcontrol = quotaControls[uniqueVolumeName] = new DiskQuotaControlClass();

                        qcontrol.Initialize(uniqueVolumeName, true);
                        qcontrol.QuotaState = QuotaStateConstants.dqStateEnforce;

                        // Set to ResolveNone to prevent blocking when using account names.
                        qcontrol.UserNameResolution = UserNameResolutionConstants.dqResolveNone;
                        qcontrol.LogQuotaThreshold = true;
                        qcontrol.LogQuotaLimit = true;

                        // Disable default quota limit and threshold
                        qcontrol.DefaultQuotaThreshold = -1;
                        qcontrol.DefaultQuotaLimit = -1;
                    }
                }
            }