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


C# FileAccess.ToString方法代码示例

本文整理汇总了C#中FileAccess.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FileAccess.ToString方法的具体用法?C# FileAccess.ToString怎么用?C# FileAccess.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileAccess的用法示例。


在下文中一共展示了FileAccess.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateAccess

 protected void ValidateAccess(FileAccess access)
 {
     if (!_access.HasFlag(access))
     {
         throw new InvalidOperationException($"The current {GetType().Name} does not support {access.ToString("G")} access.");
     }
 }
开发者ID:Azure,项目名称:azure-webjobs-sdk-script,代码行数:7,代码来源:KeyValueConverter.cs

示例2: TestMethod

        private MFTestResults TestMethod(FileMode fm, FileAccess fa)
        {
            Log.Comment("Starting tests in FileMode: " + fm.ToString() + " with FileAccess: " + fa.ToString());
            int iCountErrors = 0;

            String fileName = "TestFile";
            StreamWriter sw2;
            FileStream fs2;
            String str2;

            if (File.Exists(fileName))
                File.Delete(fileName);

            Log.Comment("File does not exist");
            //------------------------------------------------------------------

            switch (fm)
            {
                case FileMode.CreateNew:
                case FileMode.Create:
                case FileMode.OpenOrCreate:
                    try
                    {
                        Log.Comment("null path");
                        fs2 = File.Open(null, fm, fa);
                        if (!File.Exists(fileName))
                        {
                            iCountErrors++;
                            Log.Exception("File not created, FileMode==" + fm.ToString());
                        }
                        fs2.Close();
                    }
                    catch (ArgumentException aexc)
                    {
                        Log.Comment("Caught expected exception, aexc==" + aexc.Message);
                    }
                    catch (Exception exc)
                    {
                        iCountErrors++;
                        Log.Exception("Incorrect exception thrown, exc==" + exc);
                    }
                    try
                    {
                        Log.Comment("string empty path");
                        fs2 = File.Open("", fm, fa);
                        if (!File.Exists(fileName))
                        {
                            iCountErrors++;
                            Log.Exception("File not created, FileMode==" + fm.ToString());
                        }
                        fs2.Close();
                    }
                    catch (ArgumentException aexc)
                    {
                        Log.Comment("Caught expected exception, aexc==" + aexc.Message);
                    }
                    catch (Exception exc)
                    {
                        iCountErrors++;
                        Log.Exception("Incorrect exception thrown, exc==" + exc);
                    }
                    try
                    {
                        Log.Comment("string:" + fileName);
                        fs2 = File.Open(fileName, fm, fa);
                        if (!File.Exists(fileName))
                        {
                            iCountErrors++;
                            Log.Exception("File not created, FileMode==" + fm.ToString());
                        }
                        fs2.Close();
                    }
                    catch (ArgumentException aexc)
                    {
                        if ((fm == FileMode.Create && fa == FileAccess.Read) || (fm == FileMode.CreateNew && fa == FileAccess.Read))
                        {
                            Log.Comment("Caught expected exception, aexc==" + aexc.Message);
                        }
                        else
                        {
                            iCountErrors++;
                            Log.Exception("Unexpected exception, aexc==" + aexc);
                        }
                    }
                    catch (Exception exc)
                    {
                        iCountErrors++;
                        Log.Exception("Incorrect exception thrown, exc==" + exc);
                    }
                    break;
                case FileMode.Open:
                case FileMode.Truncate:
                    try
                    {
                        Log.Comment("null path");
                        fs2 = File.Open(null, fm, fa);
                        iCountErrors++;
                        Log.Exception("Expected exception not thrown");
                        fs2.Close();
                    }
//.........这里部分代码省略.........
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:101,代码来源:Open_FM_FA.cs

示例3: Init

        private void Init(XPathDocument xpDoc, FileAccess mode, bool strict, params string[] pageNames)
        {
            if (mode != FileAccess.Read) throw new IOException(mode.ToString() + " not supported");

            XsltArgumentList xslArgs = new XsltArgumentList();

            if (pageNames.Length > 0) {
                string pageNameList = "|";
                foreach(string pageName in pageNames) pageNameList += (pageName + "|");
                xslArgs.AddParam("selected-pages", String.Empty, pageNameList);
            }

            xslArgs.AddParam("strict", String.Empty, strict?"true":"false");
            XslCompiledTransform xslt = Xml.GetCachedCompiledTransform("visio2003toRuleML.xsl");

            MemoryStream stream = new MemoryStream();
            xslt.Transform(xpDoc, xslArgs, stream);
            stream.Seek(0, SeekOrigin.Begin);

            ruleBaseAdapter = new RuleML09NafDatalogAdapter(stream, FileAccess.Read);
        }
开发者ID:plamikcho,项目名称:xbrlpoc,代码行数:21,代码来源:Visio2003Adapter.cs

示例4: AbstractRuleMLAdapter

 /// <summary>
 /// Instantiates a RuleML adapter for reading or writing to an URI.
 /// In Read mode, the adapter tries to locate a flow engine binder definition file 
 /// by appending .xbre to the URI.
 /// </summary>
 /// <param name="uriRuleML">The URI to read rules from or write to.</param>
 /// <param name="mode">The FileAccess mode.</param>
 public AbstractRuleMLAdapter(string uriRuleML, FileAccess mode)
 {
     if (uriRuleML == null) throw new ArgumentNullException("A null URI is invalid");
     if ((mode != FileAccess.Read) && (mode != FileAccess.Write)) throw new IOException(mode.ToString() + " not supported");
 }
开发者ID:Ghasan,项目名称:NxBRE,代码行数:12,代码来源:AbstractRuleMLAdapter.cs

示例5: Init

        private void Init(XPathDocument xpDoc, FileAccess mode, bool strict, params string[] pageNames)
        {
            if (mode != FileAccess.Read) throw new IOException(mode.ToString() + " not supported");

            XsltArgumentList xslArgs = new XsltArgumentList();
            if (pageNames.Length > 0) {
                string pageNameList = "|";
                foreach(string pageName in pageNames) pageNameList += (pageName + "|");
                xslArgs.AddParam("selected-pages", String.Empty, pageNameList);
            }

            XslTransform xslt = new XslTransform();

            // select the appropriate XSL
            string xslName = strict?"strict-vdx2nxbre-ie.xsl":"vdx2nxbre-ie.xsl";

            xslt.Load(new XPathDocument(Assembly.GetExecutingAssembly().GetManifestResourceStream(Parameter.GetString(xslName, xslName))),
                      null,
                      null);

            MemoryStream stream = new MemoryStream();
            xslt.Transform(xpDoc, xslArgs, stream, null);
            stream.Seek(0, SeekOrigin.Begin);
            rml086da = new RuleML086NafDatalogAdapter(stream, FileAccess.Read);
        }
开发者ID:Ghasan,项目名称:NxBRE,代码行数:25,代码来源:Visio2003Adapter.cs

示例6: RuleML086NafDatalogAdapter

		/// <summary>
		/// Instantiates a RuleML 0.86 Datalog adapter for reading or writing to an URI.
		/// In Read mode, the adapter tries to locate a flow engine binder definition file 
		/// by appending .xbre to the URI.
		/// </summary>
		/// <param name="uriRuleML">The URI to read rules from or write to.</param>
		/// <param name="mode">The FileAccess mode.</param>
		public RuleML086NafDatalogAdapter(string uriRuleML, FileAccess mode, bool supportTypedFacts) {
			if (uriRuleML == null) throw new ArgumentNullException("A null URI is invalid");
			if ((mode != FileAccess.Read) && (mode != FileAccess.Write)) throw new IOException(mode.ToString() + " not supported");
			this.supportTypedFacts = supportTypedFacts;
			Init(null, uriRuleML, mode);
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:13,代码来源:RuleML086NafDatalogAdapter.cs


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