Exemplo n.º 1
0
        public override string Update(string status, string in_reply_to_status_id, UserLocation location, OutputFormatType format)
        {
            return null;
            //            if (this.PlaceID != null)

                /*string url = string.Format("http://brightkite.com/places/{0}/notes", this.PlaceID);
                string data = string.Format("note[body]={0}", System.Web.HttpUtility.UrlEncode(status));
                return ExecutePostCommand(url, data);*/
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存時の設定に戻します。
        /// </summary>
        private void RevertToSavedSettings()
        {
            var settings = Serialization.Settings.Output;

            this.OutputMethodType      = settings.OutputMethodType;
            this.OutputFolder          = settings.OutputFolder;
            this.IsAutoSaveImage       = settings.IsAutoSaveImage;
            this.OutputFileNamePattern = settings.OutputFileNamePattern;
            this.OutputFormatType      = settings.OutputFormatType;
        }
Exemplo n.º 3
0
 public TemplateConfig GetTemplate(OutputFormatType format)
 {
     foreach (var config in templateConfigs)
     {
         if (config.formatType == format)
         {
             return(config);
         }
     }
     return(null);
 }
Exemplo n.º 4
0
 public bool HasTemplate(OutputFormatType format)
 {
     foreach (var config in templateConfigs)
     {
         if (config.formatType == format)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
        public string GetFeatured(string userName, string password, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
            {
                throw new ArgumentException("GetFeatured supports only XML and JSON output format", "format");
            }

            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Featured), GetFormatTypeString(format));

            return(ExecuteGetCommand(url, userName, password));
        }
Exemplo n.º 6
0
        public string Show(string userName, string password, string IDorScreenName, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
            {
                throw new ArgumentException("Show supports only XML and JSON output format", "format");
            }

            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Users), GetActionTypeString(ActionType.Show) + "/" + IDorScreenName, GetFormatTypeString(format));

            return(ExecuteGetCommand(url, userName, password));
        }
Exemplo n.º 7
0
        public override string Update(string status, string in_reply_to_status_id, UserLocation location, OutputFormatType format)
        {
            string url = "http://api.ping.fm/v1/user.post";
            //string data = string.Format("user_app_key={0}&api_key={1}&post_method=microblog&body={2}", this.AccountInfo.UserName,this.AccountInfo.Password,HttpUtility.UrlEncode(status));
            string data = string.Format("user_app_key={0}&api_key={1}&post_method=default&body={2}", this.AccountInfo.UserName, this.AccountInfo.Password, System.Web.HttpUtility.UrlEncode(status));

            if (location != null)
            {
                data += "&location=" + location.ToString();
            }
            return ExecutePostCommand(url, data);
        }
Exemplo n.º 8
0
        public String Update(String userName, String password, String status, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
            {
                throw new ArgumentException("Update support only XML and JSON output format", "format");
            }

            String url  = String.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Update), GetFormatTypeString(format));
            String data = String.Format("status={0}", HttpUtility.UrlEncode(status));

            return(ExecutePostCommand(url, userName, password, data));
        }
