שימוש ברישיון Doconut שלך
הוראות להתקנה והפעלה של הרישיון.
כדי לגלות כיצד להשתמש ברישיון Doconut, עקבו אחרי ההוראות שלמטה עבור פלטפורמות .NET שונות.
התקנת רישיון Doconut
.NET Framework
זיהוי רישיון אוטומטי
Doconut יכולה לזהות רישיונות באופן אוטומטי אם הם ממוקמים בתיקיית bin של הפרויקט.
הוספת רישיון ברירת‑מחדל ידנית
אם אתם מעדיפים להוסיף רישיון ידנית, האפשרויות הבאות זמינות:
הוספת רישיון באמצעות נתיב קובץ
שיטה זו משתמשת בעמסת Viewer.DoconutLicense(string licencePath) להוספת רישיון על‑ידי ציון נתיב הקובץ.
var licensePath = "path/to/your/license.lic";
Viewer.DoconutLicense(licensePath);הוספת רישיון באמצעות Stream
שיטה זו משתמשת בעמסת Viewer.DoconutLicense(Stream licenseStream) להוספת רישיון דרך Stream.
using (var licenseStream = new FileStream("path/to/your/license", FileMode.Open))
{
Viewer.DoconutLicense(licenseStream);
}הוספת רישיון באמצעות מסמך XML
שיטה זו משתמשת בעמסת Viewer.DoconutLicense(XMLDocument licence) להוספת רישיון דרך מסמך XML.
var xmlDoc = new XmlDocument();
xmlDoc.Load("path/to/your/license.xml");
Viewer.DoconutLicense(xmlDoc);הוספת רישיון תוסף באמצעות נתיב קובץ
שיטה זו משתמשת בעמסת Viewer.SetLicensePlugin(string pathPluginLicence) להוספת רישיון תוסף על‑ידי ציון נתיב הקובץ.
var pluginLicensePath = "path/to/your/plugin-license.lic";
Viewer.SetLicensePlugin(pluginLicensePath);הוספת רישיון תוסף באמצעות Stream
שיטה זו משתמשת בעמסת Viewer.SetLicensePlugin(Stream pluginLicence) להוספת רישיון תוסף דרך Stream.
using (var pluginLicenseStream = new FileStream("path/to/your/plugin-license.lic", FileMode.Open))
{
Viewer.SetLicensePlugin(pluginLicenseStream);
}הוספת רישיון תוסף באמצעות מסמך XML
שיטה זו משתמשת בעמסת Viewer.SetLicensePlugin(XMLDocument xmlPluginLicence) להוספת רישיון תוסף דרך מסמך XML.
var pluginXmlDoc = new XmlDocument();
pluginXmlDoc.Load("path/to/your/plugin-license.xml");
Viewer.SetLicensePlugin(pluginXmlDoc);.NET Standard/Core ו‑.NET 6 ומעלה
זיהוי רישיון אוטומטי
Doconut יכולה לזהות רישיונות באופן אוטומטי אם הם ממוקמים בתיקיית wwwroot של הפרויקט.
כדי לאתחל את docViewer עם זיהוי רישיון אוטומטי, השתמשו בקו הבא:
var docViewer = new Viewer(_cache, _accessor);הוספת רישיון ברירת‑מחדל ידנית
אפשר לציין ידנית את הנתיב לקובץ הרישיון ברירת‑המחדל בעת אתחול הצופה.
var licenseFilePath = Path.Combine(_hostingEnvironment.WebRootPath, "path/to/your/license");
var docViewer = new Viewer(_cache, _accessor, licenseFilePath);הוספת רישיון באמצעות Stream
שיטה זו משתמשת בעמסת Viewer.DoconutLicense(Stream licenseStream) להוספת רישיון דרך Stream.
using (var licenseStream = new FileStream("path/to/your/license", FileMode.Open))
{
Viewer.DoconutLicense(licenseStream);
}הוספת רישיון באמצעות מסמך XML
שיטה זו משתמשת בעמסת Viewer.DoconutLicense(XMLDocument licence) להוספת רישיון דרך מסמך XML.
var xmlDoc = new XmlDocument();
xmlDoc.Load("path/to/your/license.xml");
Viewer.DoconutLicense(xmlDoc);הוספת רישיונות תוסף מרובים ידנית
אם נדרש להוסיף מספר רישיונות, אפשר להעביר רשימת נתיבי קבצים בעת אתחול הצופה.
List<string> licenseFilePaths = new List<string>
{
Path.Combine(_hostingEnvironment.WebRootPath, "Doconut.Viewer.lic"),
Path.Combine(_hostingEnvironment.WebRootPath, "Doconut.Viewer.Annotation.lic"),
Path.Combine(_hostingEnvironment.WebRootPath, "Doconut.Viewer.Search.lic")
};
var docViewer = new Viewer(_cache, _accessor, licenseFilePaths);הוספת רישיון תוסף באמצעות Stream
שיטה זו משתמשת בעמסת Viewer.SetLicensePlugin(Stream pluginLicence) להוספת רישיון תוסף דרך Stream.
using (var pluginLicenseStream = new FileStream("path/to/your/plugin-license.lic", FileMode.Open))
{
Viewer.SetLicensePlugin(pluginLicenseStream);
}הוספת רישיון תוסף באמצעות מסמך XML
שיטה זו משתמשת בעמסת Viewer.SetLicensePlugin(XMLDocument xmlPluginLicence) להוספת רישיון תוסף דרך מסמך XML.
var pluginXmlDoc = new XmlDocument();
pluginXmlDoc.Load("path/to/your/plugin-license.xml");
Viewer.SetLicensePlugin(pluginXmlDoc);הגנה על קובץ הרישיון
כדי לשמור על קובץ הרישיון של Doconut (.lic), חשוב לאכוף נהלי אבטחת קבצים. אחסנו את הקובץ בתיקייה מאובטחת עם גישה מוגבלת, כך שרק משתמשים או שירותים מורשים יוכלו לקרוא אותו.