示例#1
0
        static public GxLocation getlocation(IGxContext context,
                                             String sLocation)
        {
            GXXMLReader oReader;
            GxLocation  oLocation;

            if (context.nLocRead == 0)
            {
                oReader = new GXXMLReader(context.GetPhysicalPath());
                oReader.Open(context.GetPhysicalPath( ) + "location.xml");
                initLocations(context, oReader);
                if (oReader.ErrCode == 0)
                {
                    oReader.Close();
                }
            }
            context.nSOAPErr = 0;
            oLocation        = context.colLocations.GetItem(sLocation);
            context.nSOAPErr = 0;
            if (oLocation == null)
            {
                context.nSOAPErr = 1;
            }
            assigngroupproperties(context, oLocation);
            if (context.nSOAPErr != 0)
            {
                context.nSOAPErr                 = (short)(-20007);
                context.sSOAPErrMsg              = "Invalid location name.";
                oLocation                        = new GxLocation();
                oLocation.Name                   = sLocation;
                oLocation.Host                   = "";
                oLocation.Port                   = -1;
                oLocation.BaseUrl                = "";
                oLocation.Secure                 = -1;
                oLocation.ProxyServerHost        = "";
                oLocation.ProxyServerPort        = -1;
                oLocation.Timeout                = -1;
                oLocation.CancelOnError          = 0;
                oLocation.Authentication         = 0;
                oLocation.AuthenticationMethod   = 0;
                oLocation.AuthenticationRealm    = "";
                oLocation.AuthenticationUser     = "";
                oLocation.AuthenticationPassword = "";
                oLocation.GroupLocation          = "";
                context.colLocations.Add(oLocation, sLocation);
            }
            else
            {
                context.nSOAPErr    = 0;
                context.sSOAPErrMsg = "";
            }
            return(oLocation);
        }
示例#2
0
        public static void LoadFromFile(string fileName, ref GXServices services)
        {
            string filePath = ServicesFilePath(fileName);

            if (File.Exists(filePath))
            {
                try
                {
                    if (services == null)
                    {
                        services = new GXServices();
                    }
                    GXLogging.Debug(log, "Loading service:", filePath);
                    GXXMLReader reader = new GXXMLReader();
                    reader.Open(filePath);
                    reader.ReadType(1, "Services");
                    reader.Read();
                    if (reader.ErrCode == 0)
                    {
                        while (reader.Name != "Services")
                        {
                            services.ProcessService(reader);
                            reader.Read();
                            if (reader.Name == "Service" && reader.NodeType == 2)                             //</Service>
                            {
                                reader.Read();
                            }
                        }
                        reader.Close();
                    }
                }
                catch (Exception ex)
                {
                    GXLogging.Error(log, "Couldn't create service from:", filePath, ex);
                    throw ex;
                }
            }
        }