Exemplo n.º 1
0
        public static API_Azure_via_WebREPL set_Server(this API_Azure_via_WebREPL apiAzure, string server)
        {
            var serverTemplate = "http://{0}/csharprepl/CSharp_REPL.asmx";

            apiAzure.webService.Url = serverTemplate.format(server);
            return(apiAzure);
        }
Exemplo n.º 2
0
        public static Dictionary <string, string> view_Object(this API_Azure_via_WebREPL apiAzure, string objectValue)
        {
            var values = apiAzure.propertyValues_Object(objectValue);

            values.show_In_ListView()
            .title(objectValue)
            .parentForm();
            return(values);
        }
Exemplo n.º 3
0
        public static Dictionary <string, string> view_EnvironmentVariables(this API_Azure_via_WebREPL apiAzure)
        {
            var values = apiAzure.environmentVariables();

            values.show_In_ListView()
            .title("Special Folders")
            .parentForm();
            return(values);
        }
Exemplo n.º 4
0
        public static List <string> executeScript_ConvertTo_StringList(this API_Azure_via_WebREPL apiAzure, string script)
        {
            var response = apiAzure.executeScript(script);

            if (response.valid())
            {
                return(response.json_Deserialize <List <string> >());
            }
            return(new List <string>());
        }
Exemplo n.º 5
0
        public static Dictionary <string, string> propertyValues_Object(this API_Azure_via_WebREPL apiAzure, string targetObject)
        {
            var script = @"var propertyValues = from name in " + targetObject + @".type().properties().names()
							     let value = "                             + targetObject + @".prop(name).str()
							     where value.valid()
							     select new { propName = name , propValue = value};
						  return    propertyValues;"                            ;

            return(apiAzure.executeScript_ConvertTo_DicionaryStringString(script, "propName", "propValue"));
        }
Exemplo n.º 6
0
        public static Dictionary <string, string> specialFolders(this API_Azure_via_WebREPL apiAzure)
        {
            var script = @"var specialFolders = from Environment.SpecialFolder specialFolder in Enum.GetValues(typeof(Environment.SpecialFolder))
											    let folderPath = Environment.GetFolderPath(specialFolder)
											    where folderPath.valid()
											    select new { specialFolder = specialFolder.str(), folderPath = folderPath};
												return  specialFolders;"                                                ;

            return(apiAzure.executeScript_ConvertTo_DicionaryStringString(script, "specialFolder", "folderPath"));
        }
Exemplo n.º 7
0
        public static Dictionary <string, string> environmentVariables(this API_Azure_via_WebREPL apiAzure)
        {
            var rawData              = apiAzure.executeScript(@"return Environment.GetEnvironmentVariables();");
            var rawDictionary        = rawData.json_Deserialize() as Dictionary <string, object>;
            var environmentVariables = new Dictionary <string, string>();

            foreach (var item in rawDictionary)
            {
                environmentVariables.add(item.Key, item.Value.str());
            }
            return(environmentVariables);
        }
Exemplo n.º 8
0
        public static string executeScript(this API_Azure_via_WebREPL apiAzure, string script)
        {
            "Executing script: {0}".info(script);
            apiAzure.Last_ExecuteScript = script;
            var response = apiAzure.webService.ExecuteCSharpCode(script);

            apiAzure.Last_ResponseData = response;
            if (response.starts("[compileAndExecuteCodeSnippet] Compilation failed: "))
            {
                "[API_Azure_via_WebREPL][executeScript]: server compilation error: \n\n {0}".error(response);
                return(null);
            }
            "[API_Azure_via_WebREPL][executeScript]: response size: {0}".info(response.size());
            return(response);
        }
Exemplo n.º 9
0
 public static string cmd_Execute(this API_Azure_via_WebREPL apiAzure, string exePath, string arguments)
 {
     return(apiAzure.executeScript(@"return @""{0}"".startProcess_getConsoleOut(@""{1}"");"
                                   .format(exePath, arguments)));
 }
Exemplo n.º 10
0
        public static Dictionary <string, string> executeScript_ConvertTo_DicionaryStringString(this API_Azure_via_WebREPL apiAzure, string script, string nameKey, string valueKey)
        {
            var data     = new Dictionary <string, string>();
            var response = apiAzure.executeScript(script);

            if (response.valid())
            {
                var items = (Object[])response.json_Deserialize();
                if (items.notNull())
                {
                    foreach (Dictionary <string, object> item in items)
                    {
                        data.add(item[nameKey].str(), item[valueKey].str());
                    }
                }
            }
            return(data);
        }
Exemplo n.º 11
0
 public static string wsdl(this API_Azure_via_WebREPL apiAzure)
 {
     return(apiAzure.webService.Url.str());
 }
Exemplo n.º 12
0
 public static Dictionary <string, string> view_HttpContext_Object(this API_Azure_via_WebREPL apiAzure)
 {
     return(apiAzure.view_Object("System.Web.HttpContext.Current"));
 }
Exemplo n.º 13
0
 public static string applicationPath(this API_Azure_via_WebREPL apiAzure)
 {
     return(apiAzure.propertyValues_Object("System.Web.HttpContext.Current.Request")
            ["PhysicalApplicationPath"]);
 }
Exemplo n.º 14
0
 public static string fileContents(this API_Azure_via_WebREPL apiAzure, string filePath)
 {
     return(apiAzure.executeScript(@"return @""{0}"".fileContents();".format(filePath)));
 }
Exemplo n.º 15
0
 public static List <string> files(this API_Azure_via_WebREPL apiAzure, string path)
 {
     return(apiAzure.executeScript_ConvertTo_StringList(@"return @""{0}"".files();".format(path)));
 }