ex.cs

来自「用C#写的一个OPC CLIENT的工具」· CS 代码 · 共 56 行

CS
56
字号
using System;
using System.IO;
using System.Collections;
using Tools;
using RFC1157;

public class ex
{
	static void WriteOid(Def d)
	{
		uint[] path = d.path;
		for (int j=0;j<path.Length;j++)
			Console.Write("."+path[j]);
		Console.WriteLine();
	}
	static void Walk(Def d,string prefix)
	{
		string str = prefix+"."+d.name;
		if (d.help.Length>0) 
		{
			Console.WriteLine(str);
			WriteOid(d);
			Console.WriteLine(d.help);
			Console.WriteLine();
		}
		uint m = 0;
		IDictionaryEnumerator e = d.nodes.GetEnumerator();
		while (e.MoveNext())
		{
			uint k = (uint)e.Key;
			if (k>m)
				m = k;
		}
		for (uint j=0;j<=m;j++)
			if (d[j]!=null)
				Walk(d[j],str);
	}
	public static void Main(string[] argv) {
		Parser p = new syntax(new tokens());
//		p.m_debug=true;
		string fold = Environment.GetFolderPath(Environment.SpecialFolder.System);
		DirectoryInfo dir = new DirectoryInfo(fold);
		FileInfo[] list = dir.GetFiles("*.mib");
		foreach (FileInfo f in list) 
		{
			Console.WriteLine(f.Name);
			StreamReader s = new StreamReader(f.FullName);
			try 
			{
				p.Parse(s);
			} catch (Exception) {}
		}
		Walk((Def)Defs.defs["iso"],"");
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?