OpenIDE.EventListener.Instance.Get C# (CSharp) 메소드

Get() 공개 정적인 메소드

public static Get ( string file, string lines ) : Instance
file string
lines string
리턴 Instance
        public static Instance Get(string file, string[] lines)
        {
            if (lines.Length != 2)
                return null;
            int processID;
            var pid = Path.GetFileName(file).Substring(0, Path.GetFileName(file).IndexOf("."));
            if (!int.TryParse(pid, out processID))
                return null;
            int port;
            if (!int.TryParse(lines[1], out port))
                return null;
            return new Instance(file, processID, lines[0], port);
        }

Usage Example

예제 #1
0
파일: Program.cs 프로젝트: alex1989/OpenIDE
        private IEnumerable <Instance> getInstances(string path)
        {
            var dir = Path.Combine(FS.GetTempDir(), "OpenIDE.Events");

            if (Directory.Exists(dir))
            {
                foreach (var file in Directory.GetFiles(dir, "*.pid"))
                {
                    var instance = Instance.Get(file, File.ReadAllLines(file));
                    if (instance != null)
                    {
                        yield return(instance);
                    }
                }
            }
        }
All Usage Examples Of OpenIDE.EventListener.Instance::Get