Пример #1
0
        internal static void UploadFile(rest Rest, int profile, string resname, string type)
        {
            Assembly assembly;
            string   resourceName;
            string   contents = "";

            // Load resource into string
            assembly     = Assembly.GetExecutingAssembly();
            resourceName = "WFNodeServer.nodesetup." + resname;
            using (Stream stream = assembly.GetManifestResourceStream(resourceName)) {
                using (StreamReader reader = new StreamReader(stream)) {
                    contents = reader.ReadToEnd();
                }
            }

            if (contents.Length > 0)
            {
                // Send to ISY
                // This is just a http post to /rest/ns/profile/<profile>/upload/<type>/<filename>
                Rest.AuthRequired = true;
                try {
                    Rest.REST_POST("ns/profile/" + profile.ToString() + "/upload/" + type + "/" + resname, contents, contents.Length);
                } catch (Exception ex) {
                    WFLogging.Error(resname + " upload failed: " + ex.Message);
                }
            }
        }
Пример #2
0
 internal wf_station(string key)
 {
     api_key             = key;
     WFRest              = new rest();
     WFRest.Base         = "http://swd.weatherflow.com";
     WFRest.AuthRequired = false;
     Latitude            = 0;
     Longitude           = 0;
     Elevation           = 0;
     Air   = 0;
     Sky   = 0;
     AirSN = "";
     SkySN = "";
 }