Jump to content
Ketarin forum

Other Location Update Check?


a2855158
 Share

Recommended Posts

  • 2 weeks later...
  • 11 months later...

Any news? Can do you make it? 

Sorry my English,  I'm sorry I can not express myself. I want to Ketarin will check file version in downloaded folder(this folder is specific, I mean each software in each paths) and check new version to website. 

 

I say again.

 

 I mean I have D:\software\archive\winrar 5.1.rar (My files are .rar extension) and ketarin will check file version name for update? Not only winrar, for ~50 software

So compare file version in folder and version in website.

 

DirectoryInfo di = new DirectoryInfo("D:\software\archive\");

FileInfo[] files = di.GetFiles("winr*");
foreach (FileInfo fi in files)
{
           MessageBox.Show(fi.Name);
}
 
This code can take file version in folder but just I can do before downloading. I can't fi.name to current column. 
 
Please help me! If you know Turkish people (can speak English and create template)  in forum, I can talk about it.
Link to comment
Share on other sites

  • 3 weeks later...

 

You can use a pre-download script to determine if the file exists and then cancel the download if it's already there. Something like this should work:

if exist "D:\software\archive\{url:basefile}.{url:ext}" exit 2

Thank you, it works :) 

 

So, Can you make it new column for me? This column will "old version" in folder. I mean, when i check update for "example 1.23", appear 1.23 in column name "old version"

 

Example this topic: https://ketarin.org/forum/topic/812-relative-paths-on-download-location/?p=6172

I want to current column.

 

