示例#1
0
    //--------
    //-------- Methods
    //--------

    /// <summary>
    /// Method main that creates the main window and then polls for
    /// for XML files.
    /// </summary>
    /// <param name="args"> command line arguments </param>
    public static void Main1(string[] args)
    {
        int path_count = 0;

        try
        {
            // attempt to get the default adapter
            adapter = OneWireAccessProvider.DefaultAdapter;

            // create the state instances
            parseLog      = new Dictionary <long, ParseContainer>();
            taggedDevices = new List <TaggedDevice>();
            paths         = new List <OWPath>();
            deviceFrames  = new ArrayList();

            // create dummy 'trunk' search path
            paths.Add(new OWPath(adapter));

            // create the main frame
            main_Renamed = new TagMainFrame();
            main_Renamed.AdapterLabel = adapter.AdapterName + "_" + adapter.PortName;

            // get the initial log file
            logFile = main_Renamed.LogFile;

            // check for XML files on the command line
            for (int i = 0; i < args.Length; i++)
            {
                main_Renamed.Status = "File being parsed:  " + args[i];
                FileStream file_stream = new FileStream(args[i], FileMode.Open, FileAccess.Read);

                // create the tagParser
                parser = new TAGParser(adapter);

                // attempt to parse it
                parseStream(parser, file_stream, new OWPath(adapter), true);
            }

            // add the paths to the main window
            main_Renamed.clearPathList();
            for (int p = 0; p < paths.Count; p++)
            {
                main_Renamed.addToPathList(((OWPath)paths[p]).ToString());
            }

            // turn off all branches
            allBranchesOff();

            // run loop
            for (;;)
            {
                // check if scanning 1-Wire for XML files enabled
                if (main_Renamed.ScanChecked)
                {
                    // check if there is a path to search
                    if (path_count < paths.Count)
                    {
                        // only increment if there is nothing else to search for
                        if (pathXMLSearchComplete(path_count))
                        {
                            path_count++;
                        }
                    }
                    else
                    {
                        path_count = 0;
                    }
                }

                // sleep for 1 second
                main_Renamed.Status = "sleeping";
                Thread.Sleep(1000);
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.ToString());
            Debug.Write(ex.StackTrace);
        }
    }
示例#2
0
 public WindowAdapterAnonymousInnerClassHelper(TagMainFrame outerInstance, Exception e)
 {
     this.outerInstance = outerInstance;
     this.e             = e;
 }