当前位置: 首页>>代码示例>>C#>>正文


C# Security.PermissionSet类代码示例

本文整理汇总了C#中System.Security.PermissionSet的典型用法代码示例。如果您正苦于以下问题:C# System.Security.PermissionSet类的具体用法?C# System.Security.PermissionSet怎么用?C# System.Security.PermissionSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.Security.PermissionSet类属于命名空间,在下文中一共展示了System.Security.PermissionSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        public static int Load([MarshalAs(UnmanagedType.LPWStr)]String inParam)
        {
            try
            {
                lock (_lock)
                {
                    _injectCount++;
                    if (_easyHookDomain == null)
                    {
                        System.Security.PermissionSet ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
                        ps.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.AllFlags));
                        // Evidence of null means use the current appdomain evidence
                        _easyHookDomain = AppDomain.CreateDomain("EasyHook", null, new AppDomainSetup()
                        {
                            ApplicationBase = Path.GetDirectoryName(typeof(Loader).Assembly.Location),
                            // ShadowCopyFiles = "true", // copies assemblies from ApplicationBase into cache, leaving originals unlocked and updatable
                        }, ps);
                    }
                }

                int result = -1;

                // Load the EasyHook assembly in the child AppDomain by using the proxy class
                Type proxyType = typeof(LoadEasyHookProxy);
                if (proxyType.Assembly != null)
                {
                    // This is where the currentDomain.AssemblyResolve that we setup within the static 
                    // constructor is required.
                    var proxy = (LoadEasyHookProxy)_easyHookDomain.CreateInstanceFrom(
                                    proxyType.Assembly.Location,
                                    proxyType.FullName).Unwrap();

                    // Loads EasyHook.dll into the AppDomain, which in turn loads the target assembly
                    result = proxy.Load(inParam);
                }

                //result = new LoadEasyHookProxy().Load(inParam);
                return result;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Exception occured within Loader.Load: " + e.ToString());
            }
            finally
            {
                lock (_lock)
                {
                    _injectCount--;
                }
            }

            // Failed
            return -1;
        }
开发者ID:ezhangle,项目名称:Easyhook,代码行数:54,代码来源:Loader.cs

示例2: LoadReport

 //public DateTime DateFrom
 //{
 //    get
 //    {
 //        if (dateFrom.Value == "")
 //            return DateTime.Today.Date.AddDays(-1);
 //        else
 //            return DateTime.Parse(dateFrom.Value);
 //    }
 //}
 //public DateTime DateTo
 //{
 //    get
 //    {
 //        if (dateTo.Value == "")
 //            return DateTime.Today.Date.AddDays(-1);
 //        else
 //            return DateTime.Parse(dateTo.Value);
 //    }
 //}
 private void LoadReport(string path, List<ViewLvConsumed> _Employee)
 {
     string _Header = context.Options.FirstOrDefault().CompanyName + " - Anual Leave Report";
     ReportViewer1.ProcessingMode = ProcessingMode.Local;
     ReportViewer1.LocalReport.ReportPath = Server.MapPath(path);
     System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
     ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
     IEnumerable<ViewLvConsumed> ie;
     ie = _Employee.AsQueryable();
     ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie);
     ReportViewer1.LocalReport.DataSources.Clear();
     ReportViewer1.LocalReport.DataSources.Add(datasource1);
     ReportParameter rp = new ReportParameter("Header", _Header, false);
     this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
     ReportViewer1.LocalReport.Refresh();
 }
开发者ID:qq5013,项目名称:WMS-Fatima,代码行数:36,代码来源:YLvConsumed.aspx.cs

