public Mp3Tag GetTrackInfo(string artist, string track) { string response = GET("track.getInfo", ("api_key", api_key), ("artist", artist), ("track", track)); JObject dat = JObject.Parse(response); Mp3Tag tag = new Mp3Tag(); tag.Title = GetStringData(dat, "track", "name"); tag.Artist = GetStringData(dat, "track", "artist", "name"); tag.Album = GetStringData(dat, "track", "album", "title"); string dateTime = GetStringData(dat, "track", "wiki", "published"); if (dateTime != "null") { try { tag.Year = DateTime.Parse(dateTime).Year; } catch { } } tag.Genres = GetStringData(dat, "track", "toptags", "tag", "name"); return(tag); }
public API Get(GET mode) { if (deviceHandle == IntPtr.Zero) { return(API.DEVICE_DLLWASNOTLOADED); } API st = API.SUCCESS; Types.S32 tmp = new Types.S32(0); tmp.data = 0; try { operationStatus = Connector.UniDriverGet(deviceHandle, (uint)mode, ref tmp); } catch (Exception ex) { Console.WriteLine(ex.Message); if (ex.Message.Contains("Unable to load DLL")) { return((API)(operationStatus = (uint)API.UNIDRIVER_DLLWASNOTLOADED)); } else { return(API.UNDEFINED); } } st = (API)(operationStatus & MASK_RSH_ERROR); return(st); }
/// <summary> /// will show the request itself, and generate a diff for review, if used with the --diff option. /// </summary> /// <param name="ID"> /// A <see cref="System.String"/> /// </param> /// <param name="ShowDiff"> /// A <see cref="System.Boolean"/> /// </param> /// <returns> /// A <see cref="StringBuilder"/> /// </returns> public static StringBuilder GetSubmitreqShow(string ID, bool ShowDiff) { StringBuilder Result = new StringBuilder(); Result = GET.Getit("request/" + ID, VarGlobal.User, VarGlobal.Password); try { if (ShowDiff) { string SrcePrj = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/source", "project"); string SrcePkg = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/source", "package"); string DestPrj = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/target", "project"); string DestPkg = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/target", "package"); string Rev = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/source", "rev"); Result.Append(PostSourceRequestDiff.PostRequestDiff(SrcePrj, SrcePkg, DestPrj, DestPkg, Rev).ToString()); } } catch (Exception Ex) { if (!VarGlobal.LessVerbose) { Console.WriteLine("{0}{1}{2}", Ex.Message, Environment.NewLine, Ex.StackTrace); } } return(Result); }
public API Get(GET mode, ref BoardPortInfo value) { if (deviceHandle == IntPtr.Zero) { return(API.DEVICE_DLLWASNOTLOADED); } API st = API.SUCCESS; Types.BoardPortInfo tmp = new Types.BoardPortInfo(0); try { operationStatus = Connector.UniDriverGet(deviceHandle, (uint)mode, ref tmp); } catch (Exception ex) { Console.WriteLine(ex.Message); if (ex.Message.Contains("Unable to load DLL")) { return((API)(operationStatus = (uint)API.UNIDRIVER_DLLWASNOTLOADED)); } else { return(API.UNDEFINED); } } st = (API)(operationStatus & MASK_RSH_ERROR); if (st == API.SUCCESS) { if (tmp.totalConfs != 0) { value.confs = new PortInfo[tmp.totalConfs]; for (int i = 0; i < value.confs.Length; i++) { value.confs[i] = new PortInfo(); value.confs[i].address = tmp.confs[i].address; value.confs[i].bitSize = tmp.confs[i].bitSize; string str = System.Text.Encoding.UTF8.GetString(tmp.confs[i].name); value.confs[i].name = str.Substring(0, str.IndexOf('\0')); } } if (tmp.totalPorts != 0) { value.ports = new PortInfo[tmp.totalPorts]; for (int i = 0; i < value.ports.Length; i++) { value.ports[i] = new PortInfo(); value.ports[i].address = tmp.ports[i].address; value.ports[i].bitSize = tmp.ports[i].bitSize; string str = System.Text.Encoding.UTF8.GetString(tmp.ports[i].name); value.ports[i].name = str.Substring(0, str.IndexOf('\0')); } } } return(st); }
//------------------------------------------------------------- // GETリクエスト // @param // @リクエストURL // @callback // @brif POSTの時に使用したデータを消してやらないとPOSTだと判断されてしまう //------------------------------------------------------------- public void Get(GET url, UnityAction <Dictionary <string, object> > callback) { mClient = new WWWClient(this); mClient.URL = string.Format(getUrl [url], GlobalDataPool.Instance.playId); mClient.Timeout = timeout; mClient.OnDone = (WWW www) => { callback(JsonParser.Instance.Parse(www)); }; mClient.Request(); }
/// <summary> /// GET /search/request?match=submit/target/@project='home:surfzoid:' /// lists open requests attached to a project or package. /// </summary> /// <param name="Project">Project name(often home: + username)</param> /// <param name="package">If null or empty return all the package either only return result for the package</param> /// <returns> /// A <see cref="StringBuilder"/>The list of all medata aviables. /// </returns> /// <example> This sample shows how to call the GetSubmitreqList method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Search /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(SubmitreqList.GetSubmitreqList("home:surfzoid").ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetSubmitreqList(string Project, string package) { if (string.IsNullOrEmpty(package)) { return(GET.Getit("search/request?match=submit/target/@project='" + Project + "'", VarGlobal.User, VarGlobal.Password)); } else { return(GET.Getit("search/request?match=submit/target/@project='" + Project + "' and submit/target/@package='" + package + "'", VarGlobal.User, VarGlobal.Password)); } }
internal static Type GetCorrespondingType(GET mode) { switch (mode) { case GET.BUFFER_READY: case GET.WAIT_BUFFER_READY_EVENT: return(typeof(Types.U32)); default: return(typeof(Types.U32)); } }
public async Task Subject() { var factory = new SimpleConnectionFactory(); var endPoint = new IPEndPoint(IPAddress.Loopback, 6379); using var connectionResource = await factory.CreateAsync(endPoint); var connection = connectionResource.Value; var set = new SET("users:12:score", "50"); await connection.ExecuteAsync(set); var incr = new INCR("users:12:score"); await connection.ExecuteAsync(incr); var get = new GET("users:12:score"); var userScore = await connection.ExecuteAsync(get); // 51 }
private void CreateReturnValue(ILGenerator il, MethodInfo methodInfo) { Type parameterType = methodInfo.ReturnType; GET attr = (GET)methodInfo.GetCustomAttributes(typeof(GET), true).FirstOrDefault(); Debug.Log(attr.Path); var ctor = parameterType.GetConstructors()[0]; if (parameterType == typeof(void)) { return; } else if (parameterType.IsPrimitive || parameterType == typeof(string)) { this.EmitPrimitive(il, parameterType); } else { il.Emit(OpCodes.Newobj, ctor); // throw new ArgumentException("Parameter was reference value or null"); } }
/// <summary> /// Get project GPG key. If the project has no own key (default), it uses the first available one in the namespace hierarchy, ending at the global buildservice key. /// </summary> /// <returns> /// A <see cref="StringBuilder"/>Your GPG key in string format. /// </returns> /// <example> This sample shows how to call the GetKey method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Sources /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(GetPubkey.GetKey().ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetKey() { return(GET.Getit("source/" + VarGlobal.PrefixUserName + "/_pubkey", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// GET the wole list of aviable platforms/Repo. /// </summary> /// <returns> /// A <see cref="StringBuilder"/>The list of all platform/repository aviables. /// </returns> /// <example> This sample shows how to call the GetPlatforms method. /// <code> /// using System; /// using MonoOBSFramework.Functions.PlatformDataLegacy /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(GetPlatforms.GetIt().ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetIt() { return(GET.Getit("platform", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// Download one file used to construc/build a package in string format, example mypkg.spec file. /// </summary> /// <param name="PkgName">Package name</param> /// <param name="FileName">File in the package to download, string files only!</param> /// <returns> /// A <see cref="StringBuilder"/>The content of the string file. /// </returns> /// <example> This sample shows how to call the GetBuildPkgResultFile method. /// <code> /// using System; /// using MonoOBSFramework.Functions.BuildResults /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(BuildProjectPackageFile.GetBuildPkgResultFile("MonoOSC","MonoOSC.spec").ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetBuildProjectPackageFile(string PkgName, string FileName) { return(GET.Getit("build/" + VarGlobal.PrefixUserName + "/" + PkgName + "/" + FileName, VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// Get directory listing of all source files in the package /// </summary> /// <param name="Project"></param> /// <param name="PkgName"></param> /// <returns></returns> public static StringBuilder GetFileList(string Project, string PkgName) { return(GET.Getit("source/" + Project + "/" + PkgName, VarGlobal.User, VarGlobal.Password)); }
static private void ls() { string GET, data; string[] result; TcpClient client = listener.AcceptTcpClient(); //创建网络流 NetworkStream netStream = client.GetStream(); StreamReader sr = new StreamReader(client.GetStream()); //读取第一行的东西然后关闭sr GET = sr.ReadLine().ToString(); Console.Write("\r\n"); Console.Write(GET); StreamWriter sw = new StreamWriter(client.GetStream()); Readfile.Readfile rf = new Readfile.Readfile(); result = GET.Split(' '); //sw.Write("HTTP/1.1 200 OK\r\n"); if (result[1] == "") { ; } if (result[1] == "/" | result[1] == "/index.html") { //显示首页 // StreamReader fsr = new StreamReader(binpath + "/UserData/default.dba"); while (fsr.EndOfStream == false) { sw.Write(fsr.ReadLine().ToString()); } fsr.Close(); sw.Close(); sr.Close(); netStream.Close(); } else { try { //分离& string[] fs = result[1].Split('&'); //分离= string[] fr = fs[0].Split('='); if (fr[1].ToString() != "") { if (rf.Existen(binpath + "/UserData/wegDbfile-" + fr[1].ToString() + ".rdb")) { StreamReader fsr = new StreamReader(binpath + "/UserData/wegDbfile-" + fr[1].ToString() + ".rdb"); while (fsr.EndOfStream == false) { sw.Write(fsr.ReadLine().ToString()); } Console.Write("\r\n"); Console.Write(fr[1].ToString() + "数据发送成功"); fsr.Close(); sw.Close(); sr.Close(); netStream.Close(); } else { data = "<html><head><meta http-equiv=content-type content=\"text/html; charset=UTF-8\">数据不存在"; sw.Write(data); Console.Write("\r\n"); Console.Write("/UserData/wegDbfile-" + fr[1].ToString() + ".rdb"); Console.Write(fr[1].ToString() + "无此数据"); sw.Close(); sr.Close(); netStream.Close(); } } else { data = "<html><head><meta http-equiv=content-type content=\"text/html; charset=UTF-8\">数据不存在"; sw.Write(data); Console.Write("\r\n"); Console.Write(fr[1].ToString() + "数据发送失败"); sw.Close(); sr.Close(); netStream.Close(); } } catch { data = "<html><head><meta http-equiv=content-type content=\"text/html; charset=UTF-8\">数据不存在"; sw.Write(data); sw.Close(); sr.Close(); netStream.Close(); } //MessageBox.Show(data); } //此线程退出时创建新线程 Thread thrd = new Thread(new ThreadStart(ls)); thrd.IsBackground = false; thrd.Start(); }
/// <summary> /// GET /search/request?match=submit/target/@project='home:surfzoid:' /// will show the history of the given ID. /// </summary> /// <param name="ID">Project ID</param> /// <returns> /// A <see cref="StringBuilder"/>The log. /// </returns> /// <example> This sample shows how to call the GetSubmitreqLog method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Search /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(SubmitreqLog.GetSubmitreqLog("8658").ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetSubmitreqLog(string ID) { return(GET.Getit("request/" + ID, VarGlobal.User, VarGlobal.Password)); }
private string LogIn() { return(GET("auth.gettoken", ("api_key", api_key))); }
public API Get(GET mode, out string value) { value = ""; if (deviceHandle == IntPtr.Zero) { return(API.DEVICE_DLLWASNOTLOADED); } API st = API.SUCCESS; if (mode.ToString().Contains("UTF16")) { Types.U16P tmp = new Types.U16P(0); try { operationStatus = Connector.UniDriverGet(deviceHandle, (uint)mode, ref tmp); } catch (Exception ex) { Console.WriteLine(ex.Message); if (ex.Message.Contains("Unable to load DLL")) { return((API)(operationStatus = (uint)API.UNIDRIVER_DLLWASNOTLOADED)); } else { return(API.UNDEFINED); } } st = (API)(operationStatus & MASK_RSH_ERROR); if (st == API.SUCCESS) { value = System.Runtime.InteropServices.Marshal.PtrToStringUni(tmp.data); } } else { Types.S8P tmp = new Types.S8P(0); try { operationStatus = Connector.UniDriverGet(deviceHandle, (uint)mode, ref tmp); } catch (Exception ex) { Console.WriteLine(ex.Message); if (ex.Message.Contains("Unable to load DLL")) { return((API)(operationStatus = (uint)API.UNIDRIVER_DLLWASNOTLOADED)); } else { return(API.UNDEFINED); } } st = (API)(operationStatus & MASK_RSH_ERROR); if (st == API.SUCCESS) { value = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(tmp.data); } } return(st); }
/// <summary> /// /// </summary> /// <param name="Project"> /// A <see cref="System.String"/> /// </param> /// <param name="Package"> /// A <see cref="System.String"/> /// </param> /// <returns> /// A <see cref="StringBuilder"/> /// </returns> public static StringBuilder GetSourceProjectPackageMeta(string Project, string Package) { return(GET.Getit("source/" + Project + "/" + Package + "/_meta", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// Read list of all projects(consume lot of network traffic and time). /// </summary> /// <returns> /// A <see cref="StringBuilder"/>The list of all platform/repository aviables. /// </returns> /// <example> This sample shows how to call the GetProjectsList method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Sources /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(.GetAllProject.GetProjectsList().ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetProjectsList() { return(GET.Getit("source", VarGlobal.User, VarGlobal.Password)); }
public ClientReturn Get(ClientRequest CR) { return(GET.Invoke(instance, new object[] { CR }) as ClientReturn); }
/// <summary> /// GET https://api.opensuse.org/search/request?match=state/@name='Status' and state/@who='rwooninck' /// </summary> /// <param name="User">The user name to request</param> /// <param name="Status">could be : new, delete, revoked, declined and accepted</param> /// <returns></returns> public static StringBuilder GetSubmitreqListByUserName(string User, string Status) { return(GET.Getit("search/request?match=state/@name='" + Status + "' and state/@who='" + User + "'", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// /// </summary> /// <param name="PrjName"> /// A <see cref="System.String"/> /// </param> /// <param name="PkgName"> /// A <see cref="System.String"/> /// </param> /// <param name="FileName"> /// A <see cref="System.String"/> /// </param> /// <returns> /// A <see cref="StringBuilder"/> /// </returns> public static StringBuilder GetSourceProjectPackageFile(string PrjName, string PkgName, string FileName) { return(GET.Getit("source/" + PrjName + "/" + PkgName + "/" + FileName, VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// GET /search/project/id?match=starts-with(@name,'home:surfzoid:') /// Get the wole subproject list who match/start with the project name. /// </summary> /// <param name="Project">Project name(often home: + username)</param> /// <returns> /// A <see cref="StringBuilder"/>The list of all subproject aviables. /// </returns> /// <example> This sample shows how to call the GetSubPrjList method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Search /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(SubProjectList.GetSubProjectList("home:surfzoid").ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetSubProjectList(string Project) { return(GET.Getit("search/project/id?match=starts-with(@name,'" + Project + "')", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// Read meta/XML file/data of the project. /// </summary> /// <returns> /// A <see cref="StringBuilder"/>The meta/XML file/data of the project. /// </returns> /// <example> This sample shows how to call the GetProjectMeta method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Sources /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(GetSourceProjectMeta.GetProjectMeta().ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetProjectMeta() { return(GET.Getit("source/" + VarGlobal.PrefixUserName + "/_meta", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// Get tags by project. /// </summary> /// <returns> /// A <see cref="StringBuilder"/>The tags of project in XML format. /// </returns> /// <example> This sample shows how to call the GetTags method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Tags /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(GetSourceProjectTags.GetTags().ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetTags() { return(GET.Getit("source/" + VarGlobal.PrefixUserName + "/" + VarGlobal.Project + "/_tags", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// GET /build/<project>/<repository>/<arch>/<package>/_status /// Get build status of the specified project/package/repo/arch combination. /// </summary> /// <param name="Repository">repository</param> /// <param name="Arch">Arch (i586, x86_64 ...)</param> /// <param name="Package">Package name</param> /// <returns> /// A <see cref="StringBuilder"/>buildstatus in an XML structure. /// </returns> /// <example> This sample shows how to call the BuildPkgResultStatus method. /// <code> /// using System; /// using MonoOBSFramework.Functions.BuildResults /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(BuildPkgResultStatus.GetBuildPkgResultStatus("mono","i586","MonoOSC").ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetBuildPkgResultStatus(string Repository, string Arch, string Package) { return(GET.Getit("build/" + VarGlobal.PrefixUserName + "/" + Repository + "/" + Arch + "/" + Package + "/_status", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// Read status message from server. /// </summary> /// <returns> /// A <see cref="StringBuilder"/>The result in XML format. /// </returns> /// <example> This sample shows how to call the GetMessage method. /// <code> /// using System; /// using MonoOBSFramework.Functions.Status.Message /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(GetStatus.Message().ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetMessage() { return(GET.Getit("status_message", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// Read user data. /// </summary> /// <param name="UserName"> /// The user name of the person. /// </param> /// <returns> /// A <see cref="StringBuilder"/>The result in XML format. /// </returns> /// <example> This sample shows how to call the GetPersonData method. /// <code> /// using System; /// using MonoOBSFramework.Functions.User.Data /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(GetPerson.GetPersonData("surfzoid").ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetPersonData(string UserName) { return(GET.Getit("person/" + UserName, VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// Return (GET) the XML response of the About command /// </summary> /// <returns> /// A <see cref="StringBuilder"/> /// </returns> /// <example> This sample shows how to call the GetAbout method. /// You will have the same result as this link, use your Novell login infos : /// https://api.opensuse.org/apidocs/about.xml /// <code> /// using System; /// using MonoOBSFramework.Functions.About /// class TestClass /// { /// static int Main() /// { /// if(!VarGlobal.LessVerbose)Console.WriteLine(About.GetAbout().ToString()); /// } /// } /// </code> /// </example> public static StringBuilder GetAbout() { return(GET.Getit("about", VarGlobal.User, VarGlobal.Password)); }
/// <summary> /// /// </summary> /// <param name="UserPrefixName"> /// A <see cref="System.String"/> /// </param> /// <returns> /// A <see cref="StringBuilder"/> /// </returns> public static StringBuilder GetUserPackageList(string UserPrefixName) { return(GET.Getit("source/" + UserPrefixName, VarGlobal.User, VarGlobal.Password)); }