Exemple #1
0
public void VerifyProxyDefPaths()
{
    const string  gError     = "{0} {1} does not exist here {1}. Remember paths cannot start with / or \\";
    XmlSerializer serializer = new XmlSerializer(typeof(game));
    var           fs         = File.Open(Directory.GetFiles().First(x => x.Name == "definition.xml").FullName, FileMode.Open);
    var           game       = (game)serializer.Deserialize(fs);

    fs.Close();

    var proxyDef = Path.Combine(Directory.FullName, game.proxygen.definitionsrc);

    Dictionary <string, string> blockSources = ProxyDefinition.GetBlockSources(proxyDef);

    foreach (KeyValuePair <string, string> kvi in blockSources)
    {
        string path = Path.Combine(Directory.FullName, kvi.Value);
        if (!File.Exists(path))
        {
            throw new UserMessageException(gError, "Block id: " + kvi.Key, "src: " + kvi.Value, path);
        }
    }

    List <string> templateSources = ProxyDefinition.GetTemplateSources(proxyDef);

    foreach (string source in templateSources)
    {
        string path = Path.Combine(Directory.FullName, source);
        if (!File.Exists(path))
        {
            throw new UserMessageException(gError, "Template", "src: " + source, path);
        }
    }
}
Exemple #2
0
public void VerifyProxyDefPaths()
{
    XmlSerializer serializer = new XmlSerializer(typeof(game));
    var           fs         = File.Open(Directory.GetFiles().First(x => x.Name == "definition.xml").FullName, FileMode.Open);
    var           game       = (game)serializer.Deserialize(fs);

    fs.Close();

    var proxyDef = Path.Combine(Directory.FullName, game.proxygen.definitionsrc);

    Dictionary <string, string> blockSources = ProxyDefinition.GetBlockSources(proxyDef);

    foreach (KeyValuePair <string, string> kvi in blockSources)
    {
        // Check for valid attributes
        if (String.IsNullOrWhiteSpace(kvi.Value))
        {
            throw GenerateEmptyAttributeException("Block", "src", kvi.Key);
        }

        string path = Path.Combine(Directory.FullName, kvi.Value);

        if (!File.Exists(path))
        {
            throw GenerateFileDoesNotExistException("Block id: " + kvi.Key, path, kvi.Value);
        }
    }

    List <string> templateSources = ProxyDefinition.GetTemplateSources(proxyDef);

    foreach (string source in templateSources)
    {
        string path = Path.Combine(Directory.FullName, source);

        if (!File.Exists(path))
        {
            throw GenerateFileDoesNotExistException("Template", path, source);
        }
    }
}
Exemple #3
0
        private bool ValidateTemplatePaths()
        {
            Dictionary <string, string> blockSources = ProxyDefinition.GetBlockSources(proxydefPathTextBox.Text);

            foreach (KeyValuePair <string, string> kvi in blockSources)
            {
                string path = Path.Combine(rootDirTextBox.Text, kvi.Value);
                if (!File.Exists(path))
                {
                    return(false);
                }
            }
            List <string> templateSource = ProxyDefinition.GetTemplateSources(proxydefPathTextBox.Text);

            foreach (string s in templateSource)
            {
                string path = Path.Combine(rootDirTextBox.Text, s);
                if (!File.Exists(path))
                {
                    return(false);
                }
            }
            return(true);
        }