示例3: LoadReport

        private void LoadReport(List<EmpMonthlyProductivityEntity> empe, string PathString, string _dateFrom, string _dateTo)
        {
            string Header = "Monthly Productivity Sheet";
            this.ReportViewer1.LocalReport.DisplayName = "Monthly Productivity Sheet";
            this.ReportViewer1.ProcessingMode = ProcessingMode.Local;
            string Month =  Convert.ToDateTime(_dateFrom).Date.ToString("MMMM-yyyy");
            Month = "For the Month of " + Month;
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString);
            System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
            this.ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
            IEnumerable<EmpMonthlyProductivityEntity> ie;
            ie = empe.AsQueryable();
            IEnumerable<EmpPhoto> companyImage;
            companyImage = companyimage.AsQueryable();

            ReportDataSource datasource1 = new ReportDataSource("DataSet2", companyImage);
            ReportDataSource datasource2 = new ReportDataSource("DataSet1", ie);

            this.ReportViewer1.LocalReport.DataSources.Clear();
               ReportViewer1.LocalReport.EnableExternalImages = true;
              this.ReportViewer1.LocalReport.DataSources.Add(datasource1);
               ReportViewer1.LocalReport.DataSources.Add(datasource2);
              ReportParameter rp = new ReportParameter("Date", Month, false);
               ReportParameter rp1 = new ReportParameter("Header", Header, false);
               this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp });
            this.ReportViewer1.LocalReport.Refresh();

            //this.ReportViewer1.LocalReport.DisplayName = title;
            //ReportViewer1.ProcessingMode = ProcessingMode.Local;
            //ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString);
            //System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
            //ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
            //IEnumerable<DailySummary> ie;
            //ie = list.AsQueryable();
            //IEnumerable<EmpPhoto> companyImage;
            //companyImage = companyimage.AsQueryable();
            //ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie);
            //ReportDataSource datasource2 = new ReportDataSource("DataSet2", companyImage);
            //ReportViewer1.LocalReport.DataSources.Clear();
            //ReportViewer1.LocalReport.EnableExternalImages = true;
            //ReportViewer1.LocalReport.DataSources.Add(datasource1);
            //ReportViewer1.LocalReport.DataSources.Add(datasource2);
            //ReportParameter rp = new ReportParameter("Date", p, false);
            //ReportParameter rp1 = new ReportParameter("Header", Header, false);
            //this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp });
            //ReportViewer1.LocalReport.Refresh();
        }
开发者ID:linkstatic12,项目名称:WMS-Fatima,代码行数:47,代码来源:ReportContainer.aspx.cs

示例4: GetErasFromRegistry

        [System.Security.SecuritySafeCritical]  // auto-generated
        private static EraInfo[] GetErasFromRegistry()
        {
            // Look in the registry key and see if we can find any ranges
            int iFoundEras = 0;
            EraInfo[] registryEraRanges = null;
#if !MONO            
            try
            {
                // Need to access registry
                PermissionSet permSet = new PermissionSet(PermissionState.None);
                permSet.AddPermission(new RegistryPermission(RegistryPermissionAccess.Read, c_japaneseErasHivePermissionList));
                permSet.Assert();
                RegistryKey key = RegistryKey.GetBaseKey(RegistryKey.HKEY_LOCAL_MACHINE).OpenSubKey(c_japaneseErasHive, false);

                // Abort if we didn't find anything
                if (key == null) return null;

                // Look up the values in our reg key
                String[] valueNames = key.GetValueNames();
                if (valueNames != null && valueNames.Length > 0)
                {
                    registryEraRanges = new EraInfo[valueNames.Length];

                    // Loop through the registry and read in all the values
                    for (int i = 0; i < valueNames.Length; i++)
                    {
                        // See if the era is a valid date
                        EraInfo era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString());

                        // continue if not valid
                        if (era == null) continue;

                        // Remember we found one.
                        registryEraRanges[iFoundEras] = era;
                        iFoundEras++;                        
                    }
                }
            }
            catch (System.Security.SecurityException)
            {
                // If we weren't allowed to read, then just ignore the error
                return null;
            }
            catch (System.IO.IOException)
            {
                // If key is being deleted just ignore the error
                return null;
            }
            catch (System.UnauthorizedAccessException)
            {
                // Registry access rights permissions, just ignore the error
                return null;
            }

            //
            // If we didn't have valid eras, then fail
            // should have at least 4 eras
            //
            if (iFoundEras < 4) return null;

            //
            // Now we have eras, clean them up.
            //
            // Clean up array length
            Array.Resize(ref registryEraRanges, iFoundEras);

            // Sort them
            Array.Sort(registryEraRanges, CompareEraRanges);

            // Clean up era information
            for (int i = 0; i < registryEraRanges.Length; i++)
            {
                // eras count backwards from length to 1 (and are 1 based indexes into string arrays)
                registryEraRanges[i].era = registryEraRanges.Length - i;

                // update max era year
                if (i == 0)
                {
                    // First range is 'til the end of the calendar
                    registryEraRanges[0].maxEraYear = GregorianCalendar.MaxYear - registryEraRanges[0].yearOffset;
                }
                else
                {
                    // Rest are until the next era (remember most recent era is first in array)
                    registryEraRanges[i].maxEraYear = registryEraRanges[i-1].yearOffset + 1 - registryEraRanges[i].yearOffset;
                }
            }
