-
Notifications
You must be signed in to change notification settings - Fork 0
/
JSclass.cs
99 lines (83 loc) · 2.37 KB
/
JSclass.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.IO;
using System.Threading;
namespace WindowsFormsApp1
{
public class FileOperation
{
// public Semaphore semaphore;
private string fileName;
public string FileName { get => fileName; set => fileName = value; }
public FileOperation()
{
//semaphore = new Semaphore(2, 1);
}
public FileOperation(string str)
{
// semaphore = new Semaphore(0, 1);
FileName = str;
}
public static bool IsOpen(string fileName)
{
if (File.Exists(fileName + "Locked"))
return true;
return false;
}
public static void CreateLockMarker(string fileName)
{
File.Create(fileName + "Locked").Close();
}
public static void DeleteLockMarker(string fileName)
{
File.Delete(fileName + "Locked");
}
public bool IsOpen()
{
if (File.Exists(FileName + "Locked"))
return true;
return false;
}
public void CreateLockMarker()
{
File.Create(FileName + "Locked").Close();
}
public void DeleteLockMarker()
{
File.Delete(FileName + "Locked");
}
}
public class cNews
{
private string id;
private string text;
private List<string> link;
private List<string> imageLink;
public string Id { get => id; set => id = value; }
public string Text { get => text; set => text = value; }
public List<string> Link { get => link; set => link = value; }
public List<string> ImageLink { get => imageLink; set => imageLink = value; }
public cNews()
{
Link = new List<string>();
ImageLink = new List<string>();
}
}
class CNewsEqualityComparer : IEqualityComparer<cNews>
{
public bool Equals(cNews b1, cNews b2)
{
return b1.Id.Equals(b2.Id);
}
public int GetHashCode(cNews bx)
{
int hCode = bx.Id.GetHashCode();
return hCode.GetHashCode();
}
}
}