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


C# FileInfo.Remove方法代码示例

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


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

示例1: FindLanguages

        internal static List<string> FindLanguages()
        {
            string[] a;
            var LstA = new List<string>();
            if (System.IO.Directory.Exists("Languages"))
            {
                a = System.IO.Directory.GetFiles("Languages", "*.ulex");
                foreach (var i in a)
                {
                    var u = new System.IO.FileInfo(i).Name;
                    u = u.Remove(u.LastIndexOf('.'));
                    LstA.Add(u);
                }
            }
            try
            {
                if (System.IO.Directory.GetFiles(Shared.LocalData("Languages")).Length > 0)
                {
                    a = System.IO.Directory.GetFiles(Shared.LocalData("Languages\\"), "*.ulex");
                    foreach (var i in a)
                    {
                        var u = new System.IO.FileInfo(i).Name;
                        u = u.Remove(u.LastIndexOf('.'));
                        if (LstA.Contains(u)) LstA.Remove(u);
                        LstA.Add(u);
                    }
                }
            }
            catch (Exception)
            {
                return LstA;
            }

            return LstA;
        }
开发者ID:RasyidUFA,项目名称:UFSJ,代码行数:35,代码来源:Shared.cs

示例2: AplFile

        public AplFile(string file)
        {
            byte [] contents = File.ReadAllBytes(file);
            string data = Encoding.UTF8.GetString(contents);

            Match m = Regex.Match(data, aplPattern);

            imageFile_ = m.Groups[1].Value;
            startSample_ = Convert.ToInt64(m.Groups[2].Value);
            endSample_ = Convert.ToInt64(m.Groups[3].Value);
            name_ = new FileInfo(file).Name;
            name_ = name_.Remove(name_.Length - ".apl".Length);

            ParseMetadata(data);
        }
开发者ID:LastContrarian,项目名称:flacfs,代码行数:15,代码来源:AplFile.cs

示例3: SendFile

        public static void SendFile(string path, HttpListenerContext context)
        {
            var ext = new FileInfo(path).Extension;
            if (ext.StartsWith("."))
                ext = ext.Remove(0, 1);
            context.Response.ContentType = getContentType(ext);

            byte[] buffer;

            if (context.Response.ContentType == "text/html" || context.Response.ContentType == "text/javascript" || context.Response.ContentType == "text/css")
            {
                using (var rdr = File.OpenText(path))
                {
                    var send = rdr.ReadToEnd();

                    if (ext == "php")
                    {
                        Process p = new Process();
                        p.StartInfo = new ProcessStartInfo("php\\php-cgi.exe", $"-f {path} {GetPhpArgumentQuery(context.Request.QueryString)}")
                        {
                            UseShellExecute = false,
                            RedirectStandardInput = true,
                            RedirectStandardOutput = true,
                            WindowStyle = ProcessWindowStyle.Hidden
                        };
                        p.Start();
                        send = p.StandardOutput.ReadToEnd();
                    }

                    foreach (var toReplace in replaceVars)
                    {
                        var tmp = String.Empty;
                        if (toReplace.Value.StartsWith("PATH"))
                        {
                            using (var r = File.OpenText(toReplace.Value.Split(':')[1]))
                                tmp = r.ReadToEnd();

                            send = send.Replace(toReplace.Key, tmp);
                        }
                        else if (toReplace.Value.StartsWith("PROPERTYCALL"))
                        {
                            var property = context.Request.GetType().GetProperty(toReplace.Value.Split(':')[1]);
                            if (property != null)
                                send = send.Replace(toReplace.Key, property.GetValue(context.Request).ToString());
                        }
                        else
                            send = send.Replace(toReplace.Key, toReplace.Value);
                    }
                    buffer = Encoding.UTF8.GetBytes(send);
                }
            }
            else
            {
                using (Stream s = File.OpenRead(path))
                {
                    buffer = new byte[s.Length];
                    var length = s.Read(buffer, 0, (int)s.Length);
                    Array.Resize(ref buffer, length);
                }
            }
            context.Response.StatusCode = 200;
            context.Response.StatusDescription = "OK";
            context.Response.ContentLength64 = buffer.Length;
            context.Response.OutputStream.Write(buffer, 0, buffer.Length);
        }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:65,代码来源:Program.cs

示例4: recuperarMetadados

        public Dictionary<string, Metadados> recuperarMetadados()
        {
            try
            {
                IFormatter formatter = new BinaryFormatter();
                string[] arquivos = Directory.GetFiles(dirBanco + "\\" + dirBaseDados + "\\");
                Dictionary<string, Metadados> dados = new Dictionary<string, Metadados>();
                foreach (string arquivo in arquivos)
                {
                    if (arquivo.EndsWith(".meta"))
                    {
                        Stream stream = new FileStream(arquivo, FileMode.Open, FileAccess.Read, FileShare.Read);
                        Metadados meta = (Metadados)formatter.Deserialize(stream);
                        string tabela = new FileInfo(arquivo).Name;
                        tabela = tabela.Remove(tabela.IndexOf('.'));
                        dados.Add(tabela, meta);
                        stream.Close();
                    }
                }

                return dados;
            }
            catch
            {
                throw new SGDBException("Tabela não existe");
            }
        }
开发者ID:carolmkl,项目名称:TrabalhoBD2,代码行数:27,代码来源:GerenciadorMemoria.cs


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