#endif
            // Return our ranges
            return registryEraRanges;
        }
开发者ID:stormleoxia,项目名称:referencesource,代码行数:92,代码来源:japanesecalendar.cs

示例5: LoadReport

 private void LoadReport(string path, List<ViewLvApplication> _Employee, string date)
 {
     string _Header = title;
     this.ReportViewer1.LocalReport.DisplayName = title;
     ReportViewer1.ProcessingMode = ProcessingMode.Local;
     ReportViewer1.LocalReport.ReportPath = Server.MapPath(path);
     System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
     ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
     IEnumerable<ViewLvApplication> ie;
     ie = _Employee.AsQueryable();
     ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie);
     ReportViewer1.LocalReport.DataSources.Clear();
     ReportViewer1.LocalReport.DataSources.Add(datasource1);
     ReportParameter rp = new ReportParameter("Header", _Header, false);
     this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
     ReportViewer1.LocalReport.Refresh();
 }
开发者ID:qq5013,项目名称:WMS-Fatima,代码行数:17,代码来源:ReportContainer.aspx.cs

示例6: LoadReport

        private void LoadReport(string path, List<ViewAttData> _Employee, string date)
        {
            string _Header = title;
            this.ReportViewer1.LocalReport.DisplayName = title;
            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            ReportViewer1.LocalReport.ReportPath = Server.MapPath(path);
            System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
            ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
            IEnumerable<ViewAttData> ie;
            ie = _Employee.AsQueryable();
            IEnumerable<EmpPhoto> companyImage;
            companyImage = companyimage.AsQueryable();
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie);
            ReportDataSource datasource2 = new ReportDataSource("DataSet2", companyImage);

            ReportViewer1.HyperlinkTarget = "_blank";

            ReportViewer1.LocalReport.DataSources.Add(datasource1);
            ReportViewer1.LocalReport.DataSources.Add(datasource2);
            ReportParameter rp = new ReportParameter("Date", date, false);
            ReportParameter rp1 = new ReportParameter("Header", _Header, false);
            this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 });
            ReportViewer1.LocalReport.Refresh();
        }
开发者ID:ahsinanwar,项目名称:SingleCompany,代码行数:25,代码来源:ReportContainer.aspx.cs

示例7: LoadReport

 private void LoadReport(string path, List<DailySummary> _Summary,string rptName)
 {
     string _Header = rptName;
     this.ReportViewer1.LocalReport.DisplayName = rptName;
     ReportViewer1.ProcessingMode = ProcessingMode.Local;
     ReportViewer1.LocalReport.ReportPath = Server.MapPath(path);
     System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
     ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
     ReportDataSource datasource1 = new ReportDataSource("DataSet1", _Summary);
     ReportViewer1.LocalReport.DataSources.Clear();
     ReportViewer1.LocalReport.DataSources.Add(datasource1);
     ReportParameter rp = new ReportParameter("CompanyName", "National Highway Authority", false);
     ReportParameter rp1 = new ReportParameter("Title", rptName, false);
     ReportParameter rp2 = new ReportParameter("Date", DateTo.ToString("dd-MMM-yyyy") + " to " + DateFrom.ToString("dd-MMM-yyyy"), false);
     this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp,rp1,rp2 });
     ReportViewer1.LocalReport.Refresh();
 }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:17,代码来源:DSSection.aspx.cs

