using System; using System.Net; using System.Web.Services; using Microsoft.Win32; using System.Text; using System.Text.RegularExpressions; using System.Collections; using System.IO; namespace gws { public class gwst { [STAThread] static void Main(string[] args) { Microsoft.Win32.RegistryKey _grooveWebServicesRegKey; string _nonce; try { _grooveWebServicesRegKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey ("Software\\Groove Networks, Inc.\\Groove\\WebServices"); _nonce = (string) _grooveWebServicesRegKey.GetValue("WebServicesNonce"); } catch(Exception ex) { Console.WriteLine(ex.Message); throw; } GrooveDiscussion.GrooveDiscussion svc = new GrooveDiscussion.GrooveDiscussion(); svc.GrooveHeaderValue = new GrooveDiscussion.GrooveHeader(); svc.GrooveHeaderValue.GrooveNonce = (string) _nonce; svc.Url = "http://localhost:9080/GWS/Groove/1.0/Discussion/grooveTelespace/ grooveIdentity_58_47_474szupdwwmv3iji774kt5r97mq4nxehpt_64 @6ndv47pf6n88ajmg4mviut2cwr4v242jc854xk2/ToolContainer/ p2zmqfjyecx9dtpd6vsq9w67wdbqf6rq2wyapps.Discussion.Tool/ DiscussionDataModelDelegate"; GrooveDiscussion.DiscussionEntry[] entries = svc.Read(); string svcUrl = svc.Url; foreach(GrooveDiscussion.DiscussionEntry entry in entries) { svc.Url = svcUrl + "/" + entry.ID; Regex r = new Regex(@"[^_](http://[^\s]+)"); MatchCollection mc = Regex.Matches ( entry.Body, r.ToString() ); Console.WriteLine(mc.Count); foreach (Match m in mc) { string url = m.Groups[1].Captures[0].Value; System.Net.WebClient req = new System.Net.WebClient(); Stream res = req.OpenRead (url); StreamReader sr = new StreamReader(res); string page = (sr.ReadToEnd()); res.Close(); Match t = Regex.Match ( page, @"<title>[\s\n]*([^<]+)[\s\n]*", RegexOptions.IgnoreCase); string title = "untitled"; if ( t.Success ) { title = t.Groups[1].Captures[0].Value; } string repl = "_"+url+" ("+title+")_"; Regex r2 = new Regex(url); entry.Body = r2.Replace(entry.Body, repl); GrooveFilesBase64.GrooveFilesBase64 fsvc = new GrooveFilesBase64.GrooveFilesBase64(); fsvc.GrooveHeaderValue = new GrooveFilesBase64.GrooveHeader(); fsvc.GrooveHeaderValue.GrooveNonce = (string) _nonce; fsvc.Url = "http://localhost:9080/GWS/Groove/1.0/Files/grooveTelespace/ grooveIdentity_58_47_474szupdwwmv3iji774kt5r97mq4nxehpt_64 @6ndv47pf6n88ajmg4mviut2cwr4v242jc854xk2/ToolContainer/ e5xnz3xt83rdpgucb8utuuebgx6mkzncgfaiehi.Files.Tool/ DocumentShareEngine"; GrooveFilesBase64.FileDescriptor f = new GrooveFilesBase64.FileDescriptor(); f.FolderID = ""; f.Type = "File"; f.Name = title + ".html"; f.DisplayName = title; System.Text.ASCIIEncoding e = new System.Text.ASCIIEncoding(); byte[] data = e.GetBytes (page); Console.WriteLine( fsvc.Create ( f, data ) ); fsvc.Dispose(); } GrooveDiscussion.DiscussionEntry newEntry = new GrooveDiscussion.DiscussionEntry(); newEntry.Subject = entry.Subject; newEntry.Body = entry.Body; newEntry.ParentID = ""; svc.UpdateEntry (newEntry); } } } }