Exemplo n.º 9
0
        public string OutputFormatType2String(OutputFormatType output)
        {
            switch (output)
            {
            case OutputFormatType.Second:
                return("ss");

            case OutputFormatType.Minute:
                return("mm");

            case OutputFormatType.ShortHour:
                return("hh");

            case OutputFormatType.LongHour:
                return("HH");

            case OutputFormatType.Day:
                return("dd");

            case OutputFormatType.ShortWeek:
                return("w");

            case OutputFormatType.LongWeek:
                return("ww");

            case OutputFormatType.ShortMonth:
                return("MM");

            case OutputFormatType.MidMonth:
                return("MMM");

            case OutputFormatType.LongMonth:
                return("MMMM");

            case OutputFormatType.ShortYear:
                return("yy");

            case OutputFormatType.LongYear:
                return("yyyy");

            case OutputFormatType.MonthDayYearSlash:
                return("MM/dd/yyyy");

            case OutputFormatType.YearMonthDayDash:
                return("yyyy-MM-dd");

            case OutputFormatType.ShortMonthDaySlash:
                return("M/d");

            default:
                return(string.Empty);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 出力形式をイメージファイルの形式ーに変換します。
        /// </summary>
        /// <param name="type">出力形式</param>
        /// <returns>イメージファイルの形式</returns>
        public static ImageFormat ToImageFormat(this OutputFormatType type)
        {
            switch (type)
            {
            case OutputFormatType.Bmp: return(ImageFormat.Bmp);

            case OutputFormatType.Jpg: return(ImageFormat.Jpeg);

            case OutputFormatType.Png: return(ImageFormat.Png);

            case OutputFormatType.Gif: return(ImageFormat.Gif);
            }
            throw new ArgumentException(nameof(type));
        }
Exemplo n.º 11
0
        /// <summary>
        /// キャプチャ画像を保存します。
        /// </summary>
        /// <param name="bitmap">画像</param>
        public static void SaveCaptureImage(this Bitmap bitmap)
        {
            // 出力形式とファイルパスの設定
            var settings = Settings.Output;
            OutputFormatType outputFormatType = settings.OutputFormatType;
            string           fileExtension    = outputFormatType.GetExtension();
            string           fileName         = FileHelper.CreateFileName(settings.OutputFolder, fileExtension, settings.OutputFileNamePattern);
            string           filePath         = fileName + fileExtension;

            if (!string.IsNullOrEmpty(settings.OutputFolder))
            {
                filePath = Path.Combine(settings.OutputFolder, filePath);
            }

            // 自動保存の場合
            if (settings.IsAutoSaveImage)
            {
                // 出力フォルダがない場合は作成する
                if (!Directory.Exists(settings.OutputFolder))
                {
                    Directory.CreateDirectory(settings.OutputFolder);
                }
            }
            else
            {
                // ファイルの保存場所を選択する
                using (var dialog = new System.Windows.Forms.SaveFileDialog()
                {
                    Filter = Resources.Services_SaveImageFileDialog_Filter,
                    InitialDirectory = settings.OutputFolder,
                    FilterIndex = (int)outputFormatType + 1,
                    Title = Resources.Services_SaveImageFileDialog_Title,
                    FileName = Path.GetFileName(fileName)
                })
                {
                    if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        return;
                    }
                    filePath         = dialog.FileName;
                    outputFormatType = (OutputFormatType)dialog.FilterIndex;
                }
            }

            // 画像ファイルに保存
            bitmap.Save(filePath, outputFormatType.ToImageFormat());
        }
Exemplo n.º 12
0
        public String Update(String userName, String password, String status, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
            {
                throw new ArgumentException("Update support only XML and JSON output format", "format");
            }

            String url  = String.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Update), GetFormatTypeString(format));
            String data = String.Format("status={0}", HttpUtility.UrlEncode(status));

            var oldValue = ServicePointManager.Expect100Continue;

            ServicePointManager.Expect100Continue = false;
            var result = ExecutePostCommand(url, userName, password, data);

            ServicePointManager.Expect100Continue = oldValue;
            return(result);
        }
Exemplo n.º 13
0
        public XmlDocument GetFriendsTimelineAsXML(string userName, string password, OutputFormatType format)
        {
            if (format == OutputFormatType.JSON)
            {
                throw new ArgumentException("GetFriendsTimelineAsXML supports only XML based formats (XML, RSS, Atom)", "format");
            }

            string output = GetFriendsTimeline(userName, password, format);

            if (!string.IsNullOrEmpty(output))
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(output);

                return(xmlDocument);
            }

            return(null);
        }
Exemplo n.º 14
0
 public static void DumpObjectToOutput(object obj, OutputFormatType formatType)
 {
     if (formatType == OutputFormatType.User)
     {
         var dump = ObjectDumper.Dump(obj, 4);
         Console.Out.Write(dump);
     }
     else if (formatType == OutputFormatType.JSON)
     {
         var json = JsonConvert.SerializeObject(obj, Formatting.Indented);
         Console.Out.Write(json);
     }
     else if (formatType == OutputFormatType.YAML)
     {
         var yaml = new YamlDotNet.Serialization.Serializer();
         var json = yaml.Serialize(obj);
         Console.Out.Write(json);
     }
 }