示例8: GetPermissionSet

 private System.Security.PermissionSet GetPermissionSet(ISecurityAttribute securityAttribute) {
   var result = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
   foreach (var attribute in securityAttribute.Attributes) {
     var permission = this.GetPermission(securityAttribute.Action, attribute);
     if (permission == null) continue; //not a trusted permission
     result.AddPermission(permission);
   }
   return result;
 }
开发者ID:modulexcite,项目名称:Microsoft.Cci.Metadata,代码行数:9,代码来源:Emitter.cs

示例9: CreateAppDomain

        void CreateAppDomain()
        {
            System.AppDomainSetup pythonAppDomainSetup = new AppDomainSetup();
            pythonAppDomainSetup.ApplicationBase = ".";

            bool usePermissionTest = false;
            if (usePermissionTest)
            {
                System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
                permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.Execution));
                //permissionSet.AddPermission(new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted));

                compilerAppDomain = System.AppDomain.CreateDomain("Python App Domain", null, pythonAppDomainSetup, permissionSet, null);
            }
            else
            {
                compilerAppDomain = System.AppDomain.CreateDomain("Python App Domain");
            }

            Dictionary<string, object> options = new Dictionary<string, object>();
            options["Debug"] = true;
        }
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:22,代码来源:MatterCadWidget.cs

示例10: LoadReportLateIn

 private void LoadReportLateIn(string path, List<ViewAttData> _Employee, string date)
 {
     List<ViewAttData> attData = new List<ViewAttData>();
     foreach (var item in _Employee)
     {
         TimeSpan dtLateIn = new TimeSpan();
         dtLateIn = new TimeSpan(09, 0, 0);
         if (item.TimeIn.Value.TimeOfDay > dtLateIn || item.WorkMin<480)
         {
             attData.Add(item);
         }
     }
     string _Header = title;
     this.ReportViewer1.LocalReport.DisplayName = title;
     ReportViewer1.ProcessingMode = ProcessingMode.Local;
     ReportViewer1.LocalReport.ReportPath = Server.MapPath(path);
     System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
     ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
     IEnumerable<ViewAttData> ie;
     ie = attData.AsQueryable();
     ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie);
     ReportViewer1.LocalReport.DataSources.Clear();
     ReportViewer1.LocalReport.DataSources.Add(datasource1);
     ReportParameter rp = new ReportParameter("Date", date, false);
     ReportParameter rp1 = new ReportParameter("Header", _Header, false);
     this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 });
     ReportViewer1.LocalReport.Refresh();
 }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:28,代码来源:ReportContainer.aspx.cs

示例11: LoadReport

 private void LoadReport(string PathString, List<VMPosting> list, string title, string date)
 {
     string _Header = "Posting Record";
     string Date = Convert.ToDateTime(_dateFrom).Date.ToString("dd-MMM-yyyy");
     this.ReportViewer1.LocalReport.DisplayName = PathString;
     ReportViewer1.ProcessingMode = ProcessingMode.Local;
     ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString);
     System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
     ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
     IEnumerable<VMPosting> ie;
     ie = list.AsQueryable();
     ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie);
     ReportViewer1.LocalReport.DataSources.Clear();
     ReportViewer1.LocalReport.DataSources.Add(datasource1);
     ReportParameter rp = new ReportParameter("Header", _Header, false);
     ReportParameter rp1 = new ReportParameter("Date", Date, false);
     this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1 });
     ReportViewer1.LocalReport.Refresh();
 }
开发者ID:ahsinanwar,项目名称:WMSNHA2016,代码行数:19,代码来源:ReportContainer.aspx.cs

