Ejemplo n.º 1
0
 internal void Save(string filePath = "")
 {
     if (filePath == "")
     {
         filePath = Filename;
     }
     XmlSerialiationDeserilation.SaveObjectToXML <SplitsToEvents>(this, filePath);
 }
 internal void SaveConfig()
 {
     try
     {
         XmlSerialiationDeserilation.SaveObjectToXML(_connectionData, Path.Combine(USER_DIRECTORY, USER_FILE));
         MessageBox.Show("Setting were stored in: %APPDATA%\\LiveSplit.TwitchPredictions to prevent accidently sharing login information in case of sharing layouts.", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception e)
     {
         MessageBox.Show("Failed to store config to a file: " + e, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
        internal void GetNewSplits()
        {
            if (!Directory.Exists(SubDir))
            {
                Directory.CreateDirectory(SubDir);
            }

            var Filename = ReplaceIncorrectCharacters(splitStates != null && splitStates.Run != null ? splitStates.Run.GameName + "##" + splitStates.Run.CategoryName : "Unknown");

            var fullPath = Path.Combine(SubDir, Filename + ".xml");

            if (File.Exists(fullPath))
            {
                SplitsToEventsInstance = XmlSerialiationDeserilation.ReadFromXMLFile <SplitsToEvents>(fullPath);
            }
            else
            {
                SplitsToEventsInstance = new SplitsToEvents();
            }

            SplitsToEventsInstance.Filename = fullPath;
        }
 public TwitchConnection()
 {
     _connectionData = XmlSerialiationDeserilation.ReadFromXMLFile <TwitchConnectionData>(Path.Combine(USER_DIRECTORY, USER_FILE));
     twitchRequests  = new TwitchRequests(_connectionData.Channel, _connectionData.Oauth);
 }