Exemplo n.º 15
0
        internal List <string> GetWMIPropertiesOfInstance(OutputFormatType format)
        {
            var result = new List <string>();

            var className     = ConfigManager.GetInstance().WMIClassName;
            var classInstance = ConfigManager.GetInstance().WMIInstanceName;
            var provider      = ConfigManager.GetInstance().SelectedProvider;

            var wmiInstance = GetManagementBaseObject(provider, className, classInstance);

            var props = ConfigManager.GetInstance().WMIFilterProperties;

            if (props.Count == 1 && props[0] == ConfigManager.AllWMIProperties)
            {
                props = GetAllWMIPropertyNamesOfInstance();
            }

            switch (format)
            {
            case OutputFormatType.GUIDetailFormat:
                result.AddRange(props.Select(prop => prop + DetailSeparator + wmiInstance[prop]));
                break;

            case OutputFormatType.CSVFormat:
                var propsString = String.Join(CSVSeparator.ToString(CultureInfo.InvariantCulture), props.Select(prop => wmiInstance[prop]));
                result.Add(propsString);
                break;

            case OutputFormatType.XMLFormat:
                var tmp = "<WMIObject " + String.Join(" ", props.Select(prop => prop + "=" + "\"" + wmiInstance[prop] + "\"")) + "/>";
                result.Add(tmp);
                break;
            }

            return(result);
        }
Exemplo n.º 16
0
 /// <summary>
 /// 出力形式の拡張子を取得します。
 /// </summary>
 /// <param name="type">出力形式</param>
 /// <returns>拡張子</returns>
 public static string GetExtension(this OutputFormatType type)
 {
     return("." + type.ToString().ToLower());
 }
Exemplo n.º 17
0
        public static string OutputFormatType2String(OutputFormatType output)
        {
            switch (output)
            {
            case OutputFormatType.Second:
                return("ss");

            case OutputFormatType.Minute:
                return("mm");

            case OutputFormatType.ShortHour:
                return("hh");

            case OutputFormatType.LongHour:
                return("HH");

            case OutputFormatType.Day:
                return("dd");

            case OutputFormatType.ShortWeek:
                return("w");

            case OutputFormatType.LongWeek:
                return("ww");

            case OutputFormatType.ShortMonth:
                return("MM");

            case OutputFormatType.MidMonth:
                return("MMM");

            case OutputFormatType.LongMonth:
                return("MMMM");

            case OutputFormatType.ShortYear:
                return("yy");

            case OutputFormatType.LongYear:
                return("yyyy");

            case OutputFormatType.MonthDayYearSlash:
                return("MM/dd/yyyy");

            case OutputFormatType.YearMonthDayDash:
                return("yyyy-MM-dd");

            case OutputFormatType.ShortMonthDaySlash:
                return("M/d");

            case OutputFormatType.Currency:
                return("C");

            case OutputFormatType.Deciaml:
                return("D");

            case OutputFormatType.Exponential:
                return("E");

            case OutputFormatType.FixedPoint:
                return("F");

            case OutputFormatType.General:
                return("G");

            case OutputFormatType.Hexadecimal:
                return("X");

            case OutputFormatType.Number:
                return("N");

            case OutputFormatType.Percent:
                return("P");

            case OutputFormatType.RoundTrip:
                return("R");

            default:
                return(string.Empty);
            }
        }
Exemplo n.º 18
0
 public XmlDocument GetUserTimelineAsXML(string userName, string password, OutputFormatType format)
 {
     return(GetUserTimelineAsXML(userName, password, null, format));
 }
Exemplo n.º 19
0
        public string GetUserTimeline(string userName, string password, string IDorScreenName, OutputFormatType format)
        {
            string url = null;

            if (string.IsNullOrEmpty(IDorScreenName))
            {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.User_Timeline), GetFormatTypeString(format));
            }
            else
            {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.User_Timeline) + "/" + IDorScreenName, GetFormatTypeString(format));
            }

            return(ExecuteGetCommand(url, userName, password));
        }
Exemplo n.º 20
0
 protected string GetFormatTypeString(OutputFormatType format)
 {
     return(format.ToString().ToLower());
 }
Exemplo n.º 21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="docBinary"></param>
        /// <param name="docType"></param>
        /// <param name="outputType"></param>
        /// <returns></returns>
        private byte[] RenderPowerPoint(byte[] docBinary, DocumentType docType, OutputFormatType outputType)
        {
            Application  powerPointApp   = null;
            Presentation powerPointPreso = null;

            Guid workingDocID = Guid.NewGuid();

            string inputFileNameAndPath  = String.Format(@"{0}\{1}.{2}", Global.WorkingDirectory, workingDocID, Enum.GetName(typeof(DocumentType), docType).ToLower());
            string outputFileNameAndPath = String.Format(@"{0}\{1}.pdf", Global.WorkingDirectory, workingDocID);

            try
            {
                File.WriteAllBytes(inputFileNameAndPath, docBinary);

                lock (Global.powerPointProc)
                {
                    powerPointApp = Activator.CreateInstance(Type.GetTypeFromProgID(Global.PowerPointApplicationProgID)) as ApplicationClass;

                    powerPointPreso = powerPointApp.Presentations.Open2007(inputFileNameAndPath, MsoTriState.msoTrue);
                    powerPointPreso.ExportAsFixedFormat(outputFileNameAndPath, PpFixedFormatType.ppFixedFormatTypePDF);
                }

                byte[] outputBinary = File.ReadAllBytes(outputFileNameAndPath);
                return(outputBinary);
            }
            catch (Exception e)
            {
                Trace.WriteLine(String.Format(
                                    "{0}",
                                    e.Message),
                                TraceCategory.Exceptions);

                throw e;
            }
            finally
            {
                if (powerPointPreso != null)
                {
                    powerPointPreso.Close();
                    powerPointPreso = null;
                }

                if (powerPointApp != null)
                {
                    //powerPointApp.Quit();
                    powerPointApp = null;
                }

                try
                {
                    Thread purgeThread = new Thread(new ThreadStart(delegate
                    {
                        File.Delete(inputFileNameAndPath);
                        File.Delete(outputFileNameAndPath);
                    }));
                    purgeThread.Start();
                }
                catch (Exception e)
                {
                    Trace.WriteLine(String.Format(
                                        "Unable to delete scratch files; Message: \"{0}\".",
                                        e.Message),
                                    TraceCategory.Exceptions);
                }
            }
        }
Exemplo n.º 22
0
 public string SendDirectMessage(string userID, string message, OutputFormatType format)
 {
     return SendDirectMessage(userID, message, null, format);
 }
Exemplo n.º 23
0
        public string Retweet_Status(string status_id, OutputFormatType format)
        {

            if (this.AccountInfo.ServerURL.ServerType == TwitterServer.pingfm)
            {
                return null;
            }
            else if (this.AccountInfo.ServerURL.ServerType == TwitterServer.brightkite)
            {
                return null;
            }
            else
            {
                if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
                {
                    throw new ArgumentException("Update support only XML and JSON output format", "format");
                }

                string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Retweet) + "/{0}", GetFormatTypeString(format), AccountInfo.ServerURL.URL);
                url = String.Format(url, status_id);
                return ExecutePostCommand(url, null);
            }
        }
Exemplo n.º 24
0
        public List <string> GetWMIPropertiesOfInstance(string serverName, string className, string classInstance, OutputFormatType format)
        {
            var result   = new List <string>();
            var provider = ConfigManager.GetInstance().GetProviderByName(serverName);

            if (provider == null)
            {
                throw new ConfigException("Provider (server name) not found in config file: " + serverName);
            }

            var wmiInstance = GetManagementBaseObject(provider, className, classInstance);

            var props = ConfigManager.GetInstance().WMIProperties;

            switch (format)
            {
            case OutputFormatType.GUIDetailFormat:
                result.AddRange(props.Select(prop => prop + DetailSeparator + wmiInstance[prop]));
                break;

            case OutputFormatType.CSVFormat:
                var propsString = String.Join(";", props.Select(prop => wmiInstance[prop]));
                result.Add(propsString);
                break;

            case OutputFormatType.XMLFormat:
                var tmp = "<WMIObject " + String.Join(" ", props.Select(prop => prop + "=" + "\"" + wmiInstance[prop] + "\"")) + "/>";
                result.Add(tmp);
                break;
            }

            return(result);
        }
Exemplo n.º 25
0
 private String GetFormatTypeString(OutputFormatType format)
 {
     return format.ToString().ToLower();
 }
Exemplo n.º 26
0
        public string GetFriends(string IDorScreenName, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
            {
                throw new ArgumentException("GetFriends support only XML and JSON output format", "format");
            }

            string url = null;
            if (string.IsNullOrEmpty(IDorScreenName))
            {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends), GetFormatTypeString(format), AccountInfo.ServerURL.URL);
            }
            else
            {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends) + "/" + IDorScreenName, GetFormatTypeString(format), AccountInfo.ServerURL.URL);
            }

            return ExecuteGetCommand(url);
        }
Exemplo n.º 27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="docBinary"></param>
 /// <param name="docType"></param>
 /// <param name="outputType"></param>
 /// <returns></returns>
 private byte[] RenderWordDocument(byte[] docBinary, DocumentType docType, OutputFormatType outputType)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 28
0
 public string SendDirectMessage(string userID, string message, string in_reply_to_id, OutputFormatType format)
 {
     string url = string.Format(TwitterBaseUrlFormat, 
         GetActionTypeString(ActionType.Direct_Messages), GetActionTypeString(ActionType.New), 
         GetFormatTypeString(format), AccountInfo.ServerURL.URL);
     string data = string.Format("user={0}&text={1}", 
         HttpUtility.UrlEncode(userID), HttpUtility.UrlEncode(message));
     if (!string.IsNullOrEmpty(in_reply_to_id))
         data = data + "&in_reply_to_id=" + in_reply_to_id;
     return ExecutePostCommand(url, data);
 }
Exemplo n.º 29
0
        public string Update(string userName, string password, string status, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML) {
                throw new ArgumentException("Update support only XML and JSON output format", "format");
            }

            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Update), GetFormatTypeString(format));
            string data = string.Format("status={0}", HttpUtility.UrlEncode(status));

            return ExecutePostCommand(url, userName, password, data);
        }
Exemplo n.º 30
0
 public string Update(string status, OutputFormatType format)
 {
     return Update(status, null, format);
 }
Exemplo n.º 31
0
        public string GetPublicTimeline(OutputFormatType format)
        {
            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Public_Timeline), GetFormatTypeString(format));

            return(ExecuteGetCommand(url, null, null));
        }
Exemplo n.º 32
0
        public string Show(string IDorScreenName, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
            {
                throw new ArgumentException("Show supports only XML and JSON output format", "format");
            }

            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Users), GetActionTypeString(ActionType.Show) + "/" + IDorScreenName, GetFormatTypeString(format), AccountInfo.ServerURL.URL);
            return ExecuteAnonymousGetCommand(url);
        }
Exemplo n.º 33
0
 public string GetUserTimeline(string userName, string password, OutputFormatType format)
 {
     return(GetUserTimeline(userName, password, null, format));
 }
Exemplo n.º 34
0
        public string GetUserTimeline(string IDorScreenName, OutputFormatType format)
        {
            string url = null;
            if (string.IsNullOrEmpty(IDorScreenName))
            {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.User_Timeline), GetFormatTypeString(format), AccountInfo.ServerURL.URL);
            }
            else
            {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.User_Timeline) + "/" + IDorScreenName, GetFormatTypeString(format), AccountInfo.ServerURL.URL);
            }

            return ExecuteGetCommand(url);
        }