示例12: EnlistDistributedTransactionHelper

        // NOTE: This is just a private helper because OracleClient V1.1 shipped
        // with a different argument name and it's a breaking change to not use
        // the same argument names in V2.0 (VB Named Parameter Binding--Ick)
        private void EnlistDistributedTransactionHelper(System.EnterpriseServices.ITransaction transaction) {
            System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
            permissionSet.AddPermission(CONNECTIONOBJECTNAME.ExecutePermission); // MDAC 81476
            permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode));
            permissionSet.Demand();

            Bid.Trace( "<prov.DbConnectionHelper.EnlistDistributedTransactionHelper|RES|TRAN> %d#, Connection enlisting in a transaction.\n", ObjectID);
            SysTx.Transaction indigoTransaction = null;

            if (null != transaction) {
                indigoTransaction = SysTx.TransactionInterop.GetTransactionFromDtcTransaction((SysTx.IDtcTransaction)transaction);
            }

            RepairInnerConnection();
            // NOTE: since transaction enlistment involves round trips to the
            // server, we don't want to lock here, we'll handle the race conditions
            // elsewhere.
            InnerConnection.EnlistTransaction(indigoTransaction);

            // NOTE: If this outer connection were to be GC'd while we're
            // enlisting, the pooler would attempt to reclaim the inner connection
            // while we're attempting to enlist; not sure how likely that is but
            // we should consider a GC.KeepAlive(this) here.
            GC.KeepAlive(this);
        }
开发者ID:uQr,项目名称:referencesource,代码行数:28,代码来源:DbConnectionHelper.cs

示例13: InstantiatePermissionAttributes

 protected System.Security.PermissionSet InstantiatePermissionAttributes()
 {
     System.Security.PermissionSet permissions = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
     AttributeList permissionAttributes = this.PermissionAttributes;
     for(int i = 0, n = permissionAttributes == null ? 0 : permissionAttributes.Count; i < n; i++)
     {
         //^ assert permissionAttributes != null;
         object result = this.GetPermissionOrSetOfPermissionsFromAttribute(permissionAttributes[i]);
         if(result == null)
             continue;
         if(result is System.Security.PermissionSet)
             permissions = permissions.Union((System.Security.PermissionSet)result);
         else
         {
             System.Security.IPermission permission = result as System.Security.IPermission;
             if(permission == null)
                 continue;
             permissions.AddPermission(permission);
         }
     }
     return permissions;
 }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:22,代码来源:Nodes.cs

示例14: CreatePermission

 private System.Security.IPermission CreatePermission(System.Security.Permissions.SecurityAttribute/*!*/ secAttr)
 {
     //This could execute partially trusted code, so set up a very restrictive execution environment
     System.Security.PermissionSet perm = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
     //TODO: add permissions if the attribute is from a trusted assembly
     perm.PermitOnly();
     try
     {
         return secAttr.CreatePermission();
     }
     catch { }
     return null;
 }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:13,代码来源:Nodes.cs

示例15: LoadReport

 private void LoadReport(string PathString, List<ViewServiceLog> _ViewServiceLog, string date, string title)
 {
     string _Header = title;
     this.ReportViewer1.LocalReport.DisplayName = title;
     ReportViewer1.ProcessingMode = ProcessingMode.Local;
     ReportViewer1.LocalReport.ReportPath = Server.MapPath(PathString);
     System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
     ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
     ReportDataSource datasource1 = new ReportDataSource("DataSet1", _ViewServiceLog);
     ReportViewer1.LocalReport.DataSources.Clear();
     ReportViewer1.LocalReport.DataSources.Add(datasource1);
     ReportParameter rp = new ReportParameter("CompanyName", "National Highway Authority", false);
     ReportParameter rp1 = new ReportParameter("Title", title, false);
     ReportParameter rp2 = new ReportParameter("Date", date, false);
     this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp, rp1, rp2 });
     ReportViewer1.LocalReport.Refresh();
 }
开发者ID:linkstatic12,项目名称:NHAWMS,代码行数:17,代码来源:ReportContainer.aspx.cs


注:本文中的System.Security.PermissionSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。