I say again, sorry my English. I be rude unconsciously. :(

Link to comment
Share on other sites

It sounds like what you're actually trying to do is create an offline archive of multiple versions, and your method of doing so is to test the filename and version number.

 

Don't do that.

 

The better option is to simply UNCHECK the "always delete previously downloaded file" option from the bottom of the "advanced settings" page. If you use an output filename such as this you'll be able to have versioned copies stored for each release:

 

D:\software\archive\{url:basefile}-{version}.{url:ext}
Link to comment
Share on other sites

 

It sounds like what you're actually trying to do is create an offline archive of multiple versions, and your method of doing so is to test the filename and version number.

 

Don't do that.

 

The better option is to simply UNCHECK the "always delete previously downloaded file" option from the bottom of the "advanced settings" page. If you use an output filename such as this you'll be able to have versioned copies stored for each release:

D:\software\archive\{url:basefile}-{version}.{url:ext}

No, I don't want to create an offline archive of multiple versions, only I want to see old version in my software folder. And I just compare new version and old version.You are right, I create offline archive but I want to only create new version archive not multiple. I request current column only. So, how can i do it?

Link to comment
Share on other sites

If you only want one version, enable "always delete previously downloaded file" option from the bottom of the "advanced settings" page and ensure that the "use the following variable as indicator for changes" represents an appropriate value (such as version). If you just want to display the old version number then that's a problem. Either {VariableChangeIndicatorLastContent} or {property:VariableChangeIndicatorLastContent} *should* work, but they don't. I guess theoretically you could write it out to a file in post-update and then read it back in during pre-update, but that's going to be unpredictable.

Link to comment
Share on other sites

If you only want one version, enable "always delete previously downloaded file" option from the bottom of the "advanced settings" page and ensure that the "use the following variable as indicator for changes" represents an appropriate value (such as version). If you just want to display the old version number then that's a problem. Either {VariableChangeIndicatorLastContent} or {property:VariableChangeIndicatorLastContent} *should* work, but they don't. I guess theoretically you could write it out to a file in post-update and then read it back in during pre-update, but that's going to be unpredictable.

I just want to see current version coulumn for my software folder. 

https://ketarin.org/forum/topic/812-relative-paths-on-download-location/page-2#entry6172 >>> Current column is as I wanted. Ketarin will take version in soft. folder. Ketarin will scan file name and take version code in folder.

 

Example;

My dir: Winrar 5.20

CCleaner 5.02 

 

Ketarin will take version for this software. 

Appname: Winrar | Current Column : 5.20 | Last Version: 5.22

Appname: CCleaner | Current Column : 5.02 | Last Version: 5.02 (It will take all name not only availabe update.

 

 Thank you for help.
Link to comment
Share on other sites

This code 

 

DirectoryInfo di = new DirectoryInfo("D:\\my software");
FileInfo[] files = di.GetFiles("CCle*");
foreach (FileInfo fi in files)
{
string filename = fi.Name.ToString();
            filename= filename.Replace("CCleaner", "");
filename= filename.Replace(".rar", "");
            MessageBox.Show(filename);
}
 
Output >> Version in folder 
 
Can I transfer output to column?
Link to comment
Share on other sites

There might be a way to edit the variables directly, but I don't have time to test it right now. There's a way if you use one of the native properties, though. You'll need to use File, Settings to add the following as a new column:

 

Last

{property:WebsiteUrl}

Turn on "Last" by right-clicking the headers to ensure it's checked and visible.

 

Now in the PRE-update command box for your app use:

/* This obtains the base filename from the previous download */
FileInfo fi = new FileInfo(app.PreviousLocation);
string filename = System.IO.Path.GetFileNameWithoutExtension(fi.Name);

/* This removes the App name */
filename = filename.Replace(app.Name, "");
 
/* This removes the separating dash */
string oldversion = filename.Substring(1);
 
/* This stores the "old" version (based on last download) into the Website field */
app.WebsiteUrl = oldversion;

This will REPLACE whatever is currently in the "Website" field on the Information tab of your app, but it is displayable as a column this way, and can be easily manipulated from C#.

 

This method also uses the exposed information from the "previous" download and the app name to massage the data so as long as you're using something like the following pattern in your "save to file" field it should contain ONLY the version:

..\{category}\{appname}-{version:regexreplace:(\s):-}.{url:ext}

Since the pre-download code only runs when a new update is preparing to download, this SHOULD preserve the correct "old" version in the Website field as long as you don't force an update. Forcing an update would necessarily replace the "old" version with the current version if the versions don't change, since it depends only on the last filename, and not on the actual version number of a previous version. "Force" is like that. :)

 

If you perform any other save-as formatting in the "save to file" box, you'll need to replicate those within the C# "filename" variable before you capture the old version. For example, if you're replacing funky characters with _ as I do ( {appname:regexreplace:([\s\t\r\n\-\\&\/]+):_} ), then you'll also have to perform the same manipulations against the App name before performing the replacement:

/* This obtains the base filename from the previous download */
FileInfo fi = new FileInfo(app.PreviousLocation);
string filename = System.IO.Path.GetFileNameWithoutExtension(fi.Name);

/* This removes the App name which has been munged in 'save as' */
string appname = System.Text.RegularExpressions.Regex.Replace(app.Name, "[\\s\\t\\r\\n\\-\\\\&\\/]+", "_");
filename = filename.Replace(appname, "");
 
/* This removes the separating dash */
string oldversion = filename.Substring(1);
 
/* This stores the "old" version (based on last download) into the Website field */
app.WebsiteUrl = oldversion;

Even better, as long as you use consistent structure and formatting across your "save as" fields, since this consumes a native property instead of a custom property, you can even use the global pre-update command box instead of individual app pre-update commands in order to make it easier on yourself.

Link to comment
Share on other sites

Custom columns can't be shared in an xml file, so you'll have to do that part manually. File, settings, general, "Add", then in column name "Last" and in column value "{property:WebsiteUrl}" (no quotes), then click OK, OK. If the column doesn't display immediately, right-click over one of the column headers and check the box for "Last".

 

Here's a working xml app profile:

 

<?xml version='1.0' encoding='utf-8'?>
<Jobs>
  <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="64411570-bd2a-4601-b44a-a57478746106">
    <Category>Tools</Category>
    <WebsiteUrl>15.08</WebsiteUrl>
    <UserAgent>pycurl/7.18.2</UserAgent>
    <UserNotes />
    <LastFileSize>1360355</LastFileSize>
    <LastFileDate>2015-10-18T03:17:54-07:00</LastFileDate>
    <IgnoreFileInformation>false</IgnoreFileInformation>
    <DownloadBeta>Default</DownloadBeta>
    <DownloadDate>2008-11-17T20:43:12</DownloadDate>
    <CheckForUpdatesOnly>false</CheckForUpdatesOnly>
    <VariableChangeIndicator>version</VariableChangeIndicator>
    <HashVariable />
    <HashType>None</HashType>
    <CanBeShared>true</CanBeShared>
    <ShareApplication>false</ShareApplication>
    <ExclusiveDownload>false</ExclusiveDownload>
    <HttpReferer />
    <SetupInstructions />
    <Variables>
      <item>
        <key>
          <string>version</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>RegularExpression</VariableType>
            <Regex>files/7-Zip/([\d\.]+)/</Regex>
            <Url>http://sourceforge.net/projects/sevenzip/files/7-Zip/</Url>
            <Name>version</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>dl</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex>http\:\/\/downloads\.sourceforge\.net\/sevenzip\/7z[\d+.]+\-x64.msi</Regex>
            <Url>http://7-zip.org/download.html</Url>
            <TextualContent>http://downloads.sourceforge.net/sevenzip/7z{version:replace:.:}-x64.exe</TextualContent>
            <Name>dl</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>snotes</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex />
            <TextualContent />
            <Name>snotes</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>schangelog</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex />
            <TextualContent>http://www.7-zip.org/history.txt</TextualContent>
            <Name>schangelog</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>swebsite</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex />
            <TextualContent>http://sourceforge.net/projects/sevenzip/files/7-Zip/</TextualContent>
            <Name>swebsite</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>spc</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex />
            <TextualContent>7zip</TextualContent>
            <Name>spc</Name>
          </UrlVariable>
        </value>
      </item>
    </Variables>
    <ExecuteCommand />
    <ExecutePreCommand>/* This obtains the base filename from the previous download */
FileInfo fi = new FileInfo(app.PreviousLocation);
string filename = System.IO.Path.GetFileNameWithoutExtension(fi.Name);
/* This removes the App name which has been munged in 'save as' */
string appname = System.Text.RegularExpressions.Regex.Replace(app.Name, "[\\s\\t\\r\\n\\-\\\\&\\/]+", "_");
filename = filename.Replace(appname, "");
 
/* This removes the separating dash */
string oldversion = filename.Substring(1);
 
/* This stores the "old" version (based on last download) into the Website field */
app.WebsiteUrl = oldversion;</ExecutePreCommand>
    <ExecuteCommandType>Batch</ExecuteCommandType>
    <ExecutePreCommandType>CS</ExecutePreCommandType>
    <SourceType>FixedUrl</SourceType>
    <PreviousLocation>K:\_Ketarin\Ketarin\..\Tools\7-Zip_x64-15.09.exe</PreviousLocation>
    <DeletePreviousFile>true</DeletePreviousFile>
    <Enabled>true</Enabled>
    <FileHippoId />
    <LastUpdated>2015-10-29T16:57:12.0456102-07:00</LastUpdated>
    <TargetPath>..\{category}\{appname:regexreplace:([\s\t\r\n\\&\/]+):_}-{version}.{url:ext}</TargetPath>
    <FixedDownloadUrl>{dl}</FixedDownloadUrl>
    <Name>7-Zip x64</Name>
  </ApplicationJob>
</Jobs>

 

What I was saying though is that if you just copy the code I shared into the File, Settings, Commands, "before updating an application" box, this will immediately apply to all the apps.

Link to comment
Share on other sites

Custom columns can't be shared in an xml file, so you'll have to do that part manually. File, settings, general, "Add", then in column name "Last" and in column value "{property:WebsiteUrl}" (no quotes), then click OK, OK. If the column doesn't display immediately, right-click over one of the column headers and check the box for "Last".

 

Here's a working xml app profile:

<?xml version='1.0' encoding='utf-8'?>
<Jobs>
  <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="64411570-bd2a-4601-b44a-a57478746106">
    <Category>Tools</Category>
    <WebsiteUrl>15.08</WebsiteUrl>
    <UserAgent>pycurl/7.18.2</UserAgent>
    <UserNotes />
    <LastFileSize>1360355</LastFileSize>
    <LastFileDate>2015-10-18T03:17:54-07:00</LastFileDate>
    <IgnoreFileInformation>false</IgnoreFileInformation>
    <DownloadBeta>Default</DownloadBeta>
    <DownloadDate>2008-11-17T20:43:12</DownloadDate>
    <CheckForUpdatesOnly>false</CheckForUpdatesOnly>
    <VariableChangeIndicator>version</VariableChangeIndicator>
    <HashVariable />
    <HashType>None</HashType>
    <CanBeShared>true</CanBeShared>
    <ShareApplication>false</ShareApplication>
    <ExclusiveDownload>false</ExclusiveDownload>
    <HttpReferer />
    <SetupInstructions />
    <Variables>
      <item>
        <key>
          <string>version</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>RegularExpression</VariableType>
            <Regex>files/7-Zip/([\d\.]+)/</Regex>
            <Url>http://sourceforge.net/projects/sevenzip/files/7-Zip/</Url>
            <Name>version</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>dl</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex>http\:\/\/downloads\.sourceforge\.net\/sevenzip\/7z[\d+.]+\-x64.msi</Regex>
            <Url>http://7-zip.org/download.html</Url>
            <TextualContent>http://downloads.sourceforge.net/sevenzip/7z{version:replace:.:}-x64.exe</TextualContent>
            <Name>dl</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>snotes</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex />
            <TextualContent />
            <Name>snotes</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>schangelog</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex />
            <TextualContent>http://www.7-zip.org/history.txt</TextualContent>
            <Name>schangelog</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>swebsite</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex />
            <TextualContent>http://sourceforge.net/projects/sevenzip/files/7-Zip/</TextualContent>
            <Name>swebsite</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>spc</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>Textual</VariableType>
            <Regex />
            <TextualContent>7zip</TextualContent>
            <Name>spc</Name>
          </UrlVariable>
        </value>
      </item>
    </Variables>
    <ExecuteCommand />
    <ExecutePreCommand>/* This obtains the base filename from the previous download */
FileInfo fi = new FileInfo(app.PreviousLocation);
string filename = System.IO.Path.GetFileNameWithoutExtension(fi.Name);
/* This removes the App name which has been munged in 'save as' */
string appname = System.Text.RegularExpressions.Regex.Replace(app.Name, "[\\s\\t\\r\\n\\-\\\\&\\/]+", "_");
filename = filename.Replace(appname, "");
 
/* This removes the separating dash */
string oldversion = filename.Substring(1);
 
/* This stores the "old" version (based on last download) into the Website field */
app.WebsiteUrl = oldversion;</ExecutePreCommand>
    <ExecuteCommandType>Batch</ExecuteCommandType>
    <ExecutePreCommandType>CS</ExecutePreCommandType>
    <SourceType>FixedUrl</SourceType>
    <PreviousLocation>K:\_Ketarin\Ketarin\..\Tools\7-Zip_x64-15.09.exe</PreviousLocation>
    <DeletePreviousFile>true</DeletePreviousFile>
    <Enabled>true</Enabled>
    <FileHippoId />
    <LastUpdated>2015-10-29T16:57:12.0456102-07:00</LastUpdated>
    <TargetPath>..\{category}\{appname:regexreplace:([\s\t\r\n\\&\/]+):_}-{version}.{url:ext}</TargetPath>
    <FixedDownloadUrl>{dl}</FixedDownloadUrl>
    <Name>7-Zip x64</Name>
  </ApplicationJob>
</Jobs>

What I was saying though is that if you just copy the code I shared into the File, Settings, Commands, "before updating an application" box, this will immediately apply to all the apps.

Thank you :):)

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.