Exemplo n.º 35
0
        public string GetFriendsTimeline(string userName, string password, OutputFormatType format)
        {
            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends_Timeline), GetFormatTypeString(format));

            return(ExecuteGetCommand(url, userName, password));
        }
Exemplo n.º 36
0
 public XmlDocument GetUserTimelineAsXML(OutputFormatType format)
 {
     return GetUserTimelineAsXML(null, format);
 }
Exemplo n.º 37
0
        public string GetFriends(string userName, string password, string IDorScreenName, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
            {
                throw new ArgumentException("GetFriends support only XML and JSON output format", "format");
            }

            string url = null;

            if (string.IsNullOrEmpty(IDorScreenName))
            {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends), GetFormatTypeString(format));
            }
            else
            {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends) + "/" + IDorScreenName, GetFormatTypeString(format));
            }

            return(ExecuteGetCommand(url, userName, password));
        }
Exemplo n.º 38
0
 public string GetFriendsTimeLineSince(OutputFormatType format, string SinceID)
 {
     string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends_Timeline), GetFormatTypeString(format), AccountInfo.ServerURL.URL) + "?since_id=" + SinceID + "&count=" + ClientSettings.MaxTweets;
     return ExecuteGetCommand(url);
 }
Exemplo n.º 39
0
        public XmlDocument GetFriendsTimelineAsXML(OutputFormatType format)
        {
            if (format == OutputFormatType.JSON)
            {
                throw new ArgumentException("GetFriendsTimelineAsXML supports only XML based formats (XML, RSS, Atom)", "format");
            }

            string output = GetFriendsTimeline(format);
            if (!string.IsNullOrEmpty(output))
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(output);

                return xmlDocument;
            }

            return null;
        }
Exemplo n.º 40
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="docBinary"></param>
 /// <param name="docType"></param>
 /// <param name="outputType"></param>
 /// <returns></returns>
 private byte[] RenderWordDocument(byte[] docBinary, DocumentType docType, OutputFormatType outputType)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 41
0
        public string Update(string status, string in_reply_to_status_id, OutputFormatType format)
        {
            
            if (this.AccountInfo.ServerURL.ServerType == TwitterServer.pingfm)
            {
                string url = "http://api.ping.fm/v1/user.post";
                //string data = string.Format("user_app_key={0}&api_key={1}&post_method=microblog&body={2}", this.AccountInfo.UserName,this.AccountInfo.Password,HttpUtility.UrlEncode(status));
                string data = string.Format("user_app_key={0}&api_key={1}&post_method=default&body={2}", this.AccountInfo.UserName, this.AccountInfo.Password, HttpUtility.UrlEncode(status));
                
                return ExecutePostCommand(url, data);
            }
            else if (this.AccountInfo.ServerURL.ServerType == TwitterServer.brightkite)
            {
                if (this.PlaceID != null)
                {
                    string url = string.Format("http://brightkite.com/places/{0}/notes", this.PlaceID);
                    string data = string.Format("note[body]={0}", HttpUtility.UrlEncode(status));
                    return ExecutePostCommand(url, data);
                }
                else
                {
                    return null;
                }
            }
            else
            {
                if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
                {
                    throw new ArgumentException("Update support only XML and JSON output format", "format");
                }

                string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Update), GetFormatTypeString(format), AccountInfo.ServerURL.URL);
                string data = string.Format("status={0}", HttpUtility.UrlEncode(status));
                if (!string.IsNullOrEmpty(in_reply_to_status_id))
                {
                    data = data + "&in_reply_to_status_id=" + in_reply_to_status_id;
                }
                return ExecutePostCommand(url, data);
            }
        }
Exemplo n.º 42
0
        public string GetFriends(string userName, string password, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML) {
                throw new ArgumentException("GetFriends support only XML and JSON output format", "format");
            }

            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends), GetFormatTypeString(format));
            return ExecuteGetCommand(url, userName, password);
        }
Exemplo n.º 43
0
 protected string GetFormatTypeString(OutputFormatType format)
 {
     return format.ToString().ToLower();
 }
Exemplo n.º 44
0
 public string GetFriendsTimeline(string userName, string password, OutputFormatType format)
 {
     string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends_Timeline), GetFormatTypeString(format));
     url += "?count=200";
     return ExecuteGetCommand(url, userName, password);
 }
Exemplo n.º 45
0
 public string GetUserTimeline(OutputFormatType format)
 {
     return GetUserTimeline(null, format);
 }
Exemplo n.º 46
0
 public string GetPublicTimeline(OutputFormatType format)
 {
     string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Public_Timeline), GetFormatTypeString(format));
     return ExecuteGetCommand(url, null, null);
 }
Exemplo n.º 47
0
 public string GetFriendsTimeLineMax(OutputFormatType format)
 {
     string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends_Timeline), GetFormatTypeString(format), AccountInfo.ServerURL.URL)+"?count="+MaxTweets;
     return ExecuteGetCommand(url);
 }
Exemplo n.º 48
0
        public string GetUserTimeline(string userName, string password, string IDorScreenName, OutputFormatType format)
        {
            string url = null;
            if (string.IsNullOrEmpty(IDorScreenName)) {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.User_Timeline), GetFormatTypeString(format));
            }
            else {
                url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.User_Timeline) + "/" + IDorScreenName, GetFormatTypeString(format));
            }

            return ExecuteGetCommand(url, userName, password);
        }
Exemplo n.º 49
0
 public string GetFriendsTimeline(OutputFormatType format)
 {
     if (this.AccountInfo.ServerURL.ServerType == TwitterServer.brightkite)
     {
         string url = "http://brightkite.com/me/friendstream.xml";
         return ExecuteGetCommand(url);
     }
     else
     {
         string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Friends_Timeline), GetFormatTypeString(format), AccountInfo.ServerURL.URL);
         return ExecuteGetCommand(url);
     }
 }
Exemplo n.º 50
0
 public string GetUserTimeline(string userName, string password, OutputFormatType format)
 {
     return GetUserTimeline(userName, password, null, format);
 }
Exemplo n.º 51
0
 public string GetRepliesTimeLine(OutputFormatType format)
 {
     string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Replies), GetFormatTypeString(format), AccountInfo.ServerURL.URL);
     return ExecuteGetCommand(url);
 }
Exemplo n.º 52
0
        public XmlDocument GetUserTimelineAsXML(string userName, string password, string IDorScreenName, OutputFormatType format)
        {
            if (format == OutputFormatType.JSON) {
                throw new ArgumentException("GetUserTimelineAsXML supports only XML based formats (XML, RSS, Atom)", "format");
            }

            string output = GetUserTimeline(userName, password, IDorScreenName, format);
            if (!string.IsNullOrEmpty(output)) {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(output);

                return xmlDocument;
            }

            return null;
        }
Exemplo n.º 53
0
        public string GetFollowers(OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML)
            {
                throw new ArgumentException("GetFollowers supports only XML and JSON output format", "format");
            }

            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Statuses), GetActionTypeString(ActionType.Followers), GetFormatTypeString(format), AccountInfo.ServerURL.URL);
            return ExecuteGetCommand(url);
        }
Exemplo n.º 54
0
 public XmlDocument GetUserTimelineAsXML(string userName, string password, OutputFormatType format)
 {
     return GetUserTimelineAsXML(userName, password, null, format);
 }
Exemplo n.º 55
0
 private String GetFormatTypeString(OutputFormatType format)
 {
     return(format.ToString().ToLower());
 }
Exemplo n.º 56
0
        public string Show(string userName, string password, string IDorScreenName, OutputFormatType format)
        {
            if (format != OutputFormatType.JSON && format != OutputFormatType.XML) {
                throw new ArgumentException("Show supports only XML and JSON output format", "format");
            }

            string url = string.Format(TwitterBaseUrlFormat, GetObjectTypeString(ObjectType.Users), GetActionTypeString(ActionType.Show) + "/" + IDorScreenName, GetFormatTypeString(format));
            return ExecuteGetCommand(url, userName, password);
        }