Ejemplo n.º 1
0
 public void Setting()
 {
     if (!ProxyViewShow)
     {
         ProxyViewShow = true;
         return;
     }
     else
     {
         ProxyViewShow = false;
         Config.ProxyEnable(ProxyEnable.ToString());
         Config.ProxyHost(ProxyHost);
         Config.ProxyPort(ProxyPort.ToString());
         Config.ProxyUser(ProxyUser);
         Config.ProxyPwd(ProxyPwd);
     }
 }
Ejemplo n.º 2
0
        public async void Login()
        {
            if (ShowKeyView == Visibility.Visible)
            {
                return;
            }

            Errlabel = "";
            if (Username.IsBlank() || Password.IsBlank())
            {
                Errlabel = "Username or password is err!";
                return;
            }
            BtnLoginEnable = false;

            //Proxy
            TidalTool.PROXY = ProxyEnable ? new HttpHelper.ProxyInfo(ProxyHost, ProxyPort, ProxyUser, ProxyPwd) : null;
            Config.ProxyEnable(ProxyEnable.ToString());
            Config.ProxyHost(ProxyHost);
            Config.ProxyPort(ProxyPort.ToString());
            Config.ProxyUser(ProxyUser);
            Config.ProxyPwd(ProxyPwd);

            //Login
            bool bRet = await Task.Run(() => { return(TidalTool.login(Username, Password)); });

            if (!bRet)
            {
                Errlabel       = "Login Err! " + TidalTool.loginErrlabel;
                BtnLoginEnable = true;
                return;
            }

            if (Remember)
            {
                Config.Username(Username);
                Config.Password(Password);
            }
            BtnLoginEnable = true;

            VMMain.VMLogin = this;
            Manager.ShowWindow(VMMain);
            RequestClose();
            return;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 設定をファイルに保存
        /// </summary>
        public static void SaveSetting()
        {
            FileStream    fs     = null;
            XmlTextWriter writer = null;

            try
            {
                fs     = new FileStream(SettingPath, FileMode.Create, FileAccess.Write);
                writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8"));

                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument(true);

                writer.WriteStartElement("Setting");

                writer.WriteStartElement("Header");

                writer.WriteStartElement("Name");
                writer.WriteAttributeString("name", TwitterAwayInfo.ApplicationName);
                writer.WriteEndElement(); // End of Name.
                writer.WriteStartElement("Version");
                writer.WriteAttributeString("version", TwitterAwayInfo.VersionNumber);
                writer.WriteEndElement(); // End of Version.

                writer.WriteStartElement("Date");
                writer.WriteAttributeString("date", DateTime.Now.ToString());
                writer.WriteEndElement(); // End of Date.

                writer.WriteEndElement(); // End of Header.

                writer.WriteStartElement("Content");

                writer.WriteStartElement("User");
                writer.WriteAttributeString("name", UserName);
                writer.WriteAttributeString("password", Password);
                writer.WriteEndElement(); // End of User

                writer.WriteStartElement("CheckList");
                writer.WriteAttributeString("list", CheckList.ToString());
                writer.WriteEndElement(); // End of CheckList

                writer.WriteStartElement("UpdateTimer");
                writer.WriteAttributeString("check", UpdateTimerCheck.ToString());
                writer.WriteAttributeString("millsecond", UpdateTimerMillSecond.ToString());
                writer.WriteEndElement(); // End of UpdateTimer

                writer.WriteStartElement("Proxy");
                writer.WriteAttributeString("use", ProxyUse.ToString());
                writer.WriteAttributeString("server", ProxyServer);
                writer.WriteAttributeString("port", ProxyPort.ToString());
                writer.WriteEndElement(); // End of Porxy

                writer.WriteStartElement("TwitterListViewColumnWidth");
                writer.WriteAttributeString("name", TwitterListViewNameColumnWidth.ToString());
                writer.WriteAttributeString("doing", TwitterListViewDoingColumnWidth.ToString());
                writer.WriteAttributeString("date", TwitterListViewDateColumnWidth.ToString());
                writer.WriteEndElement(); // End of TwitterListViewColumnWidth

                writer.WriteEndElement(); // End of Content.

                writer.WriteEndElement(); // End of Setting.

                writer.WriteEndDocument();
            }
            catch (IOException)
            {
                throw;
            }
            finally
            {
                writer.Close();
                fs.Close();
            }
        }
Ejemplo n.º 4
0
        public Dictionary <string, AttributeValue> GetFields(bool includeKeys = false)
        {
            var fields = new Dictionary <string, AttributeValue>();

            if (includeKeys)
            {
                fields.Add(DEPLOYMENT_ID_PROPERTY_NAME, new AttributeValue(DeploymentId));
                fields.Add(SILO_IDENTITY_PROPERTY_NAME, new AttributeValue(SiloIdentity));
            }

            if (!string.IsNullOrWhiteSpace(Address))
            {
                fields.Add(ADDRESS_PROPERTY_NAME, new AttributeValue(Address));
            }

            fields.Add(PORT_PROPERTY_NAME, new AttributeValue {
                N = Port.ToString()
            });
            fields.Add(GENERATION_PROPERTY_NAME, new AttributeValue {
                N = Generation.ToString()
            });

            if (!string.IsNullOrWhiteSpace(HostName))
            {
                fields.Add(HOSTNAME_PROPERTY_NAME, new AttributeValue(HostName));
            }

            fields.Add(STATUS_PROPERTY_NAME, new AttributeValue {
                N = Status.ToString()
            });
            fields.Add(PROXY_PORT_PROPERTY_NAME, new AttributeValue {
                N = ProxyPort.ToString()
            });

            if (!string.IsNullOrWhiteSpace(SiloName))
            {
                fields.Add(SILO_NAME_PROPERTY_NAME, new AttributeValue(SiloName));
            }

            if (!string.IsNullOrWhiteSpace(SuspectingSilos))
            {
                fields.Add(SUSPECTING_SILOS_PROPERTY_NAME, new AttributeValue(SuspectingSilos));
            }

            if (!string.IsNullOrWhiteSpace(SuspectingTimes))
            {
                fields.Add(SUSPECTING_TIMES_PROPERTY_NAME, new AttributeValue(SuspectingTimes));
            }

            if (!string.IsNullOrWhiteSpace(StartTime))
            {
                fields.Add(START_TIME_PROPERTY_NAME, new AttributeValue(StartTime));
            }

            if (!string.IsNullOrWhiteSpace(IAmAliveTime))
            {
                fields.Add(I_AM_ALIVE_TIME_PROPERTY_NAME, new AttributeValue(IAmAliveTime));
            }

            fields.Add(MEMBERSHIP_VERSION_PROPERTY_NAME, new AttributeValue {
                N = MembershipVersion.ToString()
            });

            fields.Add(ETAG_PROPERTY_NAME, new AttributeValue {
                N = ETag.ToString()
            });
            return(fields);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 設定をファイルに保存
        /// </summary>
        public static void SaveSetting()
        {
            FileStream    fs     = null;
            XmlTextWriter writer = null;

            try
            {
                fs     = new FileStream(SettingPath, FileMode.Create, FileAccess.Write);
                writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8"));

                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument(true);

                writer.WriteStartElement("Setting");

                writer.WriteStartElement("Header");

                writer.WriteStartElement("Name");
                writer.WriteAttributeString("name", PodcasCoInfo.ApplicationName);
                writer.WriteEndElement(); // End of Name.
                writer.WriteStartElement("Version");
                writer.WriteAttributeString("version", PodcasCoInfo.VersionNumber);
                writer.WriteEndElement(); // End of Version.

                writer.WriteStartElement("Date");
                writer.WriteAttributeString("date", DateTime.Now.ToString());
                writer.WriteEndElement(); // End of Date.

                writer.WriteEndElement(); // End of Header.

                writer.WriteStartElement("Content");

                writer.WriteStartElement("StationList");
                foreach (Station station in StationList.GetStationList())
                {
                    writer.WriteStartElement("Station");
                    writer.WriteAttributeString("id", station.Id);
                    writer.WriteAttributeString("name", station.Name);
                    writer.WriteAttributeString("kind", station.Kind.ToString());
                    writer.WriteAttributeString("startupDownload", station.StartupDownload.ToString());
                    writer.WriteAttributeString("startupDownloadNum", station.StartupDownloadNum.ToString());
                    writer.WriteAttributeString("startupDelete", station.StartupDelete.ToString());
                    writer.WriteAttributeString("startupDeleteRemainDay", station.StartupDeleteRemainDay.ToString());
                    writer.WriteEndElement(); // End of Station
                }
                writer.WriteEndElement();     // End of StationList

                writer.WriteStartElement("PodcastClipDirectoryPath");
                writer.WriteAttributeString("path", PodcastClipDirectoryPath);
                writer.WriteEndElement(); // End of PodcastClipDirectoryPath

                writer.WriteStartElement("MediaPlayerPath");
                writer.WriteAttributeString("path", MediaPlayerPath);
                writer.WriteEndElement(); // End of MediaPlayerPath

                writer.WriteStartElement("BrowserPath");
                writer.WriteAttributeString("path", BrowserPath);
                writer.WriteEndElement(); // End of BrowserPath

                writer.WriteStartElement("Proxy");
                writer.WriteAttributeString("use", ProxyUse.ToString());
                writer.WriteAttributeString("server", ProxyServer);
                writer.WriteAttributeString("port", ProxyPort.ToString());
                writer.WriteEndElement(); // End of Porxy

                writer.WriteStartElement("ChannelSort");
                writer.WriteAttributeString("sort", ChannelSort.ToString());
                writer.WriteEndElement(); // End of ChannelSort

                writer.WriteEndElement(); // End of Content.

                writer.WriteEndElement(); // End of Setting.

                writer.WriteEndDocument();
            }
            finally
            {
                writer.Close();
                fs.Close();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 設定をファイルに保存
        /// </summary>
        public static void SaveSetting()
        {
            FileStream    fs     = null;
            XmlTextWriter writer = null;

            try
            {
                fs     = new FileStream(SettingPath, FileMode.Create, FileAccess.Write);
                writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8"));

                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument(true);

                writer.WriteStartElement("Setting");

                writer.WriteStartElement("Header");

                writer.WriteStartElement("Name");
                writer.WriteAttributeString("name", PocketLadioInfo.ApplicationName);
                writer.WriteEndElement(); // End of Name.
                writer.WriteStartElement("Version");
                writer.WriteAttributeString("version", PocketLadioInfo.VersionNumber);
                writer.WriteEndElement(); // End of Version.

                writer.WriteStartElement("Date");
                writer.WriteAttributeString("date", DateTime.Now.ToString());
                writer.WriteEndElement(); // End of Date.

                writer.WriteEndElement(); // End of Header.

                writer.WriteStartElement("Content");

                writer.WriteStartElement("StationList");
                foreach (Station station in StationList.GetStationList())
                {
                    writer.WriteStartElement("Station");
                    writer.WriteAttributeString("id", station.Id);
                    writer.WriteAttributeString("name", station.Name);
                    writer.WriteAttributeString("kind", station.Kind.ToString());
                    writer.WriteEndElement(); // End of Station
                }
                writer.WriteEndElement();     // End of StationList

                writer.WriteStartElement("FilterEnable");
                writer.WriteAttributeString("enable", FilterEnable.ToString());
                writer.WriteEndElement(); // End of FilterEnable

                writer.WriteStartElement("HeadlineTimer");
                writer.WriteAttributeString("check", HeadlineTimerCheck.ToString());
                writer.WriteAttributeString("millsecond", HeadlineTimerMillSecond.ToString());
                writer.WriteEndElement(); // End of HeadlineTimer

                writer.WriteStartElement("MediaPlayerPath");
                writer.WriteAttributeString("path", MediaPlayerPath);
                writer.WriteEndElement(); // End of MediaPlayerPath

                writer.WriteStartElement("BrowserPath");
                writer.WriteAttributeString("path", BrowserPath);
                writer.WriteEndElement(); // End of BrowserPath

                writer.WriteStartElement("PlayListSave");
                writer.WriteAttributeString("save", PlayListSave.ToString());
                writer.WriteEndElement(); // End of PlayListSave

                writer.WriteStartElement("HeadlineListBoxFont");
                writer.WriteAttributeString("change", HeadlineListBoxFontSizeChange.ToString());
                writer.WriteAttributeString("size", HeadlineListBoxFontSize.ToString());
                writer.WriteEndElement(); // End of HeadlineListBoxFont

                writer.WriteStartElement("Proxy");
                writer.WriteAttributeString("use", ProxyUse.ToString());
                writer.WriteAttributeString("server", ProxyServer);
                writer.WriteAttributeString("port", ProxyPort.ToString());
                writer.WriteEndElement(); // End of Porxy

                writer.WriteEndElement(); // End of Content.

                writer.WriteEndElement(); // End of Setting.

                writer.WriteEndDocument();
            }
            finally
            {
                writer.Close();
                fs.Close();